File: pcrel-tls-local-dynamic.ll

package info (click to toggle)
llvm-toolchain-20 1%3A20.1.6-1~exp1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 2,111,304 kB
  • sloc: cpp: 7,438,677; ansic: 1,393,822; asm: 1,012,926; python: 241,650; f90: 86,635; objc: 75,479; lisp: 42,144; pascal: 17,286; sh: 10,027; ml: 5,082; perl: 4,730; awk: 3,523; makefile: 3,349; javascript: 2,251; xml: 892; fortran: 672
file content (55 lines) | stat: -rw-r--r-- 2,376 bytes parent folder | download | duplicates (10)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
; RUN: llc -verify-machineinstrs -mtriple=powerpc64le-unknown-linux-gnu -mcpu=pwr10 \
; RUN:   -ppc-asm-full-reg-names --relocation-model=pic < %s | FileCheck %s --check-prefix=CHECK-S
; RUN: llc -verify-machineinstrs -mtriple=powerpc64le-unknown-linux-gnu -mcpu=pwr10 \
; RUN:   -ppc-asm-full-reg-names --relocation-model=pic --filetype=obj < %s | \
; RUN:   llvm-objdump --mcpu=pwr10 --no-show-raw-insn -dr - | 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 Local Dynamic TLS Model.

@x = hidden thread_local global i32 0, align 4

define nonnull ptr @LocalDynamicAddressLoad() {
  ; CHECK-S-LABEL: LocalDynamicAddressLoad:
  ; CHECK-S:         paddi r3, 0, x@got@tlsld@pcrel, 1
  ; CHECK-S-NEXT:    bl __tls_get_addr@notoc(x@tlsld)
  ; CHECK-S-NEXT:    paddi r3, r3, x@DTPREL
  ; CHECK-S-NEXT:    addi r1, r1, 32
  ; CHECK-S-NEXT:    ld r0, 16(r1)
  ; CHECK-S-NEXT:    mtlr r0
  ; CHECK-S-NEXT:    blr
  ; CHECK-O-LABEL: <LocalDynamicAddressLoad>:
  ; CHECK-O:         c: paddi 3, 0, 0, 1
  ; CHECK-O-NEXT:    000000000000000c: R_PPC64_GOT_TLSLD_PCREL34 x
  ; CHECK-O-NEXT:    14: bl 0x14
  ; CHECK-O-NEXT:    0000000000000014: R_PPC64_TLSLD x
  ; CHECK-O-NEXT:    0000000000000014: R_PPC64_REL24_NOTOC __tls_get_addr
  ; CHECK-O-NEXT:    18: paddi 3, 3, 0, 0
  ; CHECK-O-NEXT:    0000000000000018: R_PPC64_DTPREL34 x
  entry:
    ret ptr @x
}

define i32 @LocalDynamicValueLoad() {
  ; CHECK-S-LABEL: LocalDynamicValueLoad:
  ; CHECK-S:         paddi r3, 0, x@got@tlsld@pcrel, 1
  ; CHECK-S-NEXT:    bl __tls_get_addr@notoc(x@tlsld)
  ; CHECK-S-NEXT:    paddi r3, r3, x@DTPREL
  ; CHECK-S-NEXT:    lwz r3, 0(r3)
  ; CHECK-S-NEXT:    addi r1, r1, 32
  ; CHECK-S-NEXT:    ld r0, 16(r1)
  ; CHECK-S-NEXT:    mtlr r0
  ; CHECK-S-NEXT:    blr
  ; CHECK-O-LABEL: <LocalDynamicValueLoad>:
  ; CHECK-O:         4c: paddi 3, 0, 0, 1
  ; CHECK-O-NEXT:    000000000000004c: R_PPC64_GOT_TLSLD_PCREL34 x
  ; CHECK-O-NEXT:    54: bl 0x54
  ; CHECK-O-NEXT:    0000000000000054: R_PPC64_TLSLD x
  ; CHECK-O-NEXT:    0000000000000054: R_PPC64_REL24_NOTOC __tls_get_addr
  ; CHECK-O-NEXT:    58: paddi 3, 3, 0, 0
  ; CHECK-O-NEXT:    0000000000000058: R_PPC64_DTPREL34 x
  ; CHECK-O-NEXT:    60: lwz 3, 0(3)
  entry:
    %0 = load i32, ptr @x, align 4
    ret i32 %0
}