[llvm-readobj] - Simplify stack-sizes.test test case.
[llvm-complete.git] / test / MC / PowerPC / tls-ld-v2-abi.s
blob6eaa9888168b536406da3200b5f90cd357525d49
1 // RUN: llvm-mc -triple=powerpc64le-pc-linux -filetype=obj %s -o - | \
2 // RUN: llvm-readobj -r | FileCheck %s
4 // RUN: llvm-mc -triple=powerpc64-pc-linux -filetype=obj %s -o - | \
5 // RUN: llvm-readobj -r | FileCheck %s
7 // Verify we can handle all the dtprel symbol modifiers for local-dynamic tls.
8 // Tests a 16 bit offset on both DS-form and D-form instructions, 32 bit
9 // adjusted and non-adjusted offsets, and 64 bit adjusted and non-adjusted
10 // offsets.
11 .text
12 .abiversion 2
14 .globl short_offset
15 .p2align 4
16 .type short_offset,@function
17 short_offset:
18 .Lfunc_gep0:
19 addis 2, 12, .TOC.-.Lfunc_gep0@ha
20 addi 2, 2, .TOC.-.Lfunc_gep0@l
21 .Lfunc_lep0:
22 .localentry short_offset, .Lfunc_lep0-.Lfunc_gep0
23 mflr 0
24 std 0, 16(1)
25 stdu 1, -32(1)
26 addis 3, 2, i@got@tlsld@ha
27 addi 3, 3, i@got@tlsld@l
28 bl __tls_get_addr(i@tlsld)
29 nop
30 lwa 4, i@dtprel(3)
31 addi 5, 3, i@dtprel
32 lwa 3, 0(5)
33 add 3, 4, 3
34 addi 1, 1, 32
35 ld 0, 16(1)
36 mtlr 0
37 blr
39 .globl medium_offset
40 .p2align 4
41 .type medium_offset,@function
42 medium_offset:
43 .Lfunc_gep1:
44 addis 2, 12, .TOC.-.Lfunc_gep1@ha
45 addi 2, 2, .TOC.-.Lfunc_gep1@l
46 .Lfunc_lep1:
47 .localentry medium_offset, .Lfunc_lep1-.Lfunc_gep1
48 mflr 0
49 std 0, 16(1)
50 stdu 1, -32(1)
51 addis 3, 2, i@got@tlsld@ha
52 addi 3, 3, i@got@tlsld@l
53 bl __tls_get_addr(i@tlsld)
54 nop
55 addis 3, 3, i@dtprel@ha
56 lwa 3, i@dtprel@l(3)
57 addi 1, 1, 32
58 ld 0, 16(1)
59 mtlr 0
60 blr
62 .globl medium_not_adjusted
63 .p2align 4
64 .type medium_not_adjusted,@function
65 medium_not_adjusted:
66 .Lfunc_gep2:
67 addis 2, 12, .TOC.-.Lfunc_gep2@ha
68 addi 2, 2, .TOC.-.Lfunc_gep2@l
69 .Lfunc_lep2:
70 .localentry medium_not_adjusted, .Lfunc_lep2-.Lfunc_gep2
71 mflr 0
72 std 0, 16(1)
73 stdu 1, -32(1)
74 addis 3, 2, i@got@tlsld@ha
75 addi 3, 3, i@got@tlsld@l
76 bl __tls_get_addr(i@tlsld)
77 nop
78 lis 4, i@dtprel@h
79 ori 4, 4, i@dtprel@l
80 add 3, 3, 4
81 addi 1, 1, 32
82 ld 0, 16(1)
83 mtlr 0
84 blr
86 .globl large_offset
87 .p2align 4
88 .type large_offset,@function
89 large_offset:
90 .Lfunc_gep3:
91 addis 2, 12, .TOC.-.Lfunc_gep3@ha
92 addi 2, 2, .TOC.-.Lfunc_gep3@l
93 .Lfunc_lep3:
94 .localentry large_offset, .Lfunc_lep3-.Lfunc_gep3
95 mflr 0
96 std 0, 16(1)
97 stdu 1, -32(1)
98 addis 3, 2, i@got@tlsld@ha
99 addi 3, 3, i@got@tlsld@l
100 bl __tls_get_addr(i@tlsld)
102 lis 4, i@dtprel@highesta
103 ori 4, 4, i@dtprel@highera
104 sldi 4, 4, 32
105 addis 4, 4, i@dtprel@higha
106 addi 4, 4, i@dtprel@l
107 lwax 3, 4, 3
108 addi 1, 1, 32
109 ld 0, 16(1)
110 mtlr 0
113 .globl not_adjusted
114 .p2align 4
115 .type not_adjusted,@function
116 not_adjusted:
117 .Lfunc_gep4:
118 addis 2, 12, .TOC.-.Lfunc_gep4@ha
119 addi 2, 2, .TOC.-.Lfunc_gep4@l
120 .Lfunc_lep4:
121 .localentry not_adjusted, .Lfunc_lep4-.Lfunc_gep4
122 mflr 0
123 std 0, 16(1)
124 stdu 1, -32(1)
125 addis 3, 2, i@got@tlsld@ha
126 addi 3, 3, i@got@tlsld@l
127 bl __tls_get_addr(i@tlsld)
129 lis 4, i@dtprel@highest
130 ori 4, 4, i@dtprel@higher
131 sldi 4, 4, 32
132 oris 4, 4, i@dtprel@high
133 ori 4, 4, i@dtprel@l
134 lwax 3, 4, 3
135 addi 1, 1, 32
136 ld 0, 16(1)
137 mtlr 0
140 .type i,@object
141 .section .tdata,"awT",@progbits
142 .p2align 2
144 .long 55
145 .size i, 4
147 .type j,@object
148 .data
149 .p2align 3
151 .quad i@dtprel
152 .size j, 8
154 # CHECK: Relocations [
155 # CHECK: Section {{.*}} .rela.text {
156 # CHECK: 0x{{[0-9A-F]+}} R_PPC64_GOT_TLSLD16_HA i
157 # CHECK: 0x{{[0-9A-F]+}} R_PPC64_GOT_TLSLD16_LO i
158 # CHECK: 0x{{[0-9A-F]+}} R_PPC64_TLSLD i
159 # CHECK: 0x{{[0-9A-F]+}} R_PPC64_REL24 __tls_get_addr
160 # CHECK: 0x{{[0-9A-F]+}} R_PPC64_DTPREL16_DS i
161 # CHECK: 0x{{[0-9A-F]+}} R_PPC64_DTPREL16 i
162 # CHECK: 0x{{[0-9A-F]+}} R_PPC64_DTPREL16_HA i
163 # CHECK: 0x{{[0-9A-F]+}} R_PPC64_DTPREL16_LO_DS i
164 # CHECK: 0x{{[0-9A-F]+}} R_PPC64_DTPREL16_HI i
165 # CHECK: 0x{{[0-9A-F]+}} R_PPC64_DTPREL16_HIGHESTA i
166 # CHECK: 0x{{[0-9A-F]+}} R_PPC64_DTPREL16_HIGHERA i
167 # CHECK: 0x{{[0-9A-F]+}} R_PPC64_DTPREL16_HIGHA i
168 # CHECK: 0x{{[0-9A-F]+}} R_PPC64_DTPREL16_LO i
169 # CHECK: 0x{{[0-9A-F]+}} R_PPC64_DTPREL16_HIGHEST i
170 # CHECK: 0x{{[0-9A-F]+}} R_PPC64_DTPREL16_HIGHER i
171 # CHECK: 0x{{[0-9A-F]+}} R_PPC64_DTPREL16_HIGH i
172 # CHECK: 0x{{[0-9A-F]+}} R_PPC64_DTPREL16_LO i
173 # CHECK: }
174 # CHECK: Section {{.*}} .rela.data {
175 # CHECK: 0x{{[0-9A-F]+}} R_PPC64_DTPREL64 i
176 # CHECK: }
177 # CHECK: ]