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