1// RUN: llvm-mc -triple=arm64 -mattr=+neon -show-encoding < %s | FileCheck %s
2
3// Check that the assembler can handle the documented syntax for AArch64
4
5//------------------------------------------------------------------------------
6// Instructions with 2 vectors and an element
7//------------------------------------------------------------------------------
8
9        mla v0.2s, v1.2s, v2.s[2]
10        mla v0.2s, v1.2s, v22.s[2]
11        mla v3.4s, v8.4s, v2.s[1]
12        mla v3.4s, v8.4s, v22.s[3]
13
14// CHECK: mla	v0.2s, v1.2s, v2.s[2]   // encoding: [0x20,0x08,0x82,0x2f]
15// CHECK: mla	v0.2s, v1.2s, v22.s[2]  // encoding: [0x20,0x08,0x96,0x2f]
16// CHECK: mla	v3.4s, v8.4s, v2.s[1]   // encoding: [0x03,0x01,0xa2,0x6f]
17// CHECK: mla	v3.4s, v8.4s, v22.s[3]  // encoding: [0x03,0x09,0xb6,0x6f]
18
19        mla v0.4h, v1.4h, v2.h[2]
20        mla v0.4h, v1.4h, v15.h[2]
21        mla v0.8h, v1.8h, v2.h[7]
22        mla v0.8h, v1.8h, v14.h[6]
23
24// CHECK: mla	v0.4h, v1.4h, v2.h[2]   // encoding: [0x20,0x00,0x62,0x2f]
25// CHECK: mla	v0.4h, v1.4h, v15.h[2]  // encoding: [0x20,0x00,0x6f,0x2f]
26// CHECK: mla	v0.8h, v1.8h, v2.h[7]   // encoding: [0x20,0x08,0x72,0x6f]
27// CHECK: mla	v0.8h, v1.8h, v14.h[6]  // encoding: [0x20,0x08,0x6e,0x6f]
28
29        mls v0.2s, v1.2s, v2.s[2]
30        mls v0.2s, v1.2s, v22.s[2]
31        mls v3.4s, v8.4s, v2.s[1]
32        mls v3.4s, v8.4s, v22.s[3]
33
34// CHECK: mls	v0.2s, v1.2s, v2.s[2]   // encoding: [0x20,0x48,0x82,0x2f]
35// CHECK: mls	v0.2s, v1.2s, v22.s[2]  // encoding: [0x20,0x48,0x96,0x2f]
36// CHECK: mls	v3.4s, v8.4s, v2.s[1]   // encoding: [0x03,0x41,0xa2,0x6f]
37// CHECK: mls	v3.4s, v8.4s, v22.s[3]  // encoding: [0x03,0x49,0xb6,0x6f]
38
39        mls v0.4h, v1.4h, v2.h[2]
40        mls v0.4h, v1.4h, v15.h[2]
41        mls v0.8h, v1.8h, v2.h[7]
42        mls v0.8h, v1.8h, v14.h[6]
43
44// CHECK: mls	v0.4h, v1.4h, v2.h[2]   // encoding: [0x20,0x40,0x62,0x2f]
45// CHECK: mls	v0.4h, v1.4h, v15.h[2]  // encoding: [0x20,0x40,0x6f,0x2f]
46// CHECK: mls	v0.8h, v1.8h, v2.h[7]   // encoding: [0x20,0x48,0x72,0x6f]
47// CHECK: mls	v0.8h, v1.8h, v14.h[6]  // encoding: [0x20,0x48,0x6e,0x6f]
48
49        fmla v0.2s, v1.2s, v2.s[2]
50        fmla v0.2s, v1.2s, v22.s[2]
51        fmla v3.4s, v8.4s, v2.s[1]
52        fmla v3.4s, v8.4s, v22.s[3]
53        fmla v0.2d, v1.2d, v2.d[1]
54        fmla v0.2d, v1.2d, v22.d[1]
55
56// CHECK: fmla	v0.2s, v1.2s, v2.s[2]   // encoding: [0x20,0x18,0x82,0x0f]
57// CHECK: fmla	v0.2s, v1.2s, v22.s[2]  // encoding: [0x20,0x18,0x96,0x0f]
58// CHECK: fmla	v3.4s, v8.4s, v2.s[1]   // encoding: [0x03,0x11,0xa2,0x4f]
59// CHECK: fmla	v3.4s, v8.4s, v22.s[3]  // encoding: [0x03,0x19,0xb6,0x4f]
60// CHECK: fmla	v0.2d, v1.2d, v2.d[1]   // encoding: [0x20,0x18,0xc2,0x4f]
61// CHECK: fmla	v0.2d, v1.2d, v22.d[1]  // encoding: [0x20,0x18,0xd6,0x4f]
62
63        fmls v0.2s, v1.2s, v2.s[2]
64        fmls v0.2s, v1.2s, v22.s[2]
65        fmls v3.4s, v8.4s, v2.s[1]
66        fmls v3.4s, v8.4s, v22.s[3]
67        fmls v0.2d, v1.2d, v2.d[1]
68        fmls v0.2d, v1.2d, v22.d[1]
69
70// CHECK: fmls	v0.2s, v1.2s, v2.s[2]   // encoding: [0x20,0x58,0x82,0x0f]
71// CHECK: fmls	v0.2s, v1.2s, v22.s[2]  // encoding: [0x20,0x58,0x96,0x0f]
72// CHECK: fmls	v3.4s, v8.4s, v2.s[1]   // encoding: [0x03,0x51,0xa2,0x4f]
73// CHECK: fmls	v3.4s, v8.4s, v22.s[3]  // encoding: [0x03,0x59,0xb6,0x4f]
74// CHECK: fmls	v0.2d, v1.2d, v2.d[1]   // encoding: [0x20,0x58,0xc2,0x4f]
75// CHECK: fmls	v0.2d, v1.2d, v22.d[1]  // encoding: [0x20,0x58,0xd6,0x4f]
76
77        smlal v0.4s, v1.4h, v2.h[2]
78        smlal v0.2d, v1.2s, v2.s[2]
79        smlal v0.2d, v1.2s, v22.s[2]
80        smlal2 v0.4s, v1.8h, v1.h[2]
81        smlal2 v0.2d, v1.4s, v1.s[2]
82        smlal2 v0.2d, v1.4s, v22.s[2]
83
84// CHECK: smlal	v0.4s, v1.4h, v2.h[2]   // encoding: [0x20,0x20,0x62,0x0f]
85// CHECK: smlal	v0.2d, v1.2s, v2.s[2]   // encoding: [0x20,0x28,0x82,0x0f]
86// CHECK: smlal	v0.2d, v1.2s, v22.s[2]  // encoding: [0x20,0x28,0x96,0x0f]
87// CHECK: smlal2	v0.4s, v1.8h, v1.h[2]   // encoding: [0x20,0x20,0x61,0x4f]
88// CHECK: smlal2	v0.2d, v1.4s, v1.s[2]   // encoding: [0x20,0x28,0x81,0x4f]
89// CHECK: smlal2	v0.2d, v1.4s, v22.s[2]  // encoding: [0x20,0x28,0x96,0x4f]
90
91        smlsl v0.4s, v1.4h, v2.h[2]
92        smlsl v0.2d, v1.2s, v2.s[2]
93        smlsl v0.2d, v1.2s, v22.s[2]
94        smlsl2 v0.4s, v1.8h, v1.h[2]
95        smlsl2 v0.2d, v1.4s, v1.s[2]
96        smlsl2 v0.2d, v1.4s, v22.s[2]
97
98// CHECK: smlsl	v0.4s, v1.4h, v2.h[2]   // encoding: [0x20,0x60,0x62,0x0f]
99// CHECK: smlsl	v0.2d, v1.2s, v2.s[2]   // encoding: [0x20,0x68,0x82,0x0f]
100// CHECK: smlsl	v0.2d, v1.2s, v22.s[2]  // encoding: [0x20,0x68,0x96,0x0f]
101// CHECK: smlsl2	v0.4s, v1.8h, v1.h[2]   // encoding: [0x20,0x60,0x61,0x4f]
102// CHECK: smlsl2	v0.2d, v1.4s, v1.s[2]   // encoding: [0x20,0x68,0x81,0x4f]
103// CHECK: smlsl2	v0.2d, v1.4s, v22.s[2]  // encoding: [0x20,0x68,0x96,0x4f]
104
105        sqdmlal v0.4s, v1.4h, v2.h[2]
106        sqdmlal v0.2d, v1.2s, v2.s[2]
107        sqdmlal v0.2d, v1.2s, v22.s[2]
108        sqdmlal2 v0.4s, v1.8h, v1.h[2]
109        sqdmlal2 v0.2d, v1.4s, v1.s[2]
110        sqdmlal2 v0.2d, v1.4s, v22.s[2]
111
112// CHECK: sqdmlal	v0.4s, v1.4h, v2.h[2]   // encoding: [0x20,0x30,0x62,0x0f]
113// CHECK: sqdmlal	v0.2d, v1.2s, v2.s[2]   // encoding: [0x20,0x38,0x82,0x0f]
114// CHECK: sqdmlal	v0.2d, v1.2s, v22.s[2]  // encoding: [0x20,0x38,0x96,0x0f]
115// CHECK: sqdmlal2	v0.4s, v1.8h, v1.h[2] // encoding: [0x20,0x30,0x61,0x4f]
116// CHECK: sqdmlal2	v0.2d, v1.4s, v1.s[2] // encoding: [0x20,0x38,0x81,0x4f]
117// CHECK: sqdmlal2	v0.2d, v1.4s, v22.s[2] // encoding: [0x20,0x38,0x96,0x4f]
118
119        umlal v0.4s, v1.4h, v2.h[2]
120        umlal v0.2d, v1.2s, v2.s[2]
121        umlal v0.2d, v1.2s, v22.s[2]
122        umlal2 v0.4s, v1.8h, v1.h[2]
123        umlal2 v0.2d, v1.4s, v1.s[2]
124        umlal2 v0.2d, v1.4s, v22.s[2]
125
126// CHECK: umlal	v0.4s, v1.4h, v2.h[2]   // encoding: [0x20,0x20,0x62,0x2f]
127// CHECK: umlal	v0.2d, v1.2s, v2.s[2]   // encoding: [0x20,0x28,0x82,0x2f]
128// CHECK: umlal	v0.2d, v1.2s, v22.s[2]  // encoding: [0x20,0x28,0x96,0x2f]
129// CHECK: umlal2	v0.4s, v1.8h, v1.h[2]   // encoding: [0x20,0x20,0x61,0x6f]
130// CHECK: umlal2	v0.2d, v1.4s, v1.s[2]   // encoding: [0x20,0x28,0x81,0x6f]
131// CHECK: umlal2	v0.2d, v1.4s, v22.s[2]  // encoding: [0x20,0x28,0x96,0x6f]
132
133        umlsl v0.4s, v1.4h, v2.h[2]
134        umlsl v0.2d, v1.2s, v2.s[2]
135        umlsl v0.2d, v1.2s, v22.s[2]
136        umlsl2 v0.4s, v1.8h, v1.h[2]
137        umlsl2 v0.2d, v1.4s, v1.s[2]
138        umlsl2 v0.2d, v1.4s, v22.s[2]
139
140// CHECK: umlsl	v0.4s, v1.4h, v2.h[2]   // encoding: [0x20,0x60,0x62,0x2f]
141// CHECK: umlsl	v0.2d, v1.2s, v2.s[2]   // encoding: [0x20,0x68,0x82,0x2f]
142// CHECK: umlsl	v0.2d, v1.2s, v22.s[2]  // encoding: [0x20,0x68,0x96,0x2f]
143// CHECK: umlsl2	v0.4s, v1.8h, v1.h[2]   // encoding: [0x20,0x60,0x61,0x6f]
144// CHECK: umlsl2	v0.2d, v1.4s, v1.s[2]   // encoding: [0x20,0x68,0x81,0x6f]
145// CHECK: umlsl2	v0.2d, v1.4s, v22.s[2]  // encoding: [0x20,0x68,0x96,0x6f]
146
147        sqdmlsl v0.4s, v1.4h, v2.h[2]
148        sqdmlsl v0.2d, v1.2s, v2.s[2]
149        sqdmlsl v0.2d, v1.2s, v22.s[2]
150        sqdmlsl2 v0.4s, v1.8h, v1.h[2]
151        sqdmlsl2 v0.2d, v1.4s, v1.s[2]
152        sqdmlsl2 v0.2d, v1.4s, v22.s[2]
153
154// CHECK: sqdmlsl	v0.4s, v1.4h, v2.h[2]   // encoding: [0x20,0x70,0x62,0x0f]
155// CHECK: sqdmlsl	v0.2d, v1.2s, v2.s[2]   // encoding: [0x20,0x78,0x82,0x0f]
156// CHECK: sqdmlsl	v0.2d, v1.2s, v22.s[2]  // encoding: [0x20,0x78,0x96,0x0f]
157// CHECK: sqdmlsl2	v0.4s, v1.8h, v1.h[2] // encoding: [0x20,0x70,0x61,0x4f]
158// CHECK: sqdmlsl2	v0.2d, v1.4s, v1.s[2] // encoding: [0x20,0x78,0x81,0x4f]
159// CHECK: sqdmlsl2	v0.2d, v1.4s, v22.s[2] // encoding: [0x20,0x78,0x96,0x4f]
160
161        mul v0.4h, v1.4h, v2.h[2]
162        mul v0.8h, v1.8h, v2.h[2]
163        mul v0.2s, v1.2s, v2.s[2]
164        mul v0.2s, v1.2s, v22.s[2]
165        mul v0.4s, v1.4s, v2.s[2]
166        mul v0.4s, v1.4s, v22.s[2]
167
168// CHECK: mul	v0.4h, v1.4h, v2.h[2]   // encoding: [0x20,0x80,0x62,0x0f]
169// CHECK: mul	v0.8h, v1.8h, v2.h[2]   // encoding: [0x20,0x80,0x62,0x4f]
170// CHECK: mul	v0.2s, v1.2s, v2.s[2]   // encoding: [0x20,0x88,0x82,0x0f]
171// CHECK: mul	v0.2s, v1.2s, v22.s[2]  // encoding: [0x20,0x88,0x96,0x0f]
172// CHECK: mul	v0.4s, v1.4s, v2.s[2]   // encoding: [0x20,0x88,0x82,0x4f]
173// CHECK: mul	v0.4s, v1.4s, v22.s[2]  // encoding: [0x20,0x88,0x96,0x4f]
174
175        fmul v0.2s, v1.2s, v2.s[2]
176        fmul v0.2s, v1.2s, v22.s[2]
177        fmul v0.4s, v1.4s, v2.s[2]
178        fmul v0.4s, v1.4s, v22.s[2]
179        fmul v0.2d, v1.2d, v2.d[1]
180        fmul v0.2d, v1.2d, v22.d[1]
181
182// CHECK: fmul	v0.2s, v1.2s, v2.s[2]   // encoding: [0x20,0x98,0x82,0x0f]
183// CHECK: fmul	v0.2s, v1.2s, v22.s[2]  // encoding: [0x20,0x98,0x96,0x0f]
184// CHECK: fmul	v0.4s, v1.4s, v2.s[2]   // encoding: [0x20,0x98,0x82,0x4f]
185// CHECK: fmul	v0.4s, v1.4s, v22.s[2]  // encoding: [0x20,0x98,0x96,0x4f]
186// CHECK: fmul	v0.2d, v1.2d, v2.d[1]   // encoding: [0x20,0x98,0xc2,0x4f]
187// CHECK: fmul	v0.2d, v1.2d, v22.d[1]  // encoding: [0x20,0x98,0xd6,0x4f]
188
189        fmulx v0.2s, v1.2s, v2.s[2]
190        fmulx v0.2s, v1.2s, v22.s[2]
191        fmulx v0.4s, v1.4s, v2.s[2]
192        fmulx v0.4s, v1.4s, v22.s[2]
193        fmulx v0.2d, v1.2d, v2.d[1]
194        fmulx v0.2d, v1.2d, v22.d[1]
195
196// CHECK: fmulx	v0.2s, v1.2s, v2.s[2]   // encoding: [0x20,0x98,0x82,0x2f]
197// CHECK: fmulx	v0.2s, v1.2s, v22.s[2]  // encoding: [0x20,0x98,0x96,0x2f]
198// CHECK: fmulx	v0.4s, v1.4s, v2.s[2]   // encoding: [0x20,0x98,0x82,0x6f]
199// CHECK: fmulx	v0.4s, v1.4s, v22.s[2]  // encoding: [0x20,0x98,0x96,0x6f]
200// CHECK: fmulx	v0.2d, v1.2d, v2.d[1]   // encoding: [0x20,0x98,0xc2,0x6f]
201// CHECK: fmulx	v0.2d, v1.2d, v22.d[1]  // encoding: [0x20,0x98,0xd6,0x6f]
202
203        smull v0.4s, v1.4h, v2.h[2]
204        smull v0.2d, v1.2s, v2.s[2]
205        smull v0.2d, v1.2s, v22.s[2]
206        smull2 v0.4s, v1.8h, v2.h[2]
207        smull2 v0.2d, v1.4s, v2.s[2]
208        smull2 v0.2d, v1.4s, v22.s[2]
209
210// CHECK: smull	v0.4s, v1.4h, v2.h[2]   // encoding: [0x20,0xa0,0x62,0x0f]
211// CHECK: smull	v0.2d, v1.2s, v2.s[2]   // encoding: [0x20,0xa8,0x82,0x0f]
212// CHECK: smull	v0.2d, v1.2s, v22.s[2]  // encoding: [0x20,0xa8,0x96,0x0f]
213// CHECK: smull2	v0.4s, v1.8h, v2.h[2]   // encoding: [0x20,0xa0,0x62,0x4f]
214// CHECK: smull2	v0.2d, v1.4s, v2.s[2]   // encoding: [0x20,0xa8,0x82,0x4f]
215// CHECK: smull2	v0.2d, v1.4s, v22.s[2]  // encoding: [0x20,0xa8,0x96,0x4f]
216
217        umull v0.4s, v1.4h, v2.h[2]
218        umull v0.2d, v1.2s, v2.s[2]
219        umull v0.2d, v1.2s, v22.s[2]
220        umull2 v0.4s, v1.8h, v2.h[2]
221        umull2 v0.2d, v1.4s, v2.s[2]
222        umull2 v0.2d, v1.4s, v22.s[2]
223
224// CHECK: umull	v0.4s, v1.4h, v2.h[2]   // encoding: [0x20,0xa0,0x62,0x2f]
225// CHECK: umull	v0.2d, v1.2s, v2.s[2]   // encoding: [0x20,0xa8,0x82,0x2f]
226// CHECK: umull	v0.2d, v1.2s, v22.s[2]  // encoding: [0x20,0xa8,0x96,0x2f]
227// CHECK: umull2	v0.4s, v1.8h, v2.h[2]   // encoding: [0x20,0xa0,0x62,0x6f]
228// CHECK: umull2	v0.2d, v1.4s, v2.s[2]   // encoding: [0x20,0xa8,0x82,0x6f]
229// CHECK: umull2	v0.2d, v1.4s, v22.s[2]  // encoding: [0x20,0xa8,0x96,0x6f]
230
231        sqdmull v0.4s, v1.4h, v2.h[2]
232        sqdmull v0.2d, v1.2s, v2.s[2]
233        sqdmull v0.2d, v1.2s, v22.s[2]
234        sqdmull2 v0.4s, v1.8h, v2.h[2]
235        sqdmull2 v0.2d, v1.4s, v2.s[2]
236        sqdmull2 v0.2d, v1.4s, v22.s[2]
237
238// CHECK: sqdmull	v0.4s, v1.4h, v2.h[2]   // encoding: [0x20,0xb0,0x62,0x0f]
239// CHECK: sqdmull	v0.2d, v1.2s, v2.s[2]   // encoding: [0x20,0xb8,0x82,0x0f]
240// CHECK: sqdmull	v0.2d, v1.2s, v22.s[2]  // encoding: [0x20,0xb8,0x96,0x0f]
241// CHECK: sqdmull2	v0.4s, v1.8h, v2.h[2] // encoding: [0x20,0xb0,0x62,0x4f]
242// CHECK: sqdmull2	v0.2d, v1.4s, v2.s[2] // encoding: [0x20,0xb8,0x82,0x4f]
243// CHECK: sqdmull2	v0.2d, v1.4s, v22.s[2] // encoding: [0x20,0xb8,0x96,0x4f]
244
245        sqdmulh v0.4h, v1.4h, v2.h[2]
246        sqdmulh v0.8h, v1.8h, v2.h[2]
247        sqdmulh v0.2s, v1.2s, v2.s[2]
248        sqdmulh v0.2s, v1.2s, v22.s[2]
249        sqdmulh v0.4s, v1.4s, v2.s[2]
250        sqdmulh v0.4s, v1.4s, v22.s[2]
251
252// CHECK: sqdmulh	v0.4h, v1.4h, v2.h[2]   // encoding: [0x20,0xc0,0x62,0x0f]
253// CHECK: sqdmulh	v0.8h, v1.8h, v2.h[2]   // encoding: [0x20,0xc0,0x62,0x4f]
254// CHECK: sqdmulh	v0.2s, v1.2s, v2.s[2]   // encoding: [0x20,0xc8,0x82,0x0f]
255// CHECK: sqdmulh	v0.2s, v1.2s, v22.s[2]  // encoding: [0x20,0xc8,0x96,0x0f]
256// CHECK: sqdmulh	v0.4s, v1.4s, v2.s[2]   // encoding: [0x20,0xc8,0x82,0x4f]
257// CHECK: sqdmulh	v0.4s, v1.4s, v22.s[2]  // encoding: [0x20,0xc8,0x96,0x4f]
258
259        sqrdmulh v0.4h, v1.4h, v2.h[2]
260        sqrdmulh v0.8h, v1.8h, v2.h[2]
261        sqrdmulh v0.2s, v1.2s, v2.s[2]
262        sqrdmulh v0.2s, v1.2s, v22.s[2]
263        sqrdmulh v0.4s, v1.4s, v2.s[2]
264        sqrdmulh v0.4s, v1.4s, v22.s[2]
265
266// CHECK: sqrdmulh	v0.4h, v1.4h, v2.h[2] // encoding: [0x20,0xd0,0x62,0x0f]
267// CHECK: sqrdmulh	v0.8h, v1.8h, v2.h[2] // encoding: [0x20,0xd0,0x62,0x4f]
268// CHECK: sqrdmulh	v0.2s, v1.2s, v2.s[2] // encoding: [0x20,0xd8,0x82,0x0f]
269// CHECK: sqrdmulh	v0.2s, v1.2s, v22.s[2] // encoding: [0x20,0xd8,0x96,0x0f]
270// CHECK: sqrdmulh	v0.4s, v1.4s, v2.s[2] // encoding: [0x20,0xd8,0x82,0x4f]
271// CHECK: sqrdmulh	v0.4s, v1.4s, v22.s[2] // encoding: [0x20,0xd8,0x96,0x4f]
272