xref: /aosp_15_r20/external/llvm/test/CodeGen/Hexagon/cfi-offset.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; RUN: llc -march=hexagon < %s | FileCheck %s
2*9880d681SAndroid Build Coastguard Worker; Check that all the offsets in the .cfi_offset instructions are negative.
3*9880d681SAndroid Build Coastguard Worker; They are all based on R30+8 which points to the pair FP/LR stored by an
4*9880d681SAndroid Build Coastguard Worker; allocframe. Since the stack grows towards negative addresses, anything
5*9880d681SAndroid Build Coastguard Worker; in the current stack frame will have a negative offset with respect to
6*9880d681SAndroid Build Coastguard Worker; R30+8.
7*9880d681SAndroid Build Coastguard Worker
8*9880d681SAndroid Build Coastguard Worker; CHECK: cfi_def_cfa r30
9*9880d681SAndroid Build Coastguard Worker; CHECK-NOT: .cfi_offset r{{[0-9]+}}, {{[^-]}}
10*9880d681SAndroid Build Coastguard Worker
11*9880d681SAndroid Build Coastguard Workertarget triple = "hexagon"
12*9880d681SAndroid Build Coastguard Worker
13*9880d681SAndroid Build Coastguard Workerdefine i64 @_Z3fooxxx(i64 %x, i64 %y, i64 %z) #0 personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) {
14*9880d681SAndroid Build Coastguard Workerentry:
15*9880d681SAndroid Build Coastguard Worker  %call = invoke i64 @_Z3barxxx(i64 %x, i64 %y, i64 %z)
16*9880d681SAndroid Build Coastguard Worker          to label %try.cont unwind label %lpad
17*9880d681SAndroid Build Coastguard Worker
18*9880d681SAndroid Build Coastguard Workerlpad:                                             ; preds = %entry
19*9880d681SAndroid Build Coastguard Worker  %0 = landingpad { i8*, i32 }
20*9880d681SAndroid Build Coastguard Worker          catch i8* null
21*9880d681SAndroid Build Coastguard Worker  %1 = extractvalue { i8*, i32 } %0, 0
22*9880d681SAndroid Build Coastguard Worker  %2 = tail call i8* @__cxa_begin_catch(i8* %1) #1
23*9880d681SAndroid Build Coastguard Worker  tail call void @__cxa_end_catch()
24*9880d681SAndroid Build Coastguard Worker  br label %try.cont
25*9880d681SAndroid Build Coastguard Worker
26*9880d681SAndroid Build Coastguard Workertry.cont:                                         ; preds = %entry, %lpad
27*9880d681SAndroid Build Coastguard Worker  %a.0 = phi i64 [ 0, %lpad ], [ %call, %entry ]
28*9880d681SAndroid Build Coastguard Worker  %mul = mul nsw i64 %y, %x
29*9880d681SAndroid Build Coastguard Worker  %sub = sub i64 %mul, %z
30*9880d681SAndroid Build Coastguard Worker  %add = add nsw i64 %sub, %a.0
31*9880d681SAndroid Build Coastguard Worker  ret i64 %add
32*9880d681SAndroid Build Coastguard Worker}
33*9880d681SAndroid Build Coastguard Worker
34*9880d681SAndroid Build Coastguard Workerdeclare i64 @_Z3barxxx(i64, i64, i64) #0
35*9880d681SAndroid Build Coastguard Worker
36*9880d681SAndroid Build Coastguard Workerdeclare i32 @__gxx_personality_v0(...)
37*9880d681SAndroid Build Coastguard Worker
38*9880d681SAndroid Build Coastguard Workerdeclare i8* @__cxa_begin_catch(i8*)
39*9880d681SAndroid Build Coastguard Worker
40*9880d681SAndroid Build Coastguard Workerdeclare void @__cxa_end_catch()
41*9880d681SAndroid Build Coastguard Worker
42*9880d681SAndroid Build Coastguard Workerattributes #0 = { "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="hexagonv60" "target-features"="-hvx,-hvx-double" "unsafe-fp-math"="false" "use-soft-float"="false" }
43*9880d681SAndroid Build Coastguard Workerattributes #1 = { nounwind }
44