1 ; RUN: llc < %s -mtriple=powerpc64-unknown-linux-gnu -mcpu=pwr7 | FileCheck %s
2 ; RUN: llc < %s -mtriple=powerpc64-unknown-linux-gnu -mcpu=a2 | FileCheck -check-prefix=CHECK-NOAV %s
3 target datalayout = "E-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-f128:128:128-v128:128:128-n32:64"
4 target triple = "powerpc64-unknown-linux-gnu"
6 %struct.__jmp_buf_tag = type { [64 x i64], i32, %struct.__sigset_t, [8 x i8] }
7 %struct.__sigset_t = type { [16 x i64] }
9 @env_sigill = internal global [1 x %struct.__jmp_buf_tag] zeroinitializer, align 16
11 define void @foo() #0 {
13 call void @llvm.eh.sjlj.longjmp(i8* bitcast ([1 x %struct.__jmp_buf_tag]* @env_sigill to i8*))
17 ; CHECK: addis [[REG:[0-9]+]], 2, env_sigill@toc@ha
18 ; CHECK: addi [[REG]], [[REG]], env_sigill@toc@l
19 ; CHECK: ld 31, 0([[REG]])
20 ; CHECK: ld [[REG2:[0-9]+]], 8([[REG]])
21 ; CHECK: ld 1, 16([[REG]])
22 ; CHECK: mtctr [[REG2]]
23 ; CHECK: ld 2, 24([[REG]])
26 return: ; No predecessors!
30 declare void @llvm.eh.sjlj.longjmp(i8*) #1
32 define signext i32 @main() #0 {
34 %retval = alloca i32, align 4
35 store i32 0, i32* %retval
36 %0 = call i8* @llvm.frameaddress(i32 0)
37 store i8* %0, i8** bitcast ([1 x %struct.__jmp_buf_tag]* @env_sigill to i8**)
38 %1 = call i8* @llvm.stacksave()
39 store i8* %1, i8** getelementptr (i8** bitcast ([1 x %struct.__jmp_buf_tag]* @env_sigill to i8**), i32 2)
40 %2 = call i32 @llvm.eh.sjlj.setjmp(i8* bitcast ([1 x %struct.__jmp_buf_tag]* @env_sigill to i8*))
41 %tobool = icmp ne i32 %2, 0
42 br i1 %tobool, label %if.then, label %if.else
44 if.then: ; preds = %entry
45 store i32 1, i32* %retval
48 if.else: ; preds = %entry
52 if.end: ; preds = %if.else
53 store i32 0, i32* %retval
56 return: ; preds = %if.end, %if.then
57 %3 = load i32* %retval
60 ; FIXME: We should be saving VRSAVE on Darwin, but we're not!
64 ; Make sure that we're not saving VRSAVE on non-Darwin:
69 ; CHECK: addis [[REG:[0-9]+]], 2, env_sigill@toc@ha
70 ; CHECK: std 31, env_sigill@toc@l([[REG]])
71 ; CHECK: addi [[REG]], [[REG]], env_sigill@toc@l
72 ; CHECK: std [[REG]], [[OFF:[0-9]+]](31) # 8-byte Folded Spill
73 ; CHECK: std 1, 16([[REG]])
74 ; CHECK: std 2, 24([[REG]])
75 ; CHECK: bcl 20, 31, .LBB1_1
77 ; CHECK: #EH_SjLj_Setup .LBB1_1
81 ; CHECK: mflr [[REGL:[0-9]+]]
82 ; CHECK: ld [[REG2:[0-9]+]], [[OFF]](31) # 8-byte Folded Reload
83 ; CHECK: std [[REGL]], 8([[REG2]])
94 ; CHECK-NOAV-NOT: stvx
102 declare i8* @llvm.frameaddress(i32) #2
104 declare i8* @llvm.stacksave() #3
106 declare i32 @llvm.eh.sjlj.setjmp(i8*) #3
108 attributes #0 = { nounwind "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-frame-pointer-elim-non-leaf"="true" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "unsafe-fp-math"="false" "use-soft-float"="false" }
109 attributes #1 = { noreturn nounwind }
110 attributes #2 = { nounwind readnone }
111 attributes #3 = { nounwind }