1# RUN: llvm-mc -triple hexagon -filetype=obj -o - %s | llvm-objdump -d - | FileCheck %s
2# Hexagon Programmer's Reference Manual 11.5 LD
3
4# Load doubleword
5# CHECK: 90 ff d5 3a
6r17:16 = memd(r21 + r31<<#3)
7# CHECK: b0 c2 c0 49
8r17:16 = memd(gp+#168)
9# CHECK: 02 40 00 00
10# CHECK-NEXT: 10 c5 c0 49
11r17:16 = memd(##168)
12# CHECK: d0 c0 d5 91
13r17:16 = memd(r21 + #48)
14# CHECK: b0 e0 d5 99
15r17:16 = memd(r21 ++ #40:circ(m1))
16# CHECK: 10 e2 d5 99
17r17:16 = memd(r21 ++ I:circ(m1))
18# CHECK: 00 40 00 00
19# CHECK-NEXT: 70 d7 d5 9b
20r17:16 = memd(r21 = ##31)
21# CHECK: b0 c0 d5 9b
22r17:16 = memd(r21++#40)
23# CHECK: 10 e0 d5 9d
24r17:16 = memd(r21++m1)
25# CHECK: 10 e0 d5 9f
26r17:16 = memd(r21 ++ m1:brev)
27
28# Load doubleword conditionally
29# CHECK: f0 ff d5 30
30if (p3) r17:16 = memd(r21+r31<<#3)
31# CHECK: f0 ff d5 31
32if (!p3) r17:16 = memd(r21+r31<<#3)
33# CHECK: 03 40 45 85
34# CHECK-NEXT: f0 ff d5 32
35{ p3 = r5
36  if (p3.new) r17:16 = memd(r21+r31<<#3) }
37# CHECK: 03 40 45 85
38# CHECK-NEXT: f0 ff d5 33
39{ p3 = r5
40  if (!p3.new) r17:16 = memd(r21+r31<<#3) }
41# CHECK: 70 d8 d5 41
42if (p3) r17:16 = memd(r21 + #24)
43# CHECK: 03 40 45 85
44# CHECK-NEXT: 70 d8 d5 43
45{ p3 = r5
46  if (p3.new) r17:16 = memd(r21 + #24) }
47# CHECK: 70 d8 d5 45
48if (!p3) r17:16 = memd(r21 + #24)
49# CHECK: 03 40 45 85
50# CHECK-NEXT: 70 d8 d5 47
51{ p3 = r5
52  if (!p3.new) r17:16 = memd(r21 + #24) }
53# CHECK: b0 e6 d5 9b
54if (p3) r17:16 = memd(r21++#40)
55# CHECK: b0 ee d5 9b
56if (!p3) r17:16 = memd(r21++#40)
57# CHECK: 03 40 45 85
58# CHECK-NEXT: b0 f6 d5 9b
59{ p3 = r5
60  if (p3.new) r17:16 = memd(r21++#40) }
61# CHECK: 03 40 45 85
62# CHECK-NEXT: b0 fe d5 9b
63{ p3 = r5
64  if (!p3.new) r17:16 = memd(r21++#40) }
65
66# Load byte
67# CHECK: 91 ff 15 3a
68r17 = memb(r21 + r31<<#3)
69# CHECK: b1 c2 00 49
70r17 = memb(gp+#21)
71# CHECK: 00 40 00 00
72# CHECK-NEXT: b1 c2 00 49
73r17 = memb(##21)
74# CHECK: f1 c3 15 91
75r17 = memb(r21 + #31)
76# CHECK: b1 e0 15 99
77r17 = memb(r21 ++ #5:circ(m1))
78# CHECK: 11 e2 15 99
79r17 = memb(r21 ++ I:circ(m1))
80# CHECK: 00 40 00 00
81# CHECK-NEXT: 71 d7 15 9b
82r17 = memb(r21 = ##31)
83# CHECK: b1 c0 15 9b
84r17 = memb(r21++#5)
85# CHECK: 11 e0 15 9d
86r17 = memb(r21++m1)
87# CHECK: 11 e0 15 9f
88r17 = memb(r21 ++ m1:brev)
89
90# Load byte conditionally
91# CHECK: f1 ff 15 30
92if (p3) r17 = memb(r21+r31<<#3)
93# CHECK: f1 ff 15 31
94if (!p3) r17 = memb(r21+r31<<#3)
95# CHECK: 03 40 45 85
96# CHECK-NEXT: f1 ff 15 32
97{ p3 = r5
98  if (p3.new) r17 = memb(r21+r31<<#3) }
99# CHECK: 03 40 45 85
100# CHECK-NEXT: f1 ff 15 33
101{ p3 = r5
102  if (!p3.new) r17 = memb(r21+r31<<#3) }
103# CHECK: 91 dd 15 41
104if (p3) r17 = memb(r21 + #44)
105# CHECK: 03 40 45 85
106# CHECK-NEXT: 91 dd 15 43
107{ p3 = r5
108  if (p3.new) r17 = memb(r21 + #44) }
109# CHECK: 91 dd 15 45
110if (!p3) r17 = memb(r21 + #44)
111# CHECK: 03 40 45 85
112# CHECK-NEXT: 91 dd 15 47
113{ p3 = r5
114  if (!p3.new) r17 = memb(r21 + #44) }
115# CHECK: b1 e6 15 9b
116if (p3) r17 = memb(r21++#5)
117# CHECK: b1 ee 15 9b
118if (!p3) r17 = memb(r21++#5)
119# CHECK: 03 40 45 85
120# CHECK-NEXT: b1 f6 15 9b
121{ p3 = r5
122  if (p3.new) r17 = memb(r21++#5) }
123# CHECK: 03 40 45 85
124# CHECK-NEXT: b1 fe 15 9b
125{ p3 = r5
126  if (!p3.new) r17 = memb(r21++#5) }
127
128# Load byte into shifted vector
129# CHECK: f0 c3 95 90
130r17:16 = memb_fifo(r21 + #31)
131# CHECK: b0 e0 95 98
132r17:16 = memb_fifo(r21 ++ #5:circ(m1))
133# CHECK: 10 e2 95 98
134r17:16 = memb_fifo(r21 ++ I:circ(m1))
135
136# Load half into shifted vector
137# CHECK: f0 c3 55 90
138r17:16 = memh_fifo(r21 + #62)
139# CHECK: b0 e0 55 98
140r17:16 = memh_fifo(r21 ++ #10:circ(m1))
141# CHECK: 10 e2 55 98
142r17:16 = memh_fifo(r21 ++ I:circ(m1))
143
144# Load halfword
145# CHECK: 91 ff 55 3a
146r17 = memh(r21 + r31<<#3)
147# CHECK: b1 c2 40 49
148r17 = memh(gp+#42)
149# CHECK: 00 40 00 00
150# CHECK-NEXT: 51 c5 40 49
151r17 = memh(##42)
152# CHECK: f1 c3 55 91
153r17 = memh(r21 + #62)
154# CHECK: b1 e0 55 99
155r17 = memh(r21 ++ #10:circ(m1))
156# CHECK: 11 e2 55 99
157r17 = memh(r21 ++ I:circ(m1))
158# CHECK: 00 40 00 00
159# CHECK-NEXT: 71 d7 55 9b
160r17 = memh(r21 = ##31)
161# CHECK: b1 c0 55 9b
162r17 = memh(r21++#10)
163# CHECK: 11 e0 55 9d
164r17 = memh(r21++m1)
165# CHECK: 11 e0 55 9f
166r17 = memh(r21 ++ m1:brev)
167
168# Load halfword conditionally
169# CHECK: f1 ff 55 30
170if (p3) r17 = memh(r21+r31<<#3)
171# CHECK: f1 ff 55 31
172if (!p3) r17 = memh(r21+r31<<#3)
173# CHECK: 03 40 45 85
174# CHECK-NEXT: f1 ff 55 32
175{ p3 = r5
176  if (p3.new) r17 = memh(r21+r31<<#3) }
177# CHECK: 03 40 45 85
178# CHECK-NEXT: f1 ff 55 33
179{ p3 = r5
180  if (!p3.new) r17 = memh(r21+r31<<#3) }
181# CHECK: b1 e6 55 9b
182if (p3) r17 = memh(r21++#10)
183# CHECK: b1 ee 55 9b
184if (!p3) r17 = memh(r21++#10)
185# CHECK: 03 40 45 85
186# CHECK-NEXT: b1 f6 55 9b
187{ p3 = r5
188  if (p3.new) r17 = memh(r21++#10) }
189# CHECK: 03 40 45 85
190# CHECK-NEXT: b1 fe 55 9b
191{ p3 = r5
192  if (!p3.new) r17 = memh(r21++#10) }
193# CHECK: f1 db 55 41
194if (p3) r17 = memh(r21 + #62)
195# CHECK: f1 db 55 45
196if (!p3) r17 = memh(r21 + #62)
197# CHECK: 03 40 45 85
198# CHECK-NEXT: f1 db 55 43
199{ p3 = r5
200  if (p3.new) r17 = memh(r21 + #62) }
201# CHECK: 03 40 45 85
202# CHECK-NEXT: f1 db 55 47
203{ p3 = r5
204  if (!p3.new) r17 = memh(r21 + #62) }
205
206# Load unsigned byte
207# CHECK: 91 ff 35 3a
208r17 = memub(r21 + r31<<#3)
209# CHECK: b1 c2 20 49
210r17 = memub(gp+#21)
211# CHECK: 00 40 00 00
212# CHECK-NEXT: b1 c2 20 49
213r17 = memub(##21)
214# CHECK: f1 c3 35 91
215r17 = memub(r21 + #31)
216# CHECK: b1 e0 35 99
217r17 = memub(r21 ++ #5:circ(m1))
218# CHECK: 11 e2 35 99
219r17 = memub(r21 ++ I:circ(m1))
220# CHECK: 00 40 00 00
221# CHECK-NEXT: 71 d7 35 9b
222r17 = memub(r21 = ##31)
223# CHECK: b1 c0 35 9b
224r17 = memub(r21++#5)
225# CHECK: 11 e0 35 9d
226r17 = memub(r21++m1)
227# CHECK: 11 e0 35 9f
228r17 = memub(r21 ++ m1:brev)
229
230# Load unsigned byte conditionally
231# CHECK: f1 ff 35 30
232if (p3) r17 = memub(r21+r31<<#3)
233# CHECK: f1 ff 35 31
234if (!p3) r17 = memub(r21+r31<<#3)
235# CHECK: 03 40 45 85
236# CHECK-NEXT: f1 ff 35 32
237{ p3 = r5
238  if (p3.new) r17 = memub(r21+r31<<#3) }
239# CHECK: 03 40 45 85
240# CHECK-NEXT: f1 ff 35 33
241{ p3 = r5
242  if (!p3.new) r17 = memub(r21+r31<<#3) }
243# CHECK: f1 db 35 41
244if (p3) r17 = memub(r21 + #31)
245# CHECK: 03 40 45 85
246# CHECK-NEXT: f1 db 35 43
247{ p3 = r5
248  if (p3.new) r17 = memub(r21 + #31) }
249# CHECK: f1 db 35 45
250if (!p3) r17 = memub(r21 + #31)
251# CHECK: 03 40 45 85
252# CHECK-NEXT: f1 db 35 47
253{ p3 = r5
254  if (!p3.new) r17 = memub(r21 + #31) }
255# CHECK: b1 e6 35 9b
256if (p3) r17 = memub(r21++#5)
257# CHECK: b1 ee 35 9b
258if (!p3) r17 = memub(r21++#5)
259# CHECK: 03 40 45 85
260# CHECK-NEXT: b1 f6 35 9b
261{ p3 = r5
262  if (p3.new) r17 = memub(r21++#5) }
263# CHECK: 03 40 45 85
264# CHECK-NEXT: b1 fe 35 9b
265{ p3 = r5
266  if (!p3.new) r17 = memub(r21++#5) }
267
268# Load unsigned halfword
269# CHECK: 91 ff 75 3a
270r17 = memuh(r21 + r31<<#3)
271# CHECK: b1 c2 60 49
272r17 = memuh(gp+#42)
273# CHECK: 00 40 00 00
274# CHECK-NEXT: 51 c5 60 49
275r17 = memuh(##42)
276# CHECK: b1 c2 75 91
277r17 = memuh(r21 + #42)
278# CHECK: b1 e0 75 99
279r17 = memuh(r21 ++ #10:circ(m1))
280# CHECK: 11 e2 75 99
281r17 = memuh(r21 ++ I:circ(m1))
282# CHECK: 00 40 00 00
283# CHECK-NEXT: 71 d7 75 9b
284r17 = memuh(r21 = ##31)
285# CHECK: b1 c0 75 9b
286r17 = memuh(r21++#10)
287# CHECK: 11 e0 75 9d
288r17 = memuh(r21++m1)
289# CHECK: 11 e0 75 9f
290r17 = memuh(r21 ++ m1:brev)
291
292# Load unsigned halfword conditionally
293# CHECK: f1 ff 75 30
294if (p3) r17 = memuh(r21+r31<<#3)
295# CHECK: f1 ff 75 31
296if (!p3) r17 = memuh(r21+r31<<#3)
297# CHECK: 03 40 45 85
298# CHECK-NEXT: f1 ff 75 32
299{ p3 = r5
300  if (p3.new) r17 = memuh(r21+r31<<#3) }
301# CHECK: 03 40 45 85
302# CHECK-NEXT: f1 ff 75 33
303{ p3 = r5
304  if (!p3.new) r17 = memuh(r21+r31<<#3) }
305# CHECK: b1 da 75 41
306if (p3) r17 = memuh(r21 + #42)
307# CHECK: b1 da 75 45
308if (!p3) r17 = memuh(r21 + #42)
309# CHECK: 03 40 45 85
310# CHECK-NEXT: b1 da 75 43
311{ p3 = r5
312  if (p3.new) r17 = memuh(r21 + #42) }
313# CHECK: 03 40 45 85
314# CHECK-NEXT: b1 da 75 47
315{ p3 = r5
316  if (!p3.new) r17 = memuh(r21 + #42) }
317# CHECK: b1 e6 75 9b
318if (p3) r17 = memuh(r21++#10)
319# CHECK: b1 ee 75 9b
320if (!p3) r17 = memuh(r21++#10)
321# CHECK: 03 40 45 85
322# CHECK-NEXT: b1 f6 75 9b
323{ p3 = r5
324  if (p3.new) r17 = memuh(r21++#10) }
325# CHECK: 03 40 45 85
326# CHECK-NEXT: b1 fe 75 9b
327{ p3 = r5
328  if (!p3.new) r17 = memuh(r21++#10) }
329
330# Load word
331# CHECK: 91 ff 95 3a
332r17 = memw(r21 + r31<<#3)
333# CHECK: b1 c2 80 49
334r17 = memw(gp+#84)
335# CHECK: 01 40 00 00
336# CHECK-NEXT: 91 c2 80 49
337r17 = memw(##84)
338# CHECK: b1 c2 95 91
339r17 = memw(r21 + #84)
340# CHECK: b1 e0 95 99
341r17 = memw(r21 ++ #20:circ(m1))
342# CHECK: 11 e2 95 99
343r17 = memw(r21 ++ I:circ(m1))
344# CHECK: 00 40 00 00
345# CHECK-NEXT: 71 d7 95 9b
346r17 = memw(r21 = ##31)
347# CHECK: b1 c0 95 9b
348r17 = memw(r21++#20)
349# CHECK: 11 e0 95 9d
350r17 = memw(r21++m1)
351# CHECK: 11 e0 95 9f
352r17 = memw(r21 ++ m1:brev)
353
354# Load word conditionally
355# CHECK: f1 ff 95 30
356if (p3) r17 = memw(r21+r31<<#3)
357# CHECK: f1 ff 95 31
358if (!p3) r17 = memw(r21+r31<<#3)
359# CHECK: 03 40 45 85
360# CHECK-NEXT: f1 ff 95 32
361{ p3 = r5
362  if (p3.new) r17 = memw(r21+r31<<#3) }
363# CHECK: 03 40 45 85
364# CHECK-NEXT: f1 ff 95 33
365{ p3 = r5
366  if (!p3.new) r17 = memw(r21+r31<<#3) }
367# CHECK: b1 da 95 41
368if (p3) r17 = memw(r21 + #84)
369# CHECK: b1 da 95 45
370if (!p3) r17 = memw(r21 + #84)
371# CHECK: 03 40 45 85
372# CHECK-NEXT: b1 da 95 43
373{ p3 = r5
374  if (p3.new) r17 = memw(r21 + #84) }
375# CHECK: 03 40 45 85
376# CHECK-NEXT: b1 da 95 47
377{ p3 = r5
378  if (!p3.new) r17 = memw(r21 + #84) }
379# CHECK: b1 e6 95 9b
380if (p3) r17 = memw(r21++#20)
381# CHECK: b1 ee 95 9b
382if (!p3) r17 = memw(r21++#20)
383# CHECK: 03 40 45 85
384# CHECK-NEXT: b1 f6 95 9b
385{ p3 = r5
386  if (p3.new) r17 = memw(r21++#20) }
387# CHECK: 03 40 45 85
388# CHECK-NEXT: b1 fe 95 9b
389{ p3 = r5
390  if (!p3.new) r17 = memw(r21++#20) }
391
392# Deallocate stack frame
393# CHECK: 1e c0 1e 90
394deallocframe
395
396# Deallocate stack frame and return
397# CHECK: 1e c0 1e 96
398dealloc_return
399# CHECK: 03 40 45 85
400# CHECK-NEXT: 1e cb 1e 96
401{ p3 = r5
402  if (p3.new) dealloc_return:nt }
403# CHECK: 1e d3 1e 96
404if (p3) dealloc_return
405# CHECK: 03 40 45 85
406# CHECK-NEXT: 1e db 1e 96
407{ p3 = r5
408  if (p3.new) dealloc_return:t }
409# CHECK: 03 40 45 85
410# CHECK-NEXT: 1e eb 1e 96
411{ p3 = r5
412  if (!p3.new) dealloc_return:nt }
413# CHECK: 1e f3 1e 96
414if (!p3) dealloc_return
415# CHECK: 03 40 45 85
416# CHECK-NEXT: 1e fb 1e 96
417{ p3 = r5
418  if (!p3.new) dealloc_return:t }
419
420# Load and unpack bytes to halfwords
421# CHECK: f1 c3 35 90
422r17 = membh(r21 + #62)
423# CHECK: f1 c3 75 90
424r17 = memubh(r21 + #62)
425# CHECK: f0 c3 b5 90
426r17:16 = memubh(r21 + #124)
427# CHECK: f0 c3 f5 90
428r17:16 = membh(r21 + #124)
429# CHECK: b1 e0 35 98
430r17 = membh(r21 ++ #10:circ(m1))
431# CHECK: 11 e2 35 98
432r17 = membh(r21 ++ I:circ(m1))
433# CHECK: b1 e0 75 98
434r17 = memubh(r21 ++ #10:circ(m1))
435# CHECK: 11 e2 75 98
436r17 = memubh(r21 ++ I:circ(m1))
437# CHECK: b0 e0 f5 98
438r17:16 = membh(r21 ++ #20:circ(m1))
439# CHECK: 10 e2 f5 98
440r17:16 = membh(r21 ++ I:circ(m1))
441# CHECK: b0 e0 b5 98
442r17:16 = memubh(r21 ++ #20:circ(m1))
443# CHECK: 10 e2 b5 98
444r17:16 = memubh(r21 ++ I:circ(m1))
445# CHECK: 00 40 00 00
446# CHECK-NEXT: 71 d7 35 9a
447r17 = membh(r21 = ##31)
448# CHECK: b1 c0 35 9a
449r17 = membh(r21++#10)
450# CHECK: 00 40 00 00
451# CHECK-NEXT: 71 d7 75 9a
452r17 = memubh(r21 = ##31)
453# CHECK: b1 c0 75 9a
454r17 = memubh(r21++#10)
455# CHECK: 00 40 00 00
456# CHECK-NEXT: 70 d7 b5 9a
457r17:16 = memubh(r21 = ##31)
458# CHECK: b0 c0 b5 9a
459r17:16 = memubh(r21++#20)
460# CHECK: 00 40 00 00
461# CHECK-NEXT: 70 d7 f5 9a
462r17:16 = membh(r21 = ##31)
463# CHECK: b0 c0 f5 9a
464r17:16 = membh(r21++#20)
465# CHECK: 00 40 00 00
466# CHECK-NEXT: f1 f7 35 9c
467r17 = membh(r21<<#3 + ##31)
468# CHECK: 11 e0 35 9c
469r17 = membh(r21++m1)
470# CHECK: 00 40 00 00
471# CHECK-NEXT: f1 f7 75 9c
472r17 = memubh(r21<<#3 + ##31)
473# CHECK: 11 e0 75 9c
474r17 = memubh(r21++m1)
475# CHECK: 00 40 00 00
476# CHECK-NEXT: f0 f7 f5 9c
477r17:16 = membh(r21<<#3 + ##31)
478# CHECK: 10 e0 f5 9c
479r17:16 = membh(r21++m1)
480# CHECK: 00 40 00 00
481# CHECK-NEXT: f0 f7 b5 9c
482r17:16 = memubh(r21<<#3 + ##31)
483# CHECK: 11 e0 35 9c
484r17 = membh(r21++m1)
485# CHECK: 11 e0 75 9c
486r17 = memubh(r21++m1)
487# CHECK: 10 e0 f5 9c
488r17:16 = membh(r21++m1)
489# CHECK: 10 e0 b5 9c
490r17:16 = memubh(r21++m1)
491# CHECK: 11 e0 35 9e
492r17 = membh(r21 ++ m1:brev)
493# CHECK: 11 e0 75 9e
494r17 = memubh(r21 ++ m1:brev)
495# CHECK: 10 e0 b5 9e
496r17:16 = memubh(r21 ++ m1:brev)
497# CHECK: 10 e0 f5 9e
498r17:16 = membh(r21 ++ m1:brev)
499