Debian Codegraph @

llvm/test/CodeGen/PowerPC/pcrel.ll

raw
1 ; RUN: llc -verify-machineinstrs -mtriple=powerpc64le-unknown-linux-gnu \
2 ; RUN: -mcpu=pwr10 -ppc-asm-full-reg-names -ppc-vsr-nums-as-vr < %s | \
3 ; RUN: FileCheck %s --check-prefix=CHECK-S
4 ; RUN: llc -verify-machineinstrs -target-abi=elfv2 -mtriple=powerpc64-- \
5 ; RUN: -mcpu=pwr10 -ppc-asm-full-reg-names -ppc-vsr-nums-as-vr \
6 ; RUN: --filetype=obj < %s | \
7 ; RUN: llvm-objdump --mcpu=pwr10 -dr - | FileCheck %s --check-prefix=CHECK-O
8
9 ; Constant Pool Index.
10 ; CHECK-S-LABEL: ConstPool
11 ; CHECK-S: xxsplti32dx vs1, 0, 1081002676
12 ; CHECK-S-NEXT: xxsplti32dx vs1, 1, 962072674
13 ; CHECK-S: blr
14
15 ; CHECK-O-LABEL: ConstPool
16 ; CHECK-O: xxsplti32dx 1, 0, 1081002676
17 ; CHECK-O-NEXT: xxsplti32dx 1, 1, 962072674
18 ; CHECK-O-NEXT: blr
19 define dso_local double @ConstPool() local_unnamed_addr {
20 entry:
21 ret double 0x406ECAB439581062
22 }
23
24 @valIntLoc = common dso_local local_unnamed_addr global i32 0, align 4
25 define dso_local signext i32 @ReadLocalVarInt() local_unnamed_addr {
26 ; CHECK-S-LABEL: ReadLocalVarInt
27 ; CHECK-S: # %bb.0: # %entry
28 ; CHECK-S-NEXT: plwa r3, valIntLoc@PCREL(0), 1
29 ; CHECK-S-NEXT: blr
30
31 ; CHECK-O-LABEL: ReadLocalVarInt
32 ; CHECK-O: plwa 3, 0(0), 1
33 ; CHECK-O-NEXT: R_PPC64_PCREL34 valIntLoc
34 ; CHECK-O-NEXT: blr
35 entry:
36 %0 = load i32, ptr @valIntLoc, align 4
37 ret i32 %0
38 }
39
40 @valIntGlob = external global i32, align 4
41 define dso_local signext i32 @ReadGlobalVarInt() local_unnamed_addr {
42 ; CHECK-S-LABEL: ReadGlobalVarInt
43 ; CHECK-S: # %bb.0: # %entry
44 ; CHECK-S-NEXT: pld r3, valIntGlob@got@pcrel(0), 1
45 ; CHECK-S-NEXT: .Lpcrel0:
46 ; CHECK-S-NEXT: .reloc .Lpcrel0-8,R_PPC64_PCREL_OPT,.-(.Lpcrel0-8)
47 ; CHECK-S-NEXT: lwa r3, 0(r3)
48 ; CHECK-S-NEXT: blr
49
50 ; CHECK-O-LABEL: ReadGlobalVarInt
51 ; CHECK-O: pld 3, 0(0), 1
52 ; CHECK-O-NEXT: R_PPC64_GOT_PCREL34 valIntGlob
53 ; CHECK-O-NEXT: R_PPC64_PCREL_OPT *ABS*+0x8
54 ; CHECK-O-NEXT: lwa 3, 0(3)
55 ; CHECK-O-NEXT: blr
56 entry:
57 %0 = load i32, ptr @valIntGlob, align 4
58 ret i32 %0
59 }