• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# REQUIRES: hexagon
2# RUN: llvm-mc -filetype=obj -triple=hexagon-unknown-elf %s -o %t.o
3# RUN: llvm-mc -filetype=obj -triple=hexagon-unknown-elf %S/Inputs/hexagon.s -o %t1.o
4# RUN: ld.lld %t.o %t1.o -o %t
5# RUN: llvm-objdump -d %t | FileCheck %s
6
7# Note: 131648 == 0x20240
8# R_HEX_32_6_X
9# R_HEX_12_X
10if (p0) r0 = ##_start
11# CHECK: immext(#131648)
12# CHECK: if (p0) r0 = ##131648
13
14# R_HEX_B15_PCREL
15if (p0) jump:nt #_start
16# CHECK: if (p0) jump:nt 0x20240
17
18# R_HEX_B32_PCREL_X
19# R_HEX_B15_PCREL_X
20if (p0) jump:nt ##_start
21# CHECK: if (p0) jump:nt 0x20240
22
23# R_HEX_B22_PCREL
24call #_start
25# CHECK: call 0x20240
26
27# R_HEX_B32_PCREL_X
28# R_HEX_B22_PCREL_X
29call ##_start
30# CHECK: immext(#320)
31# CHECK: call 0x20240
32
33# R_HEX_6_X tests:
34# One test for each mask in the lookup table.
35
36#0x38000000
37if (!P0) memw(r0+#8)=##_start
38# CHECK: 38c0c100   	if (!p0) memw(r0+#8) = ##131648 }
39
40#0x39000000
41{ p0 = p1
42  if (!P0.new) memw(r0+#0)=##_start }
43# CHECK: 39c0c000   	if (!p0.new) memw(r0+#0) = ##131648 }
44
45#0x3e000000
46memw(r0+##_start)+=r1
47# CHECK: 3e40c001   	memw(r0+##131648) += r1 }
48
49#0x3f000000
50memw(r0+##_start)+=#4
51# CHECK: 3f40c004   	memw(r0+##131648) += #4 }
52
53#0x40000000
54{ r0 = r1
55  if (p0) memb(r0+##_start)=r0.new }
56# CHECK: 40a0c200   	if (p0) memb(r0+##131648) = r0.new }
57
58#0x41000000
59if (p0) r0=memb(r1+##_start)
60# CHECK: 4101c000   	if (p0) r0 = memb(r1+##131648) }
61
62#0x42000000
63{ r0 = r1
64  p0 = p1
65  if (p0.new) memb(r0+##_start)=r0.new }
66# CHECK: 42a0c200   	if (p0.new) memb(r0+##131648) = r0.new }
67
68#0x43000000
69{ p0 = p1
70 if (P0.new) r0=memb(r0+##_start) }
71# CHECK: 4300c000   	if (p0.new) r0 = memb(r0+##131648) }
72
73#0x44000000
74if (!p0) memb(r0+##_start)=r1
75# CHECK: 4400c100   	if (!p0) memb(r0+##131648) = r1 }
76
77#0x45000000
78if (!p0) r0=memb(r1+##_start)
79# CHECK: 4501c000   	if (!p0) r0 = memb(r1+##131648) }
80
81#0x46000000
82{ p0 = p1
83  if (!p0.new) memb(r0+##_start)=r1 }
84# CHECK: 4600c100   	if (!p0.new) memb(r0+##131648) = r1 }
85
86#0x47000000
87{ p0 = p1
88  if (!p0.new) r0=memb(r1+##_start) }
89# CHECK: 4701c000   	if (!p0.new) r0 = memb(r1+##131648) }
90
91#0x6a000000 -- Note 4294967132 == -0xa4 the distance between
92#              here and _start, so this will change if
93#              tests are added between here and _start
94r0=add(pc,##_start@pcrel)
95# CHECK: 6a49d800  	r0 = add(pc,##240) }
96
97#0x7c000000
98r1:0=combine(#8,##_start)
99# CHECK: 7c80c100   	r1:0 = combine(#8,##131648) }
100
101#0x9a000000
102r1:0=memb_fifo(r2=##_start)
103# CHECK: 9a82d000   	r1:0 = memb_fifo(r2=##131648) }
104
105#0x9b000000
106r0=memb(r1=##_start)
107# CHECK: 9b01d000   	r0 = memb(r1=##131648) }
108
109#0x9c000000
110r1:0=memb_fifo(r2<<#2+##_start)
111# CHECK: 9c82f000   	r1:0 = memb_fifo(r2<<#2+##131648) }
112
113#0x9d000000
114r0=memb(r1<<#2+##_start)
115# CHECK: 9d01f000   	r0 = memb(r1<<#2+##131648) }
116
117#0x9f000000
118if (!p0) r0=memb(##_start)
119# CHECK: 9f00e880   	if (!p0) r0 = memb(##131648) }
120
121#0xab000000
122memb(r0=##_start)=r1
123# CHECK: ab00c180   	memb(r0=##131648) = r1 }
124
125#0xad000000
126memb(r0<<#2+##_start)=r1
127# CHECK: ad00e180   	memb(r0<<#2+##131648) = r1 }
128
129#0xaf000000
130if (!p0) memb(##_start)=r1
131# CHECK: af00c184   	if (!p0) memb(##131648) = r1 }
132
133#0xd7000000
134r0=add(##_start,mpyi(r1,r2))
135# CHECK: d701c200   	r0 = add(##131648,mpyi(r1,r2)) }
136
137#0xd8000000
138R0=add(##_start,mpyi(r0,#2))
139# CHECK: d800c002   	r0 = add(##131648,mpyi(r0,#2)) }
140
141#0xdb000000
142r0=add(r1,add(r2,##_start))
143# CHECK: db01c002   	r0 = add(r1,add(r2,##131648)) }
144
145#0xdf000000
146r0=add(r1,mpyi(r2,##_start))
147# CHECK: df82c001   	r0 = add(r1,mpyi(r2,##131648)) }
148
149# Duplex form of R_HEX_6_X
150# R_HEX_32_6_X
151# R_HEX_6_X
152{ r0 = ##_start; r2 = r16 }
153# CHECK: 28003082   	r0 = ##131648; 	r2 = r16 }
154
155# R_HEX_HI16
156r0.h = #HI(_start)
157# CHECK: r0.h = #2
158
159# R_HEX_LO16
160r0.l = #LO(_start)
161# CHECK: r0.l = #576
162
163# R_HEX_8_X has 3 relocation mask variations
164#0xde000000
165r0=sub(##_start, asl(r0, #1))
166# CHECK: de40c106      r0 = sub(##131648,asl(r0,#1)) }
167
168#0x3c000000
169memw(r0+#0) = ##_start
170# CHECK: 3c40c040   	memw(r0+#0) = ##131648 }
171
172# The rest:
173r1:0=combine(r2,##_start);
174# CHECK: 7302e800   	r1:0 = combine(r2,##131648) }
175
176# R_HEX_32:
177r_hex_32:
178.word _start
179# CHECK: 00020240
180
181# R_HEX_16_X has 4 relocation mask variations
182# 0x48000000
183memw(##_start) = r0
184# CHECK: 4880c000   memw(##131648) = r0 }
185
186# 0x49000000
187r0 = memw(##_start)
188# CHECK: 4980c000   r0 = memw(##131648)
189
190# 0x78000000
191r0 = ##_start
192# CHECK: 7800c000   r0 = ##131648 }
193
194# 0xb0000000
195r0 = add(r1, ##_start)
196# CHECK: b001c000   r0 = add(r1,##131648) }
197
198# R_HEX_B9_PCREL:
199{r0=#1 ; jump #_start}
200# CHECK: jump 0x20240
201
202# R_HEX_B9_PCREL_X:
203{r0=#1 ; jump ##_start}
204# CHECK: jump 0x20240
205
206# R_HEX_B13_PCREL
207if (r0 == #0) jump:t #_start
208# CHECK: if (r0==#0) jump:t 0x20240
209
210# R_HEX_9_X
211p0 = !cmp.gtu(r0, ##_start)
212# CHECK: p0 = !cmp.gtu(r0,##131648)
213
214# R_HEX_10_X
215p0 = !cmp.gt(r0, ##_start)
216# CHECK: p0 = !cmp.gt(r0,##131648)
217
218# R_HEX_11_X
219r0 = memw(r1+##_start)
220# CHECK: r0 = memw(r1+##131648)
221
222memw(r0+##_start) = r1
223# CHECK: memw(r0+##131648) = r1
224