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.
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 }
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 }
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 }
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 }
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 }
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) }
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 }
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) }
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 }
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) }
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 }
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) }
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) }
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) }
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) }
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) }
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) }
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) }
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 }
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 }
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 }
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)) }
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)) }
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)) }
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
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