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
10// ---------------------------------------------------------------------------//
11// Test all predicate sizes for pow2 pattern
12// ---------------------------------------------------------------------------//
13
14ptrue   p0.b, pow2
15// CHECK-INST: ptrue   p0.b, pow2
16// CHECK-ENCODING: [0x00,0xe0,0x18,0x25]
17// CHECK-ERROR: instruction requires: sve
18// CHECK-UNKNOWN: 00 e0 18 25 <unknown>
19
20ptrue   p0.h, pow2
21// CHECK-INST: ptrue   p0.h, pow2
22// CHECK-ENCODING: [0x00,0xe0,0x58,0x25]
23// CHECK-ERROR: instruction requires: sve
24// CHECK-UNKNOWN: 00 e0 58 25 <unknown>
25
26ptrue   p0.s, pow2
27// CHECK-INST: ptrue   p0.s, pow2
28// CHECK-ENCODING: [0x00,0xe0,0x98,0x25]
29// CHECK-ERROR: instruction requires: sve
30// CHECK-UNKNOWN: 00 e0 98 25 <unknown>
31
32ptrue   p0.d, pow2
33// CHECK-INST: ptrue   p0.d, pow2
34// CHECK-ENCODING: [0x00,0xe0,0xd8,0x25]
35// CHECK-ERROR: instruction requires: sve
36// CHECK-UNKNOWN: 00 e0 d8 25 <unknown>
37
38// ---------------------------------------------------------------------------//
39// Test all predicate sizes without explicit pattern
40// ---------------------------------------------------------------------------//
41
42ptrue   p15.b
43// CHECK-INST: ptrue   p15.b
44// CHECK-ENCODING: [0xef,0xe3,0x18,0x25]
45// CHECK-ERROR: instruction requires: sve
46// CHECK-UNKNOWN: ef e3 18 25 <unknown>
47
48ptrue   p15.h
49// CHECK-INST: ptrue   p15.h
50// CHECK-ENCODING: [0xef,0xe3,0x58,0x25]
51// CHECK-ERROR: instruction requires: sve
52// CHECK-UNKNOWN: ef e3 58 25 <unknown>
53
54ptrue   p15.s
55// CHECK-INST: ptrue   p15.s
56// CHECK-ENCODING: [0xef,0xe3,0x98,0x25]
57// CHECK-ERROR: instruction requires: sve
58// CHECK-UNKNOWN: ef e3 98 25 <unknown>
59
60ptrue   p15.d
61// CHECK-INST: ptrue   p15.d
62// CHECK-ENCODING: [0xef,0xe3,0xd8,0x25]
63// CHECK-ERROR: instruction requires: sve
64// CHECK-UNKNOWN: ef e3 d8 25 <unknown>
65
66// ---------------------------------------------------------------------------//
67// Test available patterns
68// ---------------------------------------------------------------------------//
69
70ptrue   p7.s, #1
71// CHECK-INST: ptrue   p7.s, vl1
72// CHECK-ENCODING: [0x27,0xe0,0x98,0x25]
73// CHECK-ERROR: instruction requires: sve
74// CHECK-UNKNOWN: 27 e0 98 25 <unknown>
75
76ptrue   p7.s, vl1
77// CHECK-INST: ptrue   p7.s, vl1
78// CHECK-ENCODING: [0x27,0xe0,0x98,0x25]
79// CHECK-ERROR: instruction requires: sve
80// CHECK-UNKNOWN: 27 e0 98 25 <unknown>
81
82ptrue   p7.s, vl2
83// CHECK-INST: ptrue   p7.s, vl2
84// CHECK-ENCODING: [0x47,0xe0,0x98,0x25]
85// CHECK-ERROR: instruction requires: sve
86// CHECK-UNKNOWN: 47 e0 98 25 <unknown>
87
88ptrue   p7.s, vl3
89// CHECK-INST: ptrue   p7.s, vl3
90// CHECK-ENCODING: [0x67,0xe0,0x98,0x25]
91// CHECK-ERROR: instruction requires: sve
92// CHECK-UNKNOWN: 67 e0 98 25 <unknown>
93
94ptrue   p7.s, vl4
95// CHECK-INST: ptrue   p7.s, vl4
96// CHECK-ENCODING: [0x87,0xe0,0x98,0x25]
97// CHECK-ERROR: instruction requires: sve
98// CHECK-UNKNOWN: 87 e0 98 25 <unknown>
99
100ptrue   p7.s, vl5
101// CHECK-INST: ptrue   p7.s, vl5
102// CHECK-ENCODING: [0xa7,0xe0,0x98,0x25]
103// CHECK-ERROR: instruction requires: sve
104// CHECK-UNKNOWN: a7 e0 98 25 <unknown>
105
106ptrue   p7.s, vl6
107// CHECK-INST: ptrue   p7.s, vl6
108// CHECK-ENCODING: [0xc7,0xe0,0x98,0x25]
109// CHECK-ERROR: instruction requires: sve
110// CHECK-UNKNOWN: c7 e0 98 25 <unknown>
111
112ptrue   p7.s, vl7
113// CHECK-INST: ptrue   p7.s, vl7
114// CHECK-ENCODING: [0xe7,0xe0,0x98,0x25]
115// CHECK-ERROR: instruction requires: sve
116// CHECK-UNKNOWN: e7 e0 98 25 <unknown>
117
118ptrue   p7.s, vl8
119// CHECK-INST: ptrue   p7.s, vl8
120// CHECK-ENCODING: [0x07,0xe1,0x98,0x25]
121// CHECK-ERROR: instruction requires: sve
122// CHECK-UNKNOWN: 07 e1 98 25 <unknown>
123
124ptrue   p7.s, vl16
125// CHECK-INST: ptrue   p7.s, vl16
126// CHECK-ENCODING: [0x27,0xe1,0x98,0x25]
127// CHECK-ERROR: instruction requires: sve
128// CHECK-UNKNOWN: 27 e1 98 25 <unknown>
129
130ptrue   p7.s, vl32
131// CHECK-INST: ptrue   p7.s, vl32
132// CHECK-ENCODING: [0x47,0xe1,0x98,0x25]
133// CHECK-ERROR: instruction requires: sve
134// CHECK-UNKNOWN: 47 e1 98 25 <unknown>
135
136ptrue   p7.s, vl64
137// CHECK-INST: ptrue   p7.s, vl64
138// CHECK-ENCODING: [0x67,0xe1,0x98,0x25]
139// CHECK-ERROR: instruction requires: sve
140// CHECK-UNKNOWN: 67 e1 98 25 <unknown>
141
142ptrue   p7.s, vl128
143// CHECK-INST: ptrue   p7.s, vl128
144// CHECK-ENCODING: [0x87,0xe1,0x98,0x25]
145// CHECK-ERROR: instruction requires: sve
146// CHECK-UNKNOWN: 87 e1 98 25 <unknown>
147
148ptrue   p7.s, vl256
149// CHECK-INST: ptrue   p7.s, vl256
150// CHECK-ENCODING: [0xa7,0xe1,0x98,0x25]
151// CHECK-ERROR: instruction requires: sve
152// CHECK-UNKNOWN: a7 e1 98 25 <unknown>
153
154ptrue   p7.s, mul4
155// CHECK-INST: ptrue   p7.s, mul4
156// CHECK-ENCODING: [0xa7,0xe3,0x98,0x25]
157// CHECK-ERROR: instruction requires: sve
158// CHECK-UNKNOWN: a7 e3 98 25 <unknown>
159
160ptrue   p7.s, mul3
161// CHECK-INST: ptrue   p7.s, mul3
162// CHECK-ENCODING: [0xc7,0xe3,0x98,0x25]
163// CHECK-ERROR: instruction requires: sve
164// CHECK-UNKNOWN: c7 e3 98 25 <unknown>
165
166ptrue   p7.s, all
167// CHECK-INST: ptrue   p7.s
168// CHECK-ENCODING: [0xe7,0xe3,0x98,0x25]
169// CHECK-ERROR: instruction requires: sve
170// CHECK-UNKNOWN: e7 e3 98 25 <unknown>
171
172// ---------------------------------------------------------------------------//
173// Test immediate values not corresponding to a named pattern
174// ---------------------------------------------------------------------------//
175
176ptrue   p7.s, #14
177// CHECK-INST: ptrue   p7.s, #14
178// CHECK-ENCODING: [0xc7,0xe1,0x98,0x25]
179// CHECK-ERROR: instruction requires: sve
180// CHECK-UNKNOWN: c7 e1 98 25 <unknown>
181
182ptrue   p7.s, #15
183// CHECK-INST: ptrue   p7.s, #15
184// CHECK-ENCODING: [0xe7,0xe1,0x98,0x25]
185// CHECK-ERROR: instruction requires: sve
186// CHECK-UNKNOWN: e7 e1 98 25 <unknown>
187
188ptrue   p7.s, #16
189// CHECK-INST: ptrue   p7.s, #16
190// CHECK-ENCODING: [0x07,0xe2,0x98,0x25]
191// CHECK-ERROR: instruction requires: sve
192// CHECK-UNKNOWN: 07 e2 98 25 <unknown>
193
194ptrue   p7.s, #17
195// CHECK-INST: ptrue   p7.s, #17
196// CHECK-ENCODING: [0x27,0xe2,0x98,0x25]
197// CHECK-ERROR: instruction requires: sve
198// CHECK-UNKNOWN: 27 e2 98 25 <unknown>
199
200ptrue   p7.s, #18
201// CHECK-INST: ptrue   p7.s, #18
202// CHECK-ENCODING: [0x47,0xe2,0x98,0x25]
203// CHECK-ERROR: instruction requires: sve
204// CHECK-UNKNOWN: 47 e2 98 25 <unknown>
205
206ptrue   p7.s, #19
207// CHECK-INST: ptrue   p7.s, #19
208// CHECK-ENCODING: [0x67,0xe2,0x98,0x25]
209// CHECK-ERROR: instruction requires: sve
210// CHECK-UNKNOWN: 67 e2 98 25 <unknown>
211
212ptrue   p7.s, #20
213// CHECK-INST: ptrue   p7.s, #20
214// CHECK-ENCODING: [0x87,0xe2,0x98,0x25]
215// CHECK-ERROR: instruction requires: sve
216// CHECK-UNKNOWN: 87 e2 98 25 <unknown>
217
218ptrue   p7.s, #21
219// CHECK-INST: ptrue   p7.s, #21
220// CHECK-ENCODING: [0xa7,0xe2,0x98,0x25]
221// CHECK-ERROR: instruction requires: sve
222// CHECK-UNKNOWN: a7 e2 98 25 <unknown>
223
224ptrue   p7.s, #22
225// CHECK-INST: ptrue   p7.s, #22
226// CHECK-ENCODING: [0xc7,0xe2,0x98,0x25]
227// CHECK-ERROR: instruction requires: sve
228// CHECK-UNKNOWN: c7 e2 98 25 <unknown>
229
230ptrue   p7.s, #23
231// CHECK-INST: ptrue   p7.s, #23
232// CHECK-ENCODING: [0xe7,0xe2,0x98,0x25]
233// CHECK-ERROR: instruction requires: sve
234// CHECK-UNKNOWN: e7 e2 98 25 <unknown>
235
236ptrue   p7.s, #24
237// CHECK-INST: ptrue   p7.s, #24
238// CHECK-ENCODING: [0x07,0xe3,0x98,0x25]
239// CHECK-ERROR: instruction requires: sve
240// CHECK-UNKNOWN: 07 e3 98 25 <unknown>
241
242ptrue   p7.s, #25
243// CHECK-INST: ptrue   p7.s, #25
244// CHECK-ENCODING: [0x27,0xe3,0x98,0x25]
245// CHECK-ERROR: instruction requires: sve
246// CHECK-UNKNOWN: 27 e3 98 25 <unknown>
247
248ptrue   p7.s, #26
249// CHECK-INST: ptrue   p7.s, #26
250// CHECK-ENCODING: [0x47,0xe3,0x98,0x25]
251// CHECK-ERROR: instruction requires: sve
252// CHECK-UNKNOWN: 47 e3 98 25 <unknown>
253
254ptrue   p7.s, #27
255// CHECK-INST: ptrue   p7.s, #27
256// CHECK-ENCODING: [0x67,0xe3,0x98,0x25]
257// CHECK-ERROR: instruction requires: sve
258// CHECK-UNKNOWN: 67 e3 98 25 <unknown>
259
260ptrue   p7.s, #28
261// CHECK-INST: ptrue   p7.s, #28
262// CHECK-ENCODING: [0x87,0xe3,0x98,0x25]
263// CHECK-ERROR: instruction requires: sve
264// CHECK-UNKNOWN: 87 e3 98 25 <unknown>
265