1 ; RUN: llc -verify-machineinstrs -mtriple=powerpc64le-unknown-linux-gnu -mcpu=pwr10 \
2 ; RUN: -ppc-asm-full-reg-names --relocation-model=pic < %s | FileCheck %s --check-prefix=CHECK-S
3 ; RUN: llc -verify-machineinstrs -mtriple=powerpc64le-unknown-linux-gnu -mcpu=pwr10 \
4 ; RUN: -ppc-asm-full-reg-names --relocation-model=pic --filetype=obj < %s | \
5 ; RUN: llvm-objdump --mcpu=pwr10 --no-show-raw-insn -dr - | FileCheck %s --check-prefix=CHECK-O
7 ; These test cases are to ensure that when using pc relative memory operations
8 ; ABI correct code and relocations are produced for Local Dynamic TLS Model.
10 @x = hidden thread_local global i32 0, align 4
12 define nonnull ptr @LocalDynamicAddressLoad() {
13 ; CHECK-S-LABEL: LocalDynamicAddressLoad:
14 ; CHECK-S: paddi r3, 0, x@got@tlsld@pcrel, 1
15 ; CHECK-S-NEXT: bl __tls_get_addr@notoc(x@tlsld)
16 ; CHECK-S-NEXT: paddi r3, r3, x@DTPREL
17 ; CHECK-S-NEXT: addi r1, r1, 32
18 ; CHECK-S-NEXT: ld r0, 16(r1)
19 ; CHECK-S-NEXT: mtlr r0
21 ; CHECK-O-LABEL: <LocalDynamicAddressLoad>:
22 ; CHECK-O: c: paddi 3, 0, 0, 1
23 ; CHECK-O-NEXT: 000000000000000c: R_PPC64_GOT_TLSLD_PCREL34 x
24 ; CHECK-O-NEXT: 14: bl 0x14
25 ; CHECK-O-NEXT: 0000000000000014: R_PPC64_TLSLD x
26 ; CHECK-O-NEXT: 0000000000000014: R_PPC64_REL24_NOTOC __tls_get_addr
27 ; CHECK-O-NEXT: 18: paddi 3, 3, 0, 0
28 ; CHECK-O-NEXT: 0000000000000018: R_PPC64_DTPREL34 x
33 define i32 @LocalDynamicValueLoad() {
34 ; CHECK-S-LABEL: LocalDynamicValueLoad:
35 ; CHECK-S: paddi r3, 0, x@got@tlsld@pcrel, 1
36 ; CHECK-S-NEXT: bl __tls_get_addr@notoc(x@tlsld)
37 ; CHECK-S-NEXT: paddi r3, r3, x@DTPREL
38 ; CHECK-S-NEXT: lwz r3, 0(r3)
39 ; CHECK-S-NEXT: addi r1, r1, 32
40 ; CHECK-S-NEXT: ld r0, 16(r1)
41 ; CHECK-S-NEXT: mtlr r0
43 ; CHECK-O-LABEL: <LocalDynamicValueLoad>:
44 ; CHECK-O: 4c: paddi 3, 0, 0, 1
45 ; CHECK-O-NEXT: 000000000000004c: R_PPC64_GOT_TLSLD_PCREL34 x
46 ; CHECK-O-NEXT: 54: bl 0x54
47 ; CHECK-O-NEXT: 0000000000000054: R_PPC64_TLSLD x
48 ; CHECK-O-NEXT: 0000000000000054: R_PPC64_REL24_NOTOC __tls_get_addr
49 ; CHECK-O-NEXT: 58: paddi 3, 3, 0, 0
50 ; CHECK-O-NEXT: 0000000000000058: R_PPC64_DTPREL34 x
51 ; CHECK-O-NEXT: 60: lwz 3, 0(3)
53 %0 = load i32, ptr @x, align 4