blob: 39984fb14bcb6ad9117be960279d781ba83fb581 [file] [log] [blame]
Venkatraman Govindaraju1b418352013-09-05 05:32:16 +00001;RUN: llc -march=sparc < %s | FileCheck %s
2;RUN: llc -march=sparcv9 < %s | FileCheck %s --check-prefix=V9
3
4
5%0 = type { [32 x i32] }
6%struct.jmpbuf_env = type { i32, i32, [1 x %struct.__jmp_buf_tag], i32 }
7%struct.__jmp_buf_tag = type { [3 x i32], i32, %0 }
8
9@jenv = common unnamed_addr global %struct.jmpbuf_env* null
10@.cst = linker_private unnamed_addr constant [30 x i8] c"in bar with jmp_buf's id: %d\0A\00", align 64
11
12; CHECK-LABEL: foo
13; CHECK-DAG: st {{.+}}, [%i0]
14; CHECK-DAG: st {{.+}}, [%i0+4]
15; CHECK: call _setjmp
16; CHECK: ld [%fp+{{.+}}], %[[R:[gilo][0-7]]]
17; CHECK: st %o0, [%[[R]]+{{.+}}]
18
19; V9-LABEL: foo
20; V9-DAG: st {{.+}}, [%i0]
21; V9-DAG: st {{.+}}, [%i0+4]
22; V9: call _setjmp
23; V9: ldx [%fp+{{.+}}], %[[R:[gilo][0-7]]]
24; V9: st %o0, [%[[R]]+{{.+}}]
25
26; Function Attrs: nounwind
27define i32 @foo(%struct.jmpbuf_env* byval %inbuf) #0 {
28entry:
29 %0 = getelementptr inbounds %struct.jmpbuf_env* %inbuf, i32 0, i32 0
Manman Rene267f042013-09-30 18:17:55 +000030 store i32 0, i32* %0, align 4, !tbaa !4
Venkatraman Govindaraju1b418352013-09-05 05:32:16 +000031 %1 = getelementptr inbounds %struct.jmpbuf_env* %inbuf, i32 0, i32 1
Manman Rene267f042013-09-30 18:17:55 +000032 store i32 1, i32* %1, align 4, !tbaa !4
Venkatraman Govindaraju1b418352013-09-05 05:32:16 +000033 %2 = getelementptr inbounds %struct.jmpbuf_env* %inbuf, i32 0, i32 2, i32 0
34 %3 = call i32 @_setjmp(%struct.__jmp_buf_tag* %2) #2
35 %4 = getelementptr inbounds %struct.jmpbuf_env* %inbuf, i32 0, i32 3
Manman Rene267f042013-09-30 18:17:55 +000036 store i32 %3, i32* %4, align 4, !tbaa !4
37 store %struct.jmpbuf_env* %inbuf, %struct.jmpbuf_env** @jenv, align 4, !tbaa !3
38 %5 = load i32* %1, align 4, !tbaa !4
Venkatraman Govindaraju1b418352013-09-05 05:32:16 +000039 %6 = icmp eq i32 %5, 1
40 %7 = icmp eq i32 %3, 0
41 %or.cond = and i1 %6, %7
42 br i1 %or.cond, label %"4.i", label %bar.exit
43
44"4.i": ; preds = %entry
45 call void @longjmp(%struct.__jmp_buf_tag* %2, i32 0) #1
46 unreachable
47
48bar.exit: ; preds = %entry
Manman Rene267f042013-09-30 18:17:55 +000049 %8 = load i32* %0, align 4, !tbaa !4
Venkatraman Govindaraju1b418352013-09-05 05:32:16 +000050 %9 = call i32 (i8*, ...)* @printf(i8* noalias getelementptr inbounds ([30 x i8]* @.cst, i32 0, i32 0), i32 %8) #0
51 ret i32 0
52}
53
54; Function Attrs: nounwind returns_twice
55declare i32 @_setjmp(%struct.__jmp_buf_tag*) #2
56
57; Function Attrs: noreturn nounwind
58declare void @longjmp(%struct.__jmp_buf_tag*, i32) #1
59
60; Function Attrs: nounwind
61declare i32 @printf(i8* nocapture, ...) #0
62
63
64attributes #0 = { nounwind }
65attributes #1 = { noreturn nounwind }
66attributes #2 = { nounwind returns_twice }
67
68!0 = metadata !{metadata !"alias set 6: struct.jmpbuf_env*", metadata !1}
69!1 = metadata !{metadata !1}
70!2 = metadata !{metadata !"alias set 3: int", metadata !1}
Manman Rene267f042013-09-30 18:17:55 +000071!3 = metadata !{metadata !0, metadata !0, i64 0}
72!4 = metadata !{metadata !2, metadata !2, i64 0}