1; RUN: llc -verify-machineinstrs -mtriple=powerpc64le-unknown-linux-gnu \ 2; RUN: -mcpu=pwr10 -ppc-asm-full-reg-names -enable-ppc-pcrel-tls < %s | \ 3; RUN: FileCheck %s --check-prefix=CHECK-S 4; RUN: llc -verify-machineinstrs -mtriple=powerpc64le-unknown-linux-gnu \ 5; RUN: -mcpu=pwr10 -ppc-asm-full-reg-names --filetype=obj \ 6; RUN: -enable-ppc-pcrel-tls -o %t.o < %s 7; RUN: llvm-objdump --mcpu=pwr10 -dr %t.o | FileCheck %s --check-prefix=CHECK-O 8; RUN: llvm-readelf -s %t.o | FileCheck %s --check-prefix=CHECK-SYM 9 10; These test cases are to ensure that when using pc relative memory operations 11; ABI correct code and relocations are produced for Initial Exec TLS Model. 12; Note that with R_PPC64_TLS relocations, to distinguish PC relative 13; TLS the relocation has a field value displaced by one byte from the 14; beginning of the instruction. 15 16@x = external thread_local global i32, align 4 17 18define i32* @InitialExecAddressLoad() { 19; CHECK-S-LABEL: InitialExecAddressLoad: 20; CHECK-S: # %bb.0: # %entry 21; CHECK-S-NEXT: pld r3, x@got@tprel@pcrel(0), 1 22; CHECK-S-NEXT: add r3, r3, x@tls@pcrel 23; CHECK-S-NEXT: blr 24; CHECK-O-LABEL: <InitialExecAddressLoad>: 25; CHECK-O: 00 00 10 04 00 00 60 e4 pld 3, 0(0), 1 26; CHECK-O-NEXT: 0000000000000000: R_PPC64_GOT_TPREL_PCREL34 x 27; CHECK-O-NEXT: 14 6a 63 7c add 3, 3, 13 28; CHECK-O-NEXT: 0000000000000009: R_PPC64_TLS x 29; CHECK-O-NEXT: 20 00 80 4e blr 30entry: 31 ret i32* @x 32} 33 34define i32 @InitialExecValueLoad() { 35; CHECK-S-LABEL: InitialExecValueLoad: 36; CHECK-S: # %bb.0: # %entry 37; CHECK-S-NEXT: pld r3, x@got@tprel@pcrel(0), 1 38; CHECK-S-NEXT: lwzx r3, r3, x@tls@pcrel 39; CHECK-S-NEXT: blr 40; CHECK-O-LABEL: <InitialExecValueLoad>: 41; CHECK-O: 00 00 10 04 00 00 60 e4 pld 3, 0(0), 1 42; CHECK-O-NEXT: 0000000000000020: R_PPC64_GOT_TPREL_PCREL34 x 43; CHECK-O-NEXT: 2e 68 63 7c lwzx 3, 3, 13 44; CHECK-O-NEXT: 0000000000000029: R_PPC64_TLS x 45; CHECK-O-NEXT: 20 00 80 4e blr 46 47; CHECK-SYM-LABEL: Symbol table '.symtab' contains 6 entries 48; CHECK-SYM: 5: 0000000000000000 0 TLS GLOBAL DEFAULT UND x 49entry: 50 %0 = load i32, i32* @x, align 4 51 ret i32 %0 52} 53