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
10sub     z0.h, z0.h, z0.h
11// CHECK-INST: sub     z0.h, z0.h, z0.h
12// CHECK-ENCODING: [0x00,0x04,0x60,0x04]
13// CHECK-ERROR: instruction requires: sve
14// CHECK-UNKNOWN: 00 04 60 04 <unknown>
15
16sub     z21.b, z10.b, z21.b
17// CHECK-INST: sub     z21.b, z10.b, z21.b
18// CHECK-ENCODING: [0x55,0x05,0x35,0x04]
19// CHECK-ERROR: instruction requires: sve
20// CHECK-UNKNOWN: 55 05 35 04 <unknown>
21
22sub     z31.d, p7/m, z31.d, z31.d
23// CHECK-INST: sub     z31.d, p7/m, z31.d, z31.d
24// CHECK-ENCODING: [0xff,0x1f,0xc1,0x04]
25// CHECK-ERROR: instruction requires: sve
26// CHECK-UNKNOWN: ff 1f c1 04 <unknown>
27
28sub     z23.h, p3/m, z23.h, z13.h
29// CHECK-INST: sub     z23.h, p3/m, z23.h, z13.h
30// CHECK-ENCODING: [0xb7,0x0d,0x41,0x04]
31// CHECK-ERROR: instruction requires: sve
32// CHECK-UNKNOWN: b7 0d 41 04 <unknown>
33
34sub     z31.h, z31.h, z31.h
35// CHECK-INST: sub     z31.h, z31.h, z31.h
36// CHECK-ENCODING: [0xff,0x07,0x7f,0x04]
37// CHECK-ERROR: instruction requires: sve
38// CHECK-UNKNOWN: ff 07 7f 04 <unknown>
39
40sub     z21.h, z10.h, z21.h
41// CHECK-INST: sub     z21.h, z10.h, z21.h
42// CHECK-ENCODING: [0x55,0x05,0x75,0x04]
43// CHECK-ERROR: instruction requires: sve
44// CHECK-UNKNOWN: 55 05 75 04 <unknown>
45
46sub     z31.b, z31.b, z31.b
47// CHECK-INST: sub     z31.b, z31.b, z31.b
48// CHECK-ENCODING: [0xff,0x07,0x3f,0x04]
49// CHECK-ERROR: instruction requires: sve
50// CHECK-UNKNOWN: ff 07 3f 04 <unknown>
51
52sub     z0.s, z0.s, z0.s
53// CHECK-INST: sub     z0.s, z0.s, z0.s
54// CHECK-ENCODING: [0x00,0x04,0xa0,0x04]
55// CHECK-ERROR: instruction requires: sve
56// CHECK-UNKNOWN: 00 04 a0 04 <unknown>
57
58sub     z23.s, p3/m, z23.s, z13.s
59// CHECK-INST: sub     z23.s, p3/m, z23.s, z13.s
60// CHECK-ENCODING: [0xb7,0x0d,0x81,0x04]
61// CHECK-ERROR: instruction requires: sve
62// CHECK-UNKNOWN: b7 0d 81 04 <unknown>
63
64sub     z23.b, z13.b, z8.b
65// CHECK-INST: sub     z23.b, z13.b, z8.b
66// CHECK-ENCODING: [0xb7,0x05,0x28,0x04]
67// CHECK-ERROR: instruction requires: sve
68// CHECK-UNKNOWN: b7 05 28 04 <unknown>
69
70sub     z21.d, z10.d, z21.d
71// CHECK-INST: sub     z21.d, z10.d, z21.d
72// CHECK-ENCODING: [0x55,0x05,0xf5,0x04]
73// CHECK-ERROR: instruction requires: sve
74// CHECK-UNKNOWN: 55 05 f5 04 <unknown>
75
76sub     z21.s, z10.s, z21.s
77// CHECK-INST: sub     z21.s, z10.s, z21.s
78// CHECK-ENCODING: [0x55,0x05,0xb5,0x04]
79// CHECK-ERROR: instruction requires: sve
80// CHECK-UNKNOWN: 55 05 b5 04 <unknown>
81
82sub     z21.s, p5/m, z21.s, z10.s
83// CHECK-INST: sub     z21.s, p5/m, z21.s, z10.s
84// CHECK-ENCODING: [0x55,0x15,0x81,0x04]
85// CHECK-ERROR: instruction requires: sve
86// CHECK-UNKNOWN: 55 15 81 04 <unknown>
87
88sub     z31.s, p7/m, z31.s, z31.s
89// CHECK-INST: sub     z31.s, p7/m, z31.s, z31.s
90// CHECK-ENCODING: [0xff,0x1f,0x81,0x04]
91// CHECK-ERROR: instruction requires: sve
92// CHECK-UNKNOWN: ff 1f 81 04 <unknown>
93
94sub     z0.d, p0/m, z0.d, z0.d
95// CHECK-INST: sub     z0.d, p0/m, z0.d, z0.d
96// CHECK-ENCODING: [0x00,0x00,0xc1,0x04]
97// CHECK-ERROR: instruction requires: sve
98// CHECK-UNKNOWN: 00 00 c1 04 <unknown>
99
100sub     z0.b, z0.b, z0.b
101// CHECK-INST: sub     z0.b, z0.b, z0.b
102// CHECK-ENCODING: [0x00,0x04,0x20,0x04]
103// CHECK-ERROR: instruction requires: sve
104// CHECK-UNKNOWN: 00 04 20 04 <unknown>
105
106sub     z23.d, z13.d, z8.d
107// CHECK-INST: sub     z23.d, z13.d, z8.d
108// CHECK-ENCODING: [0xb7,0x05,0xe8,0x04]
109// CHECK-ERROR: instruction requires: sve
110// CHECK-UNKNOWN: b7 05 e8 04 <unknown>
111
112sub     z23.d, p3/m, z23.d, z13.d
113// CHECK-INST: sub     z23.d, p3/m, z23.d, z13.d
114// CHECK-ENCODING: [0xb7,0x0d,0xc1,0x04]
115// CHECK-ERROR: instruction requires: sve
116// CHECK-UNKNOWN: b7 0d c1 04 <unknown>
117
118sub     z23.s, z13.s, z8.s
119// CHECK-INST: sub     z23.s, z13.s, z8.s
120// CHECK-ENCODING: [0xb7,0x05,0xa8,0x04]
121// CHECK-ERROR: instruction requires: sve
122// CHECK-UNKNOWN: b7 05 a8 04 <unknown>
123
124sub     z31.b, p7/m, z31.b, z31.b
125// CHECK-INST: sub     z31.b, p7/m, z31.b, z31.b
126// CHECK-ENCODING: [0xff,0x1f,0x01,0x04]
127// CHECK-ERROR: instruction requires: sve
128// CHECK-UNKNOWN: ff 1f 01 04 <unknown>
129
130sub     z0.h, p0/m, z0.h, z0.h
131// CHECK-INST: sub     z0.h, p0/m, z0.h, z0.h
132// CHECK-ENCODING: [0x00,0x00,0x41,0x04]
133// CHECK-ERROR: instruction requires: sve
134// CHECK-UNKNOWN: 00 00 41 04 <unknown>
135
136sub     z31.d, z31.d, z31.d
137// CHECK-INST: sub     z31.d, z31.d, z31.d
138// CHECK-ENCODING: [0xff,0x07,0xff,0x04]
139// CHECK-ERROR: instruction requires: sve
140// CHECK-UNKNOWN: ff 07 ff 04 <unknown>
141
142sub     z31.h, p7/m, z31.h, z31.h
143// CHECK-INST: sub     z31.h, p7/m, z31.h, z31.h
144// CHECK-ENCODING: [0xff,0x1f,0x41,0x04]
145// CHECK-ERROR: instruction requires: sve
146// CHECK-UNKNOWN: ff 1f 41 04 <unknown>
147
148sub     z23.h, z13.h, z8.h
149// CHECK-INST: sub     z23.h, z13.h, z8.h
150// CHECK-ENCODING: [0xb7,0x05,0x68,0x04]
151// CHECK-ERROR: instruction requires: sve
152// CHECK-UNKNOWN: b7 05 68 04 <unknown>
153
154sub     z21.b, p5/m, z21.b, z10.b
155// CHECK-INST: sub     z21.b, p5/m, z21.b, z10.b
156// CHECK-ENCODING: [0x55,0x15,0x01,0x04]
157// CHECK-ERROR: instruction requires: sve
158// CHECK-UNKNOWN: 55 15 01 04 <unknown>
159
160sub     z21.d, p5/m, z21.d, z10.d
161// CHECK-INST: sub     z21.d, p5/m, z21.d, z10.d
162// CHECK-ENCODING: [0x55,0x15,0xc1,0x04]
163// CHECK-ERROR: instruction requires: sve
164// CHECK-UNKNOWN: 55 15 c1 04 <unknown>
165
166sub     z0.d, z0.d, z0.d
167// CHECK-INST: sub     z0.d, z0.d, z0.d
168// CHECK-ENCODING: [0x00,0x04,0xe0,0x04]
169// CHECK-ERROR: instruction requires: sve
170// CHECK-UNKNOWN: 00 04 e0 04 <unknown>
171
172sub     z31.s, z31.s, z31.s
173// CHECK-INST: sub     z31.s, z31.s, z31.s
174// CHECK-ENCODING: [0xff,0x07,0xbf,0x04]
175// CHECK-ERROR: instruction requires: sve
176// CHECK-UNKNOWN: ff 07 bf 04 <unknown>
177
178sub     z0.b, p0/m, z0.b, z0.b
179// CHECK-INST: sub     z0.b, p0/m, z0.b, z0.b
180// CHECK-ENCODING: [0x00,0x00,0x01,0x04]
181// CHECK-ERROR: instruction requires: sve
182// CHECK-UNKNOWN: 00 00 01 04 <unknown>
183
184sub     z0.s, p0/m, z0.s, z0.s
185// CHECK-INST: sub     z0.s, p0/m, z0.s, z0.s
186// CHECK-ENCODING: [0x00,0x00,0x81,0x04]
187// CHECK-ERROR: instruction requires: sve
188// CHECK-UNKNOWN: 00 00 81 04 <unknown>
189
190sub     z21.h, p5/m, z21.h, z10.h
191// CHECK-INST: sub     z21.h, p5/m, z21.h, z10.h
192// CHECK-ENCODING: [0x55,0x15,0x41,0x04]
193// CHECK-ERROR: instruction requires: sve
194// CHECK-UNKNOWN: 55 15 41 04 <unknown>
195
196sub     z23.b, p3/m, z23.b, z13.b
197// CHECK-INST: sub     z23.b, p3/m, z23.b, z13.b
198// CHECK-ENCODING: [0xb7,0x0d,0x01,0x04]
199// CHECK-ERROR: instruction requires: sve
200// CHECK-UNKNOWN: b7 0d 01 04 <unknown>
201
202// -----------------------
203//
204
205sub     z0.b, z0.b, #0
206// CHECK-INST: sub     z0.b, z0.b, #0
207// CHECK-ENCODING: [0x00,0xc0,0x21,0x25]
208// CHECK-ERROR: instruction requires: sve
209// CHECK-UNKNOWN: 00 c0 21 25 <unknown>
210
211sub     z31.b, z31.b, #255
212// CHECK-INST: sub     z31.b, z31.b, #255
213// CHECK-ENCODING: [0xff,0xdf,0x21,0x25]
214// CHECK-ERROR: instruction requires: sve
215// CHECK-UNKNOWN: ff df 21 25 <unknown>
216
217sub     z0.h, z0.h, #0
218// CHECK-INST: sub     z0.h, z0.h, #0
219// CHECK-ENCODING: [0x00,0xc0,0x61,0x25]
220// CHECK-ERROR: instruction requires: sve
221// CHECK-UNKNOWN: 00 c0 61 25 <unknown>
222
223sub     z0.h, z0.h, #0, lsl #8
224// CHECK-INST: sub     z0.h, z0.h, #0, lsl #8
225// CHECK-ENCODING: [0x00,0xe0,0x61,0x25]
226// CHECK-ERROR: instruction requires: sve
227// CHECK-UNKNOWN: 00 e0 61 25 <unknown>
228
229sub     z31.h, z31.h, #255, lsl #8
230// CHECK-INST: sub     z31.h, z31.h, #65280
231// CHECK-ENCODING: [0xff,0xff,0x61,0x25]
232// CHECK-ERROR: instruction requires: sve
233// CHECK-UNKNOWN: ff ff 61 25 <unknown>
234
235sub     z31.h, z31.h, #65280
236// CHECK-INST: sub     z31.h, z31.h, #65280
237// CHECK-ENCODING: [0xff,0xff,0x61,0x25]
238// CHECK-ERROR: instruction requires: sve
239// CHECK-UNKNOWN: ff ff 61 25 <unknown>
240
241sub     z0.s, z0.s, #0
242// CHECK-INST: sub     z0.s, z0.s, #0
243// CHECK-ENCODING: [0x00,0xc0,0xa1,0x25]
244// CHECK-ERROR: instruction requires: sve
245// CHECK-UNKNOWN: 00 c0 a1 25 <unknown>
246
247sub     z0.s, z0.s, #0, lsl #8
248// CHECK-INST: sub     z0.s, z0.s, #0, lsl #8
249// CHECK-ENCODING: [0x00,0xe0,0xa1,0x25]
250// CHECK-ERROR: instruction requires: sve
251// CHECK-UNKNOWN: 00 e0 a1 25 <unknown>
252
253sub     z31.s, z31.s, #255, lsl #8
254// CHECK-INST: sub     z31.s, z31.s, #65280
255// CHECK-ENCODING: [0xff,0xff,0xa1,0x25]
256// CHECK-ERROR: instruction requires: sve
257// CHECK-UNKNOWN: ff ff a1 25 <unknown>
258
259sub     z31.s, z31.s, #65280
260// CHECK-INST: sub     z31.s, z31.s, #65280
261// CHECK-ENCODING: [0xff,0xff,0xa1,0x25]
262// CHECK-ERROR: instruction requires: sve
263// CHECK-UNKNOWN: ff ff a1 25 <unknown>
264
265sub     z0.d, z0.d, #0
266// CHECK-INST: sub     z0.d, z0.d, #0
267// CHECK-ENCODING: [0x00,0xc0,0xe1,0x25]
268// CHECK-ERROR: instruction requires: sve
269// CHECK-UNKNOWN: 00 c0 e1 25 <unknown>
270
271sub     z0.d, z0.d, #0, lsl #8
272// CHECK-INST: sub     z0.d, z0.d, #0, lsl #8
273// CHECK-ENCODING: [0x00,0xe0,0xe1,0x25]
274// CHECK-ERROR: instruction requires: sve
275// CHECK-UNKNOWN: 00 e0 e1 25 <unknown>
276
277sub     z31.d, z31.d, #255, lsl #8
278// CHECK-INST: sub     z31.d, z31.d, #65280
279// CHECK-ENCODING: [0xff,0xff,0xe1,0x25]
280// CHECK-ERROR: instruction requires: sve
281// CHECK-UNKNOWN: ff ff e1 25 <unknown>
282
283sub     z31.d, z31.d, #65280
284// CHECK-INST: sub     z31.d, z31.d, #65280
285// CHECK-ENCODING: [0xff,0xff,0xe1,0x25]
286// CHECK-ERROR: instruction requires: sve
287// CHECK-UNKNOWN: ff ff e1 25 <unknown>
288
289
290
291// --------------------------------------------------------------------------//
292// Test compatibility with MOVPRFX instruction.
293
294movprfx z23.b, p3/z, z30.b
295// CHECK-INST: movprfx	z23.b, p3/z, z30.b
296// CHECK-ENCODING: [0xd7,0x2f,0x10,0x04]
297// CHECK-ERROR: instruction requires: sve
298// CHECK-UNKNOWN: d7 2f 10 04 <unknown>
299
300sub     z23.b, p3/m, z23.b, z13.b
301// CHECK-INST: sub	z23.b, p3/m, z23.b, z13.b
302// CHECK-ENCODING: [0xb7,0x0d,0x01,0x04]
303// CHECK-ERROR: instruction requires: sve
304// CHECK-UNKNOWN: b7 0d 01 04 <unknown>
305
306movprfx z23, z30
307// CHECK-INST: movprfx	z23, z30
308// CHECK-ENCODING: [0xd7,0xbf,0x20,0x04]
309// CHECK-ERROR: instruction requires: sve
310// CHECK-UNKNOWN: d7 bf 20 04 <unknown>
311
312sub     z23.b, p3/m, z23.b, z13.b
313// CHECK-INST: sub	z23.b, p3/m, z23.b, z13.b
314// CHECK-ENCODING: [0xb7,0x0d,0x01,0x04]
315// CHECK-ERROR: instruction requires: sve
316// CHECK-UNKNOWN: b7 0d 01 04 <unknown>
317
318movprfx z31, z6
319// CHECK-INST: movprfx	z31, z6
320// CHECK-ENCODING: [0xdf,0xbc,0x20,0x04]
321// CHECK-ERROR: instruction requires: sve
322// CHECK-UNKNOWN: df bc 20 04 <unknown>
323
324sub     z31.d, z31.d, #65280
325// CHECK-INST: sub	z31.d, z31.d, #65280
326// CHECK-ENCODING: [0xff,0xff,0xe1,0x25]
327// CHECK-ERROR: instruction requires: sve
328// CHECK-UNKNOWN: ff ff e1 25 <unknown>
329