1# REQUIRES: ppc
2# RUN: llvm-mc -filetype=obj -triple=powerpc64le %s -o %t.o
3# RUN: ld.lld %t.o -o %t
4# RUN: llvm-readelf -s %t | FileCheck %s --check-prefix=SYMBOL
5# RUN: llvm-objdump -d --no-show-raw-insn --mcpu=pwr10 %t | FileCheck %s
6
7# RUN: llvm-mc -filetype=obj -triple=powerpc64 %s -o %t.o
8# RUN: ld.lld %t.o -o %t
9# RUN: llvm-readelf -s %t | FileCheck %s --check-prefix=SYMBOL
10# RUN: llvm-objdump -d --no-show-raw-insn --mcpu=pwr10 %t | FileCheck %s
11
12## This test checks the LLD implementation of the Local Exec TLS model
13## when using prefixed instructions like paddi.
14
15# SYMBOL:      Symbol table '.symtab' contains 6 entries:
16# SYMBOL:      0000000000000000     0 TLS     LOCAL DEFAULT     2 x
17# SYMBOL-NEXT: 0000000000000004     0 TLS     LOCAL DEFAULT     2 y
18# SYMBOL-NEXT: 0000000000000008     0 TLS     LOCAL DEFAULT     2 z
19
20# CHECK-LABEL: <LocalExecAddr>:
21# CHECK:       paddi 3, 13, -28672, 0
22# CHECK-NEXT:  paddi 3, 13, -28668, 0
23# CHECK-NEXT:  paddi 3, 13, -28652, 0
24# CHECK-NEXT:  blr
25
26# CHECK-LABEL: <LocalExecVal>:
27# CHECK:       paddi 3, 13, -28672, 0
28# CHECK-NEXT:  lwz 3, 0(3)
29# CHECK-NEXT:  paddi 3, 13, -28668, 0
30# CHECK-NEXT:  lwz 3, 0(3)
31# CHECK-NEXT:  paddi 3, 13, -28652, 0
32# CHECK-NEXT:  lwz 3, 0(3)
33# CHECK-NEXT:  blr
34
35LocalExecAddr:
36	paddi 3, 13, x@TPREL, 0
37	paddi 3, 13, y@TPREL, 0
38	paddi 3, 13, z@TPREL+12, 0
39	blr
40
41LocalExecVal:
42	paddi 3, 13, x@TPREL, 0
43	lwz 3, 0(3)
44	paddi 3, 13, y@TPREL, 0
45	lwz 3, 0(3)
46	paddi 3, 13, z@TPREL+12, 0
47	lwz 3, 0(3)
48	blr
49
50.section .tbss, "awT", @nobits
51x:
52	.long	0
53y:
54	.long	0
55z:
56	.space	20
57