1*f4a2713aSLionel Sambuc// RUN: llvm-mc -triple aarch64-none-linux-gnu -mattr=+neon -show-encoding < %s | FileCheck %s
2*f4a2713aSLionel Sambuc
3*f4a2713aSLionel Sambuc// Check that the assembler can handle the documented syntax for AArch64
4*f4a2713aSLionel Sambuc
5*f4a2713aSLionel Sambuc
6*f4a2713aSLionel Sambuc//----------------------------------------------------------------------
7*f4a2713aSLionel Sambuc// Vector Move Immediate Shifted
8*f4a2713aSLionel Sambuc//----------------------------------------------------------------------
9*f4a2713aSLionel Sambuc         movi v0.2s, #1
10*f4a2713aSLionel Sambuc         movi v1.2s, #0
11*f4a2713aSLionel Sambuc         movi v15.2s, #1, lsl #8
12*f4a2713aSLionel Sambuc         movi v16.2s, #1, lsl #16
13*f4a2713aSLionel Sambuc         movi v31.2s, #1, lsl #24
14*f4a2713aSLionel Sambuc         movi v0.4s, #1
15*f4a2713aSLionel Sambuc         movi v0.4s, #1, lsl #8
16*f4a2713aSLionel Sambuc         movi v0.4s, #1, lsl #16
17*f4a2713aSLionel Sambuc         movi v0.4s, #1, lsl #24
18*f4a2713aSLionel Sambuc         movi v0.4h, #1
19*f4a2713aSLionel Sambuc         movi v0.4h, #1, lsl #8
20*f4a2713aSLionel Sambuc         movi v0.8h, #1
21*f4a2713aSLionel Sambuc         movi v0.8h, #1, lsl #8
22*f4a2713aSLionel Sambuc
23*f4a2713aSLionel Sambuc// CHECK:  movi v0.2s, #0x1           // encoding: [0x20,0x04,0x00,0x0f]
24*f4a2713aSLionel Sambuc// CHECK:  movi v1.2s, #0x0           // encoding: [0x01,0x04,0x00,0x0f]
25*f4a2713aSLionel Sambuc// CHECK:  movi v15.2s, #0x1, lsl #8  // encoding: [0x2f,0x24,0x00,0x0f]
26*f4a2713aSLionel Sambuc// CHECK:  movi v16.2s, #0x1, lsl #16 // encoding: [0x30,0x44,0x00,0x0f]
27*f4a2713aSLionel Sambuc// CHECK:  movi v31.2s, #0x1, lsl #24 // encoding: [0x3f,0x64,0x00,0x0f]
28*f4a2713aSLionel Sambuc// CHECK:  movi v0.4s, #0x1           // encoding: [0x20,0x04,0x00,0x4f]
29*f4a2713aSLionel Sambuc// CHECK:  movi v0.4s, #0x1, lsl #8   // encoding: [0x20,0x24,0x00,0x4f]
30*f4a2713aSLionel Sambuc// CHECK:  movi v0.4s, #0x1, lsl #16  // encoding: [0x20,0x44,0x00,0x4f]
31*f4a2713aSLionel Sambuc// CHECK:  movi v0.4s, #0x1, lsl #24  // encoding: [0x20,0x64,0x00,0x4f]
32*f4a2713aSLionel Sambuc// CHECK:  movi v0.4h, #0x1           // encoding: [0x20,0x84,0x00,0x0f]
33*f4a2713aSLionel Sambuc// CHECK:  movi v0.4h, #0x1, lsl #8   // encoding: [0x20,0xa4,0x00,0x0f]
34*f4a2713aSLionel Sambuc// CHECK:  movi v0.8h, #0x1           // encoding: [0x20,0x84,0x00,0x4f]
35*f4a2713aSLionel Sambuc// CHECK:  movi v0.8h, #0x1, lsl #8   // encoding: [0x20,0xa4,0x00,0x4f]
36*f4a2713aSLionel Sambuc
37*f4a2713aSLionel Sambuc//----------------------------------------------------------------------
38*f4a2713aSLionel Sambuc// Vector Move Inverted Immediate Shifted
39*f4a2713aSLionel Sambuc//----------------------------------------------------------------------
40*f4a2713aSLionel Sambuc         mvni v0.2s, #1
41*f4a2713aSLionel Sambuc         mvni v1.2s, #0
42*f4a2713aSLionel Sambuc         mvni v0.2s, #1, lsl #8
43*f4a2713aSLionel Sambuc         mvni v0.2s, #1, lsl #16
44*f4a2713aSLionel Sambuc         mvni v0.2s, #1, lsl #24
45*f4a2713aSLionel Sambuc         mvni v0.4s, #1
46*f4a2713aSLionel Sambuc         mvni v15.4s, #1, lsl #8
47*f4a2713aSLionel Sambuc         mvni v16.4s, #1, lsl #16
48*f4a2713aSLionel Sambuc         mvni v31.4s, #1, lsl #24
49*f4a2713aSLionel Sambuc         mvni v0.4h, #1
50*f4a2713aSLionel Sambuc         mvni v0.4h, #1, lsl #8
51*f4a2713aSLionel Sambuc         mvni v0.8h, #1
52*f4a2713aSLionel Sambuc         mvni v0.8h, #1, lsl #8
53*f4a2713aSLionel Sambuc
54*f4a2713aSLionel Sambuc// CHECK:  mvni v0.2s, #0x1           // encoding: [0x20,0x04,0x00,0x2f]
55*f4a2713aSLionel Sambuc// CHECK:  mvni v1.2s, #0x0           // encoding: [0x01,0x04,0x00,0x2f]
56*f4a2713aSLionel Sambuc// CHECK:  mvni v0.2s, #0x1, lsl #8   // encoding: [0x20,0x24,0x00,0x2f]
57*f4a2713aSLionel Sambuc// CHECK:  mvni v0.2s, #0x1, lsl #16  // encoding: [0x20,0x44,0x00,0x2f]
58*f4a2713aSLionel Sambuc// CHECK:  mvni v0.2s, #0x1, lsl #24  // encoding: [0x20,0x64,0x00,0x2f]
59*f4a2713aSLionel Sambuc// CHECK:  mvni v0.4s, #0x1           // encoding: [0x20,0x04,0x00,0x6f]
60*f4a2713aSLionel Sambuc// CHECK:  mvni v15.4s, #0x1, lsl #8  // encoding: [0x2f,0x24,0x00,0x6f]
61*f4a2713aSLionel Sambuc// CHECK:  mvni v16.4s, #0x1, lsl #16 // encoding: [0x30,0x44,0x00,0x6f]
62*f4a2713aSLionel Sambuc// CHECK:  mvni v31.4s, #0x1, lsl #24 // encoding: [0x3f,0x64,0x00,0x6f]
63*f4a2713aSLionel Sambuc// CHECK:  mvni v0.4h, #0x1           // encoding: [0x20,0x84,0x00,0x2f]
64*f4a2713aSLionel Sambuc// CHECK:  mvni v0.4h, #0x1, lsl #8   // encoding: [0x20,0xa4,0x00,0x2f]
65*f4a2713aSLionel Sambuc// CHECK:  mvni v0.8h, #0x1           // encoding: [0x20,0x84,0x00,0x6f]
66*f4a2713aSLionel Sambuc// CHECK:  mvni v0.8h, #0x1, lsl #8   // encoding: [0x20,0xa4,0x00,0x6f]
67*f4a2713aSLionel Sambuc
68*f4a2713aSLionel Sambuc//----------------------------------------------------------------------
69*f4a2713aSLionel Sambuc// Vector Bitwise Bit Clear (AND NOT) - immediate
70*f4a2713aSLionel Sambuc//----------------------------------------------------------------------
71*f4a2713aSLionel Sambuc         bic v0.2s, #1
72*f4a2713aSLionel Sambuc         bic v1.2s, #0
73*f4a2713aSLionel Sambuc         bic v0.2s, #1, lsl #8
74*f4a2713aSLionel Sambuc         bic v0.2s, #1, lsl #16
75*f4a2713aSLionel Sambuc         bic v0.2s, #1, lsl #24
76*f4a2713aSLionel Sambuc         bic v0.4s, #1
77*f4a2713aSLionel Sambuc         bic v0.4s, #1, lsl #8
78*f4a2713aSLionel Sambuc         bic v0.4s, #1, lsl #16
79*f4a2713aSLionel Sambuc         bic v0.4s, #1, lsl #24
80*f4a2713aSLionel Sambuc         bic v15.4h, #1
81*f4a2713aSLionel Sambuc         bic v16.4h, #1, lsl #8
82*f4a2713aSLionel Sambuc         bic v0.8h, #1
83*f4a2713aSLionel Sambuc         bic v31.8h, #1, lsl #8
84*f4a2713aSLionel Sambuc
85*f4a2713aSLionel Sambuc// CHECK:  bic v0.2s, #0x1           // encoding: [0x20,0x14,0x00,0x2f]
86*f4a2713aSLionel Sambuc// CHECK:  bic v1.2s, #0x0           // encoding: [0x01,0x14,0x00,0x2f]
87*f4a2713aSLionel Sambuc// CHECK:  bic v0.2s, #0x1, lsl #8   // encoding: [0x20,0x34,0x00,0x2f]
88*f4a2713aSLionel Sambuc// CHECK:  bic v0.2s, #0x1, lsl #16  // encoding: [0x20,0x54,0x00,0x2f]
89*f4a2713aSLionel Sambuc// CHECK:  bic v0.2s, #0x1, lsl #24  // encoding: [0x20,0x74,0x00,0x2f]
90*f4a2713aSLionel Sambuc// CHECK:  bic v0.4s, #0x1           // encoding: [0x20,0x14,0x00,0x6f]
91*f4a2713aSLionel Sambuc// CHECK:  bic v0.4s, #0x1, lsl #8   // encoding: [0x20,0x34,0x00,0x6f]
92*f4a2713aSLionel Sambuc// CHECK:  bic v0.4s, #0x1, lsl #16  // encoding: [0x20,0x54,0x00,0x6f]
93*f4a2713aSLionel Sambuc// CHECK:  bic v0.4s, #0x1, lsl #24  // encoding: [0x20,0x74,0x00,0x6f]
94*f4a2713aSLionel Sambuc// CHECK:  bic v15.4h, #0x1          // encoding: [0x2f,0x94,0x00,0x2f]
95*f4a2713aSLionel Sambuc// CHECK:  bic v16.4h, #0x1, lsl #8  // encoding: [0x30,0xb4,0x00,0x2f]
96*f4a2713aSLionel Sambuc// CHECK:  bic v0.8h, #0x1           // encoding: [0x20,0x94,0x00,0x6f]
97*f4a2713aSLionel Sambuc// CHECK:  bic v31.8h, #0x1, lsl #8  // encoding: [0x3f,0xb4,0x00,0x6f]
98*f4a2713aSLionel Sambuc
99*f4a2713aSLionel Sambuc//----------------------------------------------------------------------
100*f4a2713aSLionel Sambuc// Vector Bitwise OR - immedidate
101*f4a2713aSLionel Sambuc//----------------------------------------------------------------------
102*f4a2713aSLionel Sambuc         orr v0.2s, #1
103*f4a2713aSLionel Sambuc         orr v1.2s, #0
104*f4a2713aSLionel Sambuc         orr v0.2s, #1, lsl #8
105*f4a2713aSLionel Sambuc         orr v0.2s, #1, lsl #16
106*f4a2713aSLionel Sambuc         orr v0.2s, #1, lsl #24
107*f4a2713aSLionel Sambuc         orr v0.4s, #1
108*f4a2713aSLionel Sambuc         orr v0.4s, #1, lsl #8
109*f4a2713aSLionel Sambuc         orr v0.4s, #1, lsl #16
110*f4a2713aSLionel Sambuc         orr v0.4s, #1, lsl #24
111*f4a2713aSLionel Sambuc         orr v31.4h, #1
112*f4a2713aSLionel Sambuc         orr v15.4h, #1, lsl #8
113*f4a2713aSLionel Sambuc         orr v0.8h, #1
114*f4a2713aSLionel Sambuc         orr v16.8h, #1, lsl #8
115*f4a2713aSLionel Sambuc
116*f4a2713aSLionel Sambuc// CHECK:  orr v0.2s, #0x1           // encoding: [0x20,0x14,0x00,0x0f]
117*f4a2713aSLionel Sambuc// CHECK:  orr v1.2s, #0x0           // encoding: [0x01,0x14,0x00,0x0f]
118*f4a2713aSLionel Sambuc// CHECK:  orr v0.2s, #0x1, lsl #8   // encoding: [0x20,0x34,0x00,0x0f]
119*f4a2713aSLionel Sambuc// CHECK:  orr v0.2s, #0x1, lsl #16  // encoding: [0x20,0x54,0x00,0x0f]
120*f4a2713aSLionel Sambuc// CHECK:  orr v0.2s, #0x1, lsl #24  // encoding: [0x20,0x74,0x00,0x0f]
121*f4a2713aSLionel Sambuc// CHECK:  orr v0.4s, #0x1           // encoding: [0x20,0x14,0x00,0x4f]
122*f4a2713aSLionel Sambuc// CHECK:  orr v0.4s, #0x1, lsl #8   // encoding: [0x20,0x34,0x00,0x4f]
123*f4a2713aSLionel Sambuc// CHECK:  orr v0.4s, #0x1, lsl #16  // encoding: [0x20,0x54,0x00,0x4f]
124*f4a2713aSLionel Sambuc// CHECK:  orr v0.4s, #0x1, lsl #24  // encoding: [0x20,0x74,0x00,0x4f]
125*f4a2713aSLionel Sambuc// CHECK:  orr v31.4h, #0x1          // encoding: [0x3f,0x94,0x00,0x0f]
126*f4a2713aSLionel Sambuc// CHECK:  orr v15.4h, #0x1, lsl #8  // encoding: [0x2f,0xb4,0x00,0x0f]
127*f4a2713aSLionel Sambuc// CHECK:  orr v0.8h, #0x1           // encoding: [0x20,0x94,0x00,0x4f]
128*f4a2713aSLionel Sambuc// CHECK:  orr v16.8h, #0x1, lsl #8  // encoding: [0x30,0xb4,0x00,0x4f]
129*f4a2713aSLionel Sambuc
130*f4a2713aSLionel Sambuc//----------------------------------------------------------------------
131*f4a2713aSLionel Sambuc// Vector Move Immediate Masked
132*f4a2713aSLionel Sambuc//----------------------------------------------------------------------
133*f4a2713aSLionel Sambuc         movi v0.2s, #1, msl #8
134*f4a2713aSLionel Sambuc         movi v1.2s, #1, msl #16
135*f4a2713aSLionel Sambuc         movi v0.4s, #1, msl #8
136*f4a2713aSLionel Sambuc         movi v31.4s, #1, msl #16
137*f4a2713aSLionel Sambuc
138*f4a2713aSLionel Sambuc// CHECK:  movi v0.2s, #0x1, msl #8   // encoding: [0x20,0xc4,0x00,0x0f]
139*f4a2713aSLionel Sambuc// CHECK:  movi v1.2s, #0x1, msl #16  // encoding: [0x21,0xd4,0x00,0x0f]
140*f4a2713aSLionel Sambuc// CHECK:  movi v0.4s, #0x1, msl #8   // encoding: [0x20,0xc4,0x00,0x4f]
141*f4a2713aSLionel Sambuc// CHECK:  movi v31.4s, #0x1, msl #16 // encoding: [0x3f,0xd4,0x00,0x4f]
142*f4a2713aSLionel Sambuc
143*f4a2713aSLionel Sambuc//----------------------------------------------------------------------
144*f4a2713aSLionel Sambuc// Vector Move Inverted Immediate Masked
145*f4a2713aSLionel Sambuc//----------------------------------------------------------------------
146*f4a2713aSLionel Sambuc         mvni v1.2s, #0x1, msl #8
147*f4a2713aSLionel Sambuc         mvni v0.2s, #0x1, msl #16
148*f4a2713aSLionel Sambuc         mvni v31.4s, #0x1, msl #8
149*f4a2713aSLionel Sambuc         mvni v0.4s, #0x1, msl #16
150*f4a2713aSLionel Sambuc
151*f4a2713aSLionel Sambuc// CHECK:   mvni v1.2s, #0x1, msl #8  // encoding: [0x21,0xc4,0x00,0x2f]
152*f4a2713aSLionel Sambuc// CHECK:   mvni v0.2s, #0x1, msl #16 // encoding: [0x20,0xd4,0x00,0x2f]
153*f4a2713aSLionel Sambuc// CHECK:   mvni v31.4s, #0x1, msl #8 // encoding: [0x3f,0xc4,0x00,0x6f]
154*f4a2713aSLionel Sambuc// CHECK:   mvni v0.4s, #0x1, msl #16 // encoding: [0x20,0xd4,0x00,0x6f]
155*f4a2713aSLionel Sambuc
156*f4a2713aSLionel Sambuc//----------------------------------------------------------------------
157*f4a2713aSLionel Sambuc// Vector Immediate - per byte
158*f4a2713aSLionel Sambuc//----------------------------------------------------------------------
159*f4a2713aSLionel Sambuc         movi v0.8b, #0
160*f4a2713aSLionel Sambuc         movi v31.8b, #0xff
161*f4a2713aSLionel Sambuc         movi v15.16b, #0xf
162*f4a2713aSLionel Sambuc         movi v31.16b, #0x1f
163*f4a2713aSLionel Sambuc
164*f4a2713aSLionel Sambuc// CHECK:   movi v0.8b, #0x0        // encoding: [0x00,0xe4,0x00,0x0f]
165*f4a2713aSLionel Sambuc// CHECK:   movi v31.8b, #0xff      // encoding: [0xff,0xe7,0x07,0x0f]
166*f4a2713aSLionel Sambuc// CHECK:   movi v15.16b, #0xf      // encoding: [0xef,0xe5,0x00,0x4f]
167*f4a2713aSLionel Sambuc// CHECK:   movi v31.16b, #0x1f     // encoding: [0xff,0xe7,0x00,0x4f]
168*f4a2713aSLionel Sambuc
169*f4a2713aSLionel Sambuc//----------------------------------------------------------------------
170*f4a2713aSLionel Sambuc// Vector Move Immediate - bytemask, per doubleword
171*f4a2713aSLionel Sambuc//---------------------------------------------------------------------
172*f4a2713aSLionel Sambuc         movi v0.2d, #0xff00ff00ff00ff00
173*f4a2713aSLionel Sambuc
174*f4a2713aSLionel Sambuc// CHECK: movi v0.2d, #0xff00ff00ff00ff00 // encoding: [0x40,0xe5,0x05,0x6f]
175*f4a2713aSLionel Sambuc
176*f4a2713aSLionel Sambuc//----------------------------------------------------------------------
177*f4a2713aSLionel Sambuc// Vector Move Immediate - bytemask, one doubleword
178*f4a2713aSLionel Sambuc//----------------------------------------------------------------------
179*f4a2713aSLionel Sambuc         movi d0, #0xff00ff00ff00ff00
180*f4a2713aSLionel Sambuc
181*f4a2713aSLionel Sambuc// CHECK: movi d0,  #0xff00ff00ff00ff00 // encoding: [0x40,0xe5,0x05,0x2f]
182*f4a2713aSLionel Sambuc
183*f4a2713aSLionel Sambuc//----------------------------------------------------------------------
184*f4a2713aSLionel Sambuc// Vector Floating Point Move Immediate
185*f4a2713aSLionel Sambuc//----------------------------------------------------------------------
186*f4a2713aSLionel Sambuc         fmov v1.2s, #1.0
187*f4a2713aSLionel Sambuc         fmov v15.4s, #1.0
188*f4a2713aSLionel Sambuc         fmov v31.2d, #1.0
189*f4a2713aSLionel Sambuc
190*f4a2713aSLionel Sambuc// CHECK:  fmov v1.2s, #1.00000000     // encoding: [0x01,0xf6,0x03,0x0f]
191*f4a2713aSLionel Sambuc// CHECK:  fmov v15.4s, #1.00000000    // encoding: [0x0f,0xf6,0x03,0x4f]
192*f4a2713aSLionel Sambuc// CHECK:  fmov v31.2d, #1.00000000    // encoding: [0x1f,0xf6,0x03,0x6f]
193*f4a2713aSLionel Sambuc
194*f4a2713aSLionel Sambuc
195*f4a2713aSLionel Sambuc//----------------------------------------------------------------------
196*f4a2713aSLionel Sambuc// Vector Move -  register
197*f4a2713aSLionel Sambuc//----------------------------------------------------------------------
198*f4a2713aSLionel Sambuc
199*f4a2713aSLionel Sambuc      // FIXME: these should all print with the "mov" syntax.
200*f4a2713aSLionel Sambuc      mov v0.8b, v31.8b
201*f4a2713aSLionel Sambuc      mov v15.16b, v16.16b
202*f4a2713aSLionel Sambuc      orr v0.8b, v31.8b, v31.8b
203*f4a2713aSLionel Sambuc      orr v15.16b, v16.16b, v16.16b
204*f4a2713aSLionel Sambuc
205*f4a2713aSLionel Sambuc// CHECK:   orr v0.8b, v31.8b, v31.8b      // encoding: [0xe0,0x1f,0xbf,0x0e]
206*f4a2713aSLionel Sambuc// CHECK:   orr v15.16b, v16.16b, v16.16b  // encoding: [0x0f,0x1e,0xb0,0x4e]
207*f4a2713aSLionel Sambuc// CHECK:   orr v0.8b, v31.8b, v31.8b      // encoding: [0xe0,0x1f,0xbf,0x0e]
208*f4a2713aSLionel Sambuc// CHECK:   orr v15.16b, v16.16b, v16.16b  // encoding: [0x0f,0x1e,0xb0,0x4e]
209*f4a2713aSLionel Sambuc
210