1// RUN: llvm-mc -triple=aarch64 -show-encoding -mattr=+sve < %s \
2// RUN:        | FileCheck %s --check-prefixes=CHECK-ENCODING,CHECK-INST
3// RUN: not llvm-mc -triple=aarch64 -show-encoding < %s 2>&1 \
4// RUN:        | FileCheck %s --check-prefix=CHECK-ERROR
5// RUN: llvm-mc -triple=aarch64 -filetype=obj -mattr=+sve < %s \
6// RUN:        | llvm-objdump -d --mattr=+sve - | FileCheck %s --check-prefix=CHECK-INST
7// RUN: llvm-mc -triple=aarch64 -filetype=obj -mattr=+sve < %s \
8// RUN:        | llvm-objdump -d - | FileCheck %s --check-prefix=CHECK-UNKNOWN
9
10cpy     z0.b, p0/m, w0
11// CHECK-INST: mov     z0.b, p0/m, w0
12// CHECK-ENCODING: [0x00,0xa0,0x28,0x05]
13// CHECK-ERROR: instruction requires: sve
14// CHECK-UNKNOWN: 00 a0 28 05 <unknown>
15
16cpy     z0.h, p0/m, w0
17// CHECK-INST: mov     z0.h, p0/m, w0
18// CHECK-ENCODING: [0x00,0xa0,0x68,0x05]
19// CHECK-ERROR: instruction requires: sve
20// CHECK-UNKNOWN: 00 a0 68 05 <unknown>
21
22cpy     z0.s, p0/m, w0
23// CHECK-INST: mov     z0.s, p0/m, w0
24// CHECK-ENCODING: [0x00,0xa0,0xa8,0x05]
25// CHECK-ERROR: instruction requires: sve
26// CHECK-UNKNOWN: 00 a0 a8 05 <unknown>
27
28cpy     z0.d, p0/m, x0
29// CHECK-INST: mov     z0.d, p0/m, x0
30// CHECK-ENCODING: [0x00,0xa0,0xe8,0x05]
31// CHECK-ERROR: instruction requires: sve
32// CHECK-UNKNOWN: 00 a0 e8 05 <unknown>
33
34cpy     z31.b, p7/m, wsp
35// CHECK-INST: mov     z31.b, p7/m, wsp
36// CHECK-ENCODING: [0xff,0xbf,0x28,0x05]
37// CHECK-ERROR: instruction requires: sve
38// CHECK-UNKNOWN: ff bf 28 05 <unknown>
39
40cpy     z31.h, p7/m, wsp
41// CHECK-INST: mov     z31.h, p7/m, wsp
42// CHECK-ENCODING: [0xff,0xbf,0x68,0x05]
43// CHECK-ERROR: instruction requires: sve
44// CHECK-UNKNOWN: ff bf 68 05 <unknown>
45
46cpy     z31.s, p7/m, wsp
47// CHECK-INST: mov     z31.s, p7/m, wsp
48// CHECK-ENCODING: [0xff,0xbf,0xa8,0x05]
49// CHECK-ERROR: instruction requires: sve
50// CHECK-UNKNOWN: ff bf a8 05 <unknown>
51
52cpy     z31.d, p7/m, sp
53// CHECK-INST: mov     z31.d, p7/m, sp
54// CHECK-ENCODING: [0xff,0xbf,0xe8,0x05]
55// CHECK-ERROR: instruction requires: sve
56// CHECK-UNKNOWN: ff bf e8 05 <unknown>
57
58cpy     z0.b, p0/m, b0
59// CHECK-INST: mov     z0.b, p0/m, b0
60// CHECK-ENCODING: [0x00,0x80,0x20,0x05]
61// CHECK-ERROR: instruction requires: sve
62// CHECK-UNKNOWN: 00 80 20 05 <unknown>
63
64cpy     z31.b, p7/m, b31
65// CHECK-INST: mov     z31.b, p7/m, b31
66// CHECK-ENCODING: [0xff,0x9f,0x20,0x05]
67// CHECK-ERROR: instruction requires: sve
68// CHECK-UNKNOWN: ff 9f 20 05 <unknown>
69
70cpy     z0.h, p0/m, h0
71// CHECK-INST: mov     z0.h, p0/m, h0
72// CHECK-ENCODING: [0x00,0x80,0x60,0x05]
73// CHECK-ERROR: instruction requires: sve
74// CHECK-UNKNOWN: 00 80 60 05 <unknown>
75
76cpy     z31.h, p7/m, h31
77// CHECK-INST: mov     z31.h, p7/m, h31
78// CHECK-ENCODING: [0xff,0x9f,0x60,0x05]
79// CHECK-ERROR: instruction requires: sve
80// CHECK-UNKNOWN: ff 9f 60 05 <unknown>
81
82cpy     z0.s, p0/m, s0
83// CHECK-INST: mov     z0.s, p0/m, s0
84// CHECK-ENCODING: [0x00,0x80,0xa0,0x05]
85// CHECK-ERROR: instruction requires: sve
86// CHECK-UNKNOWN: 00 80 a0 05 <unknown>
87
88cpy     z31.s, p7/m, s31
89// CHECK-INST: mov     z31.s, p7/m, s31
90// CHECK-ENCODING: [0xff,0x9f,0xa0,0x05]
91// CHECK-ERROR: instruction requires: sve
92// CHECK-UNKNOWN: ff 9f a0 05 <unknown>
93
94cpy     z0.d, p0/m, d0
95// CHECK-INST: mov     z0.d, p0/m, d0
96// CHECK-ENCODING: [0x00,0x80,0xe0,0x05]
97// CHECK-ERROR: instruction requires: sve
98// CHECK-UNKNOWN: 00 80 e0 05 <unknown>
99
100cpy     z31.d, p7/m, d31
101// CHECK-INST: mov     z31.d, p7/m, d31
102// CHECK-ENCODING: [0xff,0x9f,0xe0,0x05]
103// CHECK-ERROR: instruction requires: sve
104// CHECK-UNKNOWN: ff 9f e0 05 <unknown>
105
106cpy     z5.b, p0/z, #-128
107// CHECK-INST: mov     z5.b, p0/z, #-128
108// CHECK-ENCODING: [0x05,0x10,0x10,0x05]
109// CHECK-ERROR: instruction requires: sve
110// CHECK-UNKNOWN: 05 10 10 05  <unknown>
111
112cpy     z5.b, p0/z, #127
113// CHECK-INST: mov     z5.b, p0/z, #127
114// CHECK-ENCODING: [0xe5,0x0f,0x10,0x05]
115// CHECK-ERROR: instruction requires: sve
116// CHECK-UNKNOWN: e5 0f 10 05  <unknown>
117
118cpy     z5.b, p0/z, #255
119// CHECK-INST: mov     z5.b, p0/z, #-1
120// CHECK-ENCODING: [0xe5,0x1f,0x10,0x05]
121// CHECK-ERROR: instruction requires: sve
122// CHECK-UNKNOWN: e5 1f 10 05  <unknown>
123
124cpy     z21.h, p0/z, #-128
125// CHECK-INST: mov     z21.h, p0/z, #-128
126// CHECK-ENCODING: [0x15,0x10,0x50,0x05]
127// CHECK-ERROR: instruction requires: sve
128// CHECK-UNKNOWN: 15 10 50 05  <unknown>
129
130cpy     z21.h, p0/z, #-128, lsl #8
131// CHECK-INST: mov     z21.h, p0/z, #-32768
132// CHECK-ENCODING: [0x15,0x30,0x50,0x05]
133// CHECK-ERROR: instruction requires: sve
134// CHECK-UNKNOWN: 15 30 50 05  <unknown>
135
136cpy     z21.h, p0/z, #-32768
137// CHECK-INST: mov     z21.h, p0/z, #-32768
138// CHECK-ENCODING: [0x15,0x30,0x50,0x05]
139// CHECK-ERROR: instruction requires: sve
140// CHECK-UNKNOWN: 15 30 50 05  <unknown>
141
142cpy     z21.h, p0/z, #127
143// CHECK-INST: mov     z21.h, p0/z, #127
144// CHECK-ENCODING: [0xf5,0x0f,0x50,0x05]
145// CHECK-ERROR: instruction requires: sve
146// CHECK-UNKNOWN: f5 0f 50 05  <unknown>
147
148cpy     z21.h, p0/z, #127, lsl #8
149// CHECK-INST: mov     z21.h, p0/z, #32512
150// CHECK-ENCODING: [0xf5,0x2f,0x50,0x05]
151// CHECK-ERROR: instruction requires: sve
152// CHECK-UNKNOWN: f5 2f 50 05  <unknown>
153
154cpy     z21.h, p0/z, #32512
155// CHECK-INST: mov     z21.h, p0/z, #32512
156// CHECK-ENCODING: [0xf5,0x2f,0x50,0x05]
157// CHECK-ERROR: instruction requires: sve
158// CHECK-UNKNOWN: f5 2f 50 05  <unknown>
159
160cpy     z21.s, p0/z, #-128
161// CHECK-INST: mov     z21.s, p0/z, #-128
162// CHECK-ENCODING: [0x15,0x10,0x90,0x05]
163// CHECK-ERROR: instruction requires: sve
164// CHECK-UNKNOWN: 15 10 90 05  <unknown>
165
166cpy     z21.s, p0/z, #-128, lsl #8
167// CHECK-INST: mov     z21.s, p0/z, #-32768
168// CHECK-ENCODING: [0x15,0x30,0x90,0x05]
169// CHECK-ERROR: instruction requires: sve
170// CHECK-UNKNOWN: 15 30 90 05  <unknown>
171
172cpy     z21.s, p0/z, #-32768
173// CHECK-INST: mov     z21.s, p0/z, #-32768
174// CHECK-ENCODING: [0x15,0x30,0x90,0x05]
175// CHECK-ERROR: instruction requires: sve
176// CHECK-UNKNOWN: 15 30 90 05  <unknown>
177
178cpy     z21.s, p0/z, #127
179// CHECK-INST: mov     z21.s, p0/z, #127
180// CHECK-ENCODING: [0xf5,0x0f,0x90,0x05]
181// CHECK-ERROR: instruction requires: sve
182// CHECK-UNKNOWN: f5 0f 90 05  <unknown>
183
184cpy     z21.s, p0/z, #127, lsl #8
185// CHECK-INST: mov     z21.s, p0/z, #32512
186// CHECK-ENCODING: [0xf5,0x2f,0x90,0x05]
187// CHECK-ERROR: instruction requires: sve
188// CHECK-UNKNOWN: f5 2f 90 05  <unknown>
189
190cpy     z21.s, p0/z, #32512
191// CHECK-INST: mov     z21.s, p0/z, #32512
192// CHECK-ENCODING: [0xf5,0x2f,0x90,0x05]
193// CHECK-ERROR: instruction requires: sve
194// CHECK-UNKNOWN: f5 2f 90 05  <unknown>
195
196cpy     z21.d, p0/z, #-128
197// CHECK-INST: mov     z21.d, p0/z, #-128
198// CHECK-ENCODING: [0x15,0x10,0xd0,0x05]
199// CHECK-ERROR: instruction requires: sve
200// CHECK-UNKNOWN: 15 10 d0 05  <unknown>
201
202cpy     z21.d, p0/z, #-128, lsl #8
203// CHECK-INST: mov     z21.d, p0/z, #-32768
204// CHECK-ENCODING: [0x15,0x30,0xd0,0x05]
205// CHECK-ERROR: instruction requires: sve
206// CHECK-UNKNOWN: 15 30 d0 05  <unknown>
207
208cpy     z21.d, p0/z, #-32768
209// CHECK-INST: mov     z21.d, p0/z, #-32768
210// CHECK-ENCODING: [0x15,0x30,0xd0,0x05]
211// CHECK-ERROR: instruction requires: sve
212// CHECK-UNKNOWN: 15 30 d0 05  <unknown>
213
214cpy     z21.d, p0/z, #127
215// CHECK-INST: mov     z21.d, p0/z, #127
216// CHECK-ENCODING: [0xf5,0x0f,0xd0,0x05]
217// CHECK-ERROR: instruction requires: sve
218// CHECK-UNKNOWN: f5 0f d0 05  <unknown>
219
220cpy     z21.d, p0/z, #127, lsl #8
221// CHECK-INST: mov     z21.d, p0/z, #32512
222// CHECK-ENCODING: [0xf5,0x2f,0xd0,0x05]
223// CHECK-ERROR: instruction requires: sve
224// CHECK-UNKNOWN: f5 2f d0 05  <unknown>
225
226cpy     z21.d, p0/z, #32512
227// CHECK-INST: mov     z21.d, p0/z, #32512
228// CHECK-ENCODING: [0xf5,0x2f,0xd0,0x05]
229// CHECK-ERROR: instruction requires: sve
230// CHECK-UNKNOWN: f5 2f d0 05  <unknown>
231
232
233// --------------------------------------------------------------------------//
234// Tests for merging variant (/m) and testing the range of predicate (> 7)
235// is allowed.
236
237cpy     z5.b, p15/m, #-128
238// CHECK-INST: mov     z5.b, p15/m, #-128
239// CHECK-ENCODING: [0x05,0x50,0x1f,0x05]
240// CHECK-ERROR: instruction requires: sve
241// CHECK-UNKNOWN: 05 50 1f 05  <unknown>
242
243cpy     z21.h, p15/m, #-128
244// CHECK-INST: mov     z21.h, p15/m, #-128
245// CHECK-ENCODING: [0x15,0x50,0x5f,0x05]
246// CHECK-ERROR: instruction requires: sve
247// CHECK-UNKNOWN: 15 50 5f 05  <unknown>
248
249cpy     z21.h, p15/m, #-128, lsl #8
250// CHECK-INST: mov     z21.h, p15/m, #-32768
251// CHECK-ENCODING: [0x15,0x70,0x5f,0x05]
252// CHECK-ERROR: instruction requires: sve
253// CHECK-UNKNOWN: 15 70 5f 05  <unknown>
254
255cpy     z21.s, p15/m, #-128
256// CHECK-INST: mov     z21.s, p15/m, #-128
257// CHECK-ENCODING: [0x15,0x50,0x9f,0x05]
258// CHECK-ERROR: instruction requires: sve
259// CHECK-UNKNOWN: 15 50 9f 05  <unknown>
260
261cpy     z21.s, p15/m, #-128, lsl #8
262// CHECK-INST: mov     z21.s, p15/m, #-32768
263// CHECK-ENCODING: [0x15,0x70,0x9f,0x05]
264// CHECK-ERROR: instruction requires: sve
265// CHECK-UNKNOWN: 15 70 9f 05  <unknown>
266
267cpy     z21.d, p15/m, #-128
268// CHECK-INST: mov     z21.d, p15/m, #-128
269// CHECK-ENCODING: [0x15,0x50,0xdf,0x05]
270// CHECK-ERROR: instruction requires: sve
271// CHECK-UNKNOWN: 15 50 df 05  <unknown>
272
273cpy     z21.d, p15/m, #-128, lsl #8
274// CHECK-INST: mov     z21.d, p15/m, #-32768
275// CHECK-ENCODING: [0x15,0x70,0xdf,0x05]
276// CHECK-ERROR: instruction requires: sve
277// CHECK-UNKNOWN: 15 70 df 05  <unknown>
278
279
280// --------------------------------------------------------------------------//
281// Test compatibility with MOVPRFX instruction.
282
283movprfx z31.d, p7/z, z6.d
284// CHECK-INST: movprfx	z31.d, p7/z, z6.d
285// CHECK-ENCODING: [0xdf,0x3c,0xd0,0x04]
286// CHECK-ERROR: instruction requires: sve
287// CHECK-UNKNOWN: df 3c d0 04 <unknown>
288
289cpy     z31.d, p7/m, sp
290// CHECK-INST: mov	z31.d, p7/m, sp
291// CHECK-ENCODING: [0xff,0xbf,0xe8,0x05]
292// CHECK-ERROR: instruction requires: sve
293// CHECK-UNKNOWN: ff bf e8 05 <unknown>
294
295movprfx z31, z6
296// CHECK-INST: movprfx	z31, z6
297// CHECK-ENCODING: [0xdf,0xbc,0x20,0x04]
298// CHECK-ERROR: instruction requires: sve
299// CHECK-UNKNOWN: df bc 20 04 <unknown>
300
301cpy     z31.d, p7/m, sp
302// CHECK-INST: mov	z31.d, p7/m, sp
303// CHECK-ENCODING: [0xff,0xbf,0xe8,0x05]
304// CHECK-ERROR: instruction requires: sve
305// CHECK-UNKNOWN: ff bf e8 05 <unknown>
306
307movprfx z21.d, p7/z, z28.d
308// CHECK-INST: movprfx	z21.d, p7/z, z28.d
309// CHECK-ENCODING: [0x95,0x3f,0xd0,0x04]
310// CHECK-ERROR: instruction requires: sve
311// CHECK-UNKNOWN: 95 3f d0 04 <unknown>
312
313cpy     z21.d, p7/m, #-128, lsl #8
314// CHECK-INST: mov	z21.d, p7/m, #-32768
315// CHECK-ENCODING: [0x15,0x70,0xd7,0x05]
316// CHECK-ERROR: instruction requires: sve
317// CHECK-UNKNOWN: 15 70 d7 05 <unknown>
318
319movprfx z21, z28
320// CHECK-INST: movprfx	z21, z28
321// CHECK-ENCODING: [0x95,0xbf,0x20,0x04]
322// CHECK-ERROR: instruction requires: sve
323// CHECK-UNKNOWN: 95 bf 20 04 <unknown>
324
325cpy     z21.d, p15/m, #-128, lsl #8
326// CHECK-INST: mov	z21.d, p15/m, #-32768
327// CHECK-ENCODING: [0x15,0x70,0xdf,0x05]
328// CHECK-ERROR: instruction requires: sve
329// CHECK-UNKNOWN: 15 70 df 05 <unknown>
330
331movprfx z4.d, p7/z, z6.d
332// CHECK-INST: movprfx	z4.d, p7/z, z6.d
333// CHECK-ENCODING: [0xc4,0x3c,0xd0,0x04]
334// CHECK-ERROR: instruction requires: sve
335// CHECK-UNKNOWN: c4 3c d0 04 <unknown>
336
337cpy     z4.d, p7/m, d31
338// CHECK-INST: mov	z4.d, p7/m, d31
339// CHECK-ENCODING: [0xe4,0x9f,0xe0,0x05]
340// CHECK-ERROR: instruction requires: sve
341// CHECK-UNKNOWN: e4 9f e0 05 <unknown>
342
343movprfx z4, z6
344// CHECK-INST: movprfx	z4, z6
345// CHECK-ENCODING: [0xc4,0xbc,0x20,0x04]
346// CHECK-ERROR: instruction requires: sve
347// CHECK-UNKNOWN: c4 bc 20 04 <unknown>
348
349cpy     z4.d, p7/m, d31
350// CHECK-INST: mov	z4.d, p7/m, d31
351// CHECK-ENCODING: [0xe4,0x9f,0xe0,0x05]
352// CHECK-ERROR: instruction requires: sve
353// CHECK-UNKNOWN: e4 9f e0 05 <unknown>
354