xref: /aosp_15_r20/external/llvm/test/CodeGen/SPARC/sjlj.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; RUN: llc < %s -march=sparc | FileCheck %s
2*9880d681SAndroid Build Coastguard Worker; RUN: llc < %s -march=sparc -mcpu=leon2 | FileCheck %s
3*9880d681SAndroid Build Coastguard Worker; RUN: llc < %s -march=sparc -mcpu=leon3 | FileCheck %s
4*9880d681SAndroid Build Coastguard Worker; RUN: llc < %s -march=sparc -mcpu=leon4 | FileCheck %s
5*9880d681SAndroid Build Coastguard Worker
6*9880d681SAndroid Build Coastguard Worker%struct.__jmp_buf_tag = type { [64 x i64], i32, %struct.__sigset_t, [8 x i8] }
7*9880d681SAndroid Build Coastguard Worker%struct.__sigset_t = type { [16 x i64] }
8*9880d681SAndroid Build Coastguard Worker
9*9880d681SAndroid Build Coastguard Worker@env_sigill = internal global [1 x %struct.__jmp_buf_tag] zeroinitializer, align 16
10*9880d681SAndroid Build Coastguard Worker
11*9880d681SAndroid Build Coastguard Workerdefine void @foo() #0 {
12*9880d681SAndroid Build Coastguard Workerentry:
13*9880d681SAndroid Build Coastguard Worker  call void @llvm.eh.sjlj.longjmp(i8* bitcast ([1 x %struct.__jmp_buf_tag]* @env_sigill to i8*))
14*9880d681SAndroid Build Coastguard Worker  unreachable
15*9880d681SAndroid Build Coastguard Worker
16*9880d681SAndroid Build Coastguard Worker; CHECK: @foo
17*9880d681SAndroid Build Coastguard Worker; CHECK: ta   3
18*9880d681SAndroid Build Coastguard Worker; CHECK: ld [%i0], %fp
19*9880d681SAndroid Build Coastguard Worker; CHECK: ld [%i0+4], %i1
20*9880d681SAndroid Build Coastguard Worker; CHECK: ld [%i0+8], %sp
21*9880d681SAndroid Build Coastguard Worker; CHECK: jmp %i1
22*9880d681SAndroid Build Coastguard Worker; CHECK: ld [%i0+12], %i7
23*9880d681SAndroid Build Coastguard Worker
24*9880d681SAndroid Build Coastguard Workerreturn:                                           ; No predecessors!
25*9880d681SAndroid Build Coastguard Worker  ret void
26*9880d681SAndroid Build Coastguard Worker}
27*9880d681SAndroid Build Coastguard Worker
28*9880d681SAndroid Build Coastguard Workerdeclare void @llvm.eh.sjlj.longjmp(i8*) #1
29*9880d681SAndroid Build Coastguard Worker
30*9880d681SAndroid Build Coastguard Workerdefine signext i32 @main() #0 {
31*9880d681SAndroid Build Coastguard Workerentry:
32*9880d681SAndroid Build Coastguard Worker  %retval = alloca i32, align 4
33*9880d681SAndroid Build Coastguard Worker  store i32 0, i32* %retval
34*9880d681SAndroid Build Coastguard Worker  %0 = call i8* @llvm.frameaddress(i32 0)
35*9880d681SAndroid Build Coastguard Worker  store i8* %0, i8** bitcast ([1 x %struct.__jmp_buf_tag]* @env_sigill to i8**)
36*9880d681SAndroid Build Coastguard Worker  %1 = call i8* @llvm.stacksave()
37*9880d681SAndroid Build Coastguard Worker  store i8* %1, i8** getelementptr (i8*, i8** bitcast ([1 x %struct.__jmp_buf_tag]* @env_sigill to i8**), i32 2)
38*9880d681SAndroid Build Coastguard Worker  %2 = call i32 @llvm.eh.sjlj.setjmp(i8* bitcast ([1 x %struct.__jmp_buf_tag]* @env_sigill to i8*))
39*9880d681SAndroid Build Coastguard Worker  %tobool = icmp ne i32 %2, 0
40*9880d681SAndroid Build Coastguard Worker  br i1 %tobool, label %if.then, label %if.else
41*9880d681SAndroid Build Coastguard Worker
42*9880d681SAndroid Build Coastguard Workerif.then:                                          ; preds = %entry
43*9880d681SAndroid Build Coastguard Worker  store i32 1, i32* %retval
44*9880d681SAndroid Build Coastguard Worker  br label %return
45*9880d681SAndroid Build Coastguard Worker
46*9880d681SAndroid Build Coastguard Workerif.else:                                          ; preds = %entry
47*9880d681SAndroid Build Coastguard Worker  call void @foo()
48*9880d681SAndroid Build Coastguard Worker  br label %if.end
49*9880d681SAndroid Build Coastguard Worker
50*9880d681SAndroid Build Coastguard Workerif.end:                                           ; preds = %if.else
51*9880d681SAndroid Build Coastguard Worker  store i32 0, i32* %retval
52*9880d681SAndroid Build Coastguard Worker  br label %return
53*9880d681SAndroid Build Coastguard Worker
54*9880d681SAndroid Build Coastguard Workerreturn:                                           ; preds = %if.end, %if.then
55*9880d681SAndroid Build Coastguard Worker  %3 = load i32, i32* %retval
56*9880d681SAndroid Build Coastguard Worker  ret i32 %3
57*9880d681SAndroid Build Coastguard Worker
58*9880d681SAndroid Build Coastguard Worker; CHECK: @main
59*9880d681SAndroid Build Coastguard Worker; CHECK:  st %fp, [%i0]
60*9880d681SAndroid Build Coastguard Worker; CHECK:  sethi %hi(.LBB1_2), %i1
61*9880d681SAndroid Build Coastguard Worker; CHECK:  or %i1, %lo(.LBB1_2), %i1
62*9880d681SAndroid Build Coastguard Worker; CHECK:  st %i1, [%i0+4]
63*9880d681SAndroid Build Coastguard Worker; CHECK:  st %sp, [%i0+8]
64*9880d681SAndroid Build Coastguard Worker; CHECK:  bn   .LBB1_2
65*9880d681SAndroid Build Coastguard Worker; CHECK:  st %i7, [%i0+12]
66*9880d681SAndroid Build Coastguard Worker; CHECK:  ba   .LBB1_1
67*9880d681SAndroid Build Coastguard Worker; CHECK:  nop
68*9880d681SAndroid Build Coastguard Worker; CHECK:.LBB1_1:                                ! %entry
69*9880d681SAndroid Build Coastguard Worker; CHECK:  ba   .LBB1_3
70*9880d681SAndroid Build Coastguard Worker; CHECK:  mov  %g0, %i0
71*9880d681SAndroid Build Coastguard Worker; CHECK:.LBB1_2:                                ! Block address taken
72*9880d681SAndroid Build Coastguard Worker; CHECK:  mov  1, %i0
73*9880d681SAndroid Build Coastguard Worker; CHECK:.LBB1_3:                                ! %entry
74*9880d681SAndroid Build Coastguard Worker; CHECK:  cmp %i0, 0
75*9880d681SAndroid Build Coastguard Worker; CHECK:  be   .LBB1_5
76*9880d681SAndroid Build Coastguard Worker; CHECK:  nop
77*9880d681SAndroid Build Coastguard Worker}
78*9880d681SAndroid Build Coastguard Workerdeclare i8* @llvm.frameaddress(i32) #2
79*9880d681SAndroid Build Coastguard Worker
80*9880d681SAndroid Build Coastguard Workerdeclare i8* @llvm.stacksave() #3
81*9880d681SAndroid Build Coastguard Worker
82*9880d681SAndroid Build Coastguard Workerdeclare i32 @llvm.eh.sjlj.setjmp(i8*) #3
83*9880d681SAndroid Build Coastguard Worker
84*9880d681SAndroid Build Coastguard Workerattributes #0 = { nounwind "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "unsafe-fp-math"="false" "use-soft-float"="false" }
85*9880d681SAndroid Build Coastguard Workerattributes #1 = { noreturn nounwind }
86*9880d681SAndroid Build Coastguard Workerattributes #2 = { nounwind readnone }
87*9880d681SAndroid Build Coastguard Workerattributes #3 = { nounwind }
88*9880d681SAndroid Build Coastguard Worker
89