Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / lld / test / ELF / hexagon-tls-tprel.s
blobb99465bc1df6b3ea73d3cb7152085bcff299d96f
1 # REQUIRES: hexagon
2 # RUN: llvm-mc -filetype=obj -triple=hexagon-unknown-elf %s -o %t.o
3 # RUN: llvm-readobj -r %t.o | FileCheck --check-prefix=RELOC %s
4 # RUN: ld.lld %t.o -o %t
5 # RUN: llvm-objdump -d --print-imm-hex %t | FileCheck %s
7 # R_HEX_6_X@TPREL tests:
8 # One test for each mask in the lookup table.
10 #0x38000000
11 if (!P0) memw(r0+#8)=##a@TPREL
12 # RELOC: 0x0 R_HEX_TPREL_32_6_X a 0x0
13 # RELOC-NEXT: 0x4 R_HEX_TPREL_16_X a 0x0
14 # CHECK: { immext(#0xffffffc0)
15 # CHECK-NEXT: if (!p0) memw(r0+#0x8) = ##-0x4 }
17 #0x39000000
18 { p0 = p1
19 if (!P0.new) memw(r0+#0)=##a@TPREL }
20 # RELOC-NEXT: 0xC R_HEX_TPREL_32_6_X a 0x0
21 # RELOC-NEXT: 0x10 R_HEX_TPREL_16_X a 0x0
22 # CHECK: immext(#0xffffffc0)
23 # CHECK-NEXT: if (!p0.new) memw(r0+#0x0) = ##-0x4 }
25 #0x3e000000
26 memw(r0+##a@TPREL)+=r1
27 # RELOC-NEXT: 0x14 R_HEX_TPREL_32_6_X a 0x0
28 # RELOC-NEXT: 0x18 R_HEX_TPREL_16_X a 0x0
29 # CHECK: { immext(#0xffffffc0)
30 # CHECK-NEXT: memw(r0+##0xfffffffc) += r1 }
32 #0x3f000000
33 memw(r0+##a@TPREL)+=#4
34 # RELOC-NEXT: 0x1C R_HEX_TPREL_32_6_X a 0x0
35 # RELOC-NEXT: 0x20 R_HEX_TPREL_16_X a 0x0
36 # CHECK: { immext(#0xffffffc0)
37 # CHECK-NEXT: memw(r0+##0xfffffffc) += #0x4 }
40 #0x40000000
41 { r0 = r1
42 if (p0) memb(r0+##a@TPREL)=r0.new }
43 # RELOC-NEXT: 0x28 R_HEX_TPREL_32_6_X a 0x0
44 # RELOC-NEXT: 0x2C R_HEX_TPREL_16_X a 0x0
45 # CHECK: immext(#0xffffffc0)
46 # CHECK-NEXT: if (p0) memb(r0+##0xfffffffc) = r0.new }
48 #0x41000000
49 if (p0) r0=memb(r1+##a@TPREL)
50 # RELOC-NEXT: 0x30 R_HEX_TPREL_32_6_X a 0x0
51 # RELOC-NEXT: 0x34 R_HEX_TPREL_16_X a 0x0
52 # CHECK: { immext(#0xffffffc0)
53 # CHECK-NEXT: if (p0) r0 = memb(r1+##0xfffffffc) }
55 #0x42000000
56 { r0 = r1
57 p0 = p1
58 if (p0.new) memb(r0+##a@TPREL)=r0.new }
59 # RELOC-NEXT: 0x40 R_HEX_TPREL_32_6_X a 0x0
60 # RELOC-NEXT: 0x44 R_HEX_TPREL_16_X a 0x0
61 # CHECK: immext(#0xffffffc0)
62 # CHECK-NEXT: if (p0.new) memb(r0+##0xfffffffc) = r0.new }
64 #0x43000000
65 { p0 = p1
66 if (P0.new) r0=memb(r0+##a@TPREL) }
67 # RELOC-NEXT: 0x4C R_HEX_TPREL_32_6_X a 0x0
68 # RELOC-NEXT: 0x50 R_HEX_TPREL_16_X a 0x0
69 # CHECK: immext(#0xffffffc0)
70 # CHECK-NEXT: if (p0.new) r0 = memb(r0+##0xfffffffc) }
72 #0x44000000
73 if (!p0) memb(r0+##a@TPREL)=r1
74 # RELOC-NEXT: 0x54 R_HEX_TPREL_32_6_X a 0x0
75 # RELOC-NEXT: 0x58 R_HEX_TPREL_16_X a 0x0
76 # CHECK: { immext(#0xffffffc0)
77 # CHECK-NEXT: if (!p0) memb(r0+##0xfffffffc) = r1 }
79 #0x45000000
80 if (!p0) r0=memb(r1+##a@TPREL)
81 # RELOC-NEXT: 0x5C R_HEX_TPREL_32_6_X a 0x0
82 # RELOC-NEXT: 0x60 R_HEX_TPREL_16_X a 0x0
83 # CHECK: { immext(#0xffffffc0)
84 # CHECK-NEXT: if (!p0) r0 = memb(r1+##0xfffffffc) }
87 #0x46000000
88 { p0 = p1
89 if (!p0.new) memb(r0+##a@TPREL)=r1 }
90 # RELOC-NEXT: 0x68 R_HEX_TPREL_32_6_X a 0x0
91 # RELOC-NEXT: 0x6C R_HEX_TPREL_16_X a 0x0
92 # CHECK: immext(#0xffffffc0)
93 # CHECK-NEXT: if (!p0.new) memb(r0+##0xfffffffc) = r1 }
95 #0x47000000
96 { p0 = p1
97 if (!p0.new) r0=memb(r1+##a@TPREL) }
98 # RELOC-NEXT: 0x74 R_HEX_TPREL_32_6_X a 0x0
99 # RELOC-NEXT: 0x78 R_HEX_TPREL_16_X a 0x0
100 # CHECK: immext(#0xffffffc0)
101 # CHECK-NEXT: if (!p0.new) r0 = memb(r1+##0xfffffffc) }
103 #0x7c000000
104 r1:0=combine(#8,##a@TPREL)
105 # RELOC-NEXT: 0x7C R_HEX_TPREL_32_6_X a 0x0
106 # RELOC-NEXT: 0x80 R_HEX_TPREL_16_X a 0x0
107 # CHECK: { immext(#0xffffffc0)
108 # CHECK-NEXT: r1:0 = combine(#0x8,##0xfffffffc) }
111 #0x9a000000
112 r1:0=memb_fifo(r2=##a@TPREL)
113 # RELOC-NEXT: 0x84 R_HEX_TPREL_32_6_X a 0x0
114 # RELOC-NEXT: 0x88 R_HEX_TPREL_16_X a 0x0
115 # CHECK: { immext(#0xffffffc0)
116 # CHECK-NEXT: r1:0 = memb_fifo(r2=##0xfffffffc) }
119 #0x9b000000
120 r0=memb(r1=##a@TPREL)
121 # RELOC-NEXT: 0x8C R_HEX_TPREL_32_6_X a 0x0
122 # RELOC-NEXT: 0x90 R_HEX_TPREL_16_X a 0x0
123 # CHECK: { immext(#0xffffffc0)
124 # CHECK-NEXT: r0 = memb(r1=##0xfffffffc) }
127 #0x9c000000
128 r1:0=memb_fifo(r2<<#2+##a@TPREL)
129 # RELOC-NEXT: 0x94 R_HEX_TPREL_32_6_X a 0x0
130 # RELOC-NEXT: 0x98 R_HEX_TPREL_16_X a 0x0
131 # CHECK: { immext(#0xffffffc0)
132 # CHECK-NEXT: r1:0 = memb_fifo(r2<<#0x2+##0xfffffffc) }
135 #0x9d000000
136 r0=memb(r1<<#2+##a@TPREL)
137 # RELOC-NEXT: 0x9C R_HEX_TPREL_32_6_X a 0x0
138 # RELOC-NEXT: 0xA0 R_HEX_TPREL_16_X a 0x0
139 # CHECK: { immext(#0xffffffc0)
140 # CHECK-NEXT: r0 = memb(r1<<#0x2+##0xfffffffc) }
143 #0x9f000000
144 if (!p0) r0=memb(##a@TPREL)
145 # RELOC-NEXT: 0xA4 R_HEX_TPREL_32_6_X a 0x0
146 # RELOC-NEXT: 0xA8 R_HEX_TPREL_16_X a 0x0
147 # CHECK: { immext(#0xffffffc0)
148 # CHECK-NEXT: if (!p0) r0 = memb(##0xfffffffc) }
151 #0xab000000
152 memb(r0=##a@TPREL)=r1
153 # RELOC-NEXT: 0xAC R_HEX_TPREL_32_6_X a 0x0
154 # RELOC-NEXT: 0xB0 R_HEX_TPREL_16_X a 0x0
155 # CHECK: { immext(#0xffffffc0)
156 # CHECK-NEXT: memb(r0=##0xfffffffc) = r1 }
159 #0xad000000
160 memb(r0<<#2+##a@TPREL)=r1
161 # RELOC-NEXT: 0xB4 R_HEX_TPREL_32_6_X a 0x0
162 # RELOC-NEXT: 0xB8 R_HEX_TPREL_16_X a 0x0
163 # CHECK: { immext(#0xffffffc0)
164 # CHECK-NEXT: memb(r0<<#0x2+##0xfffffffc) = r1 }
167 #0xaf000000
168 if (!p0) memb(##a@TPREL)=r1
169 # RELOC-NEXT: 0xBC R_HEX_TPREL_32_6_X a 0x0
170 # RELOC-NEXT: 0xC0 R_HEX_TPREL_16_X a 0x0
171 # CHECK: { immext(#0xffffffc0)
172 # CHECK-NEXT: if (!p0) memb(##0xfffffffc) = r1 }
175 #0xd7000000
176 r0=add(##a@TPREL,mpyi(r1,r2))
177 # RELOC-NEXT: 0xC4 R_HEX_TPREL_32_6_X a 0x0
178 # RELOC-NEXT: 0xC8 R_HEX_TPREL_16_X a 0x0
179 # CHECK: { immext(#0xffffffc0)
180 # CHECK-NEXT: r0 = add(##0xfffffffc,mpyi(r1,r2)) }
183 #0xd8000000
184 R0=add(##a@TPREL,mpyi(r0,#2))
185 # RELOC-NEXT: 0xCC R_HEX_TPREL_32_6_X a 0x0
186 # RELOC-NEXT: 0xD0 R_HEX_TPREL_16_X a 0x0
187 # CHECK: { immext(#0xffffffc0)
188 # CHECK-NEXT: r0 = add(##0xfffffffc,mpyi(r0,#0x2)) }
191 #0xdb000000
192 r0=add(r1,add(r2,##a@TPREL))
193 # RELOC-NEXT: 0xD4 R_HEX_TPREL_32_6_X a 0x0
194 # RELOC-NEXT: 0xD8 R_HEX_TPREL_16_X a 0x0
195 # CHECK: { immext(#0xffffffc0)
196 # CHECK-NEXT: r0 = add(r1,add(r2,##-0x4)) }
199 #0xdf000000
200 r0=add(r1,mpyi(r2,##a@TPREL))
201 # RELOC-NEXT: 0xDC R_HEX_TPREL_32_6_X a 0x0
202 # RELOC-NEXT: 0xE0 R_HEX_TPREL_16_X a 0x0
203 # CHECK: { immext(#0xffffffc0)
204 # CHECK-NEXT: r0 = add(r1,mpyi(r2,##0xfffffffc)) }
207 # Duplex form of R_HEX_6_X
208 # R_HEX_32_6_X
209 # R_HEX_6_X
210 { r0 = ##a@TPREL; r2 = r16 }
211 # RELOC-NEXT: 0xE4 R_HEX_TPREL_32_6_X a 0x0
212 # RELOC-NEXT: 0xE8 R_HEX_TPREL_16_X a 0x0
213 # CHECK: { immext(#0xffffffc0)
214 # CHECK-NEXT: r0 = ##0xfffffffc; r2 = r16 }
216 .section .tdata,"awT",@progbits
217 .globl a
218 .p2align 2
220 .word 1
221 .size a, 4