1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2025-02-01 05:01:59 +01:00
llvm-mirror/test/CodeGen/PowerPC/pcrel-tls-initial-exec.ll
Kamau Bridgeman 710eb84124 [PowerPC][PCRelative] Thread Local Storage Support for Initial Exec
This patch is the initial support for the Intial Exec Thread Local
Local Storage model to produce code sequence and relocations correct
to the ABI for the model when using PC relative memory operations.

Reviewed By: stefanp

Differential Revision: https://reviews.llvm.org/D81947
2020-08-21 10:13:11 -05:00

49 lines
2.0 KiB
LLVM

; RUN: llc -verify-machineinstrs -mtriple=powerpc64le-unknown-linux-gnu \
; RUN: -mcpu=pwr10 -ppc-asm-full-reg-names -enable-ppc-pcrel-tls < %s | \
; RUN: FileCheck %s --check-prefix=CHECK-S
; RUN: llc -verify-machineinstrs -mtriple=powerpc64le-unknown-linux-gnu \
; RUN: -mcpu=pwr10 -ppc-asm-full-reg-names --filetype=obj \
; RUN: -enable-ppc-pcrel-tls < %s | llvm-objdump --mcpu=pwr10 -dr - | \
; RUN: FileCheck %s --check-prefix=CHECK-O
; These test cases are to ensure that when using pc relative memory operations
; ABI correct code and relocations are produced for Initial Exec TLS Model.
; Note that with R_PPC64_TLS relocations, to distinguish PC relative
; TLS the relocation has a field value displaced by one byte from the
; beginning of the instruction.
@x = external thread_local global i32, align 4
define i32* @InitialExecAddressLoad() {
; CHECK-S-LABEL: InitialExecAddressLoad:
; CHECK-S: # %bb.0: # %entry
; CHECK-S-NEXT: pld r3, x@got@tprel@pcrel(0), 1
; CHECK-S-NEXT: add r3, r3, x@tls@pcrel
; CHECK-S-NEXT: blr
; CHECK-O-LABEL: <InitialExecAddressLoad>:
; CHECK-O: 00 00 10 04 00 00 60 e4 pld 3, 0(0), 1
; CHECK-O-NEXT: 0000000000000000: R_PPC64_GOT_TPREL_PCREL34 x
; CHECK-O-NEXT: 14 6a 63 7c add 3, 3, 13
; CHECK-O-NEXT: 0000000000000009: R_PPC64_TLS x
; CHECK-O-NEXT: 20 00 80 4e blr
entry:
ret i32* @x
}
define i32 @InitialExecValueLoad() {
; CHECK-S-LABEL: InitialExecValueLoad:
; CHECK-S: # %bb.0: # %entry
; CHECK-S-NEXT: pld r3, x@got@tprel@pcrel(0), 1
; CHECK-S-NEXT: lwzx r3, r3, x@tls@pcrel
; CHECK-S-NEXT: blr
; CHECK-O-LABEL: <InitialExecValueLoad>:
; CHECK-O: 00 00 10 04 00 00 60 e4 pld 3, 0(0), 1
; CHECK-O-NEXT: 0000000000000020: R_PPC64_GOT_TPREL_PCREL34 x
; CHECK-O-NEXT: 2e 68 63 7c lwzx 3, 3, 13
; CHECK-O-NEXT: 0000000000000029: R_PPC64_TLS x
; CHECK-O-NEXT: 20 00 80 4e blr
entry:
%0 = load i32, i32* @x, align 4
ret i32 %0
}