1 // RUN: llvm-mc -triple aarch64-none-linux-gnu -mattr=+neon -show-encoding < %s | FileCheck %s
2 // RUN: llvm-mc -triple arm64-none-linux-gnu -mattr=+neon -show-encoding < %s | FileCheck %s
4 // Check that the assembler can handle the documented syntax for AArch64
7 //----------------------------------------------------------------------
8 // Vector Move Immediate Shifted
9 //----------------------------------------------------------------------
12 movi v15.2s, #1, lsl #8
13 movi v16.2s, #1, lsl #16
14 movi v31.2s, #1, lsl #24
16 movi v0.4s, #1, lsl #8
17 movi v0.4s, #1, lsl #16
18 movi v0.4s, #1, lsl #24
20 movi v0.4h, #1, lsl #8
22 movi v0.8h, #1, lsl #8
24 // CHECK: movi v0.2s, #{{0x1|1}} // encoding: [0x20,0x04,0x00,0x0f]
25 // CHECK: movi v1.2s, #{{0x0|0}} // encoding: [0x01,0x04,0x00,0x0f]
26 // CHECK: movi v15.2s, #{{0x1|1}}, lsl #8 // encoding: [0x2f,0x24,0x00,0x0f]
27 // CHECK: movi v16.2s, #{{0x1|1}}, lsl #16 // encoding: [0x30,0x44,0x00,0x0f]
28 // CHECK: movi v31.2s, #{{0x1|1}}, lsl #24 // encoding: [0x3f,0x64,0x00,0x0f]
29 // CHECK: movi v0.4s, #{{0x1|1}} // encoding: [0x20,0x04,0x00,0x4f]
30 // CHECK: movi v0.4s, #{{0x1|1}}, lsl #8 // encoding: [0x20,0x24,0x00,0x4f]
31 // CHECK: movi v0.4s, #{{0x1|1}}, lsl #16 // encoding: [0x20,0x44,0x00,0x4f]
32 // CHECK: movi v0.4s, #{{0x1|1}}, lsl #24 // encoding: [0x20,0x64,0x00,0x4f]
33 // CHECK: movi v0.4h, #{{0x1|1}} // encoding: [0x20,0x84,0x00,0x0f]
34 // CHECK: movi v0.4h, #{{0x1|1}}, lsl #8 // encoding: [0x20,0xa4,0x00,0x0f]
35 // CHECK: movi v0.8h, #{{0x1|1}} // encoding: [0x20,0x84,0x00,0x4f]
36 // CHECK: movi v0.8h, #{{0x1|1}}, lsl #8 // encoding: [0x20,0xa4,0x00,0x4f]
38 //----------------------------------------------------------------------
39 // Vector Move Inverted Immediate Shifted
40 //----------------------------------------------------------------------
43 mvni v0.2s, #1, lsl #8
44 mvni v0.2s, #1, lsl #16
45 mvni v0.2s, #1, lsl #24
47 mvni v15.4s, #1, lsl #8
48 mvni v16.4s, #1, lsl #16
49 mvni v31.4s, #1, lsl #24
51 mvni v0.4h, #1, lsl #8
53 mvni v0.8h, #1, lsl #8
55 // CHECK: mvni v0.2s, #{{0x1|1}} // encoding: [0x20,0x04,0x00,0x2f]
56 // CHECK: mvni v1.2s, #{{0x0|0}} // encoding: [0x01,0x04,0x00,0x2f]
57 // CHECK: mvni v0.2s, #{{0x1|1}}, lsl #8 // encoding: [0x20,0x24,0x00,0x2f]
58 // CHECK: mvni v0.2s, #{{0x1|1}}, lsl #16 // encoding: [0x20,0x44,0x00,0x2f]
59 // CHECK: mvni v0.2s, #{{0x1|1}}, lsl #24 // encoding: [0x20,0x64,0x00,0x2f]
60 // CHECK: mvni v0.4s, #{{0x1|1}} // encoding: [0x20,0x04,0x00,0x6f]
61 // CHECK: mvni v15.4s, #{{0x1|1}}, lsl #8 // encoding: [0x2f,0x24,0x00,0x6f]
62 // CHECK: mvni v16.4s, #{{0x1|1}}, lsl #16 // encoding: [0x30,0x44,0x00,0x6f]
63 // CHECK: mvni v31.4s, #{{0x1|1}}, lsl #24 // encoding: [0x3f,0x64,0x00,0x6f]
64 // CHECK: mvni v0.4h, #{{0x1|1}} // encoding: [0x20,0x84,0x00,0x2f]
65 // CHECK: mvni v0.4h, #{{0x1|1}}, lsl #8 // encoding: [0x20,0xa4,0x00,0x2f]
66 // CHECK: mvni v0.8h, #{{0x1|1}} // encoding: [0x20,0x84,0x00,0x6f]
67 // CHECK: mvni v0.8h, #{{0x1|1}}, lsl #8 // encoding: [0x20,0xa4,0x00,0x6f]
69 //----------------------------------------------------------------------
70 // Vector Bitwise Bit Clear (AND NOT) - immediate
71 //----------------------------------------------------------------------
75 bic v0.2s, #1, lsl #16
76 bic v0.2s, #1, lsl #24
79 bic v0.4s, #1, lsl #16
80 bic v0.4s, #1, lsl #24
82 bic v16.4h, #1, lsl #8
84 bic v31.8h, #1, lsl #8
86 // CHECK: bic v0.2s, #{{0x1|1}} // encoding: [0x20,0x14,0x00,0x2f]
87 // CHECK: bic v1.2s, #{{0x0|0}} // encoding: [0x01,0x14,0x00,0x2f]
88 // CHECK: bic v0.2s, #{{0x1|1}}, lsl #8 // encoding: [0x20,0x34,0x00,0x2f]
89 // CHECK: bic v0.2s, #{{0x1|1}}, lsl #16 // encoding: [0x20,0x54,0x00,0x2f]
90 // CHECK: bic v0.2s, #{{0x1|1}}, lsl #24 // encoding: [0x20,0x74,0x00,0x2f]
91 // CHECK: bic v0.4s, #{{0x1|1}} // encoding: [0x20,0x14,0x00,0x6f]
92 // CHECK: bic v0.4s, #{{0x1|1}}, lsl #8 // encoding: [0x20,0x34,0x00,0x6f]
93 // CHECK: bic v0.4s, #{{0x1|1}}, lsl #16 // encoding: [0x20,0x54,0x00,0x6f]
94 // CHECK: bic v0.4s, #{{0x1|1}}, lsl #24 // encoding: [0x20,0x74,0x00,0x6f]
95 // CHECK: bic v15.4h, #{{0x1|1}} // encoding: [0x2f,0x94,0x00,0x2f]
96 // CHECK: bic v16.4h, #{{0x1|1}}, lsl #8 // encoding: [0x30,0xb4,0x00,0x2f]
97 // CHECK: bic v0.8h, #{{0x1|1}} // encoding: [0x20,0x94,0x00,0x6f]
98 // CHECK: bic v31.8h, #{{0x1|1}}, lsl #8 // encoding: [0x3f,0xb4,0x00,0x6f]
100 //----------------------------------------------------------------------
101 // Vector Bitwise OR - immedidate
102 //----------------------------------------------------------------------
105 orr v0.2s, #1, lsl #8
106 orr v0.2s, #1, lsl #16
107 orr v0.2s, #1, lsl #24
109 orr v0.4s, #1, lsl #8
110 orr v0.4s, #1, lsl #16
111 orr v0.4s, #1, lsl #24
113 orr v15.4h, #1, lsl #8
115 orr v16.8h, #1, lsl #8
117 // CHECK: orr v0.2s, #{{0x1|1}} // encoding: [0x20,0x14,0x00,0x0f]
118 // CHECK: orr v1.2s, #{{0x0|0}} // encoding: [0x01,0x14,0x00,0x0f]
119 // CHECK: orr v0.2s, #{{0x1|1}}, lsl #8 // encoding: [0x20,0x34,0x00,0x0f]
120 // CHECK: orr v0.2s, #{{0x1|1}}, lsl #16 // encoding: [0x20,0x54,0x00,0x0f]
121 // CHECK: orr v0.2s, #{{0x1|1}}, lsl #24 // encoding: [0x20,0x74,0x00,0x0f]
122 // CHECK: orr v0.4s, #{{0x1|1}} // encoding: [0x20,0x14,0x00,0x4f]
123 // CHECK: orr v0.4s, #{{0x1|1}}, lsl #8 // encoding: [0x20,0x34,0x00,0x4f]
124 // CHECK: orr v0.4s, #{{0x1|1}}, lsl #16 // encoding: [0x20,0x54,0x00,0x4f]
125 // CHECK: orr v0.4s, #{{0x1|1}}, lsl #24 // encoding: [0x20,0x74,0x00,0x4f]
126 // CHECK: orr v31.4h, #{{0x1|1}} // encoding: [0x3f,0x94,0x00,0x0f]
127 // CHECK: orr v15.4h, #{{0x1|1}}, lsl #8 // encoding: [0x2f,0xb4,0x00,0x0f]
128 // CHECK: orr v0.8h, #{{0x1|1}} // encoding: [0x20,0x94,0x00,0x4f]
129 // CHECK: orr v16.8h, #{{0x1|1}}, lsl #8 // encoding: [0x30,0xb4,0x00,0x4f]
131 //----------------------------------------------------------------------
132 // Vector Move Immediate Masked
133 //----------------------------------------------------------------------
134 movi v0.2s, #1, msl #8
135 movi v1.2s, #1, msl #16
136 movi v0.4s, #1, msl #8
137 movi v31.4s, #1, msl #16
139 // CHECK: movi v0.2s, #{{0x1|1}}, msl #8 // encoding: [0x20,0xc4,0x00,0x0f]
140 // CHECK: movi v1.2s, #{{0x1|1}}, msl #16 // encoding: [0x21,0xd4,0x00,0x0f]
141 // CHECK: movi v0.4s, #{{0x1|1}}, msl #8 // encoding: [0x20,0xc4,0x00,0x4f]
142 // CHECK: movi v31.4s, #{{0x1|1}}, msl #16 // encoding: [0x3f,0xd4,0x00,0x4f]
144 //----------------------------------------------------------------------
145 // Vector Move Inverted Immediate Masked
146 //----------------------------------------------------------------------
147 mvni v1.2s, #0x1, msl #8
148 mvni v0.2s, #0x1, msl #16
149 mvni v31.4s, #0x1, msl #8
150 mvni v0.4s, #0x1, msl #16
152 // CHECK: mvni v1.2s, #{{0x1|1}}, msl #8 // encoding: [0x21,0xc4,0x00,0x2f]
153 // CHECK: mvni v0.2s, #{{0x1|1}}, msl #16 // encoding: [0x20,0xd4,0x00,0x2f]
154 // CHECK: mvni v31.4s, #{{0x1|1}}, msl #8 // encoding: [0x3f,0xc4,0x00,0x6f]
155 // CHECK: mvni v0.4s, #{{0x1|1}}, msl #16 // encoding: [0x20,0xd4,0x00,0x6f]
157 //----------------------------------------------------------------------
158 // Vector Immediate - per byte
159 //----------------------------------------------------------------------
165 // CHECK: movi v0.8b, #{{0x0|0}} // encoding: [0x00,0xe4,0x00,0x0f]
166 // CHECK: movi v31.8b, #{{0xff|255}} // encoding: [0xff,0xe7,0x07,0x0f]
167 // CHECK: movi v15.16b, #{{0xf|15}} // encoding: [0xef,0xe5,0x00,0x4f]
168 // CHECK: movi v31.16b, #{{0x1f|31}} // encoding: [0xff,0xe7,0x00,0x4f]
170 //----------------------------------------------------------------------
171 // Vector Move Immediate - bytemask, per doubleword
172 //---------------------------------------------------------------------
173 movi v0.2d, #0xff00ff00ff00ff00
175 // CHECK: movi v0.2d, #0xff00ff00ff00ff00 // encoding: [0x40,0xe5,0x05,0x6f]
177 //----------------------------------------------------------------------
178 // Vector Move Immediate - bytemask, one doubleword
179 //----------------------------------------------------------------------
180 movi d0, #0xff00ff00ff00ff00
182 // CHECK: movi d0, #0xff00ff00ff00ff00 // encoding: [0x40,0xe5,0x05,0x2f]
184 //----------------------------------------------------------------------
185 // Vector Floating Point Move Immediate
186 //----------------------------------------------------------------------
191 // CHECK: fmov v1.2s, #{{1.00000000|1.000000e\+00}} // encoding: [0x01,0xf6,0x03,0x0f]
192 // CHECK: fmov v15.4s, #{{1.00000000|1.000000e\+00}} // encoding: [0x0f,0xf6,0x03,0x4f]
193 // CHECK: fmov v31.2d, #{{1.00000000|1.000000e\+00}} // encoding: [0x1f,0xf6,0x03,0x6f]
196 //----------------------------------------------------------------------
197 // Vector Move - register
198 //----------------------------------------------------------------------
202 orr v0.8b, v31.8b, v31.8b
203 orr v15.16b, v16.16b, v16.16b
205 // CHECK: mov v0.8b, v31.8b // encoding: [0xe0,0x1f,0xbf,0x0e]
206 // CHECK: mov v15.16b, v16.16b // encoding: [0x0f,0x1e,0xb0,0x4e]
207 // CHECK: mov v0.8b, v31.8b // encoding: [0xe0,0x1f,0xbf,0x0e]
208 // CHECK: mov v15.16b, v16.16b // encoding: [0x0f,0x1e,0xb0,0x4e]