xref: /llvm-project/llvm/test/MC/AArch64/SVE/sub.s (revision 75cdab6dc2453a508157a9c383b93373a93078d6)
1// RUN: llvm-mc -triple=aarch64 -show-encoding -mattr=+sve < %s \
2// RUN:        | FileCheck %s --check-prefixes=CHECK-ENCODING,CHECK-INST
3// RUN: llvm-mc -triple=aarch64 -show-encoding -mattr=+sme < %s \
4// RUN:        | FileCheck %s --check-prefixes=CHECK-ENCODING,CHECK-INST
5// RUN: not llvm-mc -triple=aarch64 -show-encoding < %s 2>&1 \
6// RUN:        | FileCheck %s --check-prefix=CHECK-ERROR
7// RUN: llvm-mc -triple=aarch64 -filetype=obj -mattr=+sve < %s \
8// RUN:        | llvm-objdump --no-print-imm-hex -d --mattr=+sve - | FileCheck %s --check-prefix=CHECK-INST
9// RUN: llvm-mc -triple=aarch64 -filetype=obj -mattr=+sve < %s \
10// RUN:   | llvm-objdump --no-print-imm-hex -d --mattr=-sve - | FileCheck %s --check-prefix=CHECK-UNKNOWN
11
12sub     z0.h, z0.h, z0.h
13// CHECK-INST: sub     z0.h, z0.h, z0.h
14// CHECK-ENCODING: [0x00,0x04,0x60,0x04]
15// CHECK-ERROR: instruction requires: sve or sme
16// CHECK-UNKNOWN: 04600400 <unknown>
17
18sub     z21.b, z10.b, z21.b
19// CHECK-INST: sub     z21.b, z10.b, z21.b
20// CHECK-ENCODING: [0x55,0x05,0x35,0x04]
21// CHECK-ERROR: instruction requires: sve or sme
22// CHECK-UNKNOWN: 04350555 <unknown>
23
24sub     z31.d, p7/m, z31.d, z31.d
25// CHECK-INST: sub     z31.d, p7/m, z31.d, z31.d
26// CHECK-ENCODING: [0xff,0x1f,0xc1,0x04]
27// CHECK-ERROR: instruction requires: sve or sme
28// CHECK-UNKNOWN: 04c11fff <unknown>
29
30sub     z23.h, p3/m, z23.h, z13.h
31// CHECK-INST: sub     z23.h, p3/m, z23.h, z13.h
32// CHECK-ENCODING: [0xb7,0x0d,0x41,0x04]
33// CHECK-ERROR: instruction requires: sve or sme
34// CHECK-UNKNOWN: 04410db7 <unknown>
35
36sub     z31.h, z31.h, z31.h
37// CHECK-INST: sub     z31.h, z31.h, z31.h
38// CHECK-ENCODING: [0xff,0x07,0x7f,0x04]
39// CHECK-ERROR: instruction requires: sve or sme
40// CHECK-UNKNOWN: 047f07ff <unknown>
41
42sub     z21.h, z10.h, z21.h
43// CHECK-INST: sub     z21.h, z10.h, z21.h
44// CHECK-ENCODING: [0x55,0x05,0x75,0x04]
45// CHECK-ERROR: instruction requires: sve or sme
46// CHECK-UNKNOWN: 04750555 <unknown>
47
48sub     z31.b, z31.b, z31.b
49// CHECK-INST: sub     z31.b, z31.b, z31.b
50// CHECK-ENCODING: [0xff,0x07,0x3f,0x04]
51// CHECK-ERROR: instruction requires: sve or sme
52// CHECK-UNKNOWN: 043f07ff <unknown>
53
54sub     z0.s, z0.s, z0.s
55// CHECK-INST: sub     z0.s, z0.s, z0.s
56// CHECK-ENCODING: [0x00,0x04,0xa0,0x04]
57// CHECK-ERROR: instruction requires: sve or sme
58// CHECK-UNKNOWN: 04a00400 <unknown>
59
60sub     z23.s, p3/m, z23.s, z13.s
61// CHECK-INST: sub     z23.s, p3/m, z23.s, z13.s
62// CHECK-ENCODING: [0xb7,0x0d,0x81,0x04]
63// CHECK-ERROR: instruction requires: sve or sme
64// CHECK-UNKNOWN: 04810db7 <unknown>
65
66sub     z23.b, z13.b, z8.b
67// CHECK-INST: sub     z23.b, z13.b, z8.b
68// CHECK-ENCODING: [0xb7,0x05,0x28,0x04]
69// CHECK-ERROR: instruction requires: sve or sme
70// CHECK-UNKNOWN: 042805b7 <unknown>
71
72sub     z21.d, z10.d, z21.d
73// CHECK-INST: sub     z21.d, z10.d, z21.d
74// CHECK-ENCODING: [0x55,0x05,0xf5,0x04]
75// CHECK-ERROR: instruction requires: sve or sme
76// CHECK-UNKNOWN: 04f50555 <unknown>
77
78sub     z21.s, z10.s, z21.s
79// CHECK-INST: sub     z21.s, z10.s, z21.s
80// CHECK-ENCODING: [0x55,0x05,0xb5,0x04]
81// CHECK-ERROR: instruction requires: sve or sme
82// CHECK-UNKNOWN: 04b50555 <unknown>
83
84sub     z21.s, p5/m, z21.s, z10.s
85// CHECK-INST: sub     z21.s, p5/m, z21.s, z10.s
86// CHECK-ENCODING: [0x55,0x15,0x81,0x04]
87// CHECK-ERROR: instruction requires: sve or sme
88// CHECK-UNKNOWN: 04811555 <unknown>
89
90sub     z31.s, p7/m, z31.s, z31.s
91// CHECK-INST: sub     z31.s, p7/m, z31.s, z31.s
92// CHECK-ENCODING: [0xff,0x1f,0x81,0x04]
93// CHECK-ERROR: instruction requires: sve or sme
94// CHECK-UNKNOWN: 04811fff <unknown>
95
96sub     z0.d, p0/m, z0.d, z0.d
97// CHECK-INST: sub     z0.d, p0/m, z0.d, z0.d
98// CHECK-ENCODING: [0x00,0x00,0xc1,0x04]
99// CHECK-ERROR: instruction requires: sve or sme
100// CHECK-UNKNOWN: 04c10000 <unknown>
101
102sub     z0.b, z0.b, z0.b
103// CHECK-INST: sub     z0.b, z0.b, z0.b
104// CHECK-ENCODING: [0x00,0x04,0x20,0x04]
105// CHECK-ERROR: instruction requires: sve or sme
106// CHECK-UNKNOWN: 04200400 <unknown>
107
108sub     z23.d, z13.d, z8.d
109// CHECK-INST: sub     z23.d, z13.d, z8.d
110// CHECK-ENCODING: [0xb7,0x05,0xe8,0x04]
111// CHECK-ERROR: instruction requires: sve or sme
112// CHECK-UNKNOWN: 04e805b7 <unknown>
113
114sub     z23.d, p3/m, z23.d, z13.d
115// CHECK-INST: sub     z23.d, p3/m, z23.d, z13.d
116// CHECK-ENCODING: [0xb7,0x0d,0xc1,0x04]
117// CHECK-ERROR: instruction requires: sve or sme
118// CHECK-UNKNOWN: 04c10db7 <unknown>
119
120sub     z23.s, z13.s, z8.s
121// CHECK-INST: sub     z23.s, z13.s, z8.s
122// CHECK-ENCODING: [0xb7,0x05,0xa8,0x04]
123// CHECK-ERROR: instruction requires: sve or sme
124// CHECK-UNKNOWN: 04a805b7 <unknown>
125
126sub     z31.b, p7/m, z31.b, z31.b
127// CHECK-INST: sub     z31.b, p7/m, z31.b, z31.b
128// CHECK-ENCODING: [0xff,0x1f,0x01,0x04]
129// CHECK-ERROR: instruction requires: sve or sme
130// CHECK-UNKNOWN: 04011fff <unknown>
131
132sub     z0.h, p0/m, z0.h, z0.h
133// CHECK-INST: sub     z0.h, p0/m, z0.h, z0.h
134// CHECK-ENCODING: [0x00,0x00,0x41,0x04]
135// CHECK-ERROR: instruction requires: sve or sme
136// CHECK-UNKNOWN: 04410000 <unknown>
137
138sub     z31.d, z31.d, z31.d
139// CHECK-INST: sub     z31.d, z31.d, z31.d
140// CHECK-ENCODING: [0xff,0x07,0xff,0x04]
141// CHECK-ERROR: instruction requires: sve or sme
142// CHECK-UNKNOWN: 04ff07ff <unknown>
143
144sub     z31.h, p7/m, z31.h, z31.h
145// CHECK-INST: sub     z31.h, p7/m, z31.h, z31.h
146// CHECK-ENCODING: [0xff,0x1f,0x41,0x04]
147// CHECK-ERROR: instruction requires: sve or sme
148// CHECK-UNKNOWN: 04411fff <unknown>
149
150sub     z23.h, z13.h, z8.h
151// CHECK-INST: sub     z23.h, z13.h, z8.h
152// CHECK-ENCODING: [0xb7,0x05,0x68,0x04]
153// CHECK-ERROR: instruction requires: sve or sme
154// CHECK-UNKNOWN: 046805b7 <unknown>
155
156sub     z21.b, p5/m, z21.b, z10.b
157// CHECK-INST: sub     z21.b, p5/m, z21.b, z10.b
158// CHECK-ENCODING: [0x55,0x15,0x01,0x04]
159// CHECK-ERROR: instruction requires: sve or sme
160// CHECK-UNKNOWN: 04011555 <unknown>
161
162sub     z21.d, p5/m, z21.d, z10.d
163// CHECK-INST: sub     z21.d, p5/m, z21.d, z10.d
164// CHECK-ENCODING: [0x55,0x15,0xc1,0x04]
165// CHECK-ERROR: instruction requires: sve or sme
166// CHECK-UNKNOWN: 04c11555 <unknown>
167
168sub     z0.d, z0.d, z0.d
169// CHECK-INST: sub     z0.d, z0.d, z0.d
170// CHECK-ENCODING: [0x00,0x04,0xe0,0x04]
171// CHECK-ERROR: instruction requires: sve or sme
172// CHECK-UNKNOWN: 04e00400 <unknown>
173
174sub     z31.s, z31.s, z31.s
175// CHECK-INST: sub     z31.s, z31.s, z31.s
176// CHECK-ENCODING: [0xff,0x07,0xbf,0x04]
177// CHECK-ERROR: instruction requires: sve or sme
178// CHECK-UNKNOWN: 04bf07ff <unknown>
179
180sub     z0.b, p0/m, z0.b, z0.b
181// CHECK-INST: sub     z0.b, p0/m, z0.b, z0.b
182// CHECK-ENCODING: [0x00,0x00,0x01,0x04]
183// CHECK-ERROR: instruction requires: sve or sme
184// CHECK-UNKNOWN: 04010000 <unknown>
185
186sub     z0.s, p0/m, z0.s, z0.s
187// CHECK-INST: sub     z0.s, p0/m, z0.s, z0.s
188// CHECK-ENCODING: [0x00,0x00,0x81,0x04]
189// CHECK-ERROR: instruction requires: sve or sme
190// CHECK-UNKNOWN: 04810000 <unknown>
191
192sub     z21.h, p5/m, z21.h, z10.h
193// CHECK-INST: sub     z21.h, p5/m, z21.h, z10.h
194// CHECK-ENCODING: [0x55,0x15,0x41,0x04]
195// CHECK-ERROR: instruction requires: sve or sme
196// CHECK-UNKNOWN: 04411555 <unknown>
197
198sub     z23.b, p3/m, z23.b, z13.b
199// CHECK-INST: sub     z23.b, p3/m, z23.b, z13.b
200// CHECK-ENCODING: [0xb7,0x0d,0x01,0x04]
201// CHECK-ERROR: instruction requires: sve or sme
202// CHECK-UNKNOWN: 04010db7 <unknown>
203
204// -----------------------
205//
206
207sub     z0.b, z0.b, #0
208// CHECK-INST: sub     z0.b, z0.b, #0
209// CHECK-ENCODING: [0x00,0xc0,0x21,0x25]
210// CHECK-ERROR: instruction requires: sve or sme
211// CHECK-UNKNOWN: 2521c000 <unknown>
212
213sub     z31.b, z31.b, #255
214// CHECK-INST: sub     z31.b, z31.b, #255
215// CHECK-ENCODING: [0xff,0xdf,0x21,0x25]
216// CHECK-ERROR: instruction requires: sve or sme
217// CHECK-UNKNOWN: 2521dfff <unknown>
218
219sub     z0.h, z0.h, #0
220// CHECK-INST: sub     z0.h, z0.h, #0
221// CHECK-ENCODING: [0x00,0xc0,0x61,0x25]
222// CHECK-ERROR: instruction requires: sve or sme
223// CHECK-UNKNOWN: 2561c000 <unknown>
224
225sub     z0.h, z0.h, #0, lsl #8
226// CHECK-INST: sub     z0.h, z0.h, #0, lsl #8
227// CHECK-ENCODING: [0x00,0xe0,0x61,0x25]
228// CHECK-ERROR: instruction requires: sve or sme
229// CHECK-UNKNOWN: 2561e000 <unknown>
230
231sub     z31.h, z31.h, #255, lsl #8
232// CHECK-INST: sub     z31.h, z31.h, #65280
233// CHECK-ENCODING: [0xff,0xff,0x61,0x25]
234// CHECK-ERROR: instruction requires: sve or sme
235// CHECK-UNKNOWN: 2561ffff <unknown>
236
237sub     z31.h, z31.h, #65280
238// CHECK-INST: sub     z31.h, z31.h, #65280
239// CHECK-ENCODING: [0xff,0xff,0x61,0x25]
240// CHECK-ERROR: instruction requires: sve or sme
241// CHECK-UNKNOWN: 2561ffff <unknown>
242
243sub     z0.s, z0.s, #0
244// CHECK-INST: sub     z0.s, z0.s, #0
245// CHECK-ENCODING: [0x00,0xc0,0xa1,0x25]
246// CHECK-ERROR: instruction requires: sve or sme
247// CHECK-UNKNOWN: 25a1c000 <unknown>
248
249sub     z0.s, z0.s, #0, lsl #8
250// CHECK-INST: sub     z0.s, z0.s, #0, lsl #8
251// CHECK-ENCODING: [0x00,0xe0,0xa1,0x25]
252// CHECK-ERROR: instruction requires: sve or sme
253// CHECK-UNKNOWN: 25a1e000 <unknown>
254
255sub     z31.s, z31.s, #255, lsl #8
256// CHECK-INST: sub     z31.s, z31.s, #65280
257// CHECK-ENCODING: [0xff,0xff,0xa1,0x25]
258// CHECK-ERROR: instruction requires: sve or sme
259// CHECK-UNKNOWN: 25a1ffff <unknown>
260
261sub     z31.s, z31.s, #65280
262// CHECK-INST: sub     z31.s, z31.s, #65280
263// CHECK-ENCODING: [0xff,0xff,0xa1,0x25]
264// CHECK-ERROR: instruction requires: sve or sme
265// CHECK-UNKNOWN: 25a1ffff <unknown>
266
267sub     z0.d, z0.d, #0
268// CHECK-INST: sub     z0.d, z0.d, #0
269// CHECK-ENCODING: [0x00,0xc0,0xe1,0x25]
270// CHECK-ERROR: instruction requires: sve or sme
271// CHECK-UNKNOWN: 25e1c000 <unknown>
272
273sub     z0.d, z0.d, #0, lsl #8
274// CHECK-INST: sub     z0.d, z0.d, #0, lsl #8
275// CHECK-ENCODING: [0x00,0xe0,0xe1,0x25]
276// CHECK-ERROR: instruction requires: sve or sme
277// CHECK-UNKNOWN: 25e1e000 <unknown>
278
279sub     z31.d, z31.d, #255, lsl #8
280// CHECK-INST: sub     z31.d, z31.d, #65280
281// CHECK-ENCODING: [0xff,0xff,0xe1,0x25]
282// CHECK-ERROR: instruction requires: sve or sme
283// CHECK-UNKNOWN: 25e1ffff <unknown>
284
285sub     z31.d, z31.d, #65280
286// CHECK-INST: sub     z31.d, z31.d, #65280
287// CHECK-ENCODING: [0xff,0xff,0xe1,0x25]
288// CHECK-ERROR: instruction requires: sve or sme
289// CHECK-UNKNOWN: 25e1ffff <unknown>
290
291
292
293// --------------------------------------------------------------------------//
294// Test compatibility with MOVPRFX instruction.
295
296movprfx z23.b, p3/z, z30.b
297// CHECK-INST: movprfx	z23.b, p3/z, z30.b
298// CHECK-ENCODING: [0xd7,0x2f,0x10,0x04]
299// CHECK-ERROR: instruction requires: sve or sme
300// CHECK-UNKNOWN: 04102fd7 <unknown>
301
302sub     z23.b, p3/m, z23.b, z13.b
303// CHECK-INST: sub	z23.b, p3/m, z23.b, z13.b
304// CHECK-ENCODING: [0xb7,0x0d,0x01,0x04]
305// CHECK-ERROR: instruction requires: sve or sme
306// CHECK-UNKNOWN: 04010db7 <unknown>
307
308movprfx z23, z30
309// CHECK-INST: movprfx	z23, z30
310// CHECK-ENCODING: [0xd7,0xbf,0x20,0x04]
311// CHECK-ERROR: instruction requires: sve or sme
312// CHECK-UNKNOWN: 0420bfd7 <unknown>
313
314sub     z23.b, p3/m, z23.b, z13.b
315// CHECK-INST: sub	z23.b, p3/m, z23.b, z13.b
316// CHECK-ENCODING: [0xb7,0x0d,0x01,0x04]
317// CHECK-ERROR: instruction requires: sve or sme
318// CHECK-UNKNOWN: 04010db7 <unknown>
319
320movprfx z31, z6
321// CHECK-INST: movprfx	z31, z6
322// CHECK-ENCODING: [0xdf,0xbc,0x20,0x04]
323// CHECK-ERROR: instruction requires: sve or sme
324// CHECK-UNKNOWN: 0420bcdf <unknown>
325
326sub     z31.d, z31.d, #65280
327// CHECK-INST: sub	z31.d, z31.d, #65280
328// CHECK-ENCODING: [0xff,0xff,0xe1,0x25]
329// CHECK-ERROR: instruction requires: sve or sme
330// CHECK-UNKNOWN: 25e1ffff <unknown>
331