[AArch64] Fix bug in prolog clobbering live reg when shrink wrapping.
[oota-llvm.git] / test / CodeGen / SPARC / 2009-08-28-PIC.ll
1 ; RUN: llc -march=sparc --relocation-model=pic < %s | FileCheck %s --check-prefix=V8
2 ; RUN: llc -march=sparcv9 --relocation-model=pic < %s | FileCheck %s --check-prefix=V9
3 ; RUN: llc -march=sparc   --relocation-model=pic < %s -O0 | FileCheck %s --check-prefix=V8UNOPT
4 ; RUN: llc -march=sparcv9 --relocation-model=pic < %s -O0 | FileCheck %s --check-prefix=V9UNOPT
5
6
7 ; V8-LABEL: func
8 ; V8:  _GLOBAL_OFFSET_TABLE_
9
10 ; V9-LABEL: func
11 ; V9:  _GLOBAL_OFFSET_TABLE_
12
13 @foo = global i32 0                               ; <i32*> [#uses=1]
14
15 define i32 @func(i32 %a) nounwind readonly {
16 entry:
17   %0 = load i32, i32* @foo, align 4                    ; <i32> [#uses=1]
18   ret i32 %0
19 }
20
21 ; V8UNOPT-LABEL: test_spill
22 ; V8UNOPT:       sethi %hi(_GLOBAL_OFFSET_TABLE_+{{.+}}), [[R:%[goli][0-7]]]
23 ; V8UNOPT:       or [[R]], %lo(_GLOBAL_OFFSET_TABLE_+{{.+}}), [[R]]
24 ; V8UNOPT:       add [[R]], %o7, [[R]]
25 ; V8UNOPT:       st [[R]], [%fp+{{.+}}]
26
27 ; V9UNOPT-LABEL: test_spill
28 ; V9UNOPT:       sethi %hi(_GLOBAL_OFFSET_TABLE_+{{.+}}), [[R:%[goli][0-7]]]
29 ; V9UNOPT:       or [[R]], %lo(_GLOBAL_OFFSET_TABLE_+{{.+}}), [[R]]
30 ; V9UNOPT:       add [[R]], %o7, [[R]]
31 ; V9UNOPT:       stx [[R]], [%fp+{{.+}}]
32
33 define i32 @test_spill(i32 %a, i32 %b) {
34 entry:
35   %cmp = icmp eq i32 %b, 0
36   br i1 %cmp, label %if.then, label %if.end
37
38 if.then:
39   %ret =  load i32, i32* @foo, align 4
40   ret i32 %ret
41
42 if.end:
43   %add = add nsw i32 %b, %a
44   ret i32 %add
45 }