1// RUN: not llvm-mc -triple=aarch64-none-linux-gnu -show-encoding -mattr=+sve  2>&1 < %s | FileCheck %s
2
3// ------------------------------------------------------------------------- //
4// Type suffix on unpredicated movprfx
5
6movprfx z0.b, z1.b
7// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: invalid operand for instruction
8// CHECK-NEXT: movprfx z0.b, z1.b
9// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}:
10
11movprfx z0.b, z1.s
12// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: invalid operand for instruction
13// CHECK-NEXT: movprfx z0.b, z1.s
14// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}:
15
16movprfx z0, z1.s
17// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: expected register without element width suffix
18// CHECK-NEXT: movprfx z0, z1.s
19// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}:
20
21
22// ------------------------------------------------------------------------- //
23// Different destination register (unary)
24
25movprfx z0, z1
26abs z2.d, p0/m, z2.d
27// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: instruction is unpredictable when following a movprfx writing to a different destination
28// CHECK-NEXT: abs z2.d, p0/m, z2.d
29// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}:
30
31
32// ------------------------------------------------------------------------- //
33// Different destination register (binary)
34
35movprfx z0, z1
36add z2.d, p0/m, z2.d, z0.d
37// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: instruction is unpredictable when following a movprfx writing to a different destination
38// CHECK-NEXT: add z2.d, p0/m, z2.d, z0.d
39// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}:
40
41
42// ------------------------------------------------------------------------- //
43// Different destination register (wide element)
44
45movprfx z0, z1
46asr z2.s, p0/m, z2.s, z0.d
47// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: instruction is unpredictable when following a movprfx writing to a different destination
48// CHECK-NEXT: asr z2.s, p0/m, z2.s, z0.d
49// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}:
50
51
52// ------------------------------------------------------------------------- //
53// Different destination register (ternary)
54
55movprfx z0, z1
56mla z3.d, p0/m, z1.d, z2.d
57// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: instruction is unpredictable when following a movprfx writing to a different destination
58// CHECK-NEXT: mla z3.d, p0/m, z1.d, z2.d
59// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}:
60
61
62// ------------------------------------------------------------------------- //
63// Destination used in other operand (unary)
64
65movprfx z0, z1
66abs z0.d, p0/m, z0.d
67// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: instruction is unpredictable when following a movprfx and destination also used as non-destructive source
68// CHECK-NEXT: abs z0.d, p0/m, z0.d
69// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}:
70
71movprfx z0.d, p0/z, z1.d
72cpy z0.d, p0/m, d0
73// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: instruction is unpredictable when following a movprfx and destination also used as non-destructive source
74// CHECK-NEXT: cpy z0.d, p0/m, d0
75// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}:
76
77movprfx z0.d, p0/z, z1.d
78mov z0.d, p0/m, d0
79// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: instruction is unpredictable when following a movprfx and destination also used as non-destructive source
80// CHECK-NEXT: mov z0.d, p0/m, d0
81// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}:
82
83// ------------------------------------------------------------------------- //
84// Destination used in other operand (binary)
85
86movprfx z0, z1
87add z0.d, p0/m, z0.d, z0.d
88// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: instruction is unpredictable when following a movprfx and destination also used as non-destructive source
89// CHECK-NEXT: add z0.d, p0/m, z0.d, z0.d
90// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}:
91
92
93// ------------------------------------------------------------------------- //
94// Destination used in other operand (wide element)
95
96movprfx z0, z1
97asr z0.s, p0/m, z0.s, z0.d
98// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: instruction is unpredictable when following a movprfx and destination also used as non-destructive source
99// CHECK-NEXT: asr z0.s, p0/m, z0.s, z0.d
100// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}:
101
102
103// ------------------------------------------------------------------------- //
104// Destination used in other operand (ternary)
105
106movprfx z0, z1
107mla z0.d, p0/m, z0.d, z2.d
108// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: instruction is unpredictable when following a movprfx and destination also used as non-destructive source
109// CHECK-NEXT: mla z0.d, p0/m, z0.d, z2.d
110// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}:
111
112
113// ------------------------------------------------------------------------- //
114// Destination used in other operand (ternary + indexed)
115
116movprfx z0, z1
117sdot z0.s, z1.b, z0.b[3]
118// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: instruction is unpredictable when following a movprfx and destination also used as non-destructive source
119// CHECK-NEXT: sdot z0.s, z1.b, z0.b[3]
120// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}:
121
122
123// ------------------------------------------------------------------------- //
124// Different general predicate (unary)
125
126movprfx z0.d, p0/m, z1.d
127abs z0.d, p1/m, z1.d
128// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: instruction is unpredictable when following a predicated movprfx using a different general predicate
129// CHECK-NEXT: abs z0.d, p1/m, z1.d
130// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}:
131
132
133// ------------------------------------------------------------------------- //
134// Different general predicate (binary)
135
136movprfx z0.d, p0/m, z1.d
137add z0.d, p1/m, z0.d, z1.d
138// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: instruction is unpredictable when following a predicated movprfx using a different general predicate
139// CHECK-NEXT: add z0.d, p1/m, z0.d, z1.d
140// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}:
141
142
143// ------------------------------------------------------------------------- //
144// Different general predicate (wide element)
145
146movprfx z0.d, p0/m, z1.d
147asr z0.s, p1/m, z0.s, z1.d
148// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: instruction is unpredictable when following a predicated movprfx using a different general predicate
149// CHECK-NEXT: asr z0.s, p1/m, z0.s, z1.d
150// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}:
151
152
153// ------------------------------------------------------------------------- //
154// Different general predicate (ternary)
155
156movprfx z0.d, p0/m, z1.d
157mla z0.d, p1/m, z1.d, z2.d
158// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: instruction is unpredictable when following a predicated movprfx using a different general predicate
159// CHECK-NEXT: mla z0.d, p1/m, z1.d, z2.d
160// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}:
161
162
163// ------------------------------------------------------------------------- //
164// Different element size (unary)
165
166movprfx z0.s, p0/m, z1.s
167abs z0.d, p0/m, z1.d
168// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: instruction is unpredictable when following a predicated movprfx with a different element size
169// CHECK-NEXT: abs z0.d, p0/m, z1.d
170// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}:
171
172
173// ------------------------------------------------------------------------- //
174// Different element size (binary)
175
176movprfx z0.s, p0/m, z1.s
177add z0.d, p0/m, z0.d, z1.d
178// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: instruction is unpredictable when following a predicated movprfx with a different element size
179// CHECK-NEXT: add z0.d, p0/m, z0.d, z1.d
180// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}:
181
182
183// ------------------------------------------------------------------------- //
184// Different element size (wide element)
185
186movprfx z0.d, p0/m, z1.d
187asr z0.s, p0/m, z0.s, z1.d
188// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: instruction is unpredictable when following a predicated movprfx with a different element size
189// CHECK-NEXT: asr z0.s, p0/m, z0.s, z1.d
190// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}:
191
192
193// ------------------------------------------------------------------------- //
194// Different element size (ternary)
195
196movprfx z0.s, p0/m, z1.s
197mla z0.d, p0/m, z1.d, z2.d
198// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: instruction is unpredictable when following a predicated movprfx with a different element size
199// CHECK-NEXT: mla z0.d, p0/m, z1.d, z2.d
200// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}:
201
202
203// ------------------------------------------------------------------------- //
204// Predicated movprfx with non-predicated instruction.
205
206movprfx z0.d, p0/m, z1.d
207add z0.d, z0.d, #1
208// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: instruction is unpredictable when following a predicated movprfx, suggest using unpredicated movprfx
209// CHECK-NEXT: add z0.d, z0.d, #1
210// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}:
211
212
213// ------------------------------------------------------------------------- //
214// Ensure we don't try to apply a prefix to subsequent instructions (upon failure)
215
216movprfx z0, z1
217add z0.d, z1.d, z2.d
218add z0.d, z1.d, z2.d
219// CHECK: [[@LINE-2]]:{{[0-9]+}}: error: instruction is unpredictable when following a movprfx, suggest replacing movprfx with mov
220// CHECK-NEXT: add z0.d, z1.d, z2.d
221// CHECK-NOT: [[@LINE-3]]:{{[0-9]+}}:
222// CHECK: add z0.d, z1.d, z2.d
223