1 // Copyright 2015, VIXL authors
2 // All rights reserved.
3 //
4 // Redistribution and use in source and binary forms, with or without
5 // modification, are permitted provided that the following conditions are met:
6 //
7 // * Redistributions of source code must retain the above copyright notice,
8 // this list of conditions and the following disclaimer.
9 // * Redistributions in binary form must reproduce the above copyright notice,
10 // this list of conditions and the following disclaimer in the documentation
11 // and/or other materials provided with the distribution.
12 // * Neither the name of ARM Limited nor the names of its contributors may be
13 // used to endorse or promote products derived from this software without
14 // specific prior written permission.
15 //
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS CONTRIBUTORS "AS IS" AND
17 // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 // WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 // DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
20 // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22 // SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
23 // CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24 // OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26
27
28 #include <cstdio>
29 #include <cstring>
30 #include <string>
31
32 #include "test-runner.h"
33
34 #include "aarch64/disasm-aarch64.h"
35 #include "aarch64/macro-assembler-aarch64.h"
36 #include "test-disasm-aarch64.h"
37
38 namespace vixl {
39 namespace aarch64 {
40
TEST(bootstrap)41 TEST(bootstrap) {
42 SETUP();
43
44 // Instructions generated by C compiler, disassembled by objdump, and
45 // reformatted to suit our disassembly style.
46 COMPARE(dci(0xa9ba7bfd), "stp x29, x30, [sp, #-96]!");
47 COMPARE(dci(0x910003fd), "mov x29, sp");
48 COMPARE(dci(0x9100e3a0), "add x0, x29, #0x38 (56)");
49 COMPARE(dci(0xb900001f), "str wzr, [x0]");
50 COMPARE(dci(0x528000e1), "mov w1, #0x7");
51 COMPARE(dci(0xb9001c01), "str w1, [x0, #28]");
52 COMPARE(dci(0x390043a0), "strb w0, [x29, #16]");
53 COMPARE(dci(0x790027a0), "strh w0, [x29, #18]");
54 COMPARE(dci(0xb9400400), "ldr w0, [x0, #4]");
55 COMPARE(dci(0x0b000021), "add w1, w1, w0");
56 COMPARE(dci(0x531b6800), "lsl w0, w0, #5");
57 COMPARE(dci(0x521e0400), "eor w0, w0, #0xc");
58 COMPARE(dci(0x72af0f00), "movk w0, #0x7878, lsl #16");
59 COMPARE(dci(0xd360fc00), "lsr x0, x0, #32");
60 COMPARE(dci(0x13037c01), "asr w1, w0, #3");
61 COMPARE(dci(0x4b000021), "sub w1, w1, w0");
62 COMPARE(dci(0x2a0103e0), "mov w0, w1");
63 COMPARE(dci(0x93407c00), "sxtw x0, w0");
64 COMPARE(dci(0x2a000020), "orr w0, w1, w0");
65 COMPARE(dci(0xa8c67bfd), "ldp x29, x30, [sp], #96");
66
67 CLEANUP();
68 }
69
70
TEST(mov_mvn)71 TEST(mov_mvn) {
72 SETUP();
73
74 COMPARE_MACRO(Mov(w0, Operand(0x1234)), "mov w0, #0x1234");
75 COMPARE_MACRO(Mov(x1, Operand(0x1234)), "mov x1, #0x1234");
76 COMPARE_MACRO(Mov(w2, Operand(w3)), "mov w2, w3");
77 COMPARE_MACRO(Mov(x4, Operand(x5)), "mov x4, x5");
78 COMPARE_MACRO(Mov(w6, Operand(w7, LSL, 5)), "lsl w6, w7, #5");
79 COMPARE_MACRO(Mov(x8, Operand(x9, ASR, 42)), "asr x8, x9, #42");
80 COMPARE_MACRO(Mov(w10, Operand(w11, UXTB)), "uxtb w10, w11");
81 COMPARE_MACRO(Mov(x12, Operand(x13, UXTB, 1)), "ubfiz x12, x13, #1, #8");
82 COMPARE_MACRO(Mov(w14, Operand(w15, SXTH, 2)), "sbfiz w14, w15, #2, #16");
83 COMPARE_MACRO(Mov(x16, Operand(x17, SXTW, 3)), "sbfiz x16, x17, #3, #32");
84
85 COMPARE_MACRO(Mvn(w0, Operand(0x101)), "mov w0, #0xfffffefe");
86 COMPARE_MACRO(Mvn(x1, Operand(0xfff1)), "mov x1, #0xffffffffffff000e");
87 COMPARE_MACRO(Mvn(w2, Operand(w3)), "mvn w2, w3");
88 COMPARE_MACRO(Mvn(x4, Operand(x5)), "mvn x4, x5");
89 COMPARE_MACRO(Mvn(w6, Operand(w7, LSL, 12)), "mvn w6, w7, lsl #12");
90 COMPARE_MACRO(Mvn(x8, Operand(x9, ASR, 63)), "mvn x8, x9, asr #63");
91
92 CLEANUP();
93 }
94
TEST(mvn_macro)95 TEST(mvn_macro) {
96 SETUP();
97
98 // Mvn uses the destination register as a scratch if it can. This only occurs
99 // when `operand.IsExtendedRegister()`.
100 COMPARE_MACRO(Mvn(x0, Operand(w1, SXTW)),
101 "sxtw x0, w1\n"
102 "mvn x0, x0");
103 COMPARE_MACRO(Mvn(x0, Operand(x0, SXTW)),
104 "sxtw x0, w0\n"
105 "mvn x0, x0");
106 }
107
108
TEST(move_immediate)109 TEST(move_immediate) {
110 SETUP();
111
112 COMPARE(movz(w0, 0x1234), "mov w0, #0x1234");
113 COMPARE(movz(x1, 0xabcd0000), "mov x1, #0xabcd0000");
114 COMPARE(movz(x2, 0x555500000000), "mov x2, #0x555500000000");
115 COMPARE(movz(x3, 0xaaaa000000000000), "mov x3, #0xaaaa000000000000");
116 COMPARE(movz(x4, 0xabcd, 16), "mov x4, #0xabcd0000");
117 COMPARE(movz(x5, 0x5555, 32), "mov x5, #0x555500000000");
118 COMPARE(movz(x6, 0xaaaa, 48), "mov x6, #0xaaaa000000000000");
119
120 COMPARE(movk(w7, 0x1234), "movk w7, #0x1234");
121 COMPARE(movk(x8, 0xabcd0000), "movk x8, #0xabcd, lsl #16");
122 COMPARE(movk(x9, 0x555500000000), "movk x9, #0x5555, lsl #32");
123 COMPARE(movk(x10, 0xaaaa000000000000), "movk x10, #0xaaaa, lsl #48");
124 COMPARE(movk(w11, 0xabcd, 16), "movk w11, #0xabcd, lsl #16");
125 COMPARE(movk(x12, 0x5555, 32), "movk x12, #0x5555, lsl #32");
126 COMPARE(movk(x13, 0xaaaa, 48), "movk x13, #0xaaaa, lsl #48");
127
128 COMPARE(movn(w14, 0x1234), "mov w14, #0xffffedcb");
129 COMPARE(movn(x15, 0xabcd0000), "mov x15, #0xffffffff5432ffff");
130 COMPARE(movn(x16, 0x555500000000), "mov x16, #0xffffaaaaffffffff");
131 COMPARE(movn(x17, 0xaaaa000000000000), "mov x17, #0x5555ffffffffffff");
132 COMPARE(movn(w18, 0xabcd, 16), "mov w18, #0x5432ffff");
133 COMPARE(movn(x19, 0x5555, 32), "mov x19, #0xffffaaaaffffffff");
134 COMPARE(movn(x20, 0xaaaa, 48), "mov x20, #0x5555ffffffffffff");
135
136 COMPARE(mov(w14, 0x1234), "mov w14, #0x1234");
137 COMPARE(mov(x15, 0xabcd0000), "mov x15, #0xabcd0000");
138 COMPARE(mov(x16, 0xaaaa000000000000), "mov x16, #0xaaaa000000000000");
139 COMPARE(mov(w17, 0xaaaaffff), "mov w17, #0xaaaaffff");
140 COMPARE(mov(x18, 0xffffaaaaffffffff), "mov x18, #0xffffaaaaffffffff");
141 COMPARE(mov(x19, 0xffffffffffffffff), "mov x19, #0xffffffffffffffff");
142 COMPARE(mov(x20, 0xc001c001c001c001), "mov x20, #0xc001c001c001c001");
143 COMPARE(mov(sp, 0xfefefefefefefefe), "mov sp, #0xfefefefefefefefe");
144
145 COMPARE(movk(w21, 0), "movk w21, #0x0");
146 COMPARE(movk(x22, 0, 0), "movk x22, #0x0");
147 COMPARE(movk(w23, 0, 16), "movk w23, #0x0, lsl #16");
148 COMPARE(movk(x24, 0, 32), "movk x24, #0x0, lsl #32");
149 COMPARE(movk(x25, 0, 48), "movk x25, #0x0, lsl #48");
150
151 COMPARE(movz(x26, 0, 48), "movz x26, #0x0");
152 COMPARE(movn(x27, 0, 48), "movn x27, #0x0");
153 COMPARE(movn(w28, 0xffff), "movn w28, #0xffff");
154
155 CLEANUP();
156 }
157
158
TEST(move_immediate_2)159 TEST(move_immediate_2) {
160 SETUP();
161
162 // Move instructions expected for certain immediates. This is really a macro
163 // assembler test, to ensure it generates immediates efficiently.
164 COMPARE_MACRO(Mov(w0, 0), "mov w0, #0x0");
165 COMPARE_MACRO(Mov(w0, 0x0000ffff), "mov w0, #0xffff");
166 COMPARE_MACRO(Mov(w0, 0x00010000), "mov w0, #0x10000");
167 COMPARE_MACRO(Mov(w0, 0xffff0000), "mov w0, #0xffff0000");
168 COMPARE_MACRO(Mov(w0, 0x0001ffff), "mov w0, #0x1ffff");
169 COMPARE_MACRO(Mov(w0, 0xffff8000), "mov w0, #0xffff8000");
170 COMPARE_MACRO(Mov(w0, 0xfffffffe), "mov w0, #0xfffffffe");
171 COMPARE_MACRO(Mov(w0, 0xffffffff), "mov w0, #0xffffffff");
172 COMPARE_MACRO(Mov(w0, 0x00ffff00), "mov w0, #0xffff00");
173 COMPARE_MACRO(Mov(w0, 0xfffe7fff), "mov w0, #0xfffe7fff");
174 COMPARE_MACRO(Mov(w0, 0xfffeffff), "mov w0, #0xfffeffff");
175 COMPARE_MACRO(Mov(w0, 0xffff7fff), "mov w0, #0xffff7fff");
176
177 COMPARE_MACRO(Mov(x0, 0), "mov x0, #0x0");
178 COMPARE_MACRO(Mov(x0, 0x0000ffff), "mov x0, #0xffff");
179 COMPARE_MACRO(Mov(x0, 0x00010000), "mov x0, #0x10000");
180 COMPARE_MACRO(Mov(x0, 0xffff0000), "mov x0, #0xffff0000");
181 COMPARE_MACRO(Mov(x0, 0x0001ffff), "mov x0, #0x1ffff");
182 COMPARE_MACRO(Mov(x0, 0xffff8000), "mov x0, #0xffff8000");
183 COMPARE_MACRO(Mov(x0, 0xfffffffe), "mov x0, #0xfffffffe");
184 COMPARE_MACRO(Mov(x0, 0xffffffff), "mov x0, #0xffffffff");
185 COMPARE_MACRO(Mov(x0, 0x00ffff00), "mov x0, #0xffff00");
186 COMPARE_MACRO(Mov(x0, 0xffff000000000000), "mov x0, #0xffff000000000000");
187 COMPARE_MACRO(Mov(x0, 0x0000ffff00000000), "mov x0, #0xffff00000000");
188 COMPARE_MACRO(Mov(x0, 0x00000000ffff0000), "mov x0, #0xffff0000");
189 COMPARE_MACRO(Mov(x0, 0xffffffffffff0000), "mov x0, #0xffffffffffff0000");
190 COMPARE_MACRO(Mov(x0, 0xffffffff0000ffff), "mov x0, #0xffffffff0000ffff");
191 COMPARE_MACRO(Mov(x0, 0xffff0000ffffffff), "mov x0, #0xffff0000ffffffff");
192 COMPARE_MACRO(Mov(x0, 0x0000ffffffffffff), "mov x0, #0xffffffffffff");
193 COMPARE_MACRO(Mov(x0, 0xfffe7fffffffffff), "mov x0, #0xfffe7fffffffffff");
194 COMPARE_MACRO(Mov(x0, 0xfffeffffffffffff), "mov x0, #0xfffeffffffffffff");
195 COMPARE_MACRO(Mov(x0, 0xffff7fffffffffff), "mov x0, #0xffff7fffffffffff");
196 COMPARE_MACRO(Mov(x0, 0xfffffffe7fffffff), "mov x0, #0xfffffffe7fffffff");
197 COMPARE_MACRO(Mov(x0, 0xfffffffeffffffff), "mov x0, #0xfffffffeffffffff");
198 COMPARE_MACRO(Mov(x0, 0xffffffff7fffffff), "mov x0, #0xffffffff7fffffff");
199 COMPARE_MACRO(Mov(x0, 0xfffffffffffe7fff), "mov x0, #0xfffffffffffe7fff");
200 COMPARE_MACRO(Mov(x0, 0xfffffffffffeffff), "mov x0, #0xfffffffffffeffff");
201 COMPARE_MACRO(Mov(x0, 0xffffffffffff7fff), "mov x0, #0xffffffffffff7fff");
202 COMPARE_MACRO(Mov(x0, 0xffffffffffffffff), "mov x0, #0xffffffffffffffff");
203
204 COMPARE_MACRO(Movk(w0, 0x1234, 0), "movk w0, #0x1234");
205 COMPARE_MACRO(Movk(x1, 0x2345, 0), "movk x1, #0x2345");
206 COMPARE_MACRO(Movk(w2, 0x3456, 16), "movk w2, #0x3456, lsl #16");
207 COMPARE_MACRO(Movk(x3, 0x4567, 16), "movk x3, #0x4567, lsl #16");
208 COMPARE_MACRO(Movk(x4, 0x5678, 32), "movk x4, #0x5678, lsl #32");
209 COMPARE_MACRO(Movk(x5, 0x6789, 48), "movk x5, #0x6789, lsl #48");
210
211 CLEANUP();
212 }
213
214
TEST(add_immediate)215 TEST(add_immediate) {
216 SETUP();
217
218 COMPARE(add(w0, w1, Operand(0xff)), "add w0, w1, #0xff (255)");
219 COMPARE(add(x2, x3, Operand(0x3ff)), "add x2, x3, #0x3ff (1023)");
220 COMPARE(add(w4, w5, Operand(0xfff)), "add w4, w5, #0xfff (4095)");
221 COMPARE(add(x6, x7, Operand(0x1000)), "add x6, x7, #0x1000 (4096)");
222 COMPARE(add(w8, w9, Operand(0xff000)), "add w8, w9, #0xff000 (1044480)");
223 COMPARE(add(x10, x11, Operand(0x3ff000)),
224 "add x10, x11, #0x3ff000 (4190208)");
225 COMPARE(add(w12, w13, Operand(0xfff000)),
226 "add w12, w13, #0xfff000 (16773120)");
227 COMPARE(adds(w14, w15, Operand(0xff)), "adds w14, w15, #0xff (255)");
228 COMPARE(adds(x16, x17, Operand(0xaa000)), "adds x16, x17, #0xaa000 (696320)");
229
230 COMPARE(cmn(w18, Operand(0xff)), "cmn w18, #0xff (255)");
231 COMPARE(cmn(x19, Operand(0xff000)), "cmn x19, #0xff000 (1044480)");
232 COMPARE(add(w0, wsp, Operand(0)), "mov w0, wsp");
233 COMPARE(add(sp, x0, Operand(0)), "mov sp, x0");
234
235 COMPARE(add(w1, wsp, Operand(8)), "add w1, wsp, #0x8 (8)");
236 COMPARE(add(x2, sp, Operand(16)), "add x2, sp, #0x10 (16)");
237 COMPARE(add(wsp, wsp, Operand(42)), "add wsp, wsp, #0x2a (42)");
238 COMPARE(cmn(sp, Operand(24)), "cmn sp, #0x18 (24)");
239 COMPARE(adds(wzr, wsp, Operand(9)), "cmn wsp, #0x9 (9)");
240
241 // Instructions in the add/sub immediate space, but unallocated due to shift
242 // value out of range.
243 COMPARE(dci(0x11800400), "unallocated (Unallocated)");
244 COMPARE(dci(0x11c00400), "unallocated (Unallocated)");
245
246 CLEANUP();
247 }
248
249
TEST(sub_immediate)250 TEST(sub_immediate) {
251 SETUP();
252
253 COMPARE(sub(w0, w1, Operand(0xff)), "sub w0, w1, #0xff (255)");
254 COMPARE(sub(x2, x3, Operand(0x3ff)), "sub x2, x3, #0x3ff (1023)");
255 COMPARE(sub(w4, w5, Operand(0xfff)), "sub w4, w5, #0xfff (4095)");
256 COMPARE(sub(x6, x7, Operand(0x1000)), "sub x6, x7, #0x1000 (4096)");
257 COMPARE(sub(w8, w9, Operand(0xff000)), "sub w8, w9, #0xff000 (1044480)");
258 COMPARE(sub(x10, x11, Operand(0x3ff000)),
259 "sub x10, x11, #0x3ff000 (4190208)");
260 COMPARE(sub(w12, w13, Operand(0xfff000)),
261 "sub w12, w13, #0xfff000 (16773120)");
262 COMPARE(subs(w14, w15, Operand(0xff)), "subs w14, w15, #0xff (255)");
263 COMPARE(subs(x16, x17, Operand(0xaa000)), "subs x16, x17, #0xaa000 (696320)");
264 COMPARE(cmp(w18, Operand(0xff)), "cmp w18, #0xff (255)");
265 COMPARE(cmp(x19, Operand(0xff000)), "cmp x19, #0xff000 (1044480)");
266
267 COMPARE(sub(w1, wsp, Operand(8)), "sub w1, wsp, #0x8 (8)");
268 COMPARE(sub(x2, sp, Operand(16)), "sub x2, sp, #0x10 (16)");
269 COMPARE(sub(wsp, wsp, Operand(42)), "sub wsp, wsp, #0x2a (42)");
270 COMPARE(cmp(sp, Operand(24)), "cmp sp, #0x18 (24)");
271 COMPARE(subs(wzr, wsp, Operand(9)), "cmp wsp, #0x9 (9)");
272
273 CLEANUP();
274 }
275
276
TEST(add_shifted)277 TEST(add_shifted) {
278 SETUP();
279
280 COMPARE(add(w0, w1, Operand(w2)), "add w0, w1, w2");
281 COMPARE(add(x3, x4, Operand(x5)), "add x3, x4, x5");
282 COMPARE(add(w6, w7, Operand(w8, LSL, 1)), "add w6, w7, w8, lsl #1");
283 COMPARE(add(x9, x10, Operand(x11, LSL, 2)), "add x9, x10, x11, lsl #2");
284 COMPARE(add(w12, w13, Operand(w14, LSR, 3)), "add w12, w13, w14, lsr #3");
285 COMPARE(add(x15, x16, Operand(x17, LSR, 4)), "add x15, x16, x17, lsr #4");
286 COMPARE(add(w18, w19, Operand(w20, ASR, 5)), "add w18, w19, w20, asr #5");
287 COMPARE(add(x21, x22, Operand(x23, ASR, 6)), "add x21, x22, x23, asr #6");
288 COMPARE(cmn(w24, Operand(w25)), "cmn w24, w25");
289 COMPARE(cmn(x26, Operand(x27, LSL, 63)), "cmn x26, x27, lsl #63");
290
291 COMPARE(add(x0, sp, Operand(x1)), "add x0, sp, x1");
292 COMPARE(add(w2, wsp, Operand(w3)), "add w2, wsp, w3");
293 COMPARE(add(x4, sp, Operand(x5, LSL, 1)), "add x4, sp, x5, lsl #1");
294 COMPARE(add(x4, xzr, Operand(x5, LSL, 1)), "add x4, xzr, x5, lsl #1");
295 COMPARE(add(w6, wsp, Operand(w7, LSL, 3)), "add w6, wsp, w7, lsl #3");
296 COMPARE(adds(xzr, sp, Operand(x8, LSL, 4)), "cmn sp, x8, lsl #4");
297 COMPARE(adds(xzr, xzr, Operand(x8, LSL, 5)), "cmn xzr, x8, lsl #5");
298
299 CLEANUP();
300 }
301
302
TEST(sub_shifted)303 TEST(sub_shifted) {
304 SETUP();
305
306 COMPARE(sub(w0, w1, Operand(w2)), "sub w0, w1, w2");
307 COMPARE(sub(x3, x4, Operand(x5)), "sub x3, x4, x5");
308 COMPARE(sub(w6, w7, Operand(w8, LSL, 1)), "sub w6, w7, w8, lsl #1");
309 COMPARE(sub(x9, x10, Operand(x11, LSL, 2)), "sub x9, x10, x11, lsl #2");
310 COMPARE(sub(w12, w13, Operand(w14, LSR, 3)), "sub w12, w13, w14, lsr #3");
311 COMPARE(sub(x15, x16, Operand(x17, LSR, 4)), "sub x15, x16, x17, lsr #4");
312 COMPARE(sub(w18, w19, Operand(w20, ASR, 5)), "sub w18, w19, w20, asr #5");
313 COMPARE(sub(x21, x22, Operand(x23, ASR, 6)), "sub x21, x22, x23, asr #6");
314 COMPARE(cmp(w24, Operand(w25)), "cmp w24, w25");
315 COMPARE(cmp(x26, Operand(x27, LSL, 63)), "cmp x26, x27, lsl #63");
316 COMPARE(neg(w28, Operand(w29)), "neg w28, w29");
317 COMPARE(neg(x30, Operand(x0, LSR, 62)), "neg x30, x0, lsr #62");
318 COMPARE(negs(w1, Operand(w2)), "negs w1, w2");
319 COMPARE(negs(x3, Operand(x4, ASR, 61)), "negs x3, x4, asr #61");
320
321 COMPARE(sub(x0, sp, Operand(x1)), "sub x0, sp, x1");
322 COMPARE(sub(w2, wsp, Operand(w3)), "sub w2, wsp, w3");
323 COMPARE(sub(x4, sp, Operand(x5, LSL, 1)), "sub x4, sp, x5, lsl #1");
324 COMPARE(sub(x4, xzr, Operand(x5, LSL, 1)), "neg x4, x5, lsl #1");
325 COMPARE(sub(w6, wsp, Operand(w7, LSL, 3)), "sub w6, wsp, w7, lsl #3");
326 COMPARE(subs(xzr, sp, Operand(x8, LSL, 4)), "cmp sp, x8, lsl #4");
327 COMPARE(subs(xzr, xzr, Operand(x8, LSL, 5)), "cmp xzr, x8, lsl #5");
328
329 CLEANUP();
330 }
331
332
TEST(add_extended)333 TEST(add_extended) {
334 SETUP();
335
336 COMPARE(add(w0, w1, Operand(w2, UXTB)), "add w0, w1, w2, uxtb");
337 COMPARE(adds(x3, x4, Operand(w5, UXTB, 1)), "adds x3, x4, w5, uxtb #1");
338 COMPARE(add(w6, w7, Operand(w8, UXTH, 2)), "add w6, w7, w8, uxth #2");
339 COMPARE(adds(x9, x10, Operand(x11, UXTW, 3)), "adds x9, x10, w11, uxtw #3");
340 COMPARE(add(x12, x13, Operand(x14, UXTX, 4)), "add x12, x13, x14, uxtx #4");
341 COMPARE(adds(w15, w16, Operand(w17, SXTB, 4)), "adds w15, w16, w17, sxtb #4");
342 COMPARE(add(x18, x19, Operand(x20, SXTB, 3)), "add x18, x19, w20, sxtb #3");
343 COMPARE(adds(w21, w22, Operand(w23, SXTH, 2)), "adds w21, w22, w23, sxth #2");
344 COMPARE(add(x24, x25, Operand(x26, SXTW, 1)), "add x24, x25, w26, sxtw #1");
345 COMPARE(adds(x27, x28, Operand(x29, SXTX)), "adds x27, x28, x29, sxtx");
346 COMPARE(cmn(w0, Operand(w1, UXTB, 2)), "cmn w0, w1, uxtb #2");
347 COMPARE(cmn(x2, Operand(x3, SXTH, 4)), "cmn x2, w3, sxth #4");
348
349 COMPARE(add(w0, wsp, Operand(w1, UXTB)), "add w0, wsp, w1, uxtb");
350 COMPARE(add(x2, sp, Operand(x3, UXTH, 1)), "add x2, sp, w3, uxth #1");
351 COMPARE(add(wsp, wsp, Operand(w4, UXTW, 2)), "add wsp, wsp, w4, lsl #2");
352 COMPARE(cmn(sp, Operand(xzr, UXTX, 3)), "cmn sp, xzr, lsl #3");
353 COMPARE(cmn(sp, Operand(xzr, LSL, 4)), "cmn sp, xzr, lsl #4");
354
355 CLEANUP();
356 }
357
358
TEST(sub_extended)359 TEST(sub_extended) {
360 SETUP();
361
362 COMPARE(sub(w0, w1, Operand(w2, UXTB)), "sub w0, w1, w2, uxtb");
363 COMPARE(subs(x3, x4, Operand(w5, UXTB, 1)), "subs x3, x4, w5, uxtb #1");
364 COMPARE(sub(w6, w7, Operand(w8, UXTH, 2)), "sub w6, w7, w8, uxth #2");
365 COMPARE(subs(x9, x10, Operand(x11, UXTW, 3)), "subs x9, x10, w11, uxtw #3");
366 COMPARE(sub(x12, x13, Operand(x14, UXTX, 4)), "sub x12, x13, x14, uxtx #4");
367 COMPARE(subs(w15, w16, Operand(w17, SXTB, 4)), "subs w15, w16, w17, sxtb #4");
368 COMPARE(sub(x18, x19, Operand(x20, SXTB, 3)), "sub x18, x19, w20, sxtb #3");
369 COMPARE(subs(w21, w22, Operand(w23, SXTH, 2)), "subs w21, w22, w23, sxth #2");
370 COMPARE(sub(x24, x25, Operand(x26, SXTW, 1)), "sub x24, x25, w26, sxtw #1");
371 COMPARE(subs(x27, x28, Operand(x29, SXTX)), "subs x27, x28, x29, sxtx");
372 COMPARE(cmp(w0, Operand(w1, SXTB, 1)), "cmp w0, w1, sxtb #1");
373 COMPARE(cmp(x2, Operand(x3, UXTH, 3)), "cmp x2, w3, uxth #3");
374
375 COMPARE(sub(w0, wsp, Operand(w1, UXTB)), "sub w0, wsp, w1, uxtb");
376 COMPARE(sub(x2, sp, Operand(x3, UXTH, 1)), "sub x2, sp, w3, uxth #1");
377 COMPARE(sub(wsp, wsp, Operand(w4, UXTW, 2)), "sub wsp, wsp, w4, lsl #2");
378 COMPARE(cmp(sp, Operand(xzr, UXTX, 3)), "cmp sp, xzr, lsl #3");
379 COMPARE(cmp(sp, Operand(xzr, LSL, 4)), "cmp sp, xzr, lsl #4");
380
381 CLEANUP();
382 }
383
384
TEST(adc_subc_ngc)385 TEST(adc_subc_ngc) {
386 SETUP();
387
388 COMPARE(adc(w0, w1, Operand(w2)), "adc w0, w1, w2");
389 COMPARE(adc(x3, x4, Operand(x5)), "adc x3, x4, x5");
390 COMPARE(adcs(w6, w7, Operand(w8)), "adcs w6, w7, w8");
391 COMPARE(adcs(x9, x10, Operand(x11)), "adcs x9, x10, x11");
392 COMPARE(sbc(w12, w13, Operand(w14)), "sbc w12, w13, w14");
393 COMPARE(sbc(x15, x16, Operand(x17)), "sbc x15, x16, x17");
394 COMPARE(sbcs(w18, w19, Operand(w20)), "sbcs w18, w19, w20");
395 COMPARE(sbcs(x21, x22, Operand(x23)), "sbcs x21, x22, x23");
396 COMPARE(ngc(w24, Operand(w25)), "ngc w24, w25");
397 COMPARE(ngc(x26, Operand(x27)), "ngc x26, x27");
398 COMPARE(ngcs(w28, Operand(w29)), "ngcs w28, w29");
399 COMPARE(ngcs(x30, Operand(x0)), "ngcs x30, x0");
400
401 CLEANUP();
402 }
403
404
TEST(rmif)405 TEST(rmif) {
406 SETUP();
407
408 COMPARE(rmif(x0, 3, ZCVFlag), "rmif x0, #3, #nZCV");
409 COMPARE(rmif(x1, 63, NCFlag), "rmif x1, #63, #NzCv");
410
411 CLEANUP();
412 }
413
414
TEST(setf8_setf16)415 TEST(setf8_setf16) {
416 SETUP();
417
418 COMPARE(setf8(w0), "setf8 w0");
419 COMPARE(setf16(w1), "setf16 w1");
420
421 CLEANUP();
422 }
423
424
TEST(mul_and_div)425 TEST(mul_and_div) {
426 SETUP();
427
428 COMPARE(mul(w0, w1, w2), "mul w0, w1, w2");
429 COMPARE(mul(x3, x4, x5), "mul x3, x4, x5");
430 COMPARE(mul(w30, w0, w1), "mul w30, w0, w1");
431 COMPARE(mul(x30, x0, x1), "mul x30, x0, x1");
432 COMPARE(mneg(w0, w1, w2), "mneg w0, w1, w2");
433 COMPARE(mneg(x3, x4, x5), "mneg x3, x4, x5");
434 COMPARE(mneg(w30, w0, w1), "mneg w30, w0, w1");
435 COMPARE(mneg(x30, x0, x1), "mneg x30, x0, x1");
436 COMPARE(smull(x0, w0, w1), "smull x0, w0, w1");
437 COMPARE(smull(x30, w30, w0), "smull x30, w30, w0");
438 COMPARE(smulh(x0, x1, x2), "smulh x0, x1, x2");
439 COMPARE(umulh(x0, x2, x1), "umulh x0, x2, x1");
440
441 COMPARE(sdiv(w0, w1, w2), "sdiv w0, w1, w2");
442 COMPARE(sdiv(x3, x4, x5), "sdiv x3, x4, x5");
443 COMPARE(udiv(w6, w7, w8), "udiv w6, w7, w8");
444 COMPARE(udiv(x9, x10, x11), "udiv x9, x10, x11");
445
446 CLEANUP();
447 }
448
449
TEST(madd)450 TEST(madd) {
451 SETUP();
452
453 COMPARE(madd(w0, w1, w2, w3), "madd w0, w1, w2, w3");
454 COMPARE(madd(w30, w21, w22, w16), "madd w30, w21, w22, w16");
455 COMPARE(madd(x0, x1, x2, x3), "madd x0, x1, x2, x3");
456 COMPARE(madd(x30, x21, x22, x16), "madd x30, x21, x22, x16");
457
458 COMPARE(smaddl(x0, w1, w2, x3), "smaddl x0, w1, w2, x3");
459 COMPARE(smaddl(x30, w21, w22, x16), "smaddl x30, w21, w22, x16");
460 COMPARE(umaddl(x0, w1, w2, x3), "umaddl x0, w1, w2, x3");
461 COMPARE(umaddl(x30, w21, w22, x16), "umaddl x30, w21, w22, x16");
462 COMPARE(umull(x0, w1, w2), "umull x0, w1, w2");
463 COMPARE(umull(x30, w21, w22), "umull x30, w21, w22");
464
465 CLEANUP();
466 }
467
468
TEST(msub)469 TEST(msub) {
470 SETUP();
471
472 COMPARE(msub(w0, w1, w2, w3), "msub w0, w1, w2, w3");
473 COMPARE(msub(w30, w21, w22, w16), "msub w30, w21, w22, w16");
474 COMPARE(msub(x0, x1, x2, x3), "msub x0, x1, x2, x3");
475 COMPARE(msub(x30, x21, x22, x16), "msub x30, x21, x22, x16");
476
477 COMPARE(smsubl(x0, w1, w2, x3), "smsubl x0, w1, w2, x3");
478 COMPARE(smsubl(x30, w21, w22, x16), "smsubl x30, w21, w22, x16");
479 COMPARE(umsubl(x0, w1, w2, x3), "umsubl x0, w1, w2, x3");
480 COMPARE(umsubl(x30, w21, w22, x16), "umsubl x30, w21, w22, x16");
481
482 CLEANUP();
483 }
484
485
TEST(dp_1_source)486 TEST(dp_1_source) {
487 SETUP();
488
489 COMPARE(rbit(w0, w1), "rbit w0, w1");
490 COMPARE(rbit(x2, x3), "rbit x2, x3");
491 COMPARE(rev16(w4, w5), "rev16 w4, w5");
492 COMPARE(rev16(x6, x7), "rev16 x6, x7");
493 COMPARE(rev32(x8, x9), "rev32 x8, x9");
494 COMPARE(rev64(x10, x11), "rev x10, x11");
495 COMPARE(rev(w12, w13), "rev w12, w13");
496 COMPARE(rev(x14, x15), "rev x14, x15");
497 COMPARE(clz(w16, w17), "clz w16, w17");
498 COMPARE(clz(x18, x19), "clz x18, x19");
499 COMPARE(cls(w20, w21), "cls w20, w21");
500 COMPARE(cls(x22, x23), "cls x22, x23");
501 COMPARE(pacia(x24, x25), "pacia x24, x25");
502 COMPARE(pacia(x26, sp), "pacia x26, sp");
503 COMPARE(pacib(x27, x28), "pacib x27, x28");
504 COMPARE(pacib(x29, sp), "pacib x29, sp");
505 COMPARE(pacda(x30, x0), "pacda x30, x0");
506 COMPARE(pacda(x1, sp), "pacda x1, sp");
507 COMPARE(pacdb(x2, x3), "pacdb x2, x3");
508 COMPARE(pacdb(x4, sp), "pacdb x4, sp");
509 COMPARE(paciza(x5), "paciza x5");
510 COMPARE(pacizb(x6), "pacizb x6");
511 COMPARE(pacdza(x7), "pacdza x7");
512 COMPARE(pacdzb(x8), "pacdzb x8");
513 COMPARE(autia(x9, x10), "autia x9, x10");
514 COMPARE(autia(x11, sp), "autia x11, sp");
515 COMPARE(autib(x12, x13), "autib x12, x13");
516 COMPARE(autib(x14, sp), "autib x14, sp");
517 COMPARE(autda(x15, x16), "autda x15, x16");
518 COMPARE(autda(x17, sp), "autda x17, sp");
519 COMPARE(autdb(x18, x19), "autdb x18, x19");
520 COMPARE(autdb(x20, sp), "autdb x20, sp");
521 COMPARE(autiza(x21), "autiza x21");
522 COMPARE(autizb(x22), "autizb x22");
523 COMPARE(autdza(x23), "autdza x23");
524
525 CLEANUP();
526 }
527
528
TEST(bitfield)529 TEST(bitfield) {
530 SETUP();
531
532 COMPARE(sxtb(w0, w1), "sxtb w0, w1");
533 COMPARE(sxtb(x2, x3), "sxtb x2, w3");
534 COMPARE(sxth(w4, w5), "sxth w4, w5");
535 COMPARE(sxth(x6, x7), "sxth x6, w7");
536 COMPARE(sxtw(x8, x9), "sxtw x8, w9");
537 COMPARE(sxtb(x0, w1), "sxtb x0, w1");
538 COMPARE(sxth(x2, w3), "sxth x2, w3");
539 COMPARE(sxtw(x4, w5), "sxtw x4, w5");
540
541 COMPARE(uxtb(w10, w11), "uxtb w10, w11");
542 COMPARE(uxtb(x12, x13), "uxtb x12, w13");
543 COMPARE(uxth(w14, w15), "uxth w14, w15");
544 COMPARE(uxth(x16, x17), "uxth x16, w17");
545 COMPARE(uxtw(x18, x19), "ubfx x18, x19, #0, #32");
546
547 COMPARE(asr(w20, w21, 10), "asr w20, w21, #10");
548 COMPARE(asr(x22, x23, 20), "asr x22, x23, #20");
549 COMPARE(lsr(w24, w25, 10), "lsr w24, w25, #10");
550 COMPARE(lsr(x26, x27, 20), "lsr x26, x27, #20");
551 COMPARE(lsl(w28, w29, 10), "lsl w28, w29, #10");
552 COMPARE(lsl(x30, x0, 20), "lsl x30, x0, #20");
553
554 COMPARE(sbfiz(w1, w2, 1, 20), "sbfiz w1, w2, #1, #20");
555 COMPARE(sbfiz(x3, x4, 2, 19), "sbfiz x3, x4, #2, #19");
556 COMPARE(sbfx(w5, w6, 3, 18), "sbfx w5, w6, #3, #18");
557 COMPARE(sbfx(x7, x8, 4, 17), "sbfx x7, x8, #4, #17");
558 COMPARE(bfi(w9, w10, 5, 16), "bfi w9, w10, #5, #16");
559 COMPARE(bfi(x11, x12, 6, 15), "bfi x11, x12, #6, #15");
560 COMPARE(bfxil(w13, w14, 7, 14), "bfxil w13, w14, #7, #14");
561 COMPARE(bfxil(x15, x16, 8, 13), "bfxil x15, x16, #8, #13");
562 COMPARE(ubfiz(w17, w18, 9, 12), "ubfiz w17, w18, #9, #12");
563 COMPARE(ubfiz(x19, x20, 10, 11), "ubfiz x19, x20, #10, #11");
564 COMPARE(ubfx(w21, w22, 11, 10), "ubfx w21, w22, #11, #10");
565 COMPARE(ubfx(x23, x24, 12, 9), "ubfx x23, x24, #12, #9");
566 COMPARE(bfc(w25, 13, 8), "bfc w25, #13, #8");
567 COMPARE(bfc(x26, 14, 7), "bfc x26, #14, #7");
568
569 CLEANUP();
570 }
571
TEST(bitfield_regression_test)572 TEST(bitfield_regression_test) {
573 SETUP();
574
575 COMPARE(dci(0x533ae450), "unallocated (Unallocated)");
576 COMPARE(dci(0x133c464c), "unallocated (Unallocated)");
577 COMPARE(dci(0x133c4e6d), "unallocated (Unallocated)");
578 COMPARE(dci(0x133c5e45), "unallocated (Unallocated)");
579 COMPARE(dci(0x1335853c), "unallocated (Unallocated)");
580 COMPARE(dci(0x1335a73d), "unallocated (Unallocated)");
581
582 CLEANUP();
583 }
584
585
TEST(crc32b)586 TEST(crc32b) {
587 SETUP();
588
589 COMPARE(crc32b(w0, w1, w2), "crc32b w0, w1, w2");
590 COMPARE(crc32b(w0, w11, w22), "crc32b w0, w11, w22");
591 COMPARE(crc32b(w10, w20, w30), "crc32b w10, w20, w30");
592
593 CLEANUP();
594 }
595
596
TEST(crc32h)597 TEST(crc32h) {
598 SETUP();
599
600 COMPARE(crc32h(w1, w2, w3), "crc32h w1, w2, w3");
601 COMPARE(crc32h(w2, w13, w23), "crc32h w2, w13, w23");
602 COMPARE(crc32h(w11, w12, w15), "crc32h w11, w12, w15");
603
604 CLEANUP();
605 }
606
607
TEST(crc32w)608 TEST(crc32w) {
609 SETUP();
610
611 COMPARE(crc32w(w2, w3, w4), "crc32w w2, w3, w4");
612 COMPARE(crc32w(w3, w14, w24), "crc32w w3, w14, w24");
613 COMPARE(crc32w(w13, w13, w16), "crc32w w13, w13, w16");
614
615 CLEANUP();
616 }
617
618
TEST(crc32x)619 TEST(crc32x) {
620 SETUP();
621
622 COMPARE(crc32x(w3, w4, x5), "crc32x w3, w4, x5");
623 COMPARE(crc32x(w4, w15, x25), "crc32x w4, w15, x25");
624 COMPARE(crc32x(w14, w14, x30), "crc32x w14, w14, x30");
625
626 CLEANUP();
627 }
628
629
TEST(crc32cb)630 TEST(crc32cb) {
631 SETUP();
632
633 COMPARE(crc32cb(w4, w5, w6), "crc32cb w4, w5, w6");
634 COMPARE(crc32cb(w5, w16, w26), "crc32cb w5, w16, w26");
635 COMPARE(crc32cb(w15, w15, w5), "crc32cb w15, w15, w5");
636
637 CLEANUP();
638 }
639
640
TEST(crc32ch)641 TEST(crc32ch) {
642 SETUP();
643
644 COMPARE(crc32ch(w5, w6, w7), "crc32ch w5, w6, w7");
645 COMPARE(crc32ch(w6, w17, w27), "crc32ch w6, w17, w27");
646 COMPARE(crc32ch(w16, w16, w2), "crc32ch w16, w16, w2");
647
648 CLEANUP();
649 }
650
651
TEST(crc32cw)652 TEST(crc32cw) {
653 SETUP();
654
655 COMPARE(crc32cw(w6, w7, w8), "crc32cw w6, w7, w8");
656 COMPARE(crc32cw(w7, w18, w28), "crc32cw w7, w18, w28");
657 COMPARE(crc32cw(w17, w17, w3), "crc32cw w17, w17, w3");
658
659 CLEANUP();
660 }
661
662
TEST(crc32cx)663 TEST(crc32cx) {
664 SETUP();
665
666 COMPARE(crc32cx(w7, w8, x9), "crc32cx w7, w8, x9");
667 COMPARE(crc32cx(w8, w19, x29), "crc32cx w8, w19, x29");
668 COMPARE(crc32cx(w18, w18, x4), "crc32cx w18, w18, x4");
669
670 CLEANUP();
671 }
672
673
TEST(extract)674 TEST(extract) {
675 SETUP();
676
677 COMPARE(extr(w0, w1, w2, 0), "extr w0, w1, w2, #0");
678 COMPARE(extr(x3, x4, x5, 1), "extr x3, x4, x5, #1");
679 COMPARE(extr(w6, w7, w8, 31), "extr w6, w7, w8, #31");
680 COMPARE(extr(x9, x10, x11, 63), "extr x9, x10, x11, #63");
681 COMPARE(extr(w12, w13, w13, 10), "ror w12, w13, #10");
682 COMPARE(extr(x14, x15, x15, 42), "ror x14, x15, #42");
683
684 CLEANUP();
685 }
686
687
TEST(logical_immediate)688 TEST(logical_immediate) {
689 SETUP();
690 #define RESULT_SIZE (256)
691
692 char result[RESULT_SIZE];
693
694 // Test immediate encoding - 64-bit destination.
695 // 64-bit patterns.
696 uint64_t value = 0x7fffffff;
697 for (int i = 0; i < 64; i++) {
698 snprintf(result, RESULT_SIZE, "and x0, x0, #0x%" PRIx64, value);
699 COMPARE(and_(x0, x0, Operand(value)), result);
700 value = ((value & 1) << 63) | (value >> 1); // Rotate right 1 bit.
701 }
702
703 // 32-bit patterns.
704 value = 0x00003fff00003fff;
705 for (int i = 0; i < 32; i++) {
706 snprintf(result, RESULT_SIZE, "and x0, x0, #0x%" PRIx64, value);
707 COMPARE(and_(x0, x0, Operand(value)), result);
708 value = ((value & 1) << 63) | (value >> 1); // Rotate right 1 bit.
709 }
710
711 // 16-bit patterns.
712 value = 0x001f001f001f001f;
713 for (int i = 0; i < 16; i++) {
714 snprintf(result, RESULT_SIZE, "and x0, x0, #0x%" PRIx64, value);
715 COMPARE(and_(x0, x0, Operand(value)), result);
716 value = ((value & 1) << 63) | (value >> 1); // Rotate right 1 bit.
717 }
718
719 // 8-bit patterns.
720 value = 0x0e0e0e0e0e0e0e0e;
721 for (int i = 0; i < 8; i++) {
722 snprintf(result, RESULT_SIZE, "and x0, x0, #0x%" PRIx64, value);
723 COMPARE(and_(x0, x0, Operand(value)), result);
724 value = ((value & 1) << 63) | (value >> 1); // Rotate right 1 bit.
725 }
726
727 // 4-bit patterns.
728 value = 0x6666666666666666;
729 for (int i = 0; i < 4; i++) {
730 snprintf(result, RESULT_SIZE, "and x0, x0, #0x%" PRIx64, value);
731 COMPARE(and_(x0, x0, Operand(value)), result);
732 value = ((value & 1) << 63) | (value >> 1); // Rotate right 1 bit.
733 }
734
735 // 2-bit patterns.
736 COMPARE(and_(x0, x0, Operand(0x5555555555555555)),
737 "and x0, x0, #0x5555555555555555");
738 COMPARE(and_(x0, x0, Operand(0xaaaaaaaaaaaaaaaa)),
739 "and x0, x0, #0xaaaaaaaaaaaaaaaa");
740
741 // Test immediate encoding - 32-bit destination.
742 COMPARE(and_(w0, w0, Operand(0xff8007ff)),
743 "and w0, w0, #0xff8007ff"); // 32-bit pattern.
744 COMPARE(and_(w0, w0, Operand(0xf87ff87f)),
745 "and w0, w0, #0xf87ff87f"); // 16-bit pattern.
746 COMPARE(and_(w0, w0, Operand(0x87878787)),
747 "and w0, w0, #0x87878787"); // 8-bit pattern.
748 COMPARE(and_(w0, w0, Operand(0x66666666)),
749 "and w0, w0, #0x66666666"); // 4-bit pattern.
750 COMPARE(and_(w0, w0, Operand(0x55555555)),
751 "and w0, w0, #0x55555555"); // 2-bit pattern.
752
753 // Test other instructions.
754 COMPARE(tst(w1, Operand(0x11111111)), "tst w1, #0x11111111");
755 COMPARE(tst(x2, Operand(0x8888888888888888)), "tst x2, #0x8888888888888888");
756 COMPARE(orr(w7, w8, Operand(0xaaaaaaaa)), "orr w7, w8, #0xaaaaaaaa");
757 COMPARE(orr(x9, x10, Operand(0x5555555555555555)),
758 "orr x9, x10, #0x5555555555555555");
759 COMPARE(eor(w15, w16, Operand(0x00000001)), "eor w15, w16, #0x1");
760 COMPARE(eor(x17, x18, Operand(0x0000000000000003)), "eor x17, x18, #0x3");
761 COMPARE(ands(w23, w24, Operand(0x0000000f)), "ands w23, w24, #0xf");
762 COMPARE(ands(x25, x26, Operand(0x800000000000000f)),
763 "ands x25, x26, #0x800000000000000f");
764
765 // Test inverse.
766 COMPARE(bic(w3, w4, Operand(0x20202020)), "and w3, w4, #0xdfdfdfdf");
767 COMPARE(bic(x5, x6, Operand(0x4040404040404040)),
768 "and x5, x6, #0xbfbfbfbfbfbfbfbf");
769 COMPARE(orn(w11, w12, Operand(0x40004000)), "orr w11, w12, #0xbfffbfff");
770 COMPARE(orn(x13, x14, Operand(0x8181818181818181)),
771 "orr x13, x14, #0x7e7e7e7e7e7e7e7e");
772 COMPARE(eon(w19, w20, Operand(0x80000001)), "eor w19, w20, #0x7ffffffe");
773 COMPARE(eon(x21, x22, Operand(0xc000000000000003)),
774 "eor x21, x22, #0x3ffffffffffffffc");
775 COMPARE(bics(w27, w28, Operand(0xfffffff7)), "ands w27, w28, #0x8");
776 COMPARE(bics(x29, x0, Operand(0xfffffffeffffffff)),
777 "ands x29, x0, #0x100000000");
778
779 // Test stack pointer.
780 COMPARE(and_(wsp, wzr, Operand(7)), "and wsp, wzr, #0x7");
781 COMPARE(ands(xzr, xzr, Operand(7)), "tst xzr, #0x7");
782 COMPARE(orr(sp, xzr, Operand(15)), "orr sp, xzr, #0xf");
783 COMPARE(eor(wsp, w0, Operand(31)), "eor wsp, w0, #0x1f");
784
785 // Test move aliases.
786 COMPARE(orr(w0, wzr, Operand(0x00000780)), "orr w0, wzr, #0x780");
787 COMPARE(orr(w1, wzr, Operand(0x00007800)), "orr w1, wzr, #0x7800");
788 COMPARE(orr(w2, wzr, Operand(0x00078000)), "mov w2, #0x78000");
789 COMPARE(orr(w3, wzr, Operand(0x00780000)), "orr w3, wzr, #0x780000");
790 COMPARE(orr(w4, wzr, Operand(0x07800000)), "orr w4, wzr, #0x7800000");
791 COMPARE(orr(x5, xzr, Operand(0xffffffffffffc001)),
792 "orr x5, xzr, #0xffffffffffffc001");
793 COMPARE(orr(x6, xzr, Operand(0xfffffffffffc001f)),
794 "mov x6, #0xfffffffffffc001f");
795 COMPARE(orr(x7, xzr, Operand(0xffffffffffc001ff)),
796 "mov x7, #0xffffffffffc001ff");
797 COMPARE(orr(x8, xzr, Operand(0xfffffffffc001fff)),
798 "mov x8, #0xfffffffffc001fff");
799 COMPARE(orr(x9, xzr, Operand(0xffffffffc001ffff)),
800 "orr x9, xzr, #0xffffffffc001ffff");
801
802 CLEANUP();
803 }
804
805
TEST(logical_shifted)806 TEST(logical_shifted) {
807 SETUP();
808
809 COMPARE(and_(w0, w1, Operand(w2)), "and w0, w1, w2");
810 COMPARE(and_(x3, x4, Operand(x5, LSL, 1)), "and x3, x4, x5, lsl #1");
811 COMPARE(and_(w6, w7, Operand(w8, LSR, 2)), "and w6, w7, w8, lsr #2");
812 COMPARE(and_(x9, x10, Operand(x11, ASR, 3)), "and x9, x10, x11, asr #3");
813 COMPARE(and_(w12, w13, Operand(w14, ROR, 4)), "and w12, w13, w14, ror #4");
814
815 COMPARE(bic(w15, w16, Operand(w17)), "bic w15, w16, w17");
816 COMPARE(bic(x18, x19, Operand(x20, LSL, 5)), "bic x18, x19, x20, lsl #5");
817 COMPARE(bic(w21, w22, Operand(w23, LSR, 6)), "bic w21, w22, w23, lsr #6");
818 COMPARE(bic(x24, x25, Operand(x26, ASR, 7)), "bic x24, x25, x26, asr #7");
819 COMPARE(bic(w27, w28, Operand(w29, ROR, 8)), "bic w27, w28, w29, ror #8");
820
821 COMPARE(orr(w0, w1, Operand(w2)), "orr w0, w1, w2");
822 COMPARE(orr(x3, x4, Operand(x5, LSL, 9)), "orr x3, x4, x5, lsl #9");
823 COMPARE(orr(w6, w7, Operand(w8, LSR, 10)), "orr w6, w7, w8, lsr #10");
824 COMPARE(orr(x9, x10, Operand(x11, ASR, 11)), "orr x9, x10, x11, asr #11");
825 COMPARE(orr(w12, w13, Operand(w14, ROR, 12)), "orr w12, w13, w14, ror #12");
826
827 COMPARE(orn(w15, w16, Operand(w17)), "orn w15, w16, w17");
828 COMPARE(orn(x18, x19, Operand(x20, LSL, 13)), "orn x18, x19, x20, lsl #13");
829 COMPARE(orn(w21, w22, Operand(w23, LSR, 14)), "orn w21, w22, w23, lsr #14");
830 COMPARE(orn(x24, x25, Operand(x26, ASR, 15)), "orn x24, x25, x26, asr #15");
831 COMPARE(orn(w27, w28, Operand(w29, ROR, 16)), "orn w27, w28, w29, ror #16");
832
833 COMPARE(eor(w0, w1, Operand(w2)), "eor w0, w1, w2");
834 COMPARE(eor(x3, x4, Operand(x5, LSL, 17)), "eor x3, x4, x5, lsl #17");
835 COMPARE(eor(w6, w7, Operand(w8, LSR, 18)), "eor w6, w7, w8, lsr #18");
836 COMPARE(eor(x9, x10, Operand(x11, ASR, 19)), "eor x9, x10, x11, asr #19");
837 COMPARE(eor(w12, w13, Operand(w14, ROR, 20)), "eor w12, w13, w14, ror #20");
838
839 COMPARE(eon(w15, w16, Operand(w17)), "eon w15, w16, w17");
840 COMPARE(eon(x18, x19, Operand(x20, LSL, 21)), "eon x18, x19, x20, lsl #21");
841 COMPARE(eon(w21, w22, Operand(w23, LSR, 22)), "eon w21, w22, w23, lsr #22");
842 COMPARE(eon(x24, x25, Operand(x26, ASR, 23)), "eon x24, x25, x26, asr #23");
843 COMPARE(eon(w27, w28, Operand(w29, ROR, 24)), "eon w27, w28, w29, ror #24");
844
845 COMPARE(ands(w0, w1, Operand(w2)), "ands w0, w1, w2");
846 COMPARE(ands(x3, x4, Operand(x5, LSL, 1)), "ands x3, x4, x5, lsl #1");
847 COMPARE(ands(w6, w7, Operand(w8, LSR, 2)), "ands w6, w7, w8, lsr #2");
848 COMPARE(ands(x9, x10, Operand(x11, ASR, 3)), "ands x9, x10, x11, asr #3");
849 COMPARE(ands(w12, w13, Operand(w14, ROR, 4)), "ands w12, w13, w14, ror #4");
850
851 COMPARE(bics(w15, w16, Operand(w17)), "bics w15, w16, w17");
852 COMPARE(bics(x18, x19, Operand(x20, LSL, 5)), "bics x18, x19, x20, lsl #5");
853 COMPARE(bics(w21, w22, Operand(w23, LSR, 6)), "bics w21, w22, w23, lsr #6");
854 COMPARE(bics(x24, x25, Operand(x26, ASR, 7)), "bics x24, x25, x26, asr #7");
855 COMPARE(bics(w27, w28, Operand(w29, ROR, 8)), "bics w27, w28, w29, ror #8");
856
857 COMPARE(tst(w0, Operand(w1)), "tst w0, w1");
858 COMPARE(tst(w2, Operand(w3, ROR, 10)), "tst w2, w3, ror #10");
859 COMPARE(tst(x0, Operand(x1)), "tst x0, x1");
860 COMPARE(tst(x2, Operand(x3, ROR, 42)), "tst x2, x3, ror #42");
861
862 COMPARE(orn(w0, wzr, Operand(w1)), "mvn w0, w1");
863 COMPARE(orn(w2, wzr, Operand(w3, ASR, 5)), "mvn w2, w3, asr #5");
864 COMPARE(orn(x0, xzr, Operand(x1)), "mvn x0, x1");
865 COMPARE(orn(x2, xzr, Operand(x3, ASR, 42)), "mvn x2, x3, asr #42");
866
867 COMPARE(orr(w0, wzr, Operand(w1)), "mov w0, w1");
868 COMPARE(orr(x0, xzr, Operand(x1)), "mov x0, x1");
869 COMPARE(orr(w16, wzr, Operand(w17, LSL, 1)), "orr w16, wzr, w17, lsl #1");
870 COMPARE(orr(x16, xzr, Operand(x17, ASR, 2)), "orr x16, xzr, x17, asr #2");
871
872 CLEANUP();
873 }
874
875
TEST(dp_2_source)876 TEST(dp_2_source) {
877 SETUP();
878
879 COMPARE(lslv(w0, w1, w2), "lsl w0, w1, w2");
880 COMPARE(lslv(x3, x4, x5), "lsl x3, x4, x5");
881 COMPARE(lsrv(w6, w7, w8), "lsr w6, w7, w8");
882 COMPARE(lsrv(x9, x10, x11), "lsr x9, x10, x11");
883 COMPARE(asrv(w12, w13, w14), "asr w12, w13, w14");
884 COMPARE(asrv(x15, x16, x17), "asr x15, x16, x17");
885 COMPARE(rorv(w18, w19, w20), "ror w18, w19, w20");
886 COMPARE(rorv(x21, x22, x23), "ror x21, x22, x23");
887 COMPARE(pacga(x24, x25, x26), "pacga x24, x25, x26");
888 COMPARE(pacga(x27, x28, sp), "pacga x27, x28, sp");
889
890 CLEANUP();
891 }
892
893
TEST(adr)894 TEST(adr) {
895 SETUP();
896
897 COMPARE_PREFIX(adr(x0, INT64_C(0)), "adr x0, #+0x0");
898 COMPARE_PREFIX(adr(x1, 1), "adr x1, #+0x1");
899 COMPARE_PREFIX(adr(x2, -1), "adr x2, #-0x1");
900 COMPARE_PREFIX(adr(x3, 4), "adr x3, #+0x4");
901 COMPARE_PREFIX(adr(x4, -4), "adr x4, #-0x4");
902 COMPARE_PREFIX(adr(x5, 0x000fffff), "adr x5, #+0xfffff");
903 COMPARE_PREFIX(adr(x6, -0x00100000), "adr x6, #-0x100000");
904 COMPARE_PREFIX(adr(xzr, INT64_C(0)), "adr xzr, #+0x0");
905
906 CLEANUP();
907 }
908
909
TEST(adrp)910 TEST(adrp) {
911 SETUP();
912
913 COMPARE_PREFIX(adrp(x0, INT64_C(0)), "adrp x0, #+0x0");
914 COMPARE_PREFIX(adrp(x1, 1), "adrp x1, #+0x1000");
915 COMPARE_PREFIX(adrp(x2, -1), "adrp x2, #-0x1000");
916 COMPARE_PREFIX(adrp(x3, 4), "adrp x3, #+0x4000");
917 COMPARE_PREFIX(adrp(x4, -4), "adrp x4, #-0x4000");
918 COMPARE_PREFIX(adrp(x5, 0x000fffff), "adrp x5, #+0xfffff000");
919 COMPARE_PREFIX(adrp(x6, -0x00100000), "adrp x6, #-0x100000000");
920 COMPARE_PREFIX(adrp(xzr, INT64_C(0)), "adrp xzr, #+0x0");
921
922 CLEANUP();
923 }
924
925
TEST(branch)926 TEST(branch) {
927 SETUP();
928
929 #define INST_OFF(x) (INT64_C(x) >> kInstructionSizeLog2)
930 COMPARE_PREFIX(b(INST_OFF(0x4)), "b #+0x4");
931 COMPARE_PREFIX(b(INST_OFF(-0x4)), "b #-0x4");
932 COMPARE_PREFIX(b(INST_OFF(0x7fffffc)), "b #+0x7fffffc");
933 COMPARE_PREFIX(b(INST_OFF(-0x8000000)), "b #-0x8000000");
934 COMPARE_PREFIX(b(INST_OFF(0xffffc), eq), "b.eq #+0xffffc");
935 COMPARE_PREFIX(b(INST_OFF(-0x100000), mi), "b.mi #-0x100000");
936 COMPARE_PREFIX(b(INST_OFF(0xffffc), al), "b.al #+0xffffc");
937 COMPARE_PREFIX(b(INST_OFF(-0x100000), nv), "b.nv #-0x100000");
938 COMPARE_PREFIX(bl(INST_OFF(0x4)), "bl #+0x4");
939 COMPARE_PREFIX(bl(INST_OFF(-0x4)), "bl #-0x4");
940 COMPARE_PREFIX(bl(INST_OFF(0xffffc)), "bl #+0xffffc");
941 COMPARE_PREFIX(bl(INST_OFF(-0x100000)), "bl #-0x100000");
942 COMPARE_PREFIX(cbz(w0, INST_OFF(0xffffc)), "cbz w0, #+0xffffc");
943 COMPARE_PREFIX(cbz(x1, INST_OFF(-0x100000)), "cbz x1, #-0x100000");
944 COMPARE_PREFIX(cbnz(w2, INST_OFF(0xffffc)), "cbnz w2, #+0xffffc");
945 COMPARE_PREFIX(cbnz(x3, INST_OFF(-0x100000)), "cbnz x3, #-0x100000");
946 COMPARE_PREFIX(tbz(w4, 0, INST_OFF(0x7ffc)), "tbz w4, #0, #+0x7ffc");
947 COMPARE_PREFIX(tbz(x5, 63, INST_OFF(-0x8000)), "tbz x5, #63, #-0x8000");
948 COMPARE_PREFIX(tbz(w6, 31, INST_OFF(0)), "tbz w6, #31, #+0x0");
949 COMPARE_PREFIX(tbz(x7, 31, INST_OFF(0x4)), "tbz w7, #31, #+0x4");
950 COMPARE_PREFIX(tbz(x8, 32, INST_OFF(0x8)), "tbz x8, #32, #+0x8");
951 COMPARE_PREFIX(tbnz(w8, 0, INST_OFF(0x7ffc)), "tbnz w8, #0, #+0x7ffc");
952 COMPARE_PREFIX(tbnz(x9, 63, INST_OFF(-0x8000)), "tbnz x9, #63, #-0x8000");
953 COMPARE_PREFIX(tbnz(w10, 31, INST_OFF(0)), "tbnz w10, #31, #+0x0");
954 COMPARE_PREFIX(tbnz(x11, 31, INST_OFF(0x4)), "tbnz w11, #31, #+0x4");
955 COMPARE_PREFIX(tbnz(x12, 32, INST_OFF(0x8)), "tbnz x12, #32, #+0x8");
956 COMPARE(br(x0), "br x0");
957 COMPARE(blr(x1), "blr x1");
958 COMPARE(ret(x2), "ret x2");
959 COMPARE(ret(lr), "ret");
960
961 COMPARE(braaz(x0), "braaz x0");
962 COMPARE(brabz(x1), "brabz x1");
963 COMPARE(blraaz(x2), "blraaz x2");
964 COMPARE(blrabz(x3), "blrabz x3");
965 COMPARE(retaa(), "retaa");
966 COMPARE(retab(), "retab");
967 COMPARE(braa(x4, x5), "braa x4, x5");
968 COMPARE(braa(x6, sp), "braa x6, sp");
969 COMPARE(brab(x7, x8), "brab x7, x8");
970 COMPARE(brab(x9, sp), "brab x9, sp");
971 COMPARE(blraa(x10, x11), "blraa x10, x11");
972 COMPARE(blraa(x12, sp), "blraa x12, sp");
973 COMPARE(blrab(x13, x14), "blrab x13, x14");
974 COMPARE(blrab(x15, sp), "blrab x15, sp");
975
976 CLEANUP();
977 }
978
979
TEST(load_store)980 TEST(load_store) {
981 SETUP();
982
983 COMPARE(ldr(w0, MemOperand(x1)), "ldr w0, [x1]");
984 COMPARE(ldr(w2, MemOperand(x3, 4)), "ldr w2, [x3, #4]");
985 COMPARE(ldr(w4, MemOperand(x5, 16380)), "ldr w4, [x5, #16380]");
986 COMPARE(ldr(x6, MemOperand(x7)), "ldr x6, [x7]");
987 COMPARE(ldr(x8, MemOperand(x9, 8)), "ldr x8, [x9, #8]");
988 COMPARE(ldr(x10, MemOperand(x11, 32760)), "ldr x10, [x11, #32760]");
989 COMPARE(str(w12, MemOperand(x13)), "str w12, [x13]");
990 COMPARE(str(w14, MemOperand(x15, 4)), "str w14, [x15, #4]");
991 COMPARE(str(w16, MemOperand(x17, 16380)), "str w16, [x17, #16380]");
992 COMPARE(str(x18, MemOperand(x19)), "str x18, [x19]");
993 COMPARE(str(x20, MemOperand(x21, 8)), "str x20, [x21, #8]");
994 COMPARE(str(x22, MemOperand(x23, 32760)), "str x22, [x23, #32760]");
995
996 COMPARE(ldr(w0, MemOperand(x1, 4, PreIndex)), "ldr w0, [x1, #4]!");
997 COMPARE(ldr(w2, MemOperand(x3, 255, PreIndex)), "ldr w2, [x3, #255]!");
998 COMPARE(ldr(w4, MemOperand(x5, -256, PreIndex)), "ldr w4, [x5, #-256]!");
999 COMPARE(ldr(x6, MemOperand(x7, 8, PreIndex)), "ldr x6, [x7, #8]!");
1000 COMPARE(ldr(x8, MemOperand(x9, 255, PreIndex)), "ldr x8, [x9, #255]!");
1001 COMPARE(ldr(x10, MemOperand(x11, -256, PreIndex)), "ldr x10, [x11, #-256]!");
1002 COMPARE(str(w12, MemOperand(x13, 4, PreIndex)), "str w12, [x13, #4]!");
1003 COMPARE(str(w14, MemOperand(x15, 255, PreIndex)), "str w14, [x15, #255]!");
1004 COMPARE(str(w16, MemOperand(x17, -256, PreIndex)), "str w16, [x17, #-256]!");
1005 COMPARE(str(x18, MemOperand(x19, 8, PreIndex)), "str x18, [x19, #8]!");
1006 COMPARE(str(x20, MemOperand(x21, 255, PreIndex)), "str x20, [x21, #255]!");
1007 COMPARE(str(x22, MemOperand(x23, -256, PreIndex)), "str x22, [x23, #-256]!");
1008 COMPARE(str(x24, MemOperand(x25, 0, PreIndex)), "str x24, [x25, #0]!");
1009 COMPARE(str(w26, MemOperand(x27, 0, PreIndex)), "str w26, [x27, #0]!");
1010
1011 COMPARE(ldr(w0, MemOperand(x1, 4, PostIndex)), "ldr w0, [x1], #4");
1012 COMPARE(ldr(w2, MemOperand(x3, 255, PostIndex)), "ldr w2, [x3], #255");
1013 COMPARE(ldr(w4, MemOperand(x5, -256, PostIndex)), "ldr w4, [x5], #-256");
1014 COMPARE(ldr(x6, MemOperand(x7, 8, PostIndex)), "ldr x6, [x7], #8");
1015 COMPARE(ldr(x8, MemOperand(x9, 255, PostIndex)), "ldr x8, [x9], #255");
1016 COMPARE(ldr(x10, MemOperand(x11, -256, PostIndex)), "ldr x10, [x11], #-256");
1017 COMPARE(str(w12, MemOperand(x13, 4, PostIndex)), "str w12, [x13], #4");
1018 COMPARE(str(w14, MemOperand(x15, 255, PostIndex)), "str w14, [x15], #255");
1019 COMPARE(str(w16, MemOperand(x17, -256, PostIndex)), "str w16, [x17], #-256");
1020 COMPARE(str(x18, MemOperand(x19, 8, PostIndex)), "str x18, [x19], #8");
1021 COMPARE(str(x20, MemOperand(x21, 255, PostIndex)), "str x20, [x21], #255");
1022 COMPARE(str(x22, MemOperand(x23, -256, PostIndex)), "str x22, [x23], #-256");
1023 COMPARE(str(x24, MemOperand(x25, 0, PostIndex)), "str x24, [x25], #0");
1024 COMPARE(str(w26, MemOperand(x27, 0, PostIndex)), "str w26, [x27], #0");
1025
1026 COMPARE(ldr(w24, MemOperand(sp)), "ldr w24, [sp]");
1027 COMPARE(ldr(x25, MemOperand(sp, 8)), "ldr x25, [sp, #8]");
1028 COMPARE(str(w26, MemOperand(sp, 4, PreIndex)), "str w26, [sp, #4]!");
1029 COMPARE(str(x27, MemOperand(sp, -8, PostIndex)), "str x27, [sp], #-8");
1030
1031 COMPARE(ldrsw(x0, MemOperand(x1)), "ldrsw x0, [x1]");
1032 COMPARE(ldrsw(x2, MemOperand(x3, 8)), "ldrsw x2, [x3, #8]");
1033 COMPARE(ldrsw(x4, MemOperand(x5, 42, PreIndex)), "ldrsw x4, [x5, #42]!");
1034 COMPARE(ldrsw(x6, MemOperand(x7, -11, PostIndex)), "ldrsw x6, [x7], #-11");
1035
1036 CLEANUP();
1037 }
1038
1039
TEST(load_store_regoffset)1040 TEST(load_store_regoffset) {
1041 SETUP();
1042
1043 COMPARE(ldr(w0, MemOperand(x1, w2, UXTW)), "ldr w0, [x1, w2, uxtw]");
1044 COMPARE(ldr(w3, MemOperand(x4, w5, UXTW, 2)), "ldr w3, [x4, w5, uxtw #2]");
1045 COMPARE(ldr(w6, MemOperand(x7, x8)), "ldr w6, [x7, x8]");
1046 COMPARE(ldr(w9, MemOperand(x10, x11, LSL, 2)), "ldr w9, [x10, x11, lsl #2]");
1047 COMPARE(ldr(w12, MemOperand(x13, w14, SXTW)), "ldr w12, [x13, w14, sxtw]");
1048 COMPARE(ldr(w15, MemOperand(x16, w17, SXTW, 2)),
1049 "ldr w15, [x16, w17, sxtw #2]");
1050 COMPARE(ldr(w18, MemOperand(x19, x20, SXTX)), "ldr w18, [x19, x20, sxtx]");
1051 COMPARE(ldr(w21, MemOperand(x22, x23, SXTX, 2)),
1052 "ldr w21, [x22, x23, sxtx #2]");
1053 COMPARE(ldr(x0, MemOperand(x1, w2, UXTW)), "ldr x0, [x1, w2, uxtw]");
1054 COMPARE(ldr(x3, MemOperand(x4, w5, UXTW, 3)), "ldr x3, [x4, w5, uxtw #3]");
1055 COMPARE(ldr(x6, MemOperand(x7, x8)), "ldr x6, [x7, x8]");
1056 COMPARE(ldr(x9, MemOperand(x10, x11, LSL, 3)), "ldr x9, [x10, x11, lsl #3]");
1057 COMPARE(ldr(x12, MemOperand(x13, w14, SXTW)), "ldr x12, [x13, w14, sxtw]");
1058 COMPARE(ldr(x15, MemOperand(x16, w17, SXTW, 3)),
1059 "ldr x15, [x16, w17, sxtw #3]");
1060 COMPARE(ldr(x18, MemOperand(x19, x20, SXTX)), "ldr x18, [x19, x20, sxtx]");
1061 COMPARE(ldr(x21, MemOperand(x22, x23, SXTX, 3)),
1062 "ldr x21, [x22, x23, sxtx #3]");
1063
1064 COMPARE(str(w0, MemOperand(x1, w2, UXTW)), "str w0, [x1, w2, uxtw]");
1065 COMPARE(str(w3, MemOperand(x4, w5, UXTW, 2)), "str w3, [x4, w5, uxtw #2]");
1066 COMPARE(str(w6, MemOperand(x7, x8)), "str w6, [x7, x8]");
1067 COMPARE(str(w9, MemOperand(x10, x11, LSL, 2)), "str w9, [x10, x11, lsl #2]");
1068 COMPARE(str(w12, MemOperand(x13, w14, SXTW)), "str w12, [x13, w14, sxtw]");
1069 COMPARE(str(w15, MemOperand(x16, w17, SXTW, 2)),
1070 "str w15, [x16, w17, sxtw #2]");
1071 COMPARE(str(w18, MemOperand(x19, x20, SXTX)), "str w18, [x19, x20, sxtx]");
1072 COMPARE(str(w21, MemOperand(x22, x23, SXTX, 2)),
1073 "str w21, [x22, x23, sxtx #2]");
1074 COMPARE(str(x0, MemOperand(x1, w2, UXTW)), "str x0, [x1, w2, uxtw]");
1075 COMPARE(str(x3, MemOperand(x4, w5, UXTW, 3)), "str x3, [x4, w5, uxtw #3]");
1076 COMPARE(str(x6, MemOperand(x7, x8)), "str x6, [x7, x8]");
1077 COMPARE(str(x9, MemOperand(x10, x11, LSL, 3)), "str x9, [x10, x11, lsl #3]");
1078 COMPARE(str(x12, MemOperand(x13, w14, SXTW)), "str x12, [x13, w14, sxtw]");
1079 COMPARE(str(x15, MemOperand(x16, w17, SXTW, 3)),
1080 "str x15, [x16, w17, sxtw #3]");
1081 COMPARE(str(x18, MemOperand(x19, x20, SXTX)), "str x18, [x19, x20, sxtx]");
1082 COMPARE(str(x21, MemOperand(x22, x23, SXTX, 3)),
1083 "str x21, [x22, x23, sxtx #3]");
1084
1085 COMPARE(ldrb(w0, MemOperand(x1, w2, UXTW)), "ldrb w0, [x1, w2, uxtw]");
1086 COMPARE(ldrb(w6, MemOperand(x7, x8)), "ldrb w6, [x7, x8]");
1087 COMPARE(ldrb(w12, MemOperand(x13, w14, SXTW)), "ldrb w12, [x13, w14, sxtw]");
1088 COMPARE(ldrb(w18, MemOperand(x19, x20, SXTX)), "ldrb w18, [x19, x20, sxtx]");
1089 COMPARE(strb(w0, MemOperand(x1, w2, UXTW)), "strb w0, [x1, w2, uxtw]");
1090 COMPARE(strb(w6, MemOperand(x7, x8)), "strb w6, [x7, x8]");
1091 COMPARE(strb(w12, MemOperand(x13, w14, SXTW)), "strb w12, [x13, w14, sxtw]");
1092 COMPARE(strb(w18, MemOperand(x19, x20, SXTX)), "strb w18, [x19, x20, sxtx]");
1093
1094 COMPARE(ldrh(w0, MemOperand(x1, w2, UXTW)), "ldrh w0, [x1, w2, uxtw]");
1095 COMPARE(ldrh(w3, MemOperand(x4, w5, UXTW, 1)), "ldrh w3, [x4, w5, uxtw #1]");
1096 COMPARE(ldrh(w6, MemOperand(x7, x8)), "ldrh w6, [x7, x8]");
1097 COMPARE(ldrh(w9, MemOperand(x10, x11, LSL, 1)),
1098 "ldrh w9, [x10, x11, lsl #1]");
1099 COMPARE(ldrh(w12, MemOperand(x13, w14, SXTW)), "ldrh w12, [x13, w14, sxtw]");
1100 COMPARE(ldrh(w15, MemOperand(x16, w17, SXTW, 1)),
1101 "ldrh w15, [x16, w17, sxtw #1]");
1102 COMPARE(ldrh(w18, MemOperand(x19, x20, SXTX)), "ldrh w18, [x19, x20, sxtx]");
1103 COMPARE(ldrh(w21, MemOperand(x22, x23, SXTX, 1)),
1104 "ldrh w21, [x22, x23, sxtx #1]");
1105 COMPARE(strh(w0, MemOperand(x1, w2, UXTW)), "strh w0, [x1, w2, uxtw]");
1106 COMPARE(strh(w3, MemOperand(x4, w5, UXTW, 1)), "strh w3, [x4, w5, uxtw #1]");
1107 COMPARE(strh(w6, MemOperand(x7, x8)), "strh w6, [x7, x8]");
1108 COMPARE(strh(w9, MemOperand(x10, x11, LSL, 1)),
1109 "strh w9, [x10, x11, lsl #1]");
1110 COMPARE(strh(w12, MemOperand(x13, w14, SXTW)), "strh w12, [x13, w14, sxtw]");
1111 COMPARE(strh(w15, MemOperand(x16, w17, SXTW, 1)),
1112 "strh w15, [x16, w17, sxtw #1]");
1113 COMPARE(strh(w18, MemOperand(x19, x20, SXTX)), "strh w18, [x19, x20, sxtx]");
1114 COMPARE(strh(w21, MemOperand(x22, x23, SXTX, 1)),
1115 "strh w21, [x22, x23, sxtx #1]");
1116
1117 COMPARE(ldr(x0, MemOperand(sp, wzr, SXTW)), "ldr x0, [sp, wzr, sxtw]");
1118 COMPARE(str(x1, MemOperand(sp, xzr)), "str x1, [sp, xzr]");
1119
1120 CLEANUP();
1121 }
1122
1123
TEST(load_store_byte)1124 TEST(load_store_byte) {
1125 SETUP();
1126
1127 COMPARE(ldrb(w0, MemOperand(x1)), "ldrb w0, [x1]");
1128 COMPARE(ldrb(x2, MemOperand(x3)), "ldrb w2, [x3]");
1129 COMPARE(ldrb(w4, MemOperand(x5, 4095)), "ldrb w4, [x5, #4095]");
1130 COMPARE(ldrb(w6, MemOperand(x7, 255, PreIndex)), "ldrb w6, [x7, #255]!");
1131 COMPARE(ldrb(w8, MemOperand(x9, -256, PreIndex)), "ldrb w8, [x9, #-256]!");
1132 COMPARE(ldrb(w10, MemOperand(x11, 255, PostIndex)), "ldrb w10, [x11], #255");
1133 COMPARE(ldrb(w12, MemOperand(x13, -256, PostIndex)),
1134 "ldrb w12, [x13], #-256");
1135 COMPARE(ldrb(w14, MemOperand(x15, 0, PreIndex)), "ldrb w14, [x15, #0]!");
1136 COMPARE(ldrb(w16, MemOperand(x17, 0, PostIndex)), "ldrb w16, [x17], #0");
1137 COMPARE(strb(w14, MemOperand(x15)), "strb w14, [x15]");
1138 COMPARE(strb(x16, MemOperand(x17)), "strb w16, [x17]");
1139 COMPARE(strb(w18, MemOperand(x19, 4095)), "strb w18, [x19, #4095]");
1140 COMPARE(strb(w20, MemOperand(x21, 255, PreIndex)), "strb w20, [x21, #255]!");
1141 COMPARE(strb(w22, MemOperand(x23, -256, PreIndex)),
1142 "strb w22, [x23, #-256]!");
1143 COMPARE(strb(w24, MemOperand(x25, 255, PostIndex)), "strb w24, [x25], #255");
1144 COMPARE(strb(w26, MemOperand(x27, -256, PostIndex)),
1145 "strb w26, [x27], #-256");
1146 COMPARE(strb(w27, MemOperand(x28, 0, PreIndex)), "strb w27, [x28, #0]!");
1147 COMPARE(strb(w29, MemOperand(x30, 0, PostIndex)), "strb w29, [x30], #0");
1148 COMPARE(ldrb(w28, MemOperand(sp, 3, PostIndex)), "ldrb w28, [sp], #3");
1149 COMPARE(strb(x29, MemOperand(sp, -42, PreIndex)), "strb w29, [sp, #-42]!");
1150 COMPARE(ldrsb(w0, MemOperand(x1)), "ldrsb w0, [x1]");
1151 COMPARE(ldrsb(x2, MemOperand(x3, 8)), "ldrsb x2, [x3, #8]");
1152 COMPARE(ldrsb(w4, MemOperand(x5, 42, PreIndex)), "ldrsb w4, [x5, #42]!");
1153 COMPARE(ldrsb(x6, MemOperand(x7, -11, PostIndex)), "ldrsb x6, [x7], #-11");
1154 COMPARE(ldrsb(w8, MemOperand(x9, 0, PreIndex)), "ldrsb w8, [x9, #0]!");
1155 COMPARE(ldrsb(x10, MemOperand(x11, 0, PostIndex)), "ldrsb x10, [x11], #0");
1156
1157 CLEANUP();
1158 }
1159
1160
TEST(load_store_half)1161 TEST(load_store_half) {
1162 SETUP();
1163
1164 COMPARE(ldrh(w0, MemOperand(x1)), "ldrh w0, [x1]");
1165 COMPARE(ldrh(x2, MemOperand(x3)), "ldrh w2, [x3]");
1166 COMPARE(ldrh(w4, MemOperand(x5, 8190)), "ldrh w4, [x5, #8190]");
1167 COMPARE(ldrh(w6, MemOperand(x7, 255, PreIndex)), "ldrh w6, [x7, #255]!");
1168 COMPARE(ldrh(w8, MemOperand(x9, -256, PreIndex)), "ldrh w8, [x9, #-256]!");
1169 COMPARE(ldrh(w10, MemOperand(x11, 255, PostIndex)), "ldrh w10, [x11], #255");
1170 COMPARE(ldrh(w12, MemOperand(x13, -256, PostIndex)),
1171 "ldrh w12, [x13], #-256");
1172 COMPARE(ldrh(w14, MemOperand(x15, 0, PreIndex)), "ldrh w14, [x15, #0]!");
1173 COMPARE(ldrh(w16, MemOperand(x17, 0, PostIndex)), "ldrh w16, [x17], #0");
1174 COMPARE(strh(w14, MemOperand(x15)), "strh w14, [x15]");
1175 COMPARE(strh(x16, MemOperand(x17)), "strh w16, [x17]");
1176 COMPARE(strh(w18, MemOperand(x19, 8190)), "strh w18, [x19, #8190]");
1177 COMPARE(strh(w20, MemOperand(x21, 255, PreIndex)), "strh w20, [x21, #255]!");
1178 COMPARE(strh(w22, MemOperand(x23, -256, PreIndex)),
1179 "strh w22, [x23, #-256]!");
1180 COMPARE(strh(w24, MemOperand(x25, 255, PostIndex)), "strh w24, [x25], #255");
1181 COMPARE(strh(w26, MemOperand(x27, -256, PostIndex)),
1182 "strh w26, [x27], #-256");
1183 COMPARE(strh(w27, MemOperand(x28, 0, PreIndex)), "strh w27, [x28, #0]!");
1184 COMPARE(strh(w29, MemOperand(x30, 0, PostIndex)), "strh w29, [x30], #0");
1185 COMPARE(ldrh(w28, MemOperand(sp, 3, PostIndex)), "ldrh w28, [sp], #3");
1186 COMPARE(strh(x29, MemOperand(sp, -42, PreIndex)), "strh w29, [sp, #-42]!");
1187 COMPARE(ldrh(w30, MemOperand(x0, 255)), "ldurh w30, [x0, #255]");
1188 COMPARE(ldrh(x1, MemOperand(x2, -256)), "ldurh w1, [x2, #-256]");
1189 COMPARE(strh(w3, MemOperand(x4, 255)), "sturh w3, [x4, #255]");
1190 COMPARE(strh(x5, MemOperand(x6, -256)), "sturh w5, [x6, #-256]");
1191 COMPARE(ldrsh(w0, MemOperand(x1)), "ldrsh w0, [x1]");
1192 COMPARE(ldrsh(w2, MemOperand(x3, 8)), "ldrsh w2, [x3, #8]");
1193 COMPARE(ldrsh(w4, MemOperand(x5, 42, PreIndex)), "ldrsh w4, [x5, #42]!");
1194 COMPARE(ldrsh(x6, MemOperand(x7, -11, PostIndex)), "ldrsh x6, [x7], #-11");
1195 COMPARE(ldrsh(w8, MemOperand(x9, 0, PreIndex)), "ldrsh w8, [x9, #0]!");
1196 COMPARE(ldrsh(x10, MemOperand(x11, 0, PostIndex)), "ldrsh x10, [x11], #0");
1197
1198 CLEANUP();
1199 }
1200
TEST(load_store_unscaled)1201 TEST(load_store_unscaled) {
1202 SETUP();
1203
1204 // If an unscaled-offset instruction is requested, it is used, even if the
1205 // offset could be encoded in a scaled-offset instruction.
1206 COMPARE(ldurb(w0, MemOperand(x1)), "ldurb w0, [x1]");
1207 COMPARE(ldurb(x2, MemOperand(x3, 1)), "ldurb w2, [x3, #1]");
1208 COMPARE(ldurb(w4, MemOperand(x5, 255)), "ldurb w4, [x5, #255]");
1209 COMPARE(sturb(w14, MemOperand(x15)), "sturb w14, [x15]");
1210 COMPARE(sturb(x16, MemOperand(x17, 1)), "sturb w16, [x17, #1]");
1211 COMPARE(sturb(w18, MemOperand(x19, 255)), "sturb w18, [x19, #255]");
1212 COMPARE(ldursb(w0, MemOperand(x1)), "ldursb w0, [x1]");
1213 COMPARE(ldursb(w2, MemOperand(x3, 1)), "ldursb w2, [x3, #1]");
1214 COMPARE(ldursb(x2, MemOperand(x3, 255)), "ldursb x2, [x3, #255]");
1215
1216 COMPARE(ldurh(w0, MemOperand(x1)), "ldurh w0, [x1]");
1217 COMPARE(ldurh(x2, MemOperand(x3, 2)), "ldurh w2, [x3, #2]");
1218 COMPARE(ldurh(w4, MemOperand(x5, 254)), "ldurh w4, [x5, #254]");
1219 COMPARE(sturh(w14, MemOperand(x15)), "sturh w14, [x15]");
1220 COMPARE(sturh(x16, MemOperand(x17, 2)), "sturh w16, [x17, #2]");
1221 COMPARE(sturh(w18, MemOperand(x19, 254)), "sturh w18, [x19, #254]");
1222 COMPARE(ldursh(w0, MemOperand(x1)), "ldursh w0, [x1]");
1223 COMPARE(ldursh(w2, MemOperand(x3, 2)), "ldursh w2, [x3, #2]");
1224 COMPARE(ldursh(x4, MemOperand(x5, 254)), "ldursh x4, [x5, #254]");
1225
1226 COMPARE(ldur(w0, MemOperand(x1)), "ldur w0, [x1]");
1227 COMPARE(ldur(w2, MemOperand(x3, 4)), "ldur w2, [x3, #4]");
1228 COMPARE(ldur(w4, MemOperand(x5, 248)), "ldur w4, [x5, #248]");
1229 COMPARE(stur(w12, MemOperand(x13)), "stur w12, [x13]");
1230 COMPARE(stur(w14, MemOperand(x15, 4)), "stur w14, [x15, #4]");
1231 COMPARE(stur(w16, MemOperand(x17, 248)), "stur w16, [x17, #248]");
1232 COMPARE(ldursw(x0, MemOperand(x1)), "ldursw x0, [x1]");
1233 COMPARE(ldursw(x2, MemOperand(x3, 4)), "ldursw x2, [x3, #4]");
1234 COMPARE(ldursw(x4, MemOperand(x5, 248)), "ldursw x4, [x5, #248]");
1235
1236 COMPARE(ldur(x6, MemOperand(x7)), "ldur x6, [x7]");
1237 COMPARE(ldur(x8, MemOperand(x9, 8)), "ldur x8, [x9, #8]");
1238 COMPARE(ldur(x10, MemOperand(x11, 248)), "ldur x10, [x11, #248]");
1239 COMPARE(stur(x18, MemOperand(x19)), "stur x18, [x19]");
1240 COMPARE(stur(x20, MemOperand(x21, 8)), "stur x20, [x21, #8]");
1241 COMPARE(stur(x22, MemOperand(x23, 248)), "stur x22, [x23, #248]");
1242
1243 COMPARE(ldur(b0, MemOperand(x1)), "ldur b0, [x1]");
1244 COMPARE(ldur(h2, MemOperand(x3, -1)), "ldur h2, [x3, #-1]");
1245 COMPARE(ldur(s4, MemOperand(x5, 2)), "ldur s4, [x5, #2]");
1246 COMPARE(ldur(d6, MemOperand(x7, -3)), "ldur d6, [x7, #-3]");
1247 COMPARE(ldur(q8, MemOperand(x9, 4)), "ldur q8, [x9, #4]");
1248 COMPARE(stur(b10, MemOperand(x11)), "stur b10, [x11]");
1249 COMPARE(stur(h12, MemOperand(x13, -1)), "stur h12, [x13, #-1]");
1250 COMPARE(stur(s14, MemOperand(x15, 2)), "stur s14, [x15, #2]");
1251 COMPARE(stur(d16, MemOperand(x17, -3)), "stur d16, [x17, #-3]");
1252 COMPARE(stur(q18, MemOperand(x19, 4)), "stur q18, [x19, #4]");
1253
1254 // Normal loads and stores are converted to unscaled loads and stores if the
1255 // offset requires it.
1256 COMPARE(ldr(w0, MemOperand(x1, 1)), "ldur w0, [x1, #1]");
1257 COMPARE(ldr(w2, MemOperand(x3, -1)), "ldur w2, [x3, #-1]");
1258 COMPARE(ldr(w4, MemOperand(x5, 255)), "ldur w4, [x5, #255]");
1259 COMPARE(ldr(w6, MemOperand(x7, -256)), "ldur w6, [x7, #-256]");
1260 COMPARE(ldr(x8, MemOperand(x9, 1)), "ldur x8, [x9, #1]");
1261 COMPARE(ldr(x10, MemOperand(x11, -1)), "ldur x10, [x11, #-1]");
1262 COMPARE(ldr(x12, MemOperand(x13, 255)), "ldur x12, [x13, #255]");
1263 COMPARE(ldr(x14, MemOperand(x15, -256)), "ldur x14, [x15, #-256]");
1264 COMPARE(str(w16, MemOperand(x17, 1)), "stur w16, [x17, #1]");
1265 COMPARE(str(w18, MemOperand(x19, -1)), "stur w18, [x19, #-1]");
1266 COMPARE(str(w20, MemOperand(x21, 255)), "stur w20, [x21, #255]");
1267 COMPARE(str(w22, MemOperand(x23, -256)), "stur w22, [x23, #-256]");
1268 COMPARE(str(x24, MemOperand(x25, 1)), "stur x24, [x25, #1]");
1269 COMPARE(str(x26, MemOperand(x27, -1)), "stur x26, [x27, #-1]");
1270 COMPARE(str(x28, MemOperand(x29, 255)), "stur x28, [x29, #255]");
1271 COMPARE(str(x30, MemOperand(x0, -256)), "stur x30, [x0, #-256]");
1272 COMPARE(ldr(w0, MemOperand(sp, 1)), "ldur w0, [sp, #1]");
1273 COMPARE(str(x1, MemOperand(sp, -1)), "stur x1, [sp, #-1]");
1274 COMPARE(ldrb(w2, MemOperand(x3, -2)), "ldurb w2, [x3, #-2]");
1275 COMPARE(ldrsb(w4, MemOperand(x5, -3)), "ldursb w4, [x5, #-3]");
1276 COMPARE(ldrsb(x6, MemOperand(x7, -4)), "ldursb x6, [x7, #-4]");
1277 COMPARE(ldrh(w8, MemOperand(x9, -5)), "ldurh w8, [x9, #-5]");
1278 COMPARE(ldrsh(w10, MemOperand(x11, -6)), "ldursh w10, [x11, #-6]");
1279 COMPARE(ldrsh(x12, MemOperand(x13, -7)), "ldursh x12, [x13, #-7]");
1280 COMPARE(ldrsw(x14, MemOperand(x15, -8)), "ldursw x14, [x15, #-8]");
1281
1282 CLEANUP();
1283 }
1284
1285
TEST(load_store_unscaled_option)1286 TEST(load_store_unscaled_option) {
1287 SETUP();
1288
1289 // Just like load_store_unscaled, but specify the scaling option explicitly.
1290 LoadStoreScalingOption options[] = {PreferUnscaledOffset,
1291 RequireUnscaledOffset};
1292
1293 for (size_t i = 0; i < sizeof(options) / sizeof(options[0]); i++) {
1294 LoadStoreScalingOption option = options[i];
1295
1296 // If an unscaled-offset instruction is requested, it is used, even if the
1297 // offset could be encoded in a scaled-offset instruction.
1298 COMPARE(ldurb(w0, MemOperand(x1), option), "ldurb w0, [x1]");
1299 COMPARE(ldurb(x2, MemOperand(x3, 1), option), "ldurb w2, [x3, #1]");
1300 COMPARE(ldurb(w4, MemOperand(x5, 255), option), "ldurb w4, [x5, #255]");
1301 COMPARE(sturb(w14, MemOperand(x15), option), "sturb w14, [x15]");
1302 COMPARE(sturb(x16, MemOperand(x17, 1), option), "sturb w16, [x17, #1]");
1303 COMPARE(sturb(w18, MemOperand(x19, 255), option), "sturb w18, [x19, #255]");
1304 COMPARE(ldursb(w0, MemOperand(x1), option), "ldursb w0, [x1]");
1305 COMPARE(ldursb(w2, MemOperand(x3, 1), option), "ldursb w2, [x3, #1]");
1306 COMPARE(ldursb(x2, MemOperand(x3, 255), option), "ldursb x2, [x3, #255]");
1307
1308 COMPARE(ldurh(w0, MemOperand(x1), option), "ldurh w0, [x1]");
1309 COMPARE(ldurh(x2, MemOperand(x3, 2), option), "ldurh w2, [x3, #2]");
1310 COMPARE(ldurh(w4, MemOperand(x5, 254), option), "ldurh w4, [x5, #254]");
1311 COMPARE(sturh(w14, MemOperand(x15), option), "sturh w14, [x15]");
1312 COMPARE(sturh(x16, MemOperand(x17, 2), option), "sturh w16, [x17, #2]");
1313 COMPARE(sturh(w18, MemOperand(x19, 254), option), "sturh w18, [x19, #254]");
1314 COMPARE(ldursh(w0, MemOperand(x1), option), "ldursh w0, [x1]");
1315 COMPARE(ldursh(w2, MemOperand(x3, 2), option), "ldursh w2, [x3, #2]");
1316 COMPARE(ldursh(x4, MemOperand(x5, 254), option), "ldursh x4, [x5, #254]");
1317
1318 COMPARE(ldur(w0, MemOperand(x1), option), "ldur w0, [x1]");
1319 COMPARE(ldur(w2, MemOperand(x3, 4), option), "ldur w2, [x3, #4]");
1320 COMPARE(ldur(w4, MemOperand(x5, 248), option), "ldur w4, [x5, #248]");
1321 COMPARE(stur(w12, MemOperand(x13), option), "stur w12, [x13]");
1322 COMPARE(stur(w14, MemOperand(x15, 4), option), "stur w14, [x15, #4]");
1323 COMPARE(stur(w16, MemOperand(x17, 248), option), "stur w16, [x17, #248]");
1324 COMPARE(ldursw(x0, MemOperand(x1), option), "ldursw x0, [x1]");
1325 COMPARE(ldursw(x2, MemOperand(x3, 4), option), "ldursw x2, [x3, #4]");
1326 COMPARE(ldursw(x4, MemOperand(x5, 248), option), "ldursw x4, [x5, #248]");
1327
1328 COMPARE(ldur(x6, MemOperand(x7), option), "ldur x6, [x7]");
1329 COMPARE(ldur(x8, MemOperand(x9, 8), option), "ldur x8, [x9, #8]");
1330 COMPARE(ldur(x10, MemOperand(x11, 248), option), "ldur x10, [x11, #248]");
1331 COMPARE(stur(x18, MemOperand(x19), option), "stur x18, [x19]");
1332 COMPARE(stur(x20, MemOperand(x21, 8), option), "stur x20, [x21, #8]");
1333 COMPARE(stur(x22, MemOperand(x23, 248), option), "stur x22, [x23, #248]");
1334
1335 COMPARE(ldur(b0, MemOperand(x1), option), "ldur b0, [x1]");
1336 COMPARE(ldur(h2, MemOperand(x3, 2), option), "ldur h2, [x3, #2]");
1337 COMPARE(ldur(s4, MemOperand(x5, 4), option), "ldur s4, [x5, #4]");
1338 COMPARE(ldur(d6, MemOperand(x7, 8), option), "ldur d6, [x7, #8]");
1339 COMPARE(ldur(q8, MemOperand(x9, 16), option), "ldur q8, [x9, #16]");
1340 COMPARE(stur(b10, MemOperand(x11), option), "stur b10, [x11]");
1341 COMPARE(stur(h12, MemOperand(x13, 2), option), "stur h12, [x13, #2]");
1342 COMPARE(stur(s14, MemOperand(x15, 4), option), "stur s14, [x15, #4]");
1343 COMPARE(stur(d16, MemOperand(x17, 8), option), "stur d16, [x17, #8]");
1344 COMPARE(stur(q18, MemOperand(x19, 16), option), "stur q18, [x19, #16]");
1345 }
1346
1347 // Normal loads and stores are converted to unscaled loads and stores if the
1348 // offset requires it. PreferScaledOffset is the default for these cases, so
1349 // the behaviour here is the same when no option is specified.
1350 LoadStoreScalingOption option = PreferScaledOffset;
1351 COMPARE(ldr(w0, MemOperand(x1, 1), option), "ldur w0, [x1, #1]");
1352 COMPARE(ldr(w2, MemOperand(x3, -1), option), "ldur w2, [x3, #-1]");
1353 COMPARE(ldr(w4, MemOperand(x5, 255), option), "ldur w4, [x5, #255]");
1354 COMPARE(ldr(w6, MemOperand(x7, -256), option), "ldur w6, [x7, #-256]");
1355 COMPARE(ldr(x8, MemOperand(x9, 1), option), "ldur x8, [x9, #1]");
1356 COMPARE(ldr(x10, MemOperand(x11, -1), option), "ldur x10, [x11, #-1]");
1357 COMPARE(ldr(x12, MemOperand(x13, 255), option), "ldur x12, [x13, #255]");
1358 COMPARE(ldr(x14, MemOperand(x15, -256), option), "ldur x14, [x15, #-256]");
1359 COMPARE(str(w16, MemOperand(x17, 1), option), "stur w16, [x17, #1]");
1360 COMPARE(str(w18, MemOperand(x19, -1), option), "stur w18, [x19, #-1]");
1361 COMPARE(str(w20, MemOperand(x21, 255), option), "stur w20, [x21, #255]");
1362 COMPARE(str(w22, MemOperand(x23, -256), option), "stur w22, [x23, #-256]");
1363 COMPARE(str(x24, MemOperand(x25, 1), option), "stur x24, [x25, #1]");
1364 COMPARE(str(x26, MemOperand(x27, -1), option), "stur x26, [x27, #-1]");
1365 COMPARE(str(x28, MemOperand(x29, 255), option), "stur x28, [x29, #255]");
1366 COMPARE(str(x30, MemOperand(x0, -256), option), "stur x30, [x0, #-256]");
1367 COMPARE(ldr(w0, MemOperand(sp, 1), option), "ldur w0, [sp, #1]");
1368 COMPARE(str(x1, MemOperand(sp, -1), option), "stur x1, [sp, #-1]");
1369 COMPARE(ldrb(w2, MemOperand(x3, -2), option), "ldurb w2, [x3, #-2]");
1370 COMPARE(ldrsb(w4, MemOperand(x5, -3), option), "ldursb w4, [x5, #-3]");
1371 COMPARE(ldrsb(x6, MemOperand(x7, -4), option), "ldursb x6, [x7, #-4]");
1372 COMPARE(ldrh(w8, MemOperand(x9, -5), option), "ldurh w8, [x9, #-5]");
1373 COMPARE(ldrsh(w10, MemOperand(x11, -6), option), "ldursh w10, [x11, #-6]");
1374 COMPARE(ldrsh(x12, MemOperand(x13, -7), option), "ldursh x12, [x13, #-7]");
1375 COMPARE(ldrsw(x14, MemOperand(x15, -8), option), "ldursw x14, [x15, #-8]");
1376 COMPARE(ldr(b0, MemOperand(x1, 1), option), "ldr b0, [x1, #1]");
1377 COMPARE(ldr(h2, MemOperand(x3, 1), option), "ldur h2, [x3, #1]");
1378 COMPARE(ldr(s4, MemOperand(x5, 3), option), "ldur s4, [x5, #3]");
1379 COMPARE(ldr(d6, MemOperand(x7, 7), option), "ldur d6, [x7, #7]");
1380 COMPARE(ldr(q8, MemOperand(x9, 15), option), "ldur q8, [x9, #15]");
1381 COMPARE(str(b10, MemOperand(x11, 1), option), "str b10, [x11, #1]");
1382 COMPARE(str(h12, MemOperand(x13, 1), option), "stur h12, [x13, #1]");
1383 COMPARE(str(s14, MemOperand(x15, 3), option), "stur s14, [x15, #3]");
1384 COMPARE(str(d16, MemOperand(x17, 7), option), "stur d16, [x17, #7]");
1385 COMPARE(str(q18, MemOperand(x19, 15), option), "stur q18, [x19, #15]");
1386
1387 CLEANUP();
1388 }
1389
1390
TEST(load_store_pair)1391 TEST(load_store_pair) {
1392 SETUP();
1393
1394 COMPARE(ldp(w0, w1, MemOperand(x2)), "ldp w0, w1, [x2]");
1395 COMPARE(ldp(x3, x4, MemOperand(x5)), "ldp x3, x4, [x5]");
1396 COMPARE(ldp(w6, w7, MemOperand(x8, 4)), "ldp w6, w7, [x8, #4]");
1397 COMPARE(ldp(x9, x10, MemOperand(x11, 8)), "ldp x9, x10, [x11, #8]");
1398 COMPARE(ldp(w12, w13, MemOperand(x14, 252)), "ldp w12, w13, [x14, #252]");
1399 COMPARE(ldp(x15, x16, MemOperand(x17, 504)), "ldp x15, x16, [x17, #504]");
1400 COMPARE(ldp(w18, w19, MemOperand(x20, -256)), "ldp w18, w19, [x20, #-256]");
1401 COMPARE(ldp(x21, x22, MemOperand(x23, -512)), "ldp x21, x22, [x23, #-512]");
1402 COMPARE(ldp(w24, w25, MemOperand(x26, 252, PreIndex)),
1403 "ldp w24, w25, [x26, #252]!");
1404 COMPARE(ldp(x27, x28, MemOperand(x29, 504, PreIndex)),
1405 "ldp x27, x28, [x29, #504]!");
1406 COMPARE(ldp(w30, w0, MemOperand(x1, -256, PreIndex)),
1407 "ldp w30, w0, [x1, #-256]!");
1408 COMPARE(ldp(x2, x3, MemOperand(x4, -512, PreIndex)),
1409 "ldp x2, x3, [x4, #-512]!");
1410 COMPARE(ldp(w5, w6, MemOperand(x7, 252, PostIndex)),
1411 "ldp w5, w6, [x7], #252");
1412 COMPARE(ldp(x8, x9, MemOperand(x10, 504, PostIndex)),
1413 "ldp x8, x9, [x10], #504");
1414 COMPARE(ldp(w11, w12, MemOperand(x13, -256, PostIndex)),
1415 "ldp w11, w12, [x13], #-256");
1416 COMPARE(ldp(x14, x15, MemOperand(x16, -512, PostIndex)),
1417 "ldp x14, x15, [x16], #-512");
1418 COMPARE(ldp(x0, x1, MemOperand(x2, 0, PostIndex)), "ldp x0, x1, [x2], #0");
1419 COMPARE(ldp(w3, w4, MemOperand(x5, 0, PreIndex)), "ldp w3, w4, [x5, #0]!");
1420
1421 COMPARE(ldp(s17, s18, MemOperand(x19)), "ldp s17, s18, [x19]");
1422 COMPARE(ldp(s20, s21, MemOperand(x22, 252)), "ldp s20, s21, [x22, #252]");
1423 COMPARE(ldp(s23, s24, MemOperand(x25, -256)), "ldp s23, s24, [x25, #-256]");
1424 COMPARE(ldp(s26, s27, MemOperand(x28, 252, PreIndex)),
1425 "ldp s26, s27, [x28, #252]!");
1426 COMPARE(ldp(s29, s30, MemOperand(x29, -256, PreIndex)),
1427 "ldp s29, s30, [x29, #-256]!");
1428 COMPARE(ldp(s31, s0, MemOperand(x1, 252, PostIndex)),
1429 "ldp s31, s0, [x1], #252");
1430 COMPARE(ldp(s2, s3, MemOperand(x4, -256, PostIndex)),
1431 "ldp s2, s3, [x4], #-256");
1432 COMPARE(ldp(d17, d18, MemOperand(x19)), "ldp d17, d18, [x19]");
1433 COMPARE(ldp(d20, d21, MemOperand(x22, 504)), "ldp d20, d21, [x22, #504]");
1434 COMPARE(ldp(d23, d24, MemOperand(x25, -512)), "ldp d23, d24, [x25, #-512]");
1435 COMPARE(ldp(d26, d27, MemOperand(x28, 504, PreIndex)),
1436 "ldp d26, d27, [x28, #504]!");
1437 COMPARE(ldp(d29, d30, MemOperand(x29, -512, PreIndex)),
1438 "ldp d29, d30, [x29, #-512]!");
1439 COMPARE(ldp(d31, d0, MemOperand(x1, 504, PostIndex)),
1440 "ldp d31, d0, [x1], #504");
1441 COMPARE(ldp(d2, d3, MemOperand(x4, -512, PostIndex)),
1442 "ldp d2, d3, [x4], #-512");
1443 COMPARE(ldp(s0, s1, MemOperand(x2, 0, PostIndex)), "ldp s0, s1, [x2], #0");
1444 COMPARE(ldp(d3, d4, MemOperand(x5, 0, PreIndex)), "ldp d3, d4, [x5, #0]!");
1445
1446 COMPARE(ldp(q5, q6, MemOperand(x7)), "ldp q5, q6, [x7]");
1447 COMPARE(ldp(q8, q9, MemOperand(x10, 1008)), "ldp q8, q9, [x10, #1008]");
1448 COMPARE(ldp(q11, q12, MemOperand(x13, -1024)), "ldp q11, q12, [x13, #-1024]");
1449 COMPARE(ldp(q14, q15, MemOperand(x16, 1008, PreIndex)),
1450 "ldp q14, q15, [x16, #1008]!");
1451 COMPARE(ldp(q17, q18, MemOperand(x19, -1024, PreIndex)),
1452 "ldp q17, q18, [x19, #-1024]!");
1453 COMPARE(ldp(q20, q21, MemOperand(x22, 1008, PostIndex)),
1454 "ldp q20, q21, [x22], #1008");
1455 COMPARE(ldp(q23, q24, MemOperand(x25, -1024, PostIndex)),
1456 "ldp q23, q24, [x25], #-1024");
1457 COMPARE(ldp(q6, q7, MemOperand(x8, 0, PreIndex)), "ldp q6, q7, [x8, #0]!");
1458
1459 COMPARE(stp(w0, w1, MemOperand(x2)), "stp w0, w1, [x2]");
1460 COMPARE(stp(x3, x4, MemOperand(x5)), "stp x3, x4, [x5]");
1461 COMPARE(stp(w6, w7, MemOperand(x8, 4)), "stp w6, w7, [x8, #4]");
1462 COMPARE(stp(x9, x10, MemOperand(x11, 8)), "stp x9, x10, [x11, #8]");
1463 COMPARE(stp(w12, w13, MemOperand(x14, 252)), "stp w12, w13, [x14, #252]");
1464 COMPARE(stp(x15, x16, MemOperand(x17, 504)), "stp x15, x16, [x17, #504]");
1465 COMPARE(stp(w18, w19, MemOperand(x20, -256)), "stp w18, w19, [x20, #-256]");
1466 COMPARE(stp(x21, x22, MemOperand(x23, -512)), "stp x21, x22, [x23, #-512]");
1467 COMPARE(stp(w24, w25, MemOperand(x26, 252, PreIndex)),
1468 "stp w24, w25, [x26, #252]!");
1469 COMPARE(stp(x27, x28, MemOperand(x29, 504, PreIndex)),
1470 "stp x27, x28, [x29, #504]!");
1471 COMPARE(stp(w30, w0, MemOperand(x1, -256, PreIndex)),
1472 "stp w30, w0, [x1, #-256]!");
1473 COMPARE(stp(x2, x3, MemOperand(x4, -512, PreIndex)),
1474 "stp x2, x3, [x4, #-512]!");
1475 COMPARE(stp(w5, w6, MemOperand(x7, 252, PostIndex)),
1476 "stp w5, w6, [x7], #252");
1477 COMPARE(stp(x8, x9, MemOperand(x10, 504, PostIndex)),
1478 "stp x8, x9, [x10], #504");
1479 COMPARE(stp(w11, w12, MemOperand(x13, -256, PostIndex)),
1480 "stp w11, w12, [x13], #-256");
1481 COMPARE(stp(x14, x15, MemOperand(x16, -512, PostIndex)),
1482 "stp x14, x15, [x16], #-512");
1483 COMPARE(stp(x0, x1, MemOperand(x2, 0, PostIndex)), "stp x0, x1, [x2], #0");
1484 COMPARE(stp(w3, w4, MemOperand(x5, 0, PreIndex)), "stp w3, w4, [x5, #0]!");
1485
1486 COMPARE(stp(s17, s18, MemOperand(x19)), "stp s17, s18, [x19]");
1487 COMPARE(stp(s20, s21, MemOperand(x22, 252)), "stp s20, s21, [x22, #252]");
1488 COMPARE(stp(s23, s24, MemOperand(x25, -256)), "stp s23, s24, [x25, #-256]");
1489 COMPARE(stp(s26, s27, MemOperand(x28, 252, PreIndex)),
1490 "stp s26, s27, [x28, #252]!");
1491 COMPARE(stp(s29, s30, MemOperand(x29, -256, PreIndex)),
1492 "stp s29, s30, [x29, #-256]!");
1493 COMPARE(stp(s31, s0, MemOperand(x1, 252, PostIndex)),
1494 "stp s31, s0, [x1], #252");
1495 COMPARE(stp(s2, s3, MemOperand(x4, -256, PostIndex)),
1496 "stp s2, s3, [x4], #-256");
1497 COMPARE(stp(d17, d18, MemOperand(x19)), "stp d17, d18, [x19]");
1498 COMPARE(stp(d20, d21, MemOperand(x22, 504)), "stp d20, d21, [x22, #504]");
1499 COMPARE(stp(d23, d24, MemOperand(x25, -512)), "stp d23, d24, [x25, #-512]");
1500 COMPARE(stp(d26, d27, MemOperand(x28, 504, PreIndex)),
1501 "stp d26, d27, [x28, #504]!");
1502 COMPARE(stp(d29, d30, MemOperand(x29, -512, PreIndex)),
1503 "stp d29, d30, [x29, #-512]!");
1504 COMPARE(stp(d31, d0, MemOperand(x1, 504, PostIndex)),
1505 "stp d31, d0, [x1], #504");
1506 COMPARE(stp(d2, d3, MemOperand(x4, -512, PostIndex)),
1507 "stp d2, d3, [x4], #-512");
1508 COMPARE(stp(s0, s1, MemOperand(x2, 0, PostIndex)), "stp s0, s1, [x2], #0");
1509 COMPARE(stp(d3, d4, MemOperand(x5, 0, PreIndex)), "stp d3, d4, [x5, #0]!");
1510
1511 COMPARE(stp(q5, q6, MemOperand(x7)), "stp q5, q6, [x7]");
1512 COMPARE(stp(q8, q9, MemOperand(x10, 1008)), "stp q8, q9, [x10, #1008]");
1513 COMPARE(stp(q11, q12, MemOperand(x13, -1024)), "stp q11, q12, [x13, #-1024]");
1514 COMPARE(stp(q14, q15, MemOperand(x16, 1008, PreIndex)),
1515 "stp q14, q15, [x16, #1008]!");
1516 COMPARE(stp(q17, q18, MemOperand(x19, -1024, PreIndex)),
1517 "stp q17, q18, [x19, #-1024]!");
1518 COMPARE(stp(q20, q21, MemOperand(x22, 1008, PostIndex)),
1519 "stp q20, q21, [x22], #1008");
1520 COMPARE(stp(q23, q24, MemOperand(x25, -1024, PostIndex)),
1521 "stp q23, q24, [x25], #-1024");
1522 COMPARE(stp(q6, q7, MemOperand(x8, 0, PreIndex)), "stp q6, q7, [x8, #0]!");
1523
1524 COMPARE(ldp(w16, w17, MemOperand(sp, 4, PostIndex)),
1525 "ldp w16, w17, [sp], #4");
1526 COMPARE(stp(x18, x19, MemOperand(sp, -8, PreIndex)),
1527 "stp x18, x19, [sp, #-8]!");
1528 COMPARE(ldp(s30, s31, MemOperand(sp, 12, PostIndex)),
1529 "ldp s30, s31, [sp], #12");
1530 COMPARE(stp(d30, d31, MemOperand(sp, -16)), "stp d30, d31, [sp, #-16]");
1531 COMPARE(ldp(q30, q31, MemOperand(sp, 32, PostIndex)),
1532 "ldp q30, q31, [sp], #32");
1533
1534 COMPARE(ldpsw(x0, x1, MemOperand(x2)), "ldpsw x0, x1, [x2]");
1535 COMPARE(ldpsw(x3, x4, MemOperand(x5, 16)), "ldpsw x3, x4, [x5, #16]");
1536 COMPARE(ldpsw(x6, x7, MemOperand(x8, -32, PreIndex)),
1537 "ldpsw x6, x7, [x8, #-32]!");
1538 COMPARE(ldpsw(x9, x10, MemOperand(x11, 128, PostIndex)),
1539 "ldpsw x9, x10, [x11], #128");
1540 COMPARE(ldpsw(x0, x1, MemOperand(x10, 0, PreIndex)),
1541 "ldpsw x0, x1, [x10, #0]!");
1542 COMPARE(ldpsw(x2, x3, MemOperand(x10, 0, PostIndex)),
1543 "ldpsw x2, x3, [x10], #0");
1544
1545 CLEANUP();
1546 }
1547
1548
TEST(load_pauth)1549 TEST(load_pauth) {
1550 SETUP();
1551
1552 COMPARE(ldraa(x0, MemOperand(x1)), "ldraa x0, [x1]");
1553 COMPARE(ldraa(x2, MemOperand(sp)), "ldraa x2, [sp]");
1554 COMPARE(ldraa(x3, MemOperand(x4, 64)), "ldraa x3, [x4, #64]");
1555 COMPARE(ldraa(x5, MemOperand(sp, 512)), "ldraa x5, [sp, #512]");
1556 COMPARE(ldraa(x6, MemOperand(x7, -256)), "ldraa x6, [x7, #-256]");
1557 COMPARE(ldraa(x8, MemOperand(sp, -1024)), "ldraa x8, [sp, #-1024]");
1558 COMPARE(ldraa(x9, MemOperand(x10, 2048, PreIndex)),
1559 "ldraa x9, [x10, #2048]!");
1560
1561 COMPARE(ldrab(x9, MemOperand(x10)), "ldrab x9, [x10]");
1562 COMPARE(ldrab(x11, MemOperand(sp)), "ldrab x11, [sp]");
1563 COMPARE(ldrab(x12, MemOperand(x13, 64)), "ldrab x12, [x13, #64]");
1564 COMPARE(ldrab(x14, MemOperand(sp, 512)), "ldrab x14, [sp, #512]");
1565 COMPARE(ldrab(x15, MemOperand(x16, -256)), "ldrab x15, [x16, #-256]");
1566 COMPARE(ldrab(x17, MemOperand(sp, -1024)), "ldrab x17, [sp, #-1024]");
1567 COMPARE(ldrab(x18, MemOperand(x19, 2048, PreIndex)),
1568 "ldrab x18, [x19, #2048]!");
1569
1570 CLEANUP();
1571 }
1572
1573
TEST(load_store_exclusive)1574 TEST(load_store_exclusive) {
1575 SETUP();
1576
1577 COMPARE(stxrb(w0, w1, MemOperand(x2)), "stxrb w0, w1, [x2]");
1578 COMPARE(stxrb(x3, w4, MemOperand(sp)), "stxrb w3, w4, [sp]");
1579 COMPARE(stxrb(w5, x6, MemOperand(x7)), "stxrb w5, w6, [x7]");
1580 COMPARE(stxrb(x8, x9, MemOperand(sp)), "stxrb w8, w9, [sp]");
1581 COMPARE(stxrh(w10, w11, MemOperand(x12)), "stxrh w10, w11, [x12]");
1582 COMPARE(stxrh(x13, w14, MemOperand(sp)), "stxrh w13, w14, [sp]");
1583 COMPARE(stxrh(w15, x16, MemOperand(x17)), "stxrh w15, w16, [x17]");
1584 COMPARE(stxrh(x18, x19, MemOperand(sp)), "stxrh w18, w19, [sp]");
1585 COMPARE(stxr(w20, w21, MemOperand(x22)), "stxr w20, w21, [x22]");
1586 COMPARE(stxr(x23, w24, MemOperand(sp)), "stxr w23, w24, [sp]");
1587 COMPARE(stxr(w25, x26, MemOperand(x27)), "stxr w25, x26, [x27]");
1588 COMPARE(stxr(x28, x29, MemOperand(sp)), "stxr w28, x29, [sp]");
1589 COMPARE(ldxrb(w30, MemOperand(x0)), "ldxrb w30, [x0]");
1590 COMPARE(ldxrb(w1, MemOperand(sp)), "ldxrb w1, [sp]");
1591 COMPARE(ldxrb(x2, MemOperand(x3)), "ldxrb w2, [x3]");
1592 COMPARE(ldxrb(x4, MemOperand(sp)), "ldxrb w4, [sp]");
1593 COMPARE(ldxrh(w5, MemOperand(x6)), "ldxrh w5, [x6]");
1594 COMPARE(ldxrh(w7, MemOperand(sp)), "ldxrh w7, [sp]");
1595 COMPARE(ldxrh(x8, MemOperand(x9)), "ldxrh w8, [x9]");
1596 COMPARE(ldxrh(x10, MemOperand(sp)), "ldxrh w10, [sp]");
1597 COMPARE(ldxr(w11, MemOperand(x12)), "ldxr w11, [x12]");
1598 COMPARE(ldxr(w13, MemOperand(sp)), "ldxr w13, [sp]");
1599 COMPARE(ldxr(x14, MemOperand(x15)), "ldxr x14, [x15]");
1600 COMPARE(ldxr(x16, MemOperand(sp)), "ldxr x16, [sp]");
1601 COMPARE(stxp(w17, w18, w19, MemOperand(x20)), "stxp w17, w18, w19, [x20]");
1602 COMPARE(stxp(x21, w22, w23, MemOperand(sp)), "stxp w21, w22, w23, [sp]");
1603 COMPARE(stxp(w24, x25, x26, MemOperand(x27)), "stxp w24, x25, x26, [x27]");
1604 COMPARE(stxp(x28, x29, x30, MemOperand(sp)), "stxp w28, x29, x30, [sp]");
1605 COMPARE(ldxp(w0, w1, MemOperand(x2)), "ldxp w0, w1, [x2]");
1606 COMPARE(ldxp(w3, w4, MemOperand(sp)), "ldxp w3, w4, [sp]");
1607 COMPARE(ldxp(x5, x6, MemOperand(x7)), "ldxp x5, x6, [x7]");
1608 COMPARE(ldxp(x8, x9, MemOperand(sp)), "ldxp x8, x9, [sp]");
1609 COMPARE(stlxrb(w10, w11, MemOperand(x12)), "stlxrb w10, w11, [x12]");
1610 COMPARE(stlxrb(x13, w14, MemOperand(sp)), "stlxrb w13, w14, [sp]");
1611 COMPARE(stlxrb(w15, x16, MemOperand(x17)), "stlxrb w15, w16, [x17]");
1612 COMPARE(stlxrb(x18, x19, MemOperand(sp)), "stlxrb w18, w19, [sp]");
1613 COMPARE(stlxrh(w20, w21, MemOperand(x22)), "stlxrh w20, w21, [x22]");
1614 COMPARE(stlxrh(x23, w24, MemOperand(sp)), "stlxrh w23, w24, [sp]");
1615 COMPARE(stlxrh(w25, x26, MemOperand(x27)), "stlxrh w25, w26, [x27]");
1616 COMPARE(stlxrh(x28, x29, MemOperand(sp)), "stlxrh w28, w29, [sp]");
1617 COMPARE(stlxr(w30, w0, MemOperand(x1)), "stlxr w30, w0, [x1]");
1618 COMPARE(stlxr(x2, w3, MemOperand(sp)), "stlxr w2, w3, [sp]");
1619 COMPARE(stlxr(w4, x5, MemOperand(x6)), "stlxr w4, x5, [x6]");
1620 COMPARE(stlxr(x7, x8, MemOperand(sp)), "stlxr w7, x8, [sp]");
1621 COMPARE(ldaxrb(w9, MemOperand(x10)), "ldaxrb w9, [x10]");
1622 COMPARE(ldaxrb(w11, MemOperand(sp)), "ldaxrb w11, [sp]");
1623 COMPARE(ldaxrb(x12, MemOperand(x13)), "ldaxrb w12, [x13]");
1624 COMPARE(ldaxrb(x14, MemOperand(sp)), "ldaxrb w14, [sp]");
1625 COMPARE(ldaxrh(w15, MemOperand(x16)), "ldaxrh w15, [x16]");
1626 COMPARE(ldaxrh(w17, MemOperand(sp)), "ldaxrh w17, [sp]");
1627 COMPARE(ldaxrh(x18, MemOperand(x19)), "ldaxrh w18, [x19]");
1628 COMPARE(ldaxrh(x20, MemOperand(sp)), "ldaxrh w20, [sp]");
1629 COMPARE(ldaxr(w21, MemOperand(x22)), "ldaxr w21, [x22]");
1630 COMPARE(ldaxr(w23, MemOperand(sp)), "ldaxr w23, [sp]");
1631 COMPARE(ldaxr(x24, MemOperand(x25)), "ldaxr x24, [x25]");
1632 COMPARE(ldaxr(x26, MemOperand(sp)), "ldaxr x26, [sp]");
1633 COMPARE(stlxp(w27, w28, w29, MemOperand(x30)), "stlxp w27, w28, w29, [x30]");
1634 COMPARE(stlxp(x0, w1, w2, MemOperand(sp)), "stlxp w0, w1, w2, [sp]");
1635 COMPARE(stlxp(w3, x4, x5, MemOperand(x6)), "stlxp w3, x4, x5, [x6]");
1636 COMPARE(stlxp(x7, x8, x9, MemOperand(sp)), "stlxp w7, x8, x9, [sp]");
1637 COMPARE(ldaxp(w10, w11, MemOperand(x12)), "ldaxp w10, w11, [x12]");
1638 COMPARE(ldaxp(w13, w14, MemOperand(sp)), "ldaxp w13, w14, [sp]");
1639 COMPARE(ldaxp(x15, x16, MemOperand(x17)), "ldaxp x15, x16, [x17]");
1640 COMPARE(ldaxp(x18, x19, MemOperand(sp)), "ldaxp x18, x19, [sp]");
1641 COMPARE(stlrb(w20, MemOperand(x21)), "stlrb w20, [x21]");
1642 COMPARE(stlrb(w22, MemOperand(sp)), "stlrb w22, [sp]");
1643 COMPARE(stlrb(x23, MemOperand(x24)), "stlrb w23, [x24]");
1644 COMPARE(stlrb(x25, MemOperand(sp)), "stlrb w25, [sp]");
1645 COMPARE(stlrh(w26, MemOperand(x27)), "stlrh w26, [x27]");
1646 COMPARE(stlrh(w28, MemOperand(sp)), "stlrh w28, [sp]");
1647 COMPARE(stlrh(x29, MemOperand(x30)), "stlrh w29, [x30]");
1648 COMPARE(stlrh(x0, MemOperand(sp)), "stlrh w0, [sp]");
1649 COMPARE(stlr(w1, MemOperand(x2)), "stlr w1, [x2]");
1650 COMPARE(stlr(w3, MemOperand(sp)), "stlr w3, [sp]");
1651 COMPARE(stlr(x4, MemOperand(x5)), "stlr x4, [x5]");
1652 COMPARE(stlr(x6, MemOperand(sp)), "stlr x6, [sp]");
1653 COMPARE(stllrb(w7, MemOperand(x8)), "stllrb w7, [x8]");
1654 COMPARE(stllrb(w9, MemOperand(sp)), "stllrb w9, [sp]");
1655 COMPARE(stllrb(x10, MemOperand(x11)), "stllrb w10, [x11]");
1656 COMPARE(stllrb(x12, MemOperand(sp)), "stllrb w12, [sp]");
1657 COMPARE(stllrh(w13, MemOperand(x14)), "stllrh w13, [x14]");
1658 COMPARE(stllrh(w15, MemOperand(sp)), "stllrh w15, [sp]");
1659 COMPARE(stllrh(x16, MemOperand(x17)), "stllrh w16, [x17]");
1660 COMPARE(stllrh(x18, MemOperand(sp)), "stllrh w18, [sp]");
1661 COMPARE(stllr(w19, MemOperand(x20)), "stllr w19, [x20]");
1662 COMPARE(stllr(w21, MemOperand(sp)), "stllr w21, [sp]");
1663 COMPARE(stllr(x22, MemOperand(x23)), "stllr x22, [x23]");
1664 COMPARE(stllr(x24, MemOperand(sp)), "stllr x24, [sp]");
1665 COMPARE(ldarb(w25, MemOperand(x26)), "ldarb w25, [x26]");
1666 COMPARE(ldarb(w27, MemOperand(sp)), "ldarb w27, [sp]");
1667 COMPARE(ldarb(x28, MemOperand(x29)), "ldarb w28, [x29]");
1668 COMPARE(ldarb(x30, MemOperand(sp)), "ldarb w30, [sp]");
1669 COMPARE(ldarh(w0, MemOperand(x1)), "ldarh w0, [x1]");
1670 COMPARE(ldarh(w2, MemOperand(sp)), "ldarh w2, [sp]");
1671 COMPARE(ldarh(x3, MemOperand(x4)), "ldarh w3, [x4]");
1672 COMPARE(ldarh(x5, MemOperand(sp)), "ldarh w5, [sp]");
1673 COMPARE(ldar(w6, MemOperand(x7)), "ldar w6, [x7]");
1674 COMPARE(ldar(w8, MemOperand(sp)), "ldar w8, [sp]");
1675 COMPARE(ldar(x9, MemOperand(x10)), "ldar x9, [x10]");
1676 COMPARE(ldar(x11, MemOperand(sp)), "ldar x11, [sp]");
1677 COMPARE(ldlarb(w12, MemOperand(x13)), "ldlarb w12, [x13]");
1678 COMPARE(ldlarb(w14, MemOperand(sp)), "ldlarb w14, [sp]");
1679 COMPARE(ldlarb(x15, MemOperand(x16)), "ldlarb w15, [x16]");
1680 COMPARE(ldlarb(x17, MemOperand(sp)), "ldlarb w17, [sp]");
1681 COMPARE(ldlarh(w18, MemOperand(x19)), "ldlarh w18, [x19]");
1682 COMPARE(ldlarh(w20, MemOperand(sp)), "ldlarh w20, [sp]");
1683 COMPARE(ldlarh(x21, MemOperand(x22)), "ldlarh w21, [x22]");
1684 COMPARE(ldlarh(x23, MemOperand(sp)), "ldlarh w23, [sp]");
1685 COMPARE(ldlar(w24, MemOperand(x25)), "ldlar w24, [x25]");
1686 COMPARE(ldlar(w26, MemOperand(sp)), "ldlar w26, [sp]");
1687 COMPARE(ldlar(x27, MemOperand(x28)), "ldlar x27, [x28]");
1688 COMPARE(ldlar(x29, MemOperand(sp)), "ldlar x29, [sp]");
1689
1690 COMPARE(cas(w30, w0, MemOperand(x1)), "cas w30, w0, [x1]");
1691 COMPARE(cas(w2, w3, MemOperand(sp)), "cas w2, w3, [sp]");
1692 COMPARE(cas(x4, x5, MemOperand(x6)), "cas x4, x5, [x6]");
1693 COMPARE(cas(x7, x8, MemOperand(sp)), "cas x7, x8, [sp]");
1694 COMPARE(casa(w9, w10, MemOperand(x11)), "casa w9, w10, [x11]");
1695 COMPARE(casa(w12, w13, MemOperand(sp)), "casa w12, w13, [sp]");
1696 COMPARE(casa(x14, x15, MemOperand(x16)), "casa x14, x15, [x16]");
1697 COMPARE(casa(x17, x18, MemOperand(sp)), "casa x17, x18, [sp]");
1698 COMPARE(casl(w19, w20, MemOperand(x21)), "casl w19, w20, [x21]");
1699 COMPARE(casl(w22, w23, MemOperand(sp)), "casl w22, w23, [sp]");
1700 COMPARE(casl(x24, x25, MemOperand(x26)), "casl x24, x25, [x26]");
1701 COMPARE(casl(x27, x28, MemOperand(sp)), "casl x27, x28, [sp]");
1702 COMPARE(casal(w29, w30, MemOperand(x0)), "casal w29, w30, [x0]");
1703 COMPARE(casal(w1, w2, MemOperand(sp)), "casal w1, w2, [sp]");
1704 COMPARE(casal(x3, x4, MemOperand(x5)), "casal x3, x4, [x5]");
1705 COMPARE(casal(x6, x7, MemOperand(sp)), "casal x6, x7, [sp]");
1706 COMPARE(casb(w8, w9, MemOperand(x10)), "casb w8, w9, [x10]");
1707 COMPARE(casb(w11, w12, MemOperand(sp)), "casb w11, w12, [sp]");
1708 COMPARE(casab(w13, w14, MemOperand(x15)), "casab w13, w14, [x15]");
1709 COMPARE(casab(w16, w17, MemOperand(sp)), "casab w16, w17, [sp]");
1710 COMPARE(caslb(w18, w19, MemOperand(x20)), "caslb w18, w19, [x20]");
1711 COMPARE(caslb(w21, w22, MemOperand(sp)), "caslb w21, w22, [sp]");
1712 COMPARE(casalb(w23, w24, MemOperand(x25)), "casalb w23, w24, [x25]");
1713 COMPARE(casalb(w26, w27, MemOperand(sp)), "casalb w26, w27, [sp]");
1714 COMPARE(cash(w28, w29, MemOperand(x30)), "cash w28, w29, [x30]");
1715 COMPARE(cash(w0, w1, MemOperand(sp)), "cash w0, w1, [sp]");
1716 COMPARE(casah(w2, w3, MemOperand(x4)), "casah w2, w3, [x4]");
1717 COMPARE(casah(w5, w6, MemOperand(sp)), "casah w5, w6, [sp]");
1718 COMPARE(caslh(w7, w8, MemOperand(x9)), "caslh w7, w8, [x9]");
1719 COMPARE(caslh(w10, w11, MemOperand(sp)), "caslh w10, w11, [sp]");
1720 COMPARE(casalh(w12, w13, MemOperand(x14)), "casalh w12, w13, [x14]");
1721 COMPARE(casalh(w15, w16, MemOperand(sp)), "casalh w15, w16, [sp]");
1722 COMPARE(casp(w18, w19, w20, w21, MemOperand(x22)),
1723 "casp w18, w19, w20, w21, [x22]");
1724 COMPARE(casp(w24, w25, w26, w27, MemOperand(sp)),
1725 "casp w24, w25, w26, w27, [sp]");
1726 COMPARE(casp(x28, x29, x0, x1, MemOperand(x2)),
1727 "casp x28, x29, x0, x1, [x2]");
1728 COMPARE(casp(x4, x5, x6, x7, MemOperand(sp)), "casp x4, x5, x6, x7, [sp]");
1729 COMPARE(caspa(w8, w9, w10, w11, MemOperand(x12)),
1730 "caspa w8, w9, w10, w11, [x12]");
1731 COMPARE(caspa(w14, w15, w16, w17, MemOperand(sp)),
1732 "caspa w14, w15, w16, w17, [sp]");
1733 COMPARE(caspa(x18, x19, x20, x21, MemOperand(x22)),
1734 "caspa x18, x19, x20, x21, [x22]");
1735 COMPARE(caspa(x24, x25, x26, x27, MemOperand(sp)),
1736 "caspa x24, x25, x26, x27, [sp]");
1737 COMPARE(caspl(w28, w29, w0, w1, MemOperand(x2)),
1738 "caspl w28, w29, w0, w1, [x2]");
1739 COMPARE(caspl(w4, w5, w6, w7, MemOperand(sp)), "caspl w4, w5, w6, w7, [sp]");
1740 COMPARE(caspl(x8, x9, x10, x11, MemOperand(x12)),
1741 "caspl x8, x9, x10, x11, [x12]");
1742 COMPARE(caspl(x14, x15, x16, x17, MemOperand(sp)),
1743 "caspl x14, x15, x16, x17, [sp]");
1744 COMPARE(caspal(w18, w19, w20, w21, MemOperand(x22)),
1745 "caspal w18, w19, w20, w21, [x22]");
1746 COMPARE(caspal(w24, w25, w26, w27, MemOperand(sp)),
1747 "caspal w24, w25, w26, w27, [sp]");
1748 COMPARE(caspal(x28, x29, x0, x1, MemOperand(x2)),
1749 "caspal x28, x29, x0, x1, [x2]");
1750 COMPARE(caspal(x4, x5, x6, x7, MemOperand(sp)),
1751 "caspal x4, x5, x6, x7, [sp]");
1752
1753
1754 CLEANUP();
1755 }
1756
1757 // clang-format off
1758 #define ATOMIC_MEMORY_DISASM_LIST(V, DEF) \
1759 V(DEF, add, "add") \
1760 V(DEF, clr, "clr") \
1761 V(DEF, eor, "eor") \
1762 V(DEF, set, "set") \
1763 V(DEF, smax, "smax") \
1764 V(DEF, smin, "smin") \
1765 V(DEF, umax, "umax") \
1766 V(DEF, umin, "umin")
1767
1768 #define ATOMIC_MEMORY_DISASM_STORE_X_MODES(V, NAME, STR) \
1769 V(NAME, STR) \
1770 V(NAME##l, STR "l")
1771
1772
1773 #define ATOMIC_MEMORY_DISASM_STORE_W_MODES(V, NAME, STR) \
1774 ATOMIC_MEMORY_DISASM_STORE_X_MODES(V, NAME, STR) \
1775 V(NAME##b, STR "b") \
1776 V(NAME##lb, STR "lb") \
1777 V(NAME##h, STR "h") \
1778 V(NAME##lh, STR "lh")
1779
1780 #define ATOMIC_MEMORY_DISASM_LOAD_X_MODES(V, NAME, STR) \
1781 ATOMIC_MEMORY_DISASM_STORE_X_MODES(V, NAME, STR) \
1782 V(NAME##a, STR "a") \
1783 V(NAME##al, STR "al")
1784
1785 #define ATOMIC_MEMORY_DISASM_LOAD_W_MODES(V, NAME, STR) \
1786 ATOMIC_MEMORY_DISASM_LOAD_X_MODES(V, NAME, STR) \
1787 V(NAME##ab, STR "ab") \
1788 V(NAME##alb, STR "alb") \
1789 V(NAME##ah, STR "ah") \
1790 V(NAME##alh, STR "alh")
1791 // clang-format on
1792
TEST(atomic_memory)1793 TEST(atomic_memory) {
1794 SETUP();
1795
1796 // These macros generate tests for all the variations of the atomic memory
1797 // operations, e.g. ldadd, ldadda, ldaddb, staddl, etc.
1798
1799 #define AM_LOAD_X_TESTS(N, MN) \
1800 COMPARE(ld##N(x0, x1, MemOperand(x2)), "ld" MN " x0, x1, [x2]"); \
1801 COMPARE(ld##N(x3, x4, MemOperand(sp)), "ld" MN " x3, x4, [sp]");
1802 #define AM_LOAD_W_TESTS(N, MN) \
1803 COMPARE(ld##N(w0, w1, MemOperand(x2)), "ld" MN " w0, w1, [x2]"); \
1804 COMPARE(ld##N(w3, w4, MemOperand(sp)), "ld" MN " w3, w4, [sp]");
1805 #define AM_STORE_X_TESTS(N, MN) \
1806 COMPARE(st##N(x0, MemOperand(x1)), "st" MN " x0, [x1]"); \
1807 COMPARE(st##N(x2, MemOperand(sp)), "st" MN " x2, [sp]");
1808 #define AM_STORE_W_TESTS(N, MN) \
1809 COMPARE(st##N(w0, MemOperand(x1)), "st" MN " w0, [x1]"); \
1810 COMPARE(st##N(w2, MemOperand(sp)), "st" MN " w2, [sp]");
1811
1812 ATOMIC_MEMORY_DISASM_LIST(ATOMIC_MEMORY_DISASM_LOAD_X_MODES, AM_LOAD_X_TESTS)
1813 ATOMIC_MEMORY_DISASM_LIST(ATOMIC_MEMORY_DISASM_LOAD_W_MODES, AM_LOAD_W_TESTS)
1814 ATOMIC_MEMORY_DISASM_LIST(ATOMIC_MEMORY_DISASM_STORE_X_MODES,
1815 AM_STORE_X_TESTS)
1816 ATOMIC_MEMORY_DISASM_LIST(ATOMIC_MEMORY_DISASM_STORE_W_MODES,
1817 AM_STORE_W_TESTS)
1818
1819 #define AM_SWP_X_TESTS(N, MN) \
1820 COMPARE(N(x0, x1, MemOperand(x2)), MN " x0, x1, [x2]"); \
1821 COMPARE(N(x3, x4, MemOperand(sp)), MN " x3, x4, [sp]");
1822 #define AM_SWP_W_TESTS(N, MN) \
1823 COMPARE(N(w0, w1, MemOperand(x2)), MN " w0, w1, [x2]"); \
1824 COMPARE(N(w3, w4, MemOperand(sp)), MN " w3, w4, [sp]");
1825
1826
1827 ATOMIC_MEMORY_DISASM_LOAD_X_MODES(AM_SWP_X_TESTS, swp, "swp")
1828 ATOMIC_MEMORY_DISASM_LOAD_W_MODES(AM_SWP_W_TESTS, swp, "swp")
1829
1830 #undef AM_LOAD_X_TESTS
1831 #undef AM_LOAD_W_TESTS
1832 #undef AM_STORE_X_TESTS
1833 #undef AM_STORE_W_TESTS
1834 #undef AM_SWP_X_TESTS
1835 #undef AM_SWP_W_TESTS
1836
1837 COMPARE(ldaprb(w0, MemOperand(x1)), "ldaprb w0, [x1]");
1838 COMPARE(ldaprb(w2, MemOperand(sp)), "ldaprb w2, [sp]");
1839 COMPARE(ldaprh(w3, MemOperand(x4)), "ldaprh w3, [x4]");
1840 COMPARE(ldaprh(w5, MemOperand(sp)), "ldaprh w5, [sp]");
1841 COMPARE(ldapr(w6, MemOperand(x7)), "ldapr w6, [x7]");
1842 COMPARE(ldapr(w8, MemOperand(sp)), "ldapr w8, [sp]");
1843 COMPARE(ldapr(x9, MemOperand(x10)), "ldapr x9, [x10]");
1844 COMPARE(ldapr(x11, MemOperand(sp)), "ldapr x11, [sp]");
1845
1846 CLEANUP();
1847 }
1848
TEST(load_store_rcpc_unscaled_offset)1849 TEST(load_store_rcpc_unscaled_offset) {
1850 SETUP();
1851
1852 COMPARE(ldapurb(w0, MemOperand(x1)), "ldapurb w0, [x1]");
1853 COMPARE(ldapurb(w2, MemOperand(x3, 13)), "ldapurb w2, [x3, #13]");
1854 COMPARE(ldapursb(w4, MemOperand(x5, 129)), "ldapursb w4, [x5, #129]");
1855 COMPARE(ldapursb(x6, MemOperand(sp, 64)), "ldapursb x6, [sp, #64]");
1856 COMPARE(ldapurh(w7, MemOperand(x8)), "ldapurh w7, [x8]");
1857 COMPARE(ldapurh(w9, MemOperand(x10, 13)), "ldapurh w9, [x10, #13]");
1858 COMPARE(ldapursh(w11, MemOperand(x12, 129)), "ldapursh w11, [x12, #129]");
1859 COMPARE(ldapursh(x13, MemOperand(sp, 64)), "ldapursh x13, [sp, #64]");
1860 COMPARE(ldapur(w14, MemOperand(x15)), "ldapur w14, [x15]");
1861 COMPARE(ldapur(w16, MemOperand(x17, 13)), "ldapur w16, [x17, #13]");
1862 COMPARE(ldapursw(x18, MemOperand(sp, 64)), "ldapursw x18, [sp, #64]");
1863 COMPARE(ldapur(x19, MemOperand(x20)), "ldapur x19, [x20]");
1864 COMPARE(ldapur(x21, MemOperand(sp, 64)), "ldapur x21, [sp, #64]");
1865
1866 COMPARE(stlurb(w22, MemOperand(x23)), "stlurb w22, [x23]");
1867 COMPARE(stlurb(w24, MemOperand(sp, 64)), "stlurb w24, [sp, #64]");
1868 COMPARE(stlurh(w25, MemOperand(x26)), "stlurh w25, [x26]");
1869 COMPARE(stlurh(w27, MemOperand(sp, 64)), "stlurh w27, [sp, #64]");
1870 COMPARE(stlur(w28, MemOperand(x29)), "stlur w28, [x29]");
1871 COMPARE(stlur(w0, MemOperand(sp, 64)), "stlur w0, [sp, #64]");
1872 COMPARE(stlur(x1, MemOperand(x2)), "stlur x1, [x2]");
1873 COMPARE(stlur(x3, MemOperand(sp, 64)), "stlur x3, [sp, #64]");
1874
1875
1876 COMPARE_MACRO(Ldaprb(w0, MemOperand(x1)), "ldaprb w0, [x1]");
1877 COMPARE_MACRO(Ldaprb(w2, MemOperand(x3, 13)), "ldapurb w2, [x3, #13]");
1878 COMPARE_MACRO(Ldaprh(w4, MemOperand(x5)), "ldaprh w4, [x5]");
1879 COMPARE_MACRO(Ldaprh(w6, MemOperand(x7, 13)), "ldapurh w6, [x7, #13]");
1880 COMPARE_MACRO(Ldapr(w8, MemOperand(x9)), "ldapr w8, [x9]");
1881 COMPARE_MACRO(Ldapr(w10, MemOperand(x11, 13)), "ldapur w10, [x11, #13]");
1882 COMPARE_MACRO(Ldapr(x12, MemOperand(x13)), "ldapr x12, [x13]");
1883 COMPARE_MACRO(Ldapr(x14, MemOperand(sp, 64)), "ldapur x14, [sp, #64]");
1884
1885 COMPARE_MACRO(Stlrb(w15, MemOperand(x16)), "stlrb w15, [x16]");
1886 COMPARE_MACRO(Stlrb(w17, MemOperand(sp, 64)), "stlurb w17, [sp, #64]");
1887 COMPARE_MACRO(Stlrh(w18, MemOperand(x19)), "stlrh w18, [x19]");
1888 COMPARE_MACRO(Stlrh(w20, MemOperand(sp, 64)), "stlurh w20, [sp, #64]");
1889 COMPARE_MACRO(Stlr(w21, MemOperand(x22)), "stlr w21, [x22]");
1890 COMPARE_MACRO(Stlr(w23, MemOperand(sp, 64)), "stlur w23, [sp, #64]");
1891 COMPARE_MACRO(Stlr(x24, MemOperand(x25)), "stlr x24, [x25]");
1892 COMPARE_MACRO(Stlr(x26, MemOperand(sp, 64)), "stlur x26, [sp, #64]");
1893
1894 CLEANUP();
1895 }
1896
1897
TEST(load_store_pair_nontemp)1898 TEST(load_store_pair_nontemp) {
1899 SETUP();
1900
1901 COMPARE(ldnp(w0, w1, MemOperand(x2)), "ldnp w0, w1, [x2]");
1902 COMPARE(stnp(w3, w4, MemOperand(x5, 252)), "stnp w3, w4, [x5, #252]");
1903 COMPARE(ldnp(w6, w7, MemOperand(x8, -256)), "ldnp w6, w7, [x8, #-256]");
1904 COMPARE(stnp(x9, x10, MemOperand(x11)), "stnp x9, x10, [x11]");
1905 COMPARE(ldnp(x12, x13, MemOperand(x14, 504)), "ldnp x12, x13, [x14, #504]");
1906 COMPARE(stnp(x15, x16, MemOperand(x17, -512)), "stnp x15, x16, [x17, #-512]");
1907 COMPARE(ldnp(s18, s19, MemOperand(x20)), "ldnp s18, s19, [x20]");
1908 COMPARE(stnp(s21, s22, MemOperand(x23, 252)), "stnp s21, s22, [x23, #252]");
1909 COMPARE(ldnp(s24, s25, MemOperand(x26, -256)), "ldnp s24, s25, [x26, #-256]");
1910 COMPARE(stnp(d27, d28, MemOperand(x29)), "stnp d27, d28, [x29]");
1911 COMPARE(ldnp(d30, d31, MemOperand(x0, 504)), "ldnp d30, d31, [x0, #504]");
1912 COMPARE(stnp(d1, d2, MemOperand(x3, -512)), "stnp d1, d2, [x3, #-512]");
1913 COMPARE(ldnp(q4, q5, MemOperand(x6)), "ldnp q4, q5, [x6]");
1914 COMPARE(stnp(q7, q8, MemOperand(x9, 1008)), "stnp q7, q8, [x9, #1008]");
1915 COMPARE(ldnp(q10, q11, MemOperand(x12, -1024)),
1916 "ldnp q10, q11, [x12, #-1024]");
1917
1918 CLEANUP();
1919 }
1920
1921
TEST(load_literal_macro)1922 TEST(load_literal_macro) {
1923 SETUP();
1924
1925 // In each case, the literal will be placed at PC+8:
1926 // ldr x10, pc+8 // Test instruction.
1927 // ldr xzr, pc+12 // Pool marker.
1928 // .word64 #0x1234567890abcdef // Test literal.
1929
1930 COMPARE_MACRO_PREFIX(Ldr(x10, 0x1234567890abcdef), "ldr x10, pc+8");
1931 COMPARE_MACRO_PREFIX(Ldr(w20, 0xfedcba09), "ldr w20, pc+8");
1932 COMPARE_MACRO_PREFIX(Ldr(d11, 1.234), "ldr d11, pc+8");
1933 COMPARE_MACRO_PREFIX(Ldr(s22, 2.5f), "ldr s22, pc+8");
1934 COMPARE_MACRO_PREFIX(Ldrsw(x21, 0x80000000), "ldrsw x21, pc+8");
1935
1936 CLEANUP();
1937 }
1938
1939
TEST(load_literal)1940 TEST(load_literal) {
1941 SETUP();
1942
1943 COMPARE_PREFIX(ldr(x20, INT64_C(0)), "ldr x20, pc+0");
1944 COMPARE_PREFIX(ldr(x20, 1), "ldr x20, pc+4");
1945 COMPARE_PREFIX(ldr(x20, -1), "ldr x20, pc-4");
1946 COMPARE_PREFIX(ldr(x20, 0x3ffff), "ldr x20, pc+1048572");
1947 COMPARE_PREFIX(ldr(x20, -0x40000), "ldr x20, pc-1048576");
1948 COMPARE_PREFIX(ldr(w21, INT64_C(0)), "ldr w21, pc+0");
1949 COMPARE_PREFIX(ldr(w21, 1), "ldr w21, pc+4");
1950 COMPARE_PREFIX(ldr(w21, -1), "ldr w21, pc-4");
1951 COMPARE_PREFIX(ldr(w21, 0x3ffff), "ldr w21, pc+1048572");
1952 COMPARE_PREFIX(ldr(w21, -0x40000), "ldr w21, pc-1048576");
1953 COMPARE_PREFIX(ldr(d22, INT64_C(0)), "ldr d22, pc+0");
1954 COMPARE_PREFIX(ldr(d22, 1), "ldr d22, pc+4");
1955 COMPARE_PREFIX(ldr(d22, -1), "ldr d22, pc-4");
1956 COMPARE_PREFIX(ldr(d22, 0x3ffff), "ldr d22, pc+1048572");
1957 COMPARE_PREFIX(ldr(d22, -0x40000), "ldr d22, pc-1048576");
1958 COMPARE_PREFIX(ldr(s23, INT64_C(0)), "ldr s23, pc+0");
1959 COMPARE_PREFIX(ldr(s23, 1), "ldr s23, pc+4");
1960 COMPARE_PREFIX(ldr(s23, -1), "ldr s23, pc-4");
1961 COMPARE_PREFIX(ldr(s23, 0x3ffff), "ldr s23, pc+1048572");
1962 COMPARE_PREFIX(ldr(s23, -0x40000), "ldr s23, pc-1048576");
1963 COMPARE_PREFIX(ldrsw(x24, INT64_C(0)), "ldrsw x24, pc+0");
1964 COMPARE_PREFIX(ldrsw(x24, 1), "ldrsw x24, pc+4");
1965 COMPARE_PREFIX(ldrsw(x24, -1), "ldrsw x24, pc-4");
1966 COMPARE_PREFIX(ldrsw(x24, 0x3ffff), "ldrsw x24, pc+1048572");
1967 COMPARE_PREFIX(ldrsw(x24, -0x40000), "ldrsw x24, pc-1048576");
1968
1969 CLEANUP();
1970 }
1971
1972
TEST(prfm_operations)1973 TEST(prfm_operations) {
1974 SETUP();
1975
1976 // Test every encodable prefetch operation.
1977 const char* expected[] = {
1978 "prfm pldl1keep, ", "prfm pldl1strm, ", "prfm pldl2keep, ",
1979 "prfm pldl2strm, ", "prfm pldl3keep, ", "prfm pldl3strm, ",
1980 "prfm #0b00110, ", "prfm #0b00111, ", "prfm plil1keep, ",
1981 "prfm plil1strm, ", "prfm plil2keep, ", "prfm plil2strm, ",
1982 "prfm plil3keep, ", "prfm plil3strm, ", "prfm #0b01110, ",
1983 "prfm #0b01111, ", "prfm pstl1keep, ", "prfm pstl1strm, ",
1984 "prfm pstl2keep, ", "prfm pstl2strm, ", "prfm pstl3keep, ",
1985 "prfm pstl3strm, ", "prfm #0b10110, ", "prfm #0b10111, ",
1986 "prfm #0b11000, ", "prfm #0b11001, ", "prfm #0b11010, ",
1987 "prfm #0b11011, ", "prfm #0b11100, ", "prfm #0b11101, ",
1988 "prfm #0b11110, ", "prfm #0b11111, ",
1989 };
1990 const int expected_count = sizeof(expected) / sizeof(expected[0]);
1991 VIXL_STATIC_ASSERT((1 << ImmPrefetchOperation_width) == expected_count);
1992
1993 for (int op = 0; op < (1 << ImmPrefetchOperation_width); op++) {
1994 COMPARE_PREFIX(prfm(op, INT64_C(0)), expected[op]);
1995 COMPARE_PREFIX(prfm(op, MemOperand(x0, 0)), expected[op]);
1996 COMPARE_PREFIX(prfm(op, MemOperand(x0, x1)), expected[op]);
1997 }
1998
1999 CLEANUP();
2000 }
2001
2002
TEST(prfum_operations)2003 TEST(prfum_operations) {
2004 SETUP();
2005
2006 // Test every encodable prefetch operation.
2007 const char* expected[] = {
2008 "prfum pldl1keep, ", "prfum pldl1strm, ", "prfum pldl2keep, ",
2009 "prfum pldl2strm, ", "prfum pldl3keep, ", "prfum pldl3strm, ",
2010 "prfum #0b00110, ", "prfum #0b00111, ", "prfum plil1keep, ",
2011 "prfum plil1strm, ", "prfum plil2keep, ", "prfum plil2strm, ",
2012 "prfum plil3keep, ", "prfum plil3strm, ", "prfum #0b01110, ",
2013 "prfum #0b01111, ", "prfum pstl1keep, ", "prfum pstl1strm, ",
2014 "prfum pstl2keep, ", "prfum pstl2strm, ", "prfum pstl3keep, ",
2015 "prfum pstl3strm, ", "prfum #0b10110, ", "prfum #0b10111, ",
2016 "prfum #0b11000, ", "prfum #0b11001, ", "prfum #0b11010, ",
2017 "prfum #0b11011, ", "prfum #0b11100, ", "prfum #0b11101, ",
2018 "prfum #0b11110, ", "prfum #0b11111, ",
2019 };
2020 const int expected_count = sizeof(expected) / sizeof(expected[0]);
2021 VIXL_STATIC_ASSERT((1 << ImmPrefetchOperation_width) == expected_count);
2022
2023 for (int op = 0; op < (1 << ImmPrefetchOperation_width); op++) {
2024 COMPARE_PREFIX(prfum(op, MemOperand(x0, 0)), expected[op]);
2025 }
2026
2027 CLEANUP();
2028 }
2029
2030
TEST(prfm_offset)2031 TEST(prfm_offset) {
2032 SETUP();
2033
2034 COMPARE(prfm(PLDL1KEEP, MemOperand(x1)), "prfm pldl1keep, [x1]");
2035 COMPARE(prfm(PLDL1STRM, MemOperand(x3, 8)), "prfm pldl1strm, [x3, #8]");
2036 COMPARE(prfm(PLDL2KEEP, MemOperand(x5, 32760)),
2037 "prfm pldl2keep, [x5, #32760]");
2038
2039 COMPARE(prfm(PLDL2STRM, MemOperand(sp)), "prfm pldl2strm, [sp]");
2040 COMPARE(prfm(PLDL3KEEP, MemOperand(sp, 8)), "prfm pldl3keep, [sp, #8]");
2041 COMPARE(prfm(PLDL3STRM, MemOperand(sp, 32760)),
2042 "prfm pldl3strm, [sp, #32760]");
2043
2044 CLEANUP();
2045 }
2046
2047
TEST(prfm_regoffset)2048 TEST(prfm_regoffset) {
2049 SETUP();
2050
2051 COMPARE(prfm(PLIL1KEEP, MemOperand(x1, x2)), "prfm plil1keep, [x1, x2]");
2052 COMPARE(prfm(PLIL1STRM, MemOperand(x3, w4, SXTW)),
2053 "prfm plil1strm, [x3, w4, sxtw]");
2054 COMPARE(prfm(PLIL2KEEP, MemOperand(x5, x6, LSL, 3)),
2055 "prfm plil2keep, [x5, x6, lsl #3]");
2056
2057 COMPARE(prfm(PLIL2STRM, MemOperand(sp, xzr)), "prfm plil2strm, [sp, xzr]");
2058 COMPARE(prfm(PLIL3KEEP, MemOperand(sp, wzr, SXTW)),
2059 "prfm plil3keep, [sp, wzr, sxtw]");
2060 COMPARE(prfm(PLIL3STRM, MemOperand(sp, xzr, LSL, 3)),
2061 "prfm plil3strm, [sp, xzr, lsl #3]");
2062
2063 CLEANUP();
2064 }
2065
2066
TEST(prfm_literal)2067 TEST(prfm_literal) {
2068 SETUP();
2069
2070 COMPARE_PREFIX(prfm(PSTL1KEEP, INT64_C(0)), "prfm pstl1keep, pc+0");
2071 COMPARE_PREFIX(prfm(PSTL1STRM, 1), "prfm pstl1strm, pc+4");
2072 COMPARE_PREFIX(prfm(PSTL2KEEP, -1), "prfm pstl2keep, pc-4");
2073 COMPARE_PREFIX(prfm(PSTL2STRM, 0x3ffff), "prfm pstl2strm, pc+1048572");
2074 COMPARE_PREFIX(prfm(PSTL3KEEP, -0x3ffff), "prfm pstl3keep, pc-1048572");
2075 COMPARE_PREFIX(prfm(PSTL3STRM, -0x40000), "prfm pstl3strm, pc-1048576");
2076
2077 CLEANUP();
2078 }
2079
2080
TEST(prfm_unscaled)2081 TEST(prfm_unscaled) {
2082 SETUP();
2083
2084 // If an unscaled-offset instruction is requested, it is used, even if the
2085 // offset could be encoded in a scaled-offset instruction.
2086 COMPARE(prfum(PLDL1KEEP, MemOperand(x1)), "prfum pldl1keep, [x1]");
2087 COMPARE(prfum(PLDL1STRM, MemOperand(x1, 8)), "prfum pldl1strm, [x1, #8]");
2088 COMPARE(prfum(PLDL2KEEP, MemOperand(x1, 248)), "prfum pldl2keep, [x1, #248]");
2089
2090 // Normal offsets are converted to unscaled offsets if necssary.
2091 COMPARE(prfm(PLDL2STRM, MemOperand(x1, 1)), "prfum pldl2strm, [x1, #1]");
2092 COMPARE(prfm(PLDL3KEEP, MemOperand(x1, -1)), "prfum pldl3keep, [x1, #-1]");
2093 COMPARE(prfm(PLDL3STRM, MemOperand(x1, 255)), "prfum pldl3strm, [x1, #255]");
2094 COMPARE(prfm(PLDL3STRM, MemOperand(x1, -256)),
2095 "prfum pldl3strm, [x1, #-256]");
2096
2097 CLEANUP();
2098 }
2099
2100
TEST(prfm_unscaled_option)2101 TEST(prfm_unscaled_option) {
2102 SETUP();
2103
2104 // Just like prfm_unscaled, but specify the scaling option explicitly.
2105
2106 // Require unscaled-offset forms.
2107 LoadStoreScalingOption option = RequireUnscaledOffset;
2108
2109 COMPARE(prfum(PLDL1KEEP, MemOperand(x1), option), "prfum pldl1keep, [x1]");
2110 COMPARE(prfum(PLDL1STRM, MemOperand(x1, 8), option),
2111 "prfum pldl1strm, [x1, #8]");
2112 COMPARE(prfum(PLDL2KEEP, MemOperand(x1, 248), option),
2113 "prfum pldl2keep, [x1, #248]");
2114 COMPARE(prfum(PLDL2STRM, MemOperand(x1, 1), option),
2115 "prfum pldl2strm, [x1, #1]");
2116 COMPARE(prfum(PLDL3KEEP, MemOperand(x1, -1), option),
2117 "prfum pldl3keep, [x1, #-1]");
2118 COMPARE(prfum(PLDL3STRM, MemOperand(x1, 255), option),
2119 "prfum pldl3strm, [x1, #255]");
2120 COMPARE(prfum(PLIL1KEEP, MemOperand(x1, -256), option),
2121 "prfum plil1keep, [x1, #-256]");
2122
2123 // Require scaled-offset forms..
2124 option = RequireScaledOffset;
2125
2126 COMPARE(prfm(PLDL1KEEP, MemOperand(x1), option), "prfm pldl1keep, [x1]");
2127 COMPARE(prfm(PLDL1STRM, MemOperand(x1, 8), option),
2128 "prfm pldl1strm, [x1, #8]");
2129 COMPARE(prfm(PLDL2KEEP, MemOperand(x1, 248), option),
2130 "prfm pldl2keep, [x1, #248]");
2131 COMPARE(prfm(PLIL2STRM, MemOperand(x1, 256), option),
2132 "prfm plil2strm, [x1, #256]");
2133 COMPARE(prfm(PLIL3KEEP, MemOperand(x1, 32760), option),
2134 "prfm plil3keep, [x1, #32760]");
2135
2136 // Prefer unscaled-offset forms, but allow scaled-offset forms if necessary.
2137 option = PreferUnscaledOffset;
2138
2139 COMPARE(prfum(PLDL1KEEP, MemOperand(x1), option), "prfum pldl1keep, [x1]");
2140 COMPARE(prfum(PLDL1STRM, MemOperand(x1, 8), option),
2141 "prfum pldl1strm, [x1, #8]");
2142 COMPARE(prfum(PLDL2KEEP, MemOperand(x1, 248), option),
2143 "prfum pldl2keep, [x1, #248]");
2144 COMPARE(prfum(PLDL2STRM, MemOperand(x1, 1), option),
2145 "prfum pldl2strm, [x1, #1]");
2146 COMPARE(prfum(PLDL3KEEP, MemOperand(x1, -1), option),
2147 "prfum pldl3keep, [x1, #-1]");
2148 COMPARE(prfum(PLDL3STRM, MemOperand(x1, 255), option),
2149 "prfum pldl3strm, [x1, #255]");
2150 COMPARE(prfum(PLIL1KEEP, MemOperand(x1, -256), option),
2151 "prfum plil1keep, [x1, #-256]");
2152 COMPARE(prfum(PLIL1STRM, MemOperand(x1, 256), option),
2153 "prfm plil1strm, [x1, #256]");
2154 COMPARE(prfum(PLIL2KEEP, MemOperand(x1, 32760), option),
2155 "prfm plil2keep, [x1, #32760]");
2156
2157 // Prefer scaled-offset forms, but allow unscaled-offset forms if necessary.
2158 option = PreferScaledOffset;
2159
2160 COMPARE(prfm(PLDL1KEEP, MemOperand(x1), option), "prfm pldl1keep, [x1]");
2161 COMPARE(prfm(PLDL1STRM, MemOperand(x1, 8), option),
2162 "prfm pldl1strm, [x1, #8]");
2163 COMPARE(prfm(PLDL2KEEP, MemOperand(x1, 248), option),
2164 "prfm pldl2keep, [x1, #248]");
2165 COMPARE(prfm(PLDL2STRM, MemOperand(x1, 1), option),
2166 "prfum pldl2strm, [x1, #1]");
2167 COMPARE(prfm(PLDL3KEEP, MemOperand(x1, -1), option),
2168 "prfum pldl3keep, [x1, #-1]");
2169 COMPARE(prfm(PLDL3STRM, MemOperand(x1, 255), option),
2170 "prfum pldl3strm, [x1, #255]");
2171 COMPARE(prfm(PLIL1KEEP, MemOperand(x1, -256), option),
2172 "prfum plil1keep, [x1, #-256]");
2173 COMPARE(prfm(PLIL1STRM, MemOperand(x1, 256), option),
2174 "prfm plil1strm, [x1, #256]");
2175 COMPARE(prfm(PLIL2KEEP, MemOperand(x1, 32760), option),
2176 "prfm plil2keep, [x1, #32760]");
2177
2178 CLEANUP();
2179 }
2180
2181
TEST(cond_select)2182 TEST(cond_select) {
2183 SETUP();
2184
2185 COMPARE(csel(w0, w1, w2, eq), "csel w0, w1, w2, eq");
2186 COMPARE(csel(x3, x4, x5, ne), "csel x3, x4, x5, ne");
2187 COMPARE(csinc(w6, w7, w8, hs), "csinc w6, w7, w8, hs");
2188 COMPARE(csinc(x9, x10, x11, lo), "csinc x9, x10, x11, lo");
2189 COMPARE(csinv(w12, w13, w14, mi), "csinv w12, w13, w14, mi");
2190 COMPARE(csinv(x15, x16, x17, pl), "csinv x15, x16, x17, pl");
2191 COMPARE(csneg(w18, w19, w20, vs), "csneg w18, w19, w20, vs");
2192 COMPARE(csneg(x21, x22, x23, vc), "csneg x21, x22, x23, vc");
2193 COMPARE(cset(w24, hi), "cset w24, hi");
2194 COMPARE(cset(x25, ls), "cset x25, ls");
2195 COMPARE(csetm(w26, ge), "csetm w26, ge");
2196 COMPARE(csetm(x27, lt), "csetm x27, lt");
2197 COMPARE(cinc(w28, w29, gt), "cinc w28, w29, gt");
2198 COMPARE(cinc(x30, x0, le), "cinc x30, x0, le");
2199 COMPARE(cinv(w1, w2, eq), "cinv w1, w2, eq");
2200 COMPARE(cinv(x3, x4, ne), "cinv x3, x4, ne");
2201 COMPARE(cneg(w5, w6, hs), "cneg w5, w6, hs");
2202 COMPARE(cneg(x7, x8, lo), "cneg x7, x8, lo");
2203
2204 COMPARE(csel(x0, x1, x2, al), "csel x0, x1, x2, al");
2205 COMPARE(csel(x1, x2, x3, nv), "csel x1, x2, x3, nv");
2206 COMPARE(csinc(x2, x3, x4, al), "csinc x2, x3, x4, al");
2207 COMPARE(csinc(x3, x4, x5, nv), "csinc x3, x4, x5, nv");
2208 COMPARE(csinv(x4, x5, x6, al), "csinv x4, x5, x6, al");
2209 COMPARE(csinv(x5, x6, x7, nv), "csinv x5, x6, x7, nv");
2210 COMPARE(csneg(x6, x7, x8, al), "csneg x6, x7, x8, al");
2211 COMPARE(csneg(x7, x8, x9, nv), "csneg x7, x8, x9, nv");
2212
2213 CLEANUP();
2214 }
2215
2216
TEST(cond_select_macro)2217 TEST(cond_select_macro) {
2218 SETUP();
2219
2220 // In the tests below we also test the `GetCselSynthesisInformation()` helper.
2221 // These tests are here (rather than in test-assembler-aarch64.cc) because the
2222 // disassembly makes it easy to see whether or not the inputs are synthesised.
2223 bool synthesises_left = false;
2224 bool synthesises_right = false;
2225
2226 COMPARE_MACRO(Csel(w0, w1, -1, eq), "csinv w0, w1, wzr, eq");
2227 MacroAssembler::GetCselSynthesisInformation(w0,
2228 w1,
2229 -1,
2230 &synthesises_left,
2231 &synthesises_right);
2232 VIXL_CHECK(!synthesises_left && !synthesises_right);
2233
2234 COMPARE_MACRO(Csel(w2, w3, 0, ne), "csel w2, w3, wzr, ne");
2235 MacroAssembler::GetCselSynthesisInformation(w2,
2236 w3,
2237 wzr,
2238 &synthesises_left,
2239 &synthesises_right);
2240 VIXL_CHECK(!synthesises_left && !synthesises_right);
2241
2242 COMPARE_MACRO(Csel(w4, w5, 1, hs), "csinc w4, w5, wzr, hs");
2243 MacroAssembler::GetCselSynthesisInformation(w4,
2244 w5,
2245 1,
2246 &synthesises_left,
2247 &synthesises_right);
2248 VIXL_CHECK(!synthesises_left && !synthesises_right);
2249
2250 COMPARE_MACRO(Csel(x6, x7, -1, lo), "csinv x6, x7, xzr, lo");
2251 MacroAssembler::GetCselSynthesisInformation(x6,
2252 x7,
2253 xzr,
2254 &synthesises_left,
2255 &synthesises_right);
2256 VIXL_CHECK(!synthesises_left && !synthesises_right);
2257
2258 COMPARE_MACRO(Csel(x8, x9, 0, mi), "csel x8, x9, xzr, mi");
2259 MacroAssembler::GetCselSynthesisInformation(x8,
2260 x9,
2261 xzr,
2262 &synthesises_left,
2263 &synthesises_right);
2264 VIXL_CHECK(!synthesises_left && !synthesises_right);
2265
2266 COMPARE_MACRO(Csel(x10, x11, 1, pl), "csinc x10, x11, xzr, pl");
2267 MacroAssembler::GetCselSynthesisInformation(x10,
2268 x11,
2269 xzr,
2270 &synthesises_left,
2271 &synthesises_right);
2272 VIXL_CHECK(!synthesises_left && !synthesises_right);
2273
2274 COMPARE_MACRO(Csel(x12, 0, 0, eq), "mov x12, #0x0");
2275 MacroAssembler::GetCselSynthesisInformation(x12,
2276 0,
2277 0,
2278 &synthesises_left,
2279 &synthesises_right);
2280 VIXL_CHECK(!synthesises_left && !synthesises_right);
2281
2282 COMPARE_MACRO(Csel(w13, 0, 1, eq), "cset w13, ne");
2283 MacroAssembler::GetCselSynthesisInformation(w13,
2284 0,
2285 1,
2286 &synthesises_left,
2287 &synthesises_right);
2288 VIXL_CHECK(!synthesises_left && !synthesises_right);
2289
2290 COMPARE_MACRO(Csel(x14, 1, 0, eq), "cset x14, eq");
2291 MacroAssembler::GetCselSynthesisInformation(x14,
2292 1,
2293 0,
2294 &synthesises_left,
2295 &synthesises_right);
2296 VIXL_CHECK(!synthesises_left && !synthesises_right);
2297
2298 COMPARE_MACRO(Csel(w15, 0, -1, eq), "csetm w15, ne");
2299 MacroAssembler::GetCselSynthesisInformation(w15,
2300 0,
2301 -1,
2302 &synthesises_left,
2303 &synthesises_right);
2304 VIXL_CHECK(!synthesises_left && !synthesises_right);
2305
2306 COMPARE_MACRO(Csel(x18, -1, 0, eq), "csetm x18, eq");
2307 MacroAssembler::GetCselSynthesisInformation(x18,
2308 -1,
2309 0,
2310 &synthesises_left,
2311 &synthesises_right);
2312 VIXL_CHECK(!synthesises_left && !synthesises_right);
2313
2314 COMPARE_MACRO(Csel(w19, -1, 1, eq),
2315 "mov w19, #0x1\n"
2316 "cneg w19, w19, eq");
2317 MacroAssembler::GetCselSynthesisInformation(w19,
2318 -1,
2319 1,
2320 &synthesises_left,
2321 &synthesises_right);
2322 VIXL_CHECK(!synthesises_left && synthesises_right);
2323
2324 COMPARE_MACRO(Csel(x20, 1, -1, eq),
2325 "mov x20, #0xffffffffffffffff\n"
2326 "cneg x20, x20, eq");
2327 MacroAssembler::GetCselSynthesisInformation(x20,
2328 1,
2329 -1,
2330 &synthesises_left,
2331 &synthesises_right);
2332 VIXL_CHECK(!synthesises_left && synthesises_right);
2333
2334 COMPARE_MACRO(Csel(w21, 0xaa, 0xbb, eq),
2335 "mov w16, #0xaa\n"
2336 "mov w17, #0xbb\n"
2337 "csel w21, w16, w17, eq");
2338 MacroAssembler::GetCselSynthesisInformation(w21,
2339 0xaa,
2340 0xbb,
2341 &synthesises_left,
2342 &synthesises_right);
2343 VIXL_CHECK(synthesises_left && synthesises_right);
2344
2345 COMPARE_MACRO(Csel(x22, 0xaa, -0xbb, eq),
2346 "mov x16, #0xaa\n"
2347 "mov x17, #0xffffffffffffff45\n"
2348 "csel x22, x16, x17, eq");
2349 MacroAssembler::GetCselSynthesisInformation(x22,
2350 0xaa,
2351 -0xbb,
2352 &synthesises_left,
2353 &synthesises_right);
2354 VIXL_CHECK(synthesises_left && synthesises_right);
2355
2356 COMPARE_MACRO(Csel(w23, 0, 0xaa, eq),
2357 "mov w16, #0xaa\n"
2358 "csel w23, w16, wzr, ne");
2359 MacroAssembler::GetCselSynthesisInformation(w23,
2360 0,
2361 0xaa,
2362 &synthesises_left,
2363 &synthesises_right);
2364 VIXL_CHECK(!synthesises_left && synthesises_right);
2365
2366 COMPARE_MACRO(Csel(x24, -0xaa, 0, eq),
2367 "mov x16, #0xffffffffffffff56\n"
2368 "csel x24, x16, xzr, eq");
2369 MacroAssembler::GetCselSynthesisInformation(x24,
2370 -0xaa,
2371 0,
2372 &synthesises_left,
2373 &synthesises_right);
2374 VIXL_CHECK(synthesises_left && !synthesises_right);
2375
2376 COMPARE_MACRO(Csel(w25, 0xcc, -0xcc, eq),
2377 "mov w25, #0xffffff34\n"
2378 "cneg w25, w25, eq");
2379 MacroAssembler::GetCselSynthesisInformation(w25,
2380 0xcc,
2381 -0xcc,
2382 &synthesises_left,
2383 &synthesises_right);
2384 VIXL_CHECK(!synthesises_left && synthesises_right);
2385
2386 COMPARE_MACRO(Csel(x26, -0xcc, 0xcc, eq),
2387 "mov x26, #0xcc\n"
2388 "cneg x26, x26, eq");
2389 MacroAssembler::GetCselSynthesisInformation(w25,
2390 -0xcc,
2391 0xcc,
2392 &synthesises_left,
2393 &synthesises_right);
2394 VIXL_CHECK(!synthesises_left && synthesises_right);
2395
2396 // Test with `Operand` inputs.
2397 COMPARE_MACRO(Csel(x0, x1, Operand(x2, LSL, 3), eq),
2398 "lsl x16, x2, #3\n"
2399 "csel x0, x1, x16, eq");
2400 MacroAssembler::GetCselSynthesisInformation(x0,
2401 x1,
2402 Operand(x2, LSL, 3),
2403 &synthesises_left,
2404 &synthesises_right);
2405 VIXL_CHECK(!synthesises_left && synthesises_right);
2406
2407 COMPARE_MACRO(Csel(x3, x4, Operand(x5, SXTH), eq),
2408 "sxth x16, w5\n"
2409 "csel x3, x4, x16, eq");
2410 MacroAssembler::GetCselSynthesisInformation(x3,
2411 x4,
2412 Operand(x5, SXTH),
2413 &synthesises_left,
2414 &synthesises_right);
2415 VIXL_CHECK(!synthesises_left && synthesises_right);
2416
2417 COMPARE_MACRO(Csel(x6, Operand(x7, LSL, 7), x8, eq),
2418 "lsl x16, x7, #7\n"
2419 "csel x6, x16, x8, eq");
2420 MacroAssembler::GetCselSynthesisInformation(x6,
2421 Operand(x7, LSL, 7),
2422 x8,
2423 &synthesises_left,
2424 &synthesises_right);
2425 VIXL_CHECK(synthesises_left && !synthesises_right);
2426
2427 COMPARE_MACRO(Csel(x9, Operand(x10, SXTH), x11, eq),
2428 "sxth x16, w10\n"
2429 "csel x9, x16, x11, eq");
2430 MacroAssembler::GetCselSynthesisInformation(x9,
2431 Operand(x10, SXTH),
2432 x11,
2433 &synthesises_left,
2434 &synthesises_right);
2435 VIXL_CHECK(synthesises_left && !synthesises_right);
2436
2437 COMPARE_MACRO(Csel(x12, Operand(x13, LSL, 13), Operand(x14, SXTB), eq),
2438 "lsl x16, x13, #13\n"
2439 "sxtb x17, w14\n"
2440 "csel x12, x16, x17, eq");
2441 MacroAssembler::GetCselSynthesisInformation(x12,
2442 Operand(x13, LSL, 13),
2443 Operand(x14, SXTB),
2444 &synthesises_left,
2445 &synthesises_right);
2446 VIXL_CHECK(synthesises_left && synthesises_right);
2447
2448 COMPARE_MACRO(Csel(x15, 0, Operand(x18, LSR, 18), eq),
2449 "lsr x16, x18, #18\n"
2450 "csel x15, x16, xzr, ne");
2451 MacroAssembler::GetCselSynthesisInformation(x15,
2452 0,
2453 Operand(x18, LSR, 18),
2454 &synthesises_left,
2455 &synthesises_right);
2456 VIXL_CHECK(!synthesises_left && synthesises_right);
2457
2458 // Test with the zero register.
2459 COMPARE_MACRO(Csel(w19, wzr, wzr, eq), "mov w19, #0x0");
2460 MacroAssembler::GetCselSynthesisInformation(w19,
2461 wzr,
2462 wzr,
2463 &synthesises_left,
2464 &synthesises_right);
2465 VIXL_CHECK(!synthesises_left && !synthesises_right);
2466
2467 COMPARE_MACRO(Csel(x20, x21, xzr, eq), "csel x20, x21, xzr, eq");
2468 MacroAssembler::GetCselSynthesisInformation(x20,
2469 x21,
2470 xzr,
2471 &synthesises_left,
2472 &synthesises_right);
2473 VIXL_CHECK(!synthesises_left && !synthesises_right);
2474
2475 COMPARE_MACRO(Csel(w22, wzr, w23, eq), "csel w22, w23, wzr, ne");
2476 MacroAssembler::GetCselSynthesisInformation(w22,
2477 wzr,
2478 w23,
2479 &synthesises_left,
2480 &synthesises_right);
2481 VIXL_CHECK(!synthesises_left && !synthesises_right);
2482
2483 COMPARE_MACRO(Csel(x24, xzr, 0, eq), "mov x24, #0x0");
2484 MacroAssembler::GetCselSynthesisInformation(x24,
2485 xzr,
2486 0,
2487 &synthesises_left,
2488 &synthesises_right);
2489 VIXL_CHECK(!synthesises_left && !synthesises_right);
2490
2491 COMPARE_MACRO(Csel(w25, wzr, 1, eq), "cset w25, ne");
2492 MacroAssembler::GetCselSynthesisInformation(w25,
2493 wzr,
2494 1,
2495 &synthesises_left,
2496 &synthesises_right);
2497 VIXL_CHECK(!synthesises_left && !synthesises_right);
2498
2499
2500 CLEANUP();
2501 }
2502
2503
TEST(cond_cmp)2504 TEST(cond_cmp) {
2505 SETUP();
2506
2507 COMPARE(ccmn(w0, w1, NZCVFlag, eq), "ccmn w0, w1, #NZCV, eq");
2508 COMPARE(ccmn(x2, x3, NZCFlag, ne), "ccmn x2, x3, #NZCv, ne");
2509 COMPARE(ccmp(w4, w5, NZVFlag, hs), "ccmp w4, w5, #NZcV, hs");
2510 COMPARE(ccmp(x6, x7, NZFlag, lo), "ccmp x6, x7, #NZcv, lo");
2511 COMPARE(ccmn(w8, 31, NFlag, mi), "ccmn w8, #31, #Nzcv, mi");
2512 COMPARE(ccmn(x9, 30, NCFlag, pl), "ccmn x9, #30, #NzCv, pl");
2513 COMPARE(ccmp(w10, 29, NVFlag, vs), "ccmp w10, #29, #NzcV, vs");
2514 COMPARE(ccmp(x11, 28, NFlag, vc), "ccmp x11, #28, #Nzcv, vc");
2515 COMPARE(ccmn(w12, w13, NoFlag, al), "ccmn w12, w13, #nzcv, al");
2516 COMPARE(ccmp(x14, 27, ZVFlag, nv), "ccmp x14, #27, #nZcV, nv");
2517
2518 CLEANUP();
2519 }
2520
2521
TEST(cond_cmp_macro)2522 TEST(cond_cmp_macro) {
2523 SETUP();
2524
2525 COMPARE_MACRO(Ccmp(w0, -1, VFlag, hi), "ccmn w0, #1, #nzcV, hi");
2526 COMPARE_MACRO(Ccmp(x1, -31, CFlag, ge), "ccmn x1, #31, #nzCv, ge");
2527 COMPARE_MACRO(Ccmn(w2, -1, CVFlag, gt), "ccmp w2, #1, #nzCV, gt");
2528 COMPARE_MACRO(Ccmn(x3, -31, ZCVFlag, ls), "ccmp x3, #31, #nZCV, ls");
2529
2530 CLEANUP();
2531 }
2532
2533
TEST(system_clrex)2534 TEST(system_clrex) {
2535 SETUP();
2536
2537 COMPARE(clrex(0), "clrex #0x0");
2538 COMPARE(clrex(14), "clrex #0xe");
2539 COMPARE(clrex(15), "clrex");
2540 COMPARE(clrex(), "clrex");
2541
2542 CLEANUP();
2543 }
2544
2545
TEST(system_mrs)2546 TEST(system_mrs) {
2547 SETUP();
2548
2549 COMPARE(mrs(x0, NZCV), "mrs x0, nzcv");
2550 COMPARE(mrs(x30, NZCV), "mrs x30, nzcv");
2551 COMPARE(mrs(x15, FPCR), "mrs x15, fpcr");
2552 COMPARE(mrs(x20, RNDR), "mrs x20, rndr");
2553 COMPARE(mrs(x5, RNDRRS), "mrs x5, rndrrs");
2554
2555 // Test mrs that use system registers we haven't named.
2556 COMPARE(dci(MRS | (0x5555 << 5)), "mrs x0, S3_2_c10_c10_5");
2557 COMPARE(dci(0xd53e1000), "mrs x0, S3_6_c1_c0_0");
2558
2559 CLEANUP();
2560 }
2561
2562
TEST(system_msr)2563 TEST(system_msr) {
2564 SETUP();
2565
2566 COMPARE(msr(NZCV, x0), "msr nzcv, x0");
2567 COMPARE(msr(NZCV, x30), "msr nzcv, x30");
2568 COMPARE(msr(FPCR, x15), "msr fpcr, x15");
2569
2570 // Test msr that use system registers we haven't named.
2571 COMPARE(dci(MSR | (0x1234 << 5)), "msr S2_2_c4_c6_4, x0");
2572 COMPARE(dci(0xd51e1000), "msr S3_6_c1_c0_0, x0");
2573
2574 CLEANUP();
2575 }
2576
2577
TEST(system_pstate)2578 TEST(system_pstate) {
2579 SETUP();
2580
2581 COMPARE(cfinv(), "cfinv");
2582 COMPARE(axflag(), "axflag");
2583 COMPARE(xaflag(), "xaflag");
2584
2585 CLEANUP();
2586 }
2587
2588
TEST(system_sys)2589 TEST(system_sys) {
2590 SETUP();
2591
2592 COMPARE(sys(0x3, 0x7, 0x5, 0x1, x1), "ic ivau, x1");
2593 COMPARE(sys(0x3, 0x7, 0xa, 0x1, x2), "dc cvac, x2");
2594 COMPARE(sys(0x3, 0x7, 0xb, 0x1, x3), "dc cvau, x3");
2595 COMPARE(sys(0x3, 0x7, 0xe, 0x1, x4), "dc civac, x4");
2596 COMPARE(sys(0x3, 0x7, 0xc, 0x1, x5), "dc cvap, x5");
2597 COMPARE(sys(0x3, 0x7, 0xd, 0x1, x6), "dc cvadp, x6");
2598 COMPARE(sys(0x3, 0x7, 0x4, 0x1, x0), "dc zva, x0");
2599 COMPARE(sys(0x0, 0x0, 0x0, 0x0, x0), "sys #0, C0, C0, #0, x0");
2600 COMPARE(sys(0x1, 0x2, 0x5, 0x2, x5), "sys #1, C2, C5, #2, x5");
2601 COMPARE(sys(0x2, 0x8, 0xa, 0x3, x6), "sys #2, C8, C10, #3, x6");
2602 COMPARE(sys(0x2, 0xf, 0xf, 0x1, xzr), "sys #2, C15, C15, #1");
2603 COMPARE(sys(0x2, 0xf, 0xf, 0x1), "sys #2, C15, C15, #1");
2604
2605 CLEANUP();
2606 }
2607
2608
TEST(system_ic)2609 TEST(system_ic) {
2610 SETUP();
2611
2612 COMPARE(ic(IVAU, x0), "ic ivau, x0");
2613 COMPARE(ic(IVAU, x1), "ic ivau, x1");
2614 COMPARE(ic(IVAU, xzr), "ic ivau, xzr");
2615
2616 CLEANUP();
2617 }
2618
2619
TEST(system_dc)2620 TEST(system_dc) {
2621 SETUP();
2622
2623 COMPARE(dc(CVAC, x2), "dc cvac, x2");
2624 COMPARE(dc(CVAU, x3), "dc cvau, x3");
2625 COMPARE(dc(CVAP, x4), "dc cvap, x4");
2626 COMPARE(dc(CIVAC, x5), "dc civac, x5");
2627 COMPARE(dc(CVADP, x6), "dc cvadp, x6");
2628 COMPARE(dc(ZVA, x0), "dc zva, x0");
2629 COMPARE(dc(ZVA, xzr), "dc zva, xzr");
2630
2631 CLEANUP();
2632 }
2633
2634
TEST(system_nop)2635 TEST(system_nop) {
2636 SETUP();
2637
2638 COMPARE(nop(), "nop");
2639 COMPARE_MACRO(Nop(), "nop");
2640
2641 CLEANUP();
2642 }
2643
2644
TEST(system_pauth)2645 TEST(system_pauth) {
2646 SETUP();
2647
2648 COMPARE(pacia1716(), "pacia1716");
2649 COMPARE(pacib1716(), "pacib1716");
2650 COMPARE(paciaz(), "paciaz");
2651 COMPARE(pacibz(), "pacibz");
2652 COMPARE(paciasp(), "paciasp");
2653 COMPARE(pacibsp(), "pacibsp");
2654 COMPARE(autia1716(), "autia1716");
2655 COMPARE(autib1716(), "autib1716");
2656 COMPARE(autiaz(), "autiaz");
2657 COMPARE(autibz(), "autibz");
2658 COMPARE(autiasp(), "autiasp");
2659 COMPARE(autibsp(), "autibsp");
2660 COMPARE(xpaclri(), "xpaclri");
2661
2662 CLEANUP();
2663 }
2664
2665
TEST(unreachable)2666 TEST(unreachable) {
2667 SETUP();
2668
2669 VIXL_ASSERT(kUnreachableOpcode == 0xdeb0);
2670 #ifdef VIXL_INCLUDE_SIMULATOR_AARCH64
2671 COMPARE_MACRO(Unreachable(), "hlt #0xdeb0");
2672 #else
2673 COMPARE_MACRO(Unreachable(), "udf #0xdeb0");
2674 #endif
2675
2676 CLEANUP();
2677 }
2678
2679
2680 #ifdef VIXL_INCLUDE_SIMULATOR_AARCH64
TEST(trace)2681 TEST(trace) {
2682 SETUP();
2683
2684 VIXL_ASSERT(kTraceOpcode == 0xdeb2);
2685
2686 // All Trace calls should produce the same instruction.
2687 COMPARE_MACRO_PREFIX(Trace(LOG_ALL, TRACE_ENABLE), "hlt #0xdeb2");
2688 COMPARE_MACRO_PREFIX(Trace(LOG_REGS, TRACE_DISABLE), "hlt #0xdeb2");
2689
2690 CLEANUP();
2691 }
2692 #endif
2693
2694
2695 #ifdef VIXL_INCLUDE_SIMULATOR_AARCH64
TEST(log)2696 TEST(log) {
2697 SETUP();
2698
2699 VIXL_ASSERT(kLogOpcode == 0xdeb3);
2700
2701 // All Log calls should produce the same instruction.
2702 COMPARE_MACRO_PREFIX(Log(LOG_ALL), "hlt #0xdeb3");
2703 COMPARE_MACRO_PREFIX(Log(LOG_SYSREGS), "hlt #0xdeb3");
2704
2705 CLEANUP();
2706 }
2707 #endif
2708
2709
TEST(hlt)2710 TEST(hlt) {
2711 SETUP();
2712
2713 COMPARE(hlt(0), "hlt #0x0");
2714 COMPARE(hlt(1), "hlt #0x1");
2715 COMPARE(hlt(65535), "hlt #0xffff");
2716
2717 CLEANUP();
2718 }
2719
2720
TEST(brk)2721 TEST(brk) {
2722 SETUP();
2723
2724 COMPARE(brk(0), "brk #0x0");
2725 COMPARE(brk(1), "brk #0x1");
2726 COMPARE(brk(65535), "brk #0xffff");
2727
2728 CLEANUP();
2729 }
2730
2731
TEST(svc)2732 TEST(svc) {
2733 SETUP();
2734
2735 COMPARE(svc(0), "svc #0x0");
2736 COMPARE(svc(1), "svc #0x1");
2737 COMPARE(svc(65535), "svc #0xffff");
2738
2739 CLEANUP();
2740 }
2741
2742
TEST(add_sub_negative)2743 TEST(add_sub_negative) {
2744 SETUP();
2745
2746 COMPARE_MACRO(Add(x10, x0, -42), "sub x10, x0, #0x2a (42)");
2747 COMPARE_MACRO(Add(x11, x1, -687), "sub x11, x1, #0x2af (687)");
2748 COMPARE_MACRO(Add(x12, x2, -0x88), "sub x12, x2, #0x88 (136)");
2749
2750 COMPARE_MACRO(Sub(x13, x0, -600), "add x13, x0, #0x258 (600)");
2751 COMPARE_MACRO(Sub(x14, x1, -313), "add x14, x1, #0x139 (313)");
2752 COMPARE_MACRO(Sub(x15, x2, -0x555), "add x15, x2, #0x555 (1365)");
2753
2754 COMPARE_MACRO(Add(w19, w3, -0x344), "sub w19, w3, #0x344 (836)");
2755 COMPARE_MACRO(Add(w20, w4, -2000), "sub w20, w4, #0x7d0 (2000)");
2756
2757 COMPARE_MACRO(Add(w0, w1, 5, LeaveFlags), "add w0, w1, #0x5 (5)");
2758 COMPARE_MACRO(Add(w1, w2, 15, SetFlags), "adds w1, w2, #0xf (15)");
2759
2760 COMPARE_MACRO(Sub(w0, w1, 5, LeaveFlags), "sub w0, w1, #0x5 (5)");
2761 COMPARE_MACRO(Sub(w1, w2, 15, SetFlags), "subs w1, w2, #0xf (15)");
2762
2763 COMPARE_MACRO(Sub(w21, w3, -0xbc), "add w21, w3, #0xbc (188)");
2764 COMPARE_MACRO(Sub(w22, w4, -2000), "add w22, w4, #0x7d0 (2000)");
2765
2766 COMPARE_MACRO(Cmp(w0, -1), "cmn w0, #0x1 (1)");
2767 COMPARE_MACRO(Cmp(x1, -1), "cmn x1, #0x1 (1)");
2768 COMPARE_MACRO(Cmp(w2, -4095), "cmn w2, #0xfff (4095)");
2769 COMPARE_MACRO(Cmp(x3, -4095), "cmn x3, #0xfff (4095)");
2770
2771 COMPARE_MACRO(Cmn(w0, -1), "cmp w0, #0x1 (1)");
2772 COMPARE_MACRO(Cmn(x1, -1), "cmp x1, #0x1 (1)");
2773 COMPARE_MACRO(Cmn(w2, -4095), "cmp w2, #0xfff (4095)");
2774 COMPARE_MACRO(Cmn(x3, -4095), "cmp x3, #0xfff (4095)");
2775
2776 CLEANUP();
2777 }
2778
TEST(add_sub_macro)2779 TEST(add_sub_macro) {
2780 SETUP();
2781
2782 // Add and Sub use their destination register as a scratch if they can.
2783 COMPARE_MACRO(Add(x0, x1, 0x4242),
2784 "mov x0, #0x4242\n"
2785 "add x0, x1, x0");
2786 COMPARE_MACRO(Add(x0, x0, 0x4242),
2787 "mov x16, #0x4242\n"
2788 "add x0, x0, x16");
2789 COMPARE_MACRO(Adds(x0, xzr, Operand(w1, SXTW)),
2790 "sxtw x0, w1\n"
2791 "adds x0, xzr, x0");
2792 COMPARE_MACRO(Sub(x0, x1, 0x4242),
2793 "mov x0, #0x4242\n"
2794 "sub x0, x1, x0");
2795 COMPARE_MACRO(Sub(x0, x0, 0x4242),
2796 "mov x16, #0x4242\n"
2797 "sub x0, x0, x16");
2798 COMPARE_MACRO(Subs(x0, xzr, Operand(w1, SXTW)),
2799 "sxtw x0, w1\n"
2800 "negs x0, x0");
2801 }
2802
TEST(adc_sbc_macro)2803 TEST(adc_sbc_macro) {
2804 SETUP();
2805
2806 // Adc and Sbc use their destination register as a scratch if they can.
2807 COMPARE_MACRO(Adc(x0, x1, 0x4242),
2808 "mov x0, #0x4242\n"
2809 "adc x0, x1, x0");
2810 COMPARE_MACRO(Adc(x0, x0, 0x4242),
2811 "mov x16, #0x4242\n"
2812 "adc x0, x0, x16");
2813 COMPARE_MACRO(Adcs(x0, xzr, Operand(w1, SXTW)),
2814 "sxtw x0, w1\n"
2815 "adcs x0, xzr, x0");
2816 COMPARE_MACRO(Sbc(x0, x1, 0x4242),
2817 "mov x0, #0x4242\n"
2818 "sbc x0, x1, x0");
2819 COMPARE_MACRO(Sbc(x0, x0, 0x4242),
2820 "mov x16, #0x4242\n"
2821 "sbc x0, x0, x16");
2822 COMPARE_MACRO(Sbcs(x0, xzr, Operand(w1, SXTW)),
2823 "sxtw x0, w1\n"
2824 "ngcs x0, x0");
2825 }
2826
TEST(logical_immediate_move)2827 TEST(logical_immediate_move) {
2828 SETUP();
2829
2830 COMPARE_MACRO(And(w0, w1, 0), "mov w0, #0x0");
2831 COMPARE_MACRO(And(x0, x1, 0), "mov x0, #0x0");
2832 COMPARE_MACRO(Orr(w2, w3, 0), "mov w2, w3");
2833 COMPARE_MACRO(Orr(x2, x3, 0), "mov x2, x3");
2834 COMPARE_MACRO(Eor(w4, w5, 0), "mov w4, w5");
2835 COMPARE_MACRO(Eor(x4, x5, 0), "mov x4, x5");
2836 COMPARE_MACRO(Bic(w6, w7, 0), "mov w6, w7");
2837 COMPARE_MACRO(Bic(x6, x7, 0), "mov x6, x7");
2838 COMPARE_MACRO(Orn(w8, w9, 0), "mov w8, #0xffffffff");
2839 COMPARE_MACRO(Orn(x8, x9, 0), "mov x8, #0xffffffffffffffff");
2840 COMPARE_MACRO(Eon(w10, w11, 0), "mvn w10, w11");
2841 COMPARE_MACRO(Eon(x10, x11, 0), "mvn x10, x11");
2842
2843 COMPARE_MACRO(And(w12, w13, 0xffffffff), "mov w12, w13");
2844 COMPARE_MACRO(And(x12, x13, 0xffffffff), "and x12, x13, #0xffffffff");
2845 COMPARE_MACRO(And(x12, x13, 0xffffffffffffffff), "mov x12, x13");
2846 COMPARE_MACRO(Orr(w14, w15, 0xffffffff), "mov w14, #0xffffffff");
2847 COMPARE_MACRO(Orr(x14, x15, 0xffffffff), "orr x14, x15, #0xffffffff");
2848 COMPARE_MACRO(Orr(x14, x15, 0xffffffffffffffff),
2849 "mov x14, #0xffffffffffffffff");
2850 COMPARE_MACRO(Eor(w16, w17, 0xffffffff), "mvn w16, w17");
2851 COMPARE_MACRO(Eor(x16, x17, 0xffffffff), "eor x16, x17, #0xffffffff");
2852 COMPARE_MACRO(Eor(x16, x17, 0xffffffffffffffff), "mvn x16, x17");
2853 COMPARE_MACRO(Bic(w18, w19, 0xffffffff), "mov w18, #0x0");
2854 COMPARE_MACRO(Bic(x18, x19, 0xffffffff), "and x18, x19, #0xffffffff00000000");
2855 COMPARE_MACRO(Bic(x18, x19, 0xffffffffffffffff), "mov x18, #0x0");
2856 COMPARE_MACRO(Orn(w20, w21, 0xffffffff), "mov w20, w21");
2857 COMPARE_MACRO(Orn(x20, x21, 0xffffffff), "orr x20, x21, #0xffffffff00000000");
2858 COMPARE_MACRO(Orn(x20, x21, 0xffffffffffffffff), "mov x20, x21");
2859 COMPARE_MACRO(Eon(w22, w23, 0xffffffff), "mov w22, w23");
2860 COMPARE_MACRO(Eon(x22, x23, 0xffffffff), "eor x22, x23, #0xffffffff00000000");
2861 COMPARE_MACRO(Eon(x22, x23, 0xffffffffffffffff), "mov x22, x23");
2862
2863 // Test stack pointer with non encodable immediate.
2864 COMPARE_MACRO(Orr(wsp, w5, 0x1234),
2865 "mov w16, #0x1234\n"
2866 "orr w16, w5, w16\n"
2867 "mov wsp, w16");
2868 COMPARE_MACRO(Orr(sp, x15, 0x123),
2869 "mov x16, #0x123\n"
2870 "orr x16, x15, x16\n"
2871 "mov sp, x16");
2872
2873 CLEANUP();
2874 }
2875
TEST(logical_macro)2876 TEST(logical_macro) {
2877 SETUP();
2878
2879 // LogicalMacro uses the destination register as a scratch if it can.
2880 COMPARE_MACRO(And(x0, x1, 0x4242),
2881 "mov x0, #0x4242\n"
2882 "and x0, x1, x0");
2883 COMPARE_MACRO(Bic(x0, x0, 0x4242),
2884 "mov x16, #0xffffffffffffbdbd\n"
2885 "and x0, x0, x16");
2886 COMPARE_MACRO(Orn(x0, xzr, Operand(w1, SXTW)),
2887 "sxtw x0, w1\n"
2888 "mvn x0, x0");
2889 COMPARE_MACRO(Orr(x0, x1, 0x4242),
2890 "mov x0, #0x4242\n"
2891 "orr x0, x1, x0");
2892 COMPARE_MACRO(Ands(x0, x0, 0x4242),
2893 "mov x16, #0x4242\n"
2894 "ands x0, x0, x16");
2895 COMPARE_MACRO(Tst(xzr, Operand(w1, SXTW)),
2896 "sxtw x16, w1\n"
2897 "tst xzr, x16");
2898 }
2899
TEST(barriers)2900 TEST(barriers) {
2901 SETUP();
2902
2903 // DMB
2904 COMPARE_MACRO(Dmb(FullSystem, BarrierAll), "dmb sy");
2905 COMPARE_MACRO(Dmb(FullSystem, BarrierReads), "dmb ld");
2906 COMPARE_MACRO(Dmb(FullSystem, BarrierWrites), "dmb st");
2907
2908 COMPARE_MACRO(Dmb(InnerShareable, BarrierAll), "dmb ish");
2909 COMPARE_MACRO(Dmb(InnerShareable, BarrierReads), "dmb ishld");
2910 COMPARE_MACRO(Dmb(InnerShareable, BarrierWrites), "dmb ishst");
2911
2912 COMPARE_MACRO(Dmb(NonShareable, BarrierAll), "dmb nsh");
2913 COMPARE_MACRO(Dmb(NonShareable, BarrierReads), "dmb nshld");
2914 COMPARE_MACRO(Dmb(NonShareable, BarrierWrites), "dmb nshst");
2915
2916 COMPARE_MACRO(Dmb(OuterShareable, BarrierAll), "dmb osh");
2917 COMPARE_MACRO(Dmb(OuterShareable, BarrierReads), "dmb oshld");
2918 COMPARE_MACRO(Dmb(OuterShareable, BarrierWrites), "dmb oshst");
2919
2920 COMPARE_MACRO(Dmb(FullSystem, BarrierOther), "dmb sy (0b1100)");
2921 COMPARE_MACRO(Dmb(InnerShareable, BarrierOther), "dmb sy (0b1000)");
2922 COMPARE_MACRO(Dmb(NonShareable, BarrierOther), "dmb sy (0b0100)");
2923 COMPARE_MACRO(Dmb(OuterShareable, BarrierOther), "dmb sy (0b0000)");
2924
2925 // DSB
2926 COMPARE_MACRO(Dsb(FullSystem, BarrierAll), "dsb sy");
2927 COMPARE_MACRO(Dsb(FullSystem, BarrierReads), "dsb ld");
2928 COMPARE_MACRO(Dsb(FullSystem, BarrierWrites), "dsb st");
2929
2930 COMPARE_MACRO(Dsb(InnerShareable, BarrierAll), "dsb ish");
2931 COMPARE_MACRO(Dsb(InnerShareable, BarrierReads), "dsb ishld");
2932 COMPARE_MACRO(Dsb(InnerShareable, BarrierWrites), "dsb ishst");
2933
2934 COMPARE_MACRO(Dsb(NonShareable, BarrierAll), "dsb nsh");
2935 COMPARE_MACRO(Dsb(NonShareable, BarrierReads), "dsb nshld");
2936 COMPARE_MACRO(Dsb(NonShareable, BarrierWrites), "dsb nshst");
2937
2938 COMPARE_MACRO(Dsb(OuterShareable, BarrierAll), "dsb osh");
2939 COMPARE_MACRO(Dsb(OuterShareable, BarrierReads), "dsb oshld");
2940 COMPARE_MACRO(Dsb(OuterShareable, BarrierWrites), "dsb oshst");
2941
2942 COMPARE_MACRO(Dsb(FullSystem, BarrierOther), "dsb sy (0b1100)");
2943 COMPARE_MACRO(Dsb(InnerShareable, BarrierOther), "dsb sy (0b1000)");
2944 COMPARE_MACRO(Dsb(NonShareable, BarrierOther), "pssbb");
2945 COMPARE_MACRO(Dsb(OuterShareable, BarrierOther), "ssbb");
2946
2947 // ISB
2948 COMPARE_MACRO(Isb(), "isb");
2949
2950 // ESB
2951 COMPARE_MACRO(Esb(), "esb");
2952
2953 // CSDB
2954 COMPARE_MACRO(Csdb(), "csdb");
2955
2956 CLEANUP();
2957 }
2958
TEST(address_map)2959 TEST(address_map) {
2960 // Check that we can disassemble from a fake base address.
2961 SETUP();
2962
2963 disasm.MapCodeAddress(0, masm.GetBuffer()->GetStartAddress<Instruction*>());
2964 COMPARE(ldr(x0, INT64_C(0)), "ldr x0, pc+0 (addr 0x0)");
2965 COMPARE(ldr(x0, -1), "ldr x0, pc-4 (addr -0x4)");
2966 COMPARE(ldr(x0, 1), "ldr x0, pc+4 (addr 0x4)");
2967 COMPARE(prfm(PLIL1KEEP, INT64_C(0)), "prfm plil1keep, pc+0 (addr 0x0)");
2968 COMPARE(prfm(PLIL1KEEP, -1), "prfm plil1keep, pc-4 (addr -0x4)");
2969 COMPARE(prfm(PLIL1KEEP, 1), "prfm plil1keep, pc+4 (addr 0x4)");
2970 COMPARE(adr(x0, INT64_C(0)), "adr x0, #+0x0 (addr 0x0)");
2971 COMPARE(adr(x0, -1), "adr x0, #-0x1 (addr -0x1)");
2972 COMPARE(adr(x0, 1), "adr x0, #+0x1 (addr 0x1)");
2973 COMPARE(adrp(x0, INT64_C(0)), "adrp x0, #+0x0 (addr 0x0)");
2974 COMPARE(adrp(x0, -1), "adrp x0, #-0x1000 (addr -0x1000)");
2975 COMPARE(adrp(x0, 1), "adrp x0, #+0x1000 (addr 0x1000)");
2976 COMPARE(b(INT64_C(0)), "b #+0x0 (addr 0x0)");
2977 COMPARE(b(-1), "b #-0x4 (addr -0x4)");
2978 COMPARE(b(1), "b #+0x4 (addr 0x4)");
2979
2980 disasm.MapCodeAddress(0x1234,
2981 masm.GetBuffer()->GetStartAddress<Instruction*>());
2982 COMPARE(ldr(x0, INT64_C(0)), "ldr x0, pc+0 (addr 0x1234)");
2983 COMPARE(ldr(x0, -1), "ldr x0, pc-4 (addr 0x1230)");
2984 COMPARE(ldr(x0, 1), "ldr x0, pc+4 (addr 0x1238)");
2985 COMPARE(prfm(PLIL1KEEP, INT64_C(0)), "prfm plil1keep, pc+0 (addr 0x1234)");
2986 COMPARE(prfm(PLIL1KEEP, -1), "prfm plil1keep, pc-4 (addr 0x1230)");
2987 COMPARE(prfm(PLIL1KEEP, 1), "prfm plil1keep, pc+4 (addr 0x1238)");
2988 COMPARE(adr(x0, INT64_C(0)), "adr x0, #+0x0 (addr 0x1234)");
2989 COMPARE(adr(x0, -1), "adr x0, #-0x1 (addr 0x1233)");
2990 COMPARE(adr(x0, 1), "adr x0, #+0x1 (addr 0x1235)");
2991 COMPARE(adrp(x0, INT64_C(0)), "adrp x0, #+0x0 (addr 0x1000)");
2992 COMPARE(adrp(x0, -1), "adrp x0, #-0x1000 (addr 0x0)");
2993 COMPARE(adrp(x0, 1), "adrp x0, #+0x1000 (addr 0x2000)");
2994 COMPARE(b(INT64_C(0)), "b #+0x0 (addr 0x1234)");
2995 COMPARE(b(-1), "b #-0x4 (addr 0x1230)");
2996 COMPARE(b(1), "b #+0x4 (addr 0x1238)");
2997
2998 // Check that 64-bit addresses work.
2999 disasm.MapCodeAddress(UINT64_C(0x100000000),
3000 masm.GetBuffer()->GetStartAddress<Instruction*>());
3001 COMPARE(ldr(x0, INT64_C(0)), "ldr x0, pc+0 (addr 0x100000000)");
3002 COMPARE(ldr(x0, -1), "ldr x0, pc-4 (addr 0xfffffffc)");
3003 COMPARE(ldr(x0, 1), "ldr x0, pc+4 (addr 0x100000004)");
3004 COMPARE(prfm(PLIL1KEEP, INT64_C(0)),
3005 "prfm plil1keep, pc+0 (addr 0x100000000)");
3006 COMPARE(prfm(PLIL1KEEP, -1), "prfm plil1keep, pc-4 (addr 0xfffffffc)");
3007 COMPARE(prfm(PLIL1KEEP, 1), "prfm plil1keep, pc+4 (addr 0x100000004)");
3008 COMPARE(adr(x0, INT64_C(0)), "adr x0, #+0x0 (addr 0x100000000)");
3009 COMPARE(adr(x0, -1), "adr x0, #-0x1 (addr 0xffffffff)");
3010 COMPARE(adr(x0, 1), "adr x0, #+0x1 (addr 0x100000001)");
3011 COMPARE(adrp(x0, INT64_C(0)), "adrp x0, #+0x0 (addr 0x100000000)");
3012 COMPARE(adrp(x0, -1), "adrp x0, #-0x1000 (addr 0xfffff000)");
3013 COMPARE(adrp(x0, 1), "adrp x0, #+0x1000 (addr 0x100001000)");
3014 COMPARE(b(INT64_C(0)), "b #+0x0 (addr 0x100000000)");
3015 COMPARE(b(-1), "b #-0x4 (addr 0xfffffffc)");
3016 COMPARE(b(1), "b #+0x4 (addr 0x100000004)");
3017
3018 disasm.MapCodeAddress(0xfffffffc,
3019 masm.GetBuffer()->GetStartAddress<Instruction*>());
3020 COMPARE(ldr(x0, 1), "ldr x0, pc+4 (addr 0x100000000)");
3021 COMPARE(prfm(PLIL1KEEP, 1), "prfm plil1keep, pc+4 (addr 0x100000000)");
3022 COMPARE(b(1), "b #+0x4 (addr 0x100000000)");
3023 COMPARE(adr(x0, 4), "adr x0, #+0x4 (addr 0x100000000)");
3024 COMPARE(adrp(x0, 1), "adrp x0, #+0x1000 (addr 0x100000000)");
3025
3026 // Check that very large offsets are handled properly. This detects misuse of
3027 // the host's ptrdiff_t type when run on a 32-bit host. Only adrp is capable
3028 // of encoding such offsets.
3029 disasm.MapCodeAddress(0, masm.GetBuffer()->GetStartAddress<Instruction*>());
3030 COMPARE(adrp(x0, 0x000fffff), "adrp x0, #+0xfffff000 (addr 0xfffff000)");
3031 COMPARE(adrp(x0, -0x00100000), "adrp x0, #-0x100000000 (addr -0x100000000)");
3032
3033 CLEANUP();
3034 }
3035
TEST(hint)3036 TEST(hint) {
3037 SETUP();
3038
3039 // Test that we properly disassemble named and unnamed hints.
3040 COMPARE(hint(NOP), "nop");
3041 COMPARE(hint(YIELD), "yield");
3042 COMPARE(hint(WFE), "wfe");
3043 COMPARE(hint(WFI), "wfi");
3044 COMPARE(hint(SEV), "sev");
3045 COMPARE(hint(SEVL), "sevl");
3046 COMPARE(hint(6), "dgh");
3047 COMPARE(hint(ESB), "esb");
3048 COMPARE(hint(CSDB), "csdb");
3049 COMPARE(hint(42), "hint #42");
3050 COMPARE(hint(127), "hint #127");
3051
3052 // The MacroAssembler should simply pass through to the Assembler.
3053 COMPARE_MACRO(Hint(NOP), "nop");
3054 COMPARE_MACRO(Hint(CSDB), "csdb");
3055 COMPARE_MACRO(Hint(42), "hint #42");
3056 COMPARE_MACRO(Hint(127), "hint #127");
3057
3058 CLEANUP();
3059 }
3060
TEST(bti)3061 TEST(bti) {
3062 SETUP();
3063
3064 COMPARE(bti(EmitBTI), "bti");
3065 COMPARE(bti(EmitBTI_c), "bti c");
3066 COMPARE(bti(EmitBTI_j), "bti j");
3067 COMPARE(bti(EmitBTI_jc), "bti jc");
3068 COMPARE(hint(BTI), "bti");
3069 COMPARE(hint(BTI_c), "bti c");
3070 COMPARE(hint(BTI_j), "bti j");
3071 COMPARE(hint(BTI_jc), "bti jc");
3072
3073 Label placeholder1, placeholder2, placeholder3, placeholder4;
3074 COMPARE_MACRO(Bind(&placeholder1, EmitBTI), "bti");
3075 COMPARE_MACRO(Bind(&placeholder2, EmitBTI_c), "bti c");
3076 COMPARE_MACRO(Bind(&placeholder3, EmitBTI_j), "bti j");
3077 COMPARE_MACRO(Bind(&placeholder4, EmitBTI_jc), "bti jc");
3078
3079 CLEANUP();
3080 }
3081
TEST(udf)3082 TEST(udf) {
3083 SETUP();
3084
3085 COMPARE(udf(0), "udf #0x0");
3086 COMPARE(udf(0x1234), "udf #0x1234");
3087 COMPARE(udf(0xffff), "udf #0xffff");
3088
3089 // UDF gives the useful property that zero-initialised memory is guaranteed to
3090 // generate undefined instruction exceptions.
3091 COMPARE(dc(0), "udf #0x0");
3092
3093 // Check related unallocated bit patterns from the reserved block.
3094 COMPARE(dc(0x00010000), "unallocated (Unallocated)");
3095 COMPARE(dc(0x01000000), "unallocated (Unallocated)");
3096 COMPARE(dc(0x20000000), "unallocated (Unallocated)");
3097 COMPARE(dc(0x80000000), "unallocated (Unallocated)");
3098
3099 CLEANUP();
3100 }
3101
TEST(architecture_features)3102 TEST(architecture_features) {
3103 SETUP();
3104
3105 // ARMv8.1 - LOR
3106 COMPARE_PREFIX(dci(0x08800000), "stllrb"); // STLLRB_SL32_ldstexcl
3107 COMPARE_PREFIX(dci(0x08c00000), "ldlarb"); // LDLARB_LR32_ldstexcl
3108 COMPARE_PREFIX(dci(0x48800000), "stllrh"); // STLLRH_SL32_ldstexcl
3109 COMPARE_PREFIX(dci(0x48c00000), "ldlarh"); // LDLARH_LR32_ldstexcl
3110 COMPARE_PREFIX(dci(0x88800000), "stllr"); // STLLR_SL32_ldstexcl
3111 COMPARE_PREFIX(dci(0x88c00000), "ldlar"); // LDLAR_LR32_ldstexcl
3112 COMPARE_PREFIX(dci(0xc8800000), "stllr"); // STLLR_SL64_ldstexcl
3113 COMPARE_PREFIX(dci(0xc8c00000), "ldlar"); // LDLAR_LR64_ldstexcl
3114
3115 // ARMv8.1 - LSE
3116 COMPARE_PREFIX(dci(0x08207c00), "casp"); // CASP_CP32_ldstexcl
3117 COMPARE_PREFIX(dci(0x0820fc00), "caspl"); // CASPL_CP32_ldstexcl
3118 COMPARE_PREFIX(dci(0x08607c00), "caspa"); // CASPA_CP32_ldstexcl
3119 COMPARE_PREFIX(dci(0x0860fc00), "caspal"); // CASPAL_CP32_ldstexcl
3120 COMPARE_PREFIX(dci(0x08a07c00), "casb"); // CASB_C32_ldstexcl
3121 COMPARE_PREFIX(dci(0x08a0fc00), "caslb"); // CASLB_C32_ldstexcl
3122 COMPARE_PREFIX(dci(0x08e07c00), "casab"); // CASAB_C32_ldstexcl
3123 COMPARE_PREFIX(dci(0x08e0fc00), "casalb"); // CASALB_C32_ldstexcl
3124 COMPARE_PREFIX(dci(0x38200000), "ldaddb"); // LDADDB_32_memop
3125 COMPARE_PREFIX(dci(0x38201000), "ldclrb"); // LDCLRB_32_memop
3126 COMPARE_PREFIX(dci(0x38202000), "ldeorb"); // LDEORB_32_memop
3127 COMPARE_PREFIX(dci(0x38203000), "ldsetb"); // LDSETB_32_memop
3128 COMPARE_PREFIX(dci(0x38204000), "ldsmaxb"); // LDSMAXB_32_memop
3129 COMPARE_PREFIX(dci(0x38205000), "ldsminb"); // LDSMINB_32_memop
3130 COMPARE_PREFIX(dci(0x38206000), "ldumaxb"); // LDUMAXB_32_memop
3131 COMPARE_PREFIX(dci(0x38207000), "lduminb"); // LDUMINB_32_memop
3132 COMPARE_PREFIX(dci(0x38208000), "swpb"); // SWPB_32_memop
3133 COMPARE_PREFIX(dci(0x38600000), "ldaddlb"); // LDADDLB_32_memop
3134 COMPARE_PREFIX(dci(0x38601000), "ldclrlb"); // LDCLRLB_32_memop
3135 COMPARE_PREFIX(dci(0x38602000), "ldeorlb"); // LDEORLB_32_memop
3136 COMPARE_PREFIX(dci(0x38603000), "ldsetlb"); // LDSETLB_32_memop
3137 COMPARE_PREFIX(dci(0x38604000), "ldsmaxlb"); // LDSMAXLB_32_memop
3138 COMPARE_PREFIX(dci(0x38605000), "ldsminlb"); // LDSMINLB_32_memop
3139 COMPARE_PREFIX(dci(0x38606000), "ldumaxlb"); // LDUMAXLB_32_memop
3140 COMPARE_PREFIX(dci(0x38607000), "lduminlb"); // LDUMINLB_32_memop
3141 COMPARE_PREFIX(dci(0x38608000), "swplb"); // SWPLB_32_memop
3142 COMPARE_PREFIX(dci(0x38a00000), "ldaddab"); // LDADDAB_32_memop
3143 COMPARE_PREFIX(dci(0x38a01000), "ldclrab"); // LDCLRAB_32_memop
3144 COMPARE_PREFIX(dci(0x38a02000), "ldeorab"); // LDEORAB_32_memop
3145 COMPARE_PREFIX(dci(0x38a03000), "ldsetab"); // LDSETAB_32_memop
3146 COMPARE_PREFIX(dci(0x38a04000), "ldsmaxab"); // LDSMAXAB_32_memop
3147 COMPARE_PREFIX(dci(0x38a05000), "ldsminab"); // LDSMINAB_32_memop
3148 COMPARE_PREFIX(dci(0x38a06000), "ldumaxab"); // LDUMAXAB_32_memop
3149 COMPARE_PREFIX(dci(0x38a07000), "lduminab"); // LDUMINAB_32_memop
3150 COMPARE_PREFIX(dci(0x38a08000), "swpab"); // SWPAB_32_memop
3151 COMPARE_PREFIX(dci(0x38e00000), "ldaddalb"); // LDADDALB_32_memop
3152 COMPARE_PREFIX(dci(0x38e01000), "ldclralb"); // LDCLRALB_32_memop
3153 COMPARE_PREFIX(dci(0x38e02000), "ldeoralb"); // LDEORALB_32_memop
3154 COMPARE_PREFIX(dci(0x38e03000), "ldsetalb"); // LDSETALB_32_memop
3155 COMPARE_PREFIX(dci(0x38e04000), "ldsmaxalb"); // LDSMAXALB_32_memop
3156 COMPARE_PREFIX(dci(0x38e05000), "ldsminalb"); // LDSMINALB_32_memop
3157 COMPARE_PREFIX(dci(0x38e06000), "ldumaxalb"); // LDUMAXALB_32_memop
3158 COMPARE_PREFIX(dci(0x38e07000), "lduminalb"); // LDUMINALB_32_memop
3159 COMPARE_PREFIX(dci(0x38e08000), "swpalb"); // SWPALB_32_memop
3160 COMPARE_PREFIX(dci(0x48207c00), "casp"); // CASP_CP64_ldstexcl
3161 COMPARE_PREFIX(dci(0x4820fc00), "caspl"); // CASPL_CP64_ldstexcl
3162 COMPARE_PREFIX(dci(0x48607c00), "caspa"); // CASPA_CP64_ldstexcl
3163 COMPARE_PREFIX(dci(0x4860fc00), "caspal"); // CASPAL_CP64_ldstexcl
3164 COMPARE_PREFIX(dci(0x48a07c00), "cash"); // CASH_C32_ldstexcl
3165 COMPARE_PREFIX(dci(0x48a0fc00), "caslh"); // CASLH_C32_ldstexcl
3166 COMPARE_PREFIX(dci(0x48e07c00), "casah"); // CASAH_C32_ldstexcl
3167 COMPARE_PREFIX(dci(0x48e0fc00), "casalh"); // CASALH_C32_ldstexcl
3168 COMPARE_PREFIX(dci(0x78200000), "ldaddh"); // LDADDH_32_memop
3169 COMPARE_PREFIX(dci(0x78201000), "ldclrh"); // LDCLRH_32_memop
3170 COMPARE_PREFIX(dci(0x78202000), "ldeorh"); // LDEORH_32_memop
3171 COMPARE_PREFIX(dci(0x78203000), "ldseth"); // LDSETH_32_memop
3172 COMPARE_PREFIX(dci(0x78204000), "ldsmaxh"); // LDSMAXH_32_memop
3173 COMPARE_PREFIX(dci(0x78205000), "ldsminh"); // LDSMINH_32_memop
3174 COMPARE_PREFIX(dci(0x78206000), "ldumaxh"); // LDUMAXH_32_memop
3175 COMPARE_PREFIX(dci(0x78207000), "lduminh"); // LDUMINH_32_memop
3176 COMPARE_PREFIX(dci(0x78208000), "swph"); // SWPH_32_memop
3177 COMPARE_PREFIX(dci(0x78600000), "ldaddlh"); // LDADDLH_32_memop
3178 COMPARE_PREFIX(dci(0x78601000), "ldclrlh"); // LDCLRLH_32_memop
3179 COMPARE_PREFIX(dci(0x78602000), "ldeorlh"); // LDEORLH_32_memop
3180 COMPARE_PREFIX(dci(0x78603000), "ldsetlh"); // LDSETLH_32_memop
3181 COMPARE_PREFIX(dci(0x78604000), "ldsmaxlh"); // LDSMAXLH_32_memop
3182 COMPARE_PREFIX(dci(0x78605000), "ldsminlh"); // LDSMINLH_32_memop
3183 COMPARE_PREFIX(dci(0x78606000), "ldumaxlh"); // LDUMAXLH_32_memop
3184 COMPARE_PREFIX(dci(0x78607000), "lduminlh"); // LDUMINLH_32_memop
3185 COMPARE_PREFIX(dci(0x78608000), "swplh"); // SWPLH_32_memop
3186 COMPARE_PREFIX(dci(0x78a00000), "ldaddah"); // LDADDAH_32_memop
3187 COMPARE_PREFIX(dci(0x78a01000), "ldclrah"); // LDCLRAH_32_memop
3188 COMPARE_PREFIX(dci(0x78a02000), "ldeorah"); // LDEORAH_32_memop
3189 COMPARE_PREFIX(dci(0x78a03000), "ldsetah"); // LDSETAH_32_memop
3190 COMPARE_PREFIX(dci(0x78a04000), "ldsmaxah"); // LDSMAXAH_32_memop
3191 COMPARE_PREFIX(dci(0x78a05000), "ldsminah"); // LDSMINAH_32_memop
3192 COMPARE_PREFIX(dci(0x78a06000), "ldumaxah"); // LDUMAXAH_32_memop
3193 COMPARE_PREFIX(dci(0x78a07000), "lduminah"); // LDUMINAH_32_memop
3194 COMPARE_PREFIX(dci(0x78a08000), "swpah"); // SWPAH_32_memop
3195 COMPARE_PREFIX(dci(0x78e00000), "ldaddalh"); // LDADDALH_32_memop
3196 COMPARE_PREFIX(dci(0x78e01000), "ldclralh"); // LDCLRALH_32_memop
3197 COMPARE_PREFIX(dci(0x78e02000), "ldeoralh"); // LDEORALH_32_memop
3198 COMPARE_PREFIX(dci(0x78e03000), "ldsetalh"); // LDSETALH_32_memop
3199 COMPARE_PREFIX(dci(0x78e04000), "ldsmaxalh"); // LDSMAXALH_32_memop
3200 COMPARE_PREFIX(dci(0x78e05000), "ldsminalh"); // LDSMINALH_32_memop
3201 COMPARE_PREFIX(dci(0x78e06000), "ldumaxalh"); // LDUMAXALH_32_memop
3202 COMPARE_PREFIX(dci(0x78e07000), "lduminalh"); // LDUMINALH_32_memop
3203 COMPARE_PREFIX(dci(0x78e08000), "swpalh"); // SWPALH_32_memop
3204 COMPARE_PREFIX(dci(0x88a07c00), "cas"); // CAS_C32_ldstexcl
3205 COMPARE_PREFIX(dci(0x88a0fc00), "casl"); // CASL_C32_ldstexcl
3206 COMPARE_PREFIX(dci(0x88e07c00), "casa"); // CASA_C32_ldstexcl
3207 COMPARE_PREFIX(dci(0x88e0fc00), "casal"); // CASAL_C32_ldstexcl
3208 COMPARE_PREFIX(dci(0xb8200000), "ldadd"); // LDADD_32_memop
3209 COMPARE_PREFIX(dci(0xb8201000), "ldclr"); // LDCLR_32_memop
3210 COMPARE_PREFIX(dci(0xb8202000), "ldeor"); // LDEOR_32_memop
3211 COMPARE_PREFIX(dci(0xb8203000), "ldset"); // LDSET_32_memop
3212 COMPARE_PREFIX(dci(0xb8204000), "ldsmax"); // LDSMAX_32_memop
3213 COMPARE_PREFIX(dci(0xb8205000), "ldsmin"); // LDSMIN_32_memop
3214 COMPARE_PREFIX(dci(0xb8206000), "ldumax"); // LDUMAX_32_memop
3215 COMPARE_PREFIX(dci(0xb8207000), "ldumin"); // LDUMIN_32_memop
3216 COMPARE_PREFIX(dci(0xb8208000), "swp"); // SWP_32_memop
3217 COMPARE_PREFIX(dci(0xb8600000), "ldaddl"); // LDADDL_32_memop
3218 COMPARE_PREFIX(dci(0xb8601000), "ldclrl"); // LDCLRL_32_memop
3219 COMPARE_PREFIX(dci(0xb8602000), "ldeorl"); // LDEORL_32_memop
3220 COMPARE_PREFIX(dci(0xb8603000), "ldsetl"); // LDSETL_32_memop
3221 COMPARE_PREFIX(dci(0xb8604000), "ldsmaxl"); // LDSMAXL_32_memop
3222 COMPARE_PREFIX(dci(0xb8605000), "ldsminl"); // LDSMINL_32_memop
3223 COMPARE_PREFIX(dci(0xb8606000), "ldumaxl"); // LDUMAXL_32_memop
3224 COMPARE_PREFIX(dci(0xb8607000), "lduminl"); // LDUMINL_32_memop
3225 COMPARE_PREFIX(dci(0xb8608000), "swpl"); // SWPL_32_memop
3226 COMPARE_PREFIX(dci(0xb8a00000), "ldadda"); // LDADDA_32_memop
3227 COMPARE_PREFIX(dci(0xb8a01000), "ldclra"); // LDCLRA_32_memop
3228 COMPARE_PREFIX(dci(0xb8a02000), "ldeora"); // LDEORA_32_memop
3229 COMPARE_PREFIX(dci(0xb8a03000), "ldseta"); // LDSETA_32_memop
3230 COMPARE_PREFIX(dci(0xb8a04000), "ldsmaxa"); // LDSMAXA_32_memop
3231 COMPARE_PREFIX(dci(0xb8a05000), "ldsmina"); // LDSMINA_32_memop
3232 COMPARE_PREFIX(dci(0xb8a06000), "ldumaxa"); // LDUMAXA_32_memop
3233 COMPARE_PREFIX(dci(0xb8a07000), "ldumina"); // LDUMINA_32_memop
3234 COMPARE_PREFIX(dci(0xb8a08000), "swpa"); // SWPA_32_memop
3235 COMPARE_PREFIX(dci(0xb8e00000), "ldaddal"); // LDADDAL_32_memop
3236 COMPARE_PREFIX(dci(0xb8e01000), "ldclral"); // LDCLRAL_32_memop
3237 COMPARE_PREFIX(dci(0xb8e02000), "ldeoral"); // LDEORAL_32_memop
3238 COMPARE_PREFIX(dci(0xb8e03000), "ldsetal"); // LDSETAL_32_memop
3239 COMPARE_PREFIX(dci(0xb8e04000), "ldsmaxal"); // LDSMAXAL_32_memop
3240 COMPARE_PREFIX(dci(0xb8e05000), "ldsminal"); // LDSMINAL_32_memop
3241 COMPARE_PREFIX(dci(0xb8e06000), "ldumaxal"); // LDUMAXAL_32_memop
3242 COMPARE_PREFIX(dci(0xb8e07000), "lduminal"); // LDUMINAL_32_memop
3243 COMPARE_PREFIX(dci(0xb8e08000), "swpal"); // SWPAL_32_memop
3244 COMPARE_PREFIX(dci(0xc8a07c00), "cas"); // CAS_C64_ldstexcl
3245 COMPARE_PREFIX(dci(0xc8a0fc00), "casl"); // CASL_C64_ldstexcl
3246 COMPARE_PREFIX(dci(0xc8e07c00), "casa"); // CASA_C64_ldstexcl
3247 COMPARE_PREFIX(dci(0xc8e0fc00), "casal"); // CASAL_C64_ldstexcl
3248 COMPARE_PREFIX(dci(0xf8200000), "ldadd"); // LDADD_64_memop
3249 COMPARE_PREFIX(dci(0xf8201000), "ldclr"); // LDCLR_64_memop
3250 COMPARE_PREFIX(dci(0xf8202000), "ldeor"); // LDEOR_64_memop
3251 COMPARE_PREFIX(dci(0xf8203000), "ldset"); // LDSET_64_memop
3252 COMPARE_PREFIX(dci(0xf8204000), "ldsmax"); // LDSMAX_64_memop
3253 COMPARE_PREFIX(dci(0xf8205000), "ldsmin"); // LDSMIN_64_memop
3254 COMPARE_PREFIX(dci(0xf8206000), "ldumax"); // LDUMAX_64_memop
3255 COMPARE_PREFIX(dci(0xf8207000), "ldumin"); // LDUMIN_64_memop
3256 COMPARE_PREFIX(dci(0xf8208000), "swp"); // SWP_64_memop
3257 COMPARE_PREFIX(dci(0xf8600000), "ldaddl"); // LDADDL_64_memop
3258 COMPARE_PREFIX(dci(0xf8601000), "ldclrl"); // LDCLRL_64_memop
3259 COMPARE_PREFIX(dci(0xf8602000), "ldeorl"); // LDEORL_64_memop
3260 COMPARE_PREFIX(dci(0xf8603000), "ldsetl"); // LDSETL_64_memop
3261 COMPARE_PREFIX(dci(0xf8604000), "ldsmaxl"); // LDSMAXL_64_memop
3262 COMPARE_PREFIX(dci(0xf8605000), "ldsminl"); // LDSMINL_64_memop
3263 COMPARE_PREFIX(dci(0xf8606000), "ldumaxl"); // LDUMAXL_64_memop
3264 COMPARE_PREFIX(dci(0xf8607000), "lduminl"); // LDUMINL_64_memop
3265 COMPARE_PREFIX(dci(0xf8608000), "swpl"); // SWPL_64_memop
3266 COMPARE_PREFIX(dci(0xf8a00000), "ldadda"); // LDADDA_64_memop
3267 COMPARE_PREFIX(dci(0xf8a01000), "ldclra"); // LDCLRA_64_memop
3268 COMPARE_PREFIX(dci(0xf8a02000), "ldeora"); // LDEORA_64_memop
3269 COMPARE_PREFIX(dci(0xf8a03000), "ldseta"); // LDSETA_64_memop
3270 COMPARE_PREFIX(dci(0xf8a04000), "ldsmaxa"); // LDSMAXA_64_memop
3271 COMPARE_PREFIX(dci(0xf8a05000), "ldsmina"); // LDSMINA_64_memop
3272 COMPARE_PREFIX(dci(0xf8a06000), "ldumaxa"); // LDUMAXA_64_memop
3273 COMPARE_PREFIX(dci(0xf8a07000), "ldumina"); // LDUMINA_64_memop
3274 COMPARE_PREFIX(dci(0xf8a08000), "swpa"); // SWPA_64_memop
3275 COMPARE_PREFIX(dci(0xf8e00000), "ldaddal"); // LDADDAL_64_memop
3276 COMPARE_PREFIX(dci(0xf8e01000), "ldclral"); // LDCLRAL_64_memop
3277 COMPARE_PREFIX(dci(0xf8e02000), "ldeoral"); // LDEORAL_64_memop
3278 COMPARE_PREFIX(dci(0xf8e03000), "ldsetal"); // LDSETAL_64_memop
3279 COMPARE_PREFIX(dci(0xf8e04000), "ldsmaxal"); // LDSMAXAL_64_memop
3280 COMPARE_PREFIX(dci(0xf8e05000), "ldsminal"); // LDSMINAL_64_memop
3281 COMPARE_PREFIX(dci(0xf8e06000), "ldumaxal"); // LDUMAXAL_64_memop
3282 COMPARE_PREFIX(dci(0xf8e07000), "lduminal"); // LDUMINAL_64_memop
3283 COMPARE_PREFIX(dci(0xf8e08000), "swpal"); // SWPAL_64_memop
3284
3285 // ARMv8.1 - RDM
3286 COMPARE_PREFIX(dci(0x2e008400), "sqrdmlah"); // SQRDMLAH_asimdsame2_only
3287 COMPARE_PREFIX(dci(0x2e008c00), "sqrdmlsh"); // SQRDMLSH_asimdsame2_only
3288 COMPARE_PREFIX(dci(0x2f40d000), "sqrdmlah"); // SQRDMLAH_asimdelem_R
3289 COMPARE_PREFIX(dci(0x2f40f000), "sqrdmlsh"); // SQRDMLSH_asimdelem_R
3290 COMPARE_PREFIX(dci(0x7e008400), "sqrdmlah"); // SQRDMLAH_asisdsame2_only
3291 COMPARE_PREFIX(dci(0x7e008c00), "sqrdmlsh"); // SQRDMLSH_asisdsame2_only
3292 COMPARE_PREFIX(dci(0x7f40d000), "sqrdmlah"); // SQRDMLAH_asisdelem_R
3293 COMPARE_PREFIX(dci(0x7f40f000), "sqrdmlsh"); // SQRDMLSH_asisdelem_R
3294
3295 // ARMv8.2 - DotProd
3296 COMPARE_PREFIX(dci(0x0e009400), "sdot"); // SDOT_asimdsame2_D
3297 COMPARE_PREFIX(dci(0x0f00e000), "sdot"); // SDOT_asimdelem_D
3298 COMPARE_PREFIX(dci(0x2e009400), "udot"); // UDOT_asimdsame2_D
3299 COMPARE_PREFIX(dci(0x2f00e000), "udot"); // UDOT_asimdelem_D
3300
3301 // ARMv8.2 - FHM
3302 COMPARE_PREFIX(dci(0x0e20ec00), "fmlal"); // FMLAL_asimdsame_F
3303 COMPARE_PREFIX(dci(0x0ea0ec00), "fmlsl"); // FMLSL_asimdsame_F
3304 COMPARE_PREFIX(dci(0x0f800000), "fmlal"); // FMLAL_asimdelem_LH
3305 COMPARE_PREFIX(dci(0x0f804000), "fmlsl"); // FMLSL_asimdelem_LH
3306 COMPARE_PREFIX(dci(0x2e20cc00), "fmlal2"); // FMLAL2_asimdsame_F
3307 COMPARE_PREFIX(dci(0x2ea0cc00), "fmlsl2"); // FMLSL2_asimdsame_F
3308 COMPARE_PREFIX(dci(0x2f808000), "fmlal2"); // FMLAL2_asimdelem_LH
3309 COMPARE_PREFIX(dci(0x2f80c000), "fmlsl2"); // FMLSL2_asimdelem_LH
3310
3311 // ARMv8.2 - FP16
3312 COMPARE_PREFIX(dci(0x0e20c400), "fmaxnm"); // FMAXNM_asimdsame_only
3313 COMPARE_PREFIX(dci(0x0e20cc00), "fmla"); // FMLA_asimdsame_only
3314 COMPARE_PREFIX(dci(0x0e20d400), "fadd"); // FADD_asimdsame_only
3315 COMPARE_PREFIX(dci(0x0e20dc00), "fmulx"); // FMULX_asimdsame_only
3316 COMPARE_PREFIX(dci(0x0e20e400), "fcmeq"); // FCMEQ_asimdsame_only
3317 COMPARE_PREFIX(dci(0x0e20f400), "fmax"); // FMAX_asimdsame_only
3318 COMPARE_PREFIX(dci(0x0e20fc00), "frecps"); // FRECPS_asimdsame_only
3319 COMPARE_PREFIX(dci(0x0e218800), "frintn"); // FRINTN_asimdmisc_R
3320 COMPARE_PREFIX(dci(0x0e219800), "frintm"); // FRINTM_asimdmisc_R
3321 COMPARE_PREFIX(dci(0x0e21a800), "fcvtns"); // FCVTNS_asimdmisc_R
3322 COMPARE_PREFIX(dci(0x0e21b800), "fcvtms"); // FCVTMS_asimdmisc_R
3323 COMPARE_PREFIX(dci(0x0e21c800), "fcvtas"); // FCVTAS_asimdmisc_R
3324 COMPARE_PREFIX(dci(0x0e21d800), "scvtf"); // SCVTF_asimdmisc_R
3325 COMPARE_PREFIX(dci(0x0e30c800), "fmaxnmv"); // FMAXNMV_asimdall_only_H
3326 COMPARE_PREFIX(dci(0x0e30f800), "fmaxv"); // FMAXV_asimdall_only_H
3327 COMPARE_PREFIX(dci(0x0e400400), "fmaxnm"); // FMAXNM_asimdsamefp16_only
3328 COMPARE_PREFIX(dci(0x0e400c00), "fmla"); // FMLA_asimdsamefp16_only
3329 COMPARE_PREFIX(dci(0x0e401400), "fadd"); // FADD_asimdsamefp16_only
3330 COMPARE_PREFIX(dci(0x0e401c00), "fmulx"); // FMULX_asimdsamefp16_only
3331 COMPARE_PREFIX(dci(0x0e402400), "fcmeq"); // FCMEQ_asimdsamefp16_only
3332 COMPARE_PREFIX(dci(0x0e403400), "fmax"); // FMAX_asimdsamefp16_only
3333 COMPARE_PREFIX(dci(0x0e403c00), "frecps"); // FRECPS_asimdsamefp16_only
3334 COMPARE_PREFIX(dci(0x0e798800), "frintn"); // FRINTN_asimdmiscfp16_R
3335 COMPARE_PREFIX(dci(0x0e799800), "frintm"); // FRINTM_asimdmiscfp16_R
3336 COMPARE_PREFIX(dci(0x0e79a800), "fcvtns"); // FCVTNS_asimdmiscfp16_R
3337 COMPARE_PREFIX(dci(0x0e79b800), "fcvtms"); // FCVTMS_asimdmiscfp16_R
3338 COMPARE_PREFIX(dci(0x0e79c800), "fcvtas"); // FCVTAS_asimdmiscfp16_R
3339 COMPARE_PREFIX(dci(0x0e79d800), "scvtf"); // SCVTF_asimdmiscfp16_R
3340 COMPARE_PREFIX(dci(0x0ea0c400), "fminnm"); // FMINNM_asimdsame_only
3341 COMPARE_PREFIX(dci(0x0ea0cc00), "fmls"); // FMLS_asimdsame_only
3342 COMPARE_PREFIX(dci(0x0ea0d400), "fsub"); // FSUB_asimdsame_only
3343 COMPARE_PREFIX(dci(0x0ea0f400), "fmin"); // FMIN_asimdsame_only
3344 COMPARE_PREFIX(dci(0x0ea0fc00), "frsqrts"); // FRSQRTS_asimdsame_only
3345 COMPARE_PREFIX(dci(0x0ea0c800), "fcmgt"); // FCMGT_asimdmisc_FZ
3346 COMPARE_PREFIX(dci(0x0ea0d800), "fcmeq"); // FCMEQ_asimdmisc_FZ
3347 COMPARE_PREFIX(dci(0x0ea0e800), "fcmlt"); // FCMLT_asimdmisc_FZ
3348 COMPARE_PREFIX(dci(0x0ea0f800), "fabs"); // FABS_asimdmisc_R
3349 COMPARE_PREFIX(dci(0x0ea18800), "frintp"); // FRINTP_asimdmisc_R
3350 COMPARE_PREFIX(dci(0x0ea19800), "frintz"); // FRINTZ_asimdmisc_R
3351 COMPARE_PREFIX(dci(0x0ea1a800), "fcvtps"); // FCVTPS_asimdmisc_R
3352 COMPARE_PREFIX(dci(0x0ea1b800), "fcvtzs"); // FCVTZS_asimdmisc_R
3353 COMPARE_PREFIX(dci(0x0ea1d800), "frecpe"); // FRECPE_asimdmisc_R
3354 COMPARE_PREFIX(dci(0x0eb0c800), "fminnmv"); // FMINNMV_asimdall_only_H
3355 COMPARE_PREFIX(dci(0x0eb0f800), "fminv"); // FMINV_asimdall_only_H
3356 COMPARE_PREFIX(dci(0x0ec00400), "fminnm"); // FMINNM_asimdsamefp16_only
3357 COMPARE_PREFIX(dci(0x0ec00c00), "fmls"); // FMLS_asimdsamefp16_only
3358 COMPARE_PREFIX(dci(0x0ec01400), "fsub"); // FSUB_asimdsamefp16_only
3359 COMPARE_PREFIX(dci(0x0ec03400), "fmin"); // FMIN_asimdsamefp16_only
3360 COMPARE_PREFIX(dci(0x0ec03c00), "frsqrts"); // FRSQRTS_asimdsamefp16_only
3361 COMPARE_PREFIX(dci(0x0ef8c800), "fcmgt"); // FCMGT_asimdmiscfp16_FZ
3362 COMPARE_PREFIX(dci(0x0ef8d800), "fcmeq"); // FCMEQ_asimdmiscfp16_FZ
3363 COMPARE_PREFIX(dci(0x0ef8e800), "fcmlt"); // FCMLT_asimdmiscfp16_FZ
3364 COMPARE_PREFIX(dci(0x0ef8f800), "fabs"); // FABS_asimdmiscfp16_R
3365 COMPARE_PREFIX(dci(0x0ef98800), "frintp"); // FRINTP_asimdmiscfp16_R
3366 COMPARE_PREFIX(dci(0x0ef99800), "frintz"); // FRINTZ_asimdmiscfp16_R
3367 COMPARE_PREFIX(dci(0x0ef9a800), "fcvtps"); // FCVTPS_asimdmiscfp16_R
3368 COMPARE_PREFIX(dci(0x0ef9b800), "fcvtzs"); // FCVTZS_asimdmiscfp16_R
3369 COMPARE_PREFIX(dci(0x0ef9d800), "frecpe"); // FRECPE_asimdmiscfp16_R
3370 COMPARE_PREFIX(dci(0x0f001000), "fmla"); // FMLA_asimdelem_RH_H
3371 COMPARE_PREFIX(dci(0x0f005000), "fmls"); // FMLS_asimdelem_RH_H
3372 COMPARE_PREFIX(dci(0x0f009000), "fmul"); // FMUL_asimdelem_RH_H
3373 COMPARE_PREFIX(dci(0x0f00f400), "fmov"); // FMOV_asimdimm_S_s
3374 COMPARE_PREFIX(dci(0x0f00fc00), "fmov"); // FMOV_asimdimm_H_h
3375 COMPARE_PREFIX(dci(0x0f801000), "fmla"); // FMLA_asimdelem_R_SD
3376 COMPARE_PREFIX(dci(0x0f805000), "fmls"); // FMLS_asimdelem_R_SD
3377 COMPARE_PREFIX(dci(0x0f809000), "fmul"); // FMUL_asimdelem_R_SD
3378 COMPARE_PREFIX(dci(0x2e20c400), "fmaxnmp"); // FMAXNMP_asimdsame_only
3379 COMPARE_PREFIX(dci(0x2e20d400), "faddp"); // FADDP_asimdsame_only
3380 COMPARE_PREFIX(dci(0x2e20dc00), "fmul"); // FMUL_asimdsame_only
3381 COMPARE_PREFIX(dci(0x2e20e400), "fcmge"); // FCMGE_asimdsame_only
3382 COMPARE_PREFIX(dci(0x2e20ec00), "facge"); // FACGE_asimdsame_only
3383 COMPARE_PREFIX(dci(0x2e20f400), "fmaxp"); // FMAXP_asimdsame_only
3384 COMPARE_PREFIX(dci(0x2e20fc00), "fdiv"); // FDIV_asimdsame_only
3385 COMPARE_PREFIX(dci(0x2e218800), "frinta"); // FRINTA_asimdmisc_R
3386 COMPARE_PREFIX(dci(0x2e219800), "frintx"); // FRINTX_asimdmisc_R
3387 COMPARE_PREFIX(dci(0x2e21a800), "fcvtnu"); // FCVTNU_asimdmisc_R
3388 COMPARE_PREFIX(dci(0x2e21b800), "fcvtmu"); // FCVTMU_asimdmisc_R
3389 COMPARE_PREFIX(dci(0x2e21c800), "fcvtau"); // FCVTAU_asimdmisc_R
3390 COMPARE_PREFIX(dci(0x2e21d800), "ucvtf"); // UCVTF_asimdmisc_R
3391 COMPARE_PREFIX(dci(0x6e30c800), "fmaxnmv"); // FMAXNMV_asimdall_only_SD
3392 COMPARE_PREFIX(dci(0x6e30f800), "fmaxv"); // FMAXV_asimdall_only_SD
3393 COMPARE_PREFIX(dci(0x2e400400), "fmaxnmp"); // FMAXNMP_asimdsamefp16_only
3394 COMPARE_PREFIX(dci(0x2e401400), "faddp"); // FADDP_asimdsamefp16_only
3395 COMPARE_PREFIX(dci(0x2e401c00), "fmul"); // FMUL_asimdsamefp16_only
3396 COMPARE_PREFIX(dci(0x2e402400), "fcmge"); // FCMGE_asimdsamefp16_only
3397 COMPARE_PREFIX(dci(0x2e402c00), "facge"); // FACGE_asimdsamefp16_only
3398 COMPARE_PREFIX(dci(0x2e403400), "fmaxp"); // FMAXP_asimdsamefp16_only
3399 COMPARE_PREFIX(dci(0x2e403c00), "fdiv"); // FDIV_asimdsamefp16_only
3400 COMPARE_PREFIX(dci(0x2e798800), "frinta"); // FRINTA_asimdmiscfp16_R
3401 COMPARE_PREFIX(dci(0x2e799800), "frintx"); // FRINTX_asimdmiscfp16_R
3402 COMPARE_PREFIX(dci(0x2e79a800), "fcvtnu"); // FCVTNU_asimdmiscfp16_R
3403 COMPARE_PREFIX(dci(0x2e79b800), "fcvtmu"); // FCVTMU_asimdmiscfp16_R
3404 COMPARE_PREFIX(dci(0x2e79c800), "fcvtau"); // FCVTAU_asimdmiscfp16_R
3405 COMPARE_PREFIX(dci(0x2e79d800), "ucvtf"); // UCVTF_asimdmiscfp16_R
3406 COMPARE_PREFIX(dci(0x2ea0c400), "fminnmp"); // FMINNMP_asimdsame_only
3407 COMPARE_PREFIX(dci(0x2ea0d400), "fabd"); // FABD_asimdsame_only
3408 COMPARE_PREFIX(dci(0x2ea0e400), "fcmgt"); // FCMGT_asimdsame_only
3409 COMPARE_PREFIX(dci(0x2ea0ec00), "facgt"); // FACGT_asimdsame_only
3410 COMPARE_PREFIX(dci(0x2ea0f400), "fminp"); // FMINP_asimdsame_only
3411 COMPARE_PREFIX(dci(0x2ea0c800), "fcmge"); // FCMGE_asimdmisc_FZ
3412 COMPARE_PREFIX(dci(0x2ea0d800), "fcmle"); // FCMLE_asimdmisc_FZ
3413 COMPARE_PREFIX(dci(0x2ea0f800), "fneg"); // FNEG_asimdmisc_R
3414 COMPARE_PREFIX(dci(0x2ea19800), "frinti"); // FRINTI_asimdmisc_R
3415 COMPARE_PREFIX(dci(0x2ea1a800), "fcvtpu"); // FCVTPU_asimdmisc_R
3416 COMPARE_PREFIX(dci(0x2ea1b800), "fcvtzu"); // FCVTZU_asimdmisc_R
3417 COMPARE_PREFIX(dci(0x2ea1d800), "frsqrte"); // FRSQRTE_asimdmisc_R
3418 COMPARE_PREFIX(dci(0x2ea1f800), "fsqrt"); // FSQRT_asimdmisc_R
3419 COMPARE_PREFIX(dci(0x6eb0c800), "fminnmv"); // FMINNMV_asimdall_only_SD
3420 COMPARE_PREFIX(dci(0x6eb0f800), "fminv"); // FMINV_asimdall_only_SD
3421 COMPARE_PREFIX(dci(0x2ec00400), "fminnmp"); // FMINNMP_asimdsamefp16_only
3422 COMPARE_PREFIX(dci(0x2ec01400), "fabd"); // FABD_asimdsamefp16_only
3423 COMPARE_PREFIX(dci(0x2ec02400), "fcmgt"); // FCMGT_asimdsamefp16_only
3424 COMPARE_PREFIX(dci(0x2ec02c00), "facgt"); // FACGT_asimdsamefp16_only
3425 COMPARE_PREFIX(dci(0x2ec03400), "fminp"); // FMINP_asimdsamefp16_only
3426 COMPARE_PREFIX(dci(0x2ef8c800), "fcmge"); // FCMGE_asimdmiscfp16_FZ
3427 COMPARE_PREFIX(dci(0x2ef8d800), "fcmle"); // FCMLE_asimdmiscfp16_FZ
3428 COMPARE_PREFIX(dci(0x2ef8f800), "fneg"); // FNEG_asimdmiscfp16_R
3429 COMPARE_PREFIX(dci(0x2ef99800), "frinti"); // FRINTI_asimdmiscfp16_R
3430 COMPARE_PREFIX(dci(0x2ef9a800), "fcvtpu"); // FCVTPU_asimdmiscfp16_R
3431 COMPARE_PREFIX(dci(0x2ef9b800), "fcvtzu"); // FCVTZU_asimdmiscfp16_R
3432 COMPARE_PREFIX(dci(0x2ef9d800), "frsqrte"); // FRSQRTE_asimdmiscfp16_R
3433 COMPARE_PREFIX(dci(0x2ef9f800), "fsqrt"); // FSQRT_asimdmiscfp16_R
3434 COMPARE_PREFIX(dci(0x2f009000), "fmulx"); // FMULX_asimdelem_RH_H
3435 COMPARE_PREFIX(dci(0x2f809000), "fmulx"); // FMULX_asimdelem_R_SD
3436 COMPARE_PREFIX(dci(0x5e20dc00), "fmulx"); // FMULX_asisdsame_only
3437 COMPARE_PREFIX(dci(0x5e20e400), "fcmeq"); // FCMEQ_asisdsame_only
3438 COMPARE_PREFIX(dci(0x5e20fc00), "frecps"); // FRECPS_asisdsame_only
3439 COMPARE_PREFIX(dci(0x5e21a800), "fcvtns"); // FCVTNS_asisdmisc_R
3440 COMPARE_PREFIX(dci(0x5e21b800), "fcvtms"); // FCVTMS_asisdmisc_R
3441 COMPARE_PREFIX(dci(0x5e21c800), "fcvtas"); // FCVTAS_asisdmisc_R
3442 COMPARE_PREFIX(dci(0x5e21d800), "scvtf"); // SCVTF_asisdmisc_R
3443 COMPARE_PREFIX(dci(0x5e30c800), "fmaxnmp"); // FMAXNMP_asisdpair_only_H
3444 COMPARE_PREFIX(dci(0x5e30d800), "faddp"); // FADDP_asisdpair_only_H
3445 COMPARE_PREFIX(dci(0x5e30f800), "fmaxp"); // FMAXP_asisdpair_only_H
3446 COMPARE_PREFIX(dci(0x5e401c00), "fmulx"); // FMULX_asisdsamefp16_only
3447 COMPARE_PREFIX(dci(0x5e402400), "fcmeq"); // FCMEQ_asisdsamefp16_only
3448 COMPARE_PREFIX(dci(0x5e403c00), "frecps"); // FRECPS_asisdsamefp16_only
3449 COMPARE_PREFIX(dci(0x5e79a800), "fcvtns"); // FCVTNS_asisdmiscfp16_R
3450 COMPARE_PREFIX(dci(0x5e79b800), "fcvtms"); // FCVTMS_asisdmiscfp16_R
3451 COMPARE_PREFIX(dci(0x5e79c800), "fcvtas"); // FCVTAS_asisdmiscfp16_R
3452 COMPARE_PREFIX(dci(0x5e79d800), "scvtf"); // SCVTF_asisdmiscfp16_R
3453 COMPARE_PREFIX(dci(0x5ea0fc00), "frsqrts"); // FRSQRTS_asisdsame_only
3454 COMPARE_PREFIX(dci(0x5ea0c800), "fcmgt"); // FCMGT_asisdmisc_FZ
3455 COMPARE_PREFIX(dci(0x5ea0d800), "fcmeq"); // FCMEQ_asisdmisc_FZ
3456 COMPARE_PREFIX(dci(0x5ea0e800), "fcmlt"); // FCMLT_asisdmisc_FZ
3457 COMPARE_PREFIX(dci(0x5ea1a800), "fcvtps"); // FCVTPS_asisdmisc_R
3458 COMPARE_PREFIX(dci(0x5ea1b800), "fcvtzs"); // FCVTZS_asisdmisc_R
3459 COMPARE_PREFIX(dci(0x5ea1d800), "frecpe"); // FRECPE_asisdmisc_R
3460 COMPARE_PREFIX(dci(0x5ea1f800), "frecpx"); // FRECPX_asisdmisc_R
3461 COMPARE_PREFIX(dci(0x5eb0c800), "fminnmp"); // FMINNMP_asisdpair_only_H
3462 COMPARE_PREFIX(dci(0x5eb0f800), "fminp"); // FMINP_asisdpair_only_H
3463 COMPARE_PREFIX(dci(0x5ec03c00), "frsqrts"); // FRSQRTS_asisdsamefp16_only
3464 COMPARE_PREFIX(dci(0x5ef8c800), "fcmgt"); // FCMGT_asisdmiscfp16_FZ
3465 COMPARE_PREFIX(dci(0x5ef8d800), "fcmeq"); // FCMEQ_asisdmiscfp16_FZ
3466 COMPARE_PREFIX(dci(0x5ef8e800), "fcmlt"); // FCMLT_asisdmiscfp16_FZ
3467 COMPARE_PREFIX(dci(0x5ef9a800), "fcvtps"); // FCVTPS_asisdmiscfp16_R
3468 COMPARE_PREFIX(dci(0x5ef9b800), "fcvtzs"); // FCVTZS_asisdmiscfp16_R
3469 COMPARE_PREFIX(dci(0x5ef9d800), "frecpe"); // FRECPE_asisdmiscfp16_R
3470 COMPARE_PREFIX(dci(0x5ef9f800), "frecpx"); // FRECPX_asisdmiscfp16_R
3471 COMPARE_PREFIX(dci(0x5f001000), "fmla"); // FMLA_asisdelem_RH_H
3472 COMPARE_PREFIX(dci(0x5f005000), "fmls"); // FMLS_asisdelem_RH_H
3473 COMPARE_PREFIX(dci(0x5f009000), "fmul"); // FMUL_asisdelem_RH_H
3474 COMPARE_PREFIX(dci(0x5f801000), "fmla"); // FMLA_asisdelem_R_SD
3475 COMPARE_PREFIX(dci(0x5f805000), "fmls"); // FMLS_asisdelem_R_SD
3476 COMPARE_PREFIX(dci(0x5f809000), "fmul"); // FMUL_asisdelem_R_SD
3477 COMPARE_PREFIX(dci(0x6f00f400), "fmov"); // FMOV_asimdimm_D2_d
3478 COMPARE_PREFIX(dci(0x7e20e400), "fcmge"); // FCMGE_asisdsame_only
3479 COMPARE_PREFIX(dci(0x7e20ec00), "facge"); // FACGE_asisdsame_only
3480 COMPARE_PREFIX(dci(0x7e21a800), "fcvtnu"); // FCVTNU_asisdmisc_R
3481 COMPARE_PREFIX(dci(0x7e21b800), "fcvtmu"); // FCVTMU_asisdmisc_R
3482 COMPARE_PREFIX(dci(0x7e21c800), "fcvtau"); // FCVTAU_asisdmisc_R
3483 COMPARE_PREFIX(dci(0x7e21d800), "ucvtf"); // UCVTF_asisdmisc_R
3484 COMPARE_PREFIX(dci(0x7e30c800), "fmaxnmp"); // FMAXNMP_asisdpair_only_SD
3485 COMPARE_PREFIX(dci(0x7e30d800), "faddp"); // FADDP_asisdpair_only_SD
3486 COMPARE_PREFIX(dci(0x7e30f800), "fmaxp"); // FMAXP_asisdpair_only_SD
3487 COMPARE_PREFIX(dci(0x7e402400), "fcmge"); // FCMGE_asisdsamefp16_only
3488 COMPARE_PREFIX(dci(0x7e402c00), "facge"); // FACGE_asisdsamefp16_only
3489 COMPARE_PREFIX(dci(0x7e79a800), "fcvtnu"); // FCVTNU_asisdmiscfp16_R
3490 COMPARE_PREFIX(dci(0x7e79b800), "fcvtmu"); // FCVTMU_asisdmiscfp16_R
3491 COMPARE_PREFIX(dci(0x7e79c800), "fcvtau"); // FCVTAU_asisdmiscfp16_R
3492 COMPARE_PREFIX(dci(0x7e79d800), "ucvtf"); // UCVTF_asisdmiscfp16_R
3493 COMPARE_PREFIX(dci(0x7ea0d400), "fabd"); // FABD_asisdsame_only
3494 COMPARE_PREFIX(dci(0x7ea0e400), "fcmgt"); // FCMGT_asisdsame_only
3495 COMPARE_PREFIX(dci(0x7ea0ec00), "facgt"); // FACGT_asisdsame_only
3496 COMPARE_PREFIX(dci(0x7ea0c800), "fcmge"); // FCMGE_asisdmisc_FZ
3497 COMPARE_PREFIX(dci(0x7ea0d800), "fcmle"); // FCMLE_asisdmisc_FZ
3498 COMPARE_PREFIX(dci(0x7ea1a800), "fcvtpu"); // FCVTPU_asisdmisc_R
3499 COMPARE_PREFIX(dci(0x7ea1b800), "fcvtzu"); // FCVTZU_asisdmisc_R
3500 COMPARE_PREFIX(dci(0x7ea1d800), "frsqrte"); // FRSQRTE_asisdmisc_R
3501 COMPARE_PREFIX(dci(0x7eb0c800), "fminnmp"); // FMINNMP_asisdpair_only_SD
3502 COMPARE_PREFIX(dci(0x7eb0f800), "fminp"); // FMINP_asisdpair_only_SD
3503 COMPARE_PREFIX(dci(0x7ec01400), "fabd"); // FABD_asisdsamefp16_only
3504 COMPARE_PREFIX(dci(0x7ec02400), "fcmgt"); // FCMGT_asisdsamefp16_only
3505 COMPARE_PREFIX(dci(0x7ec02c00), "facgt"); // FACGT_asisdsamefp16_only
3506 COMPARE_PREFIX(dci(0x7ef8c800), "fcmge"); // FCMGE_asisdmiscfp16_FZ
3507 COMPARE_PREFIX(dci(0x7ef8d800), "fcmle"); // FCMLE_asisdmiscfp16_FZ
3508 COMPARE_PREFIX(dci(0x7ef9a800), "fcvtpu"); // FCVTPU_asisdmiscfp16_R
3509 COMPARE_PREFIX(dci(0x7ef9b800), "fcvtzu"); // FCVTZU_asisdmiscfp16_R
3510 COMPARE_PREFIX(dci(0x7ef9d800), "frsqrte"); // FRSQRTE_asisdmiscfp16_R
3511 COMPARE_PREFIX(dci(0x7f009000), "fmulx"); // FMULX_asisdelem_RH_H
3512 COMPARE_PREFIX(dci(0x7f809000), "fmulx"); // FMULX_asisdelem_R_SD
3513
3514 // ARMv8.2 - RAS
3515 COMPARE_PREFIX(dci(0xd503221f), "esb"); // ESB_HI_hints
3516
3517 // ARMv8.2 - SHA3
3518 // COMPARE_PREFIX(dci(0xce000000), "eor3"); // EOR3_VVV16_crypto4
3519 // COMPARE_PREFIX(dci(0xce200000), "bcax"); // BCAX_VVV16_crypto4
3520 // COMPARE_PREFIX(dci(0xce608c00), "rax1"); // RAX1_VVV2_cryptosha512_3
3521 // COMPARE_PREFIX(dci(0xce800000), "xar"); // XAR_VVV2_crypto3_imm6
3522
3523 // ARMv8.2 - SHA512
3524 // COMPARE_PREFIX(dci(0xce608000), "sha512h"); // SHA512H_QQV_cryptosha512_3
3525 // COMPARE_PREFIX(dci(0xce608400), "sha512h2"); //
3526 // SHA512H2_QQV_cryptosha512_3
3527 // COMPARE_PREFIX(dci(0xce608800), "sha512su1"); //
3528 // SHA512SU1_VVV2_cryptosha512_3
3529 // COMPARE_PREFIX(dci(0xcec08000), "sha512su0"); //
3530 // SHA512SU0_VV2_cryptosha512_2
3531
3532 // ARMv8.2 - SM3
3533 // COMPARE_PREFIX(dci(0xce400000), "sm3ss1"); // SM3SS1_VVV4_crypto4
3534 // COMPARE_PREFIX(dci(0xce408000), "sm3tt1a"); // SM3TT1A_VVV4_crypto3_imm2
3535 // COMPARE_PREFIX(dci(0xce408400), "sm3tt1b"); // SM3TT1B_VVV4_crypto3_imm2
3536 // COMPARE_PREFIX(dci(0xce408800), "sm3tt2a"); // SM3TT2A_VVV4_crypto3_imm2
3537 // COMPARE_PREFIX(dci(0xce408c00), "sm3tt2b"); // SM3TT2B_VVV_crypto3_imm2
3538 // COMPARE_PREFIX(dci(0xce60c000), "sm3partw1"); //
3539 // SM3PARTW1_VVV4_cryptosha512_3
3540 // COMPARE_PREFIX(dci(0xce60c400), "sm3partw2"); //
3541 // SM3PARTW2_VVV4_cryptosha512_3
3542
3543 // ARMv8.2 - SM4
3544 // COMPARE_PREFIX(dci(0xce60c800), "sm4ekey"); //
3545 // SM4EKEY_VVV4_cryptosha512_3
3546 // COMPARE_PREFIX(dci(0xcec08400), "sm4e"); // SM4E_VV4_cryptosha512_2
3547
3548 // ARMv8.2 - SPE
3549 // COMPARE_PREFIX(dci(0xd503223f), "psb"); // PSB_HC_hints
3550
3551 // ARMv8.3 - FCMA
3552 COMPARE_PREFIX(dci(0x2e40c400), "fcmla"); // FCMLA_asimdsame2_C
3553 COMPARE_PREFIX(dci(0x2e00e400), "fcadd"); // FCADD_asimdsame2_C
3554 COMPARE_PREFIX(dci(0x2f401000), "fcmla"); // FCMLA_asimdelem_C_H
3555 COMPARE_PREFIX(dci(0x6f801000), "fcmla"); // FCMLA_asimdelem_C_S
3556
3557 // ARMv8.3 - JSCVT
3558 COMPARE_PREFIX(dci(0x1e7e0000), "fjcvtzs"); // FJCVTZS_32D_float2int
3559
3560 // ARMv8.3 - LRCPC
3561 COMPARE_PREFIX(dci(0x38a0c000), "ldaprb"); // LDAPRB_32L_memop
3562 COMPARE_PREFIX(dci(0x78a0c000), "ldaprh"); // LDAPRH_32L_memop
3563 COMPARE_PREFIX(dci(0xb8a0c000), "ldapr"); // LDAPR_32L_memop
3564 COMPARE_PREFIX(dci(0xf8a0c000), "ldapr"); // LDAPR_64L_memop
3565
3566 // ARMv8.3 - PAuth
3567 COMPARE_PREFIX(dci(0x9ac03000), "pacga"); // PACGA_64P_dp_2src
3568 COMPARE_PREFIX(dci(0xd50320ff), "xpaclri"); // XPACLRI_HI_hints
3569 COMPARE_PREFIX(dci(0xd503211f), "pacia1716"); // PACIA1716_HI_hints
3570 COMPARE_PREFIX(dci(0xd503215f), "pacib1716"); // PACIB1716_HI_hints
3571 COMPARE_PREFIX(dci(0xd503219f), "autia1716"); // AUTIA1716_HI_hints
3572 COMPARE_PREFIX(dci(0xd50321df), "autib1716"); // AUTIB1716_HI_hints
3573 COMPARE_PREFIX(dci(0xd503231f), "paciaz"); // PACIAZ_HI_hints
3574 COMPARE_PREFIX(dci(0xd503233f), "paciasp"); // PACIASP_HI_hints
3575 COMPARE_PREFIX(dci(0xd503235f), "pacibz"); // PACIBZ_HI_hints
3576 COMPARE_PREFIX(dci(0xd503237f), "pacibsp"); // PACIBSP_HI_hints
3577 COMPARE_PREFIX(dci(0xd503239f), "autiaz"); // AUTIAZ_HI_hints
3578 COMPARE_PREFIX(dci(0xd50323bf), "autiasp"); // AUTIASP_HI_hints
3579 COMPARE_PREFIX(dci(0xd50323df), "autibz"); // AUTIBZ_HI_hints
3580 COMPARE_PREFIX(dci(0xd50323ff), "autibsp"); // AUTIBSP_HI_hints
3581 COMPARE_PREFIX(dci(0xd61f081f), "braaz"); // BRAAZ_64_branch_reg
3582 COMPARE_PREFIX(dci(0xd61f0c1f), "brabz"); // BRABZ_64_branch_reg
3583 COMPARE_PREFIX(dci(0xd63f081f), "blraaz"); // BLRAAZ_64_branch_reg
3584 COMPARE_PREFIX(dci(0xd63f0c1f), "blrabz"); // BLRABZ_64_branch_reg
3585 COMPARE_PREFIX(dci(0xd65f0bff), "retaa"); // RETAA_64E_branch_reg
3586 COMPARE_PREFIX(dci(0xd65f0fff), "retab"); // RETAB_64E_branch_reg
3587 // COMPARE_PREFIX(dci(0xd69f0bff), "eretaa"); // ERETAA_64E_branch_reg
3588 // COMPARE_PREFIX(dci(0xd69f0fff), "eretab"); // ERETAB_64E_branch_reg
3589 COMPARE_PREFIX(dci(0xd71f0800), "braa"); // BRAA_64P_branch_reg
3590 COMPARE_PREFIX(dci(0xd71f0c00), "brab"); // BRAB_64P_branch_reg
3591 COMPARE_PREFIX(dci(0xd73f0800), "blraa"); // BLRAA_64P_branch_reg
3592 COMPARE_PREFIX(dci(0xd73f0c00), "blrab"); // BLRAB_64P_branch_reg
3593 COMPARE_PREFIX(dci(0xdac10000), "pacia"); // PACIA_64P_dp_1src
3594 COMPARE_PREFIX(dci(0xdac10400), "pacib"); // PACIB_64P_dp_1src
3595 COMPARE_PREFIX(dci(0xdac10800), "pacda"); // PACDA_64P_dp_1src
3596 COMPARE_PREFIX(dci(0xdac10c00), "pacdb"); // PACDB_64P_dp_1src
3597 COMPARE_PREFIX(dci(0xdac11000), "autia"); // AUTIA_64P_dp_1src
3598 COMPARE_PREFIX(dci(0xdac11400), "autib"); // AUTIB_64P_dp_1src
3599 COMPARE_PREFIX(dci(0xdac11800), "autda"); // AUTDA_64P_dp_1src
3600 COMPARE_PREFIX(dci(0xdac11c00), "autdb"); // AUTDB_64P_dp_1src
3601 COMPARE_PREFIX(dci(0xdac123e0), "paciza"); // PACIZA_64Z_dp_1src
3602 COMPARE_PREFIX(dci(0xdac127e0), "pacizb"); // PACIZB_64Z_dp_1src
3603 COMPARE_PREFIX(dci(0xdac12be0), "pacdza"); // PACDZA_64Z_dp_1src
3604 COMPARE_PREFIX(dci(0xdac12fe0), "pacdzb"); // PACDZB_64Z_dp_1src
3605 COMPARE_PREFIX(dci(0xdac133e0), "autiza"); // AUTIZA_64Z_dp_1src
3606 COMPARE_PREFIX(dci(0xdac137e0), "autizb"); // AUTIZB_64Z_dp_1src
3607 COMPARE_PREFIX(dci(0xdac13be0), "autdza"); // AUTDZA_64Z_dp_1src
3608 COMPARE_PREFIX(dci(0xdac13fe0), "autdzb"); // AUTDZB_64Z_dp_1src
3609 COMPARE_PREFIX(dci(0xdac143e0), "xpaci"); // XPACI_64Z_dp_1src
3610 COMPARE_PREFIX(dci(0xdac147e0), "xpacd"); // XPACD_64Z_dp_1src
3611 COMPARE_PREFIX(dci(0xf8200400), "ldraa"); // LDRAA_64_ldst_pac
3612 COMPARE_PREFIX(dci(0xf8200c00), "ldraa"); // LDRAA_64W_ldst_pac
3613 COMPARE_PREFIX(dci(0xf8a00400), "ldrab"); // LDRAB_64_ldst_pac
3614 COMPARE_PREFIX(dci(0xf8a00c00), "ldrab"); // LDRAB_64W_ldst_pac
3615
3616 // ARMv8.4 - FlagM
3617 COMPARE_PREFIX(dci(0x3a00080d), "setf8"); // SETF8_only_setf
3618 COMPARE_PREFIX(dci(0x3a00480d), "setf16"); // SETF16_only_setf
3619 COMPARE_PREFIX(dci(0xba000400), "rmif"); // RMIF_only_rmif
3620 COMPARE_PREFIX(dci(0xd500401f), "cfinv"); // CFINV_M_pstate
3621
3622 // ARMv8.4 - LRCPC2
3623 COMPARE_PREFIX(dci(0x19000000), "stlurb"); // STLURB_32_ldapstl_unscaled
3624 COMPARE_PREFIX(dci(0x19400000), "ldapurb"); // LDAPURB_32_ldapstl_unscaled
3625 COMPARE_PREFIX(dci(0x19800000), "ldapursb"); // LDAPURSB_64_ldapstl_unscaled
3626 COMPARE_PREFIX(dci(0x19c00000), "ldapursb"); // LDAPURSB_32_ldapstl_unscaled
3627 COMPARE_PREFIX(dci(0x59000000), "stlurh"); // STLURH_32_ldapstl_unscaled
3628 COMPARE_PREFIX(dci(0x59400000), "ldapurh"); // LDAPURH_32_ldapstl_unscaled
3629 COMPARE_PREFIX(dci(0x59800000), "ldapursh"); // LDAPURSH_64_ldapstl_unscaled
3630 COMPARE_PREFIX(dci(0x59c00000), "ldapursh"); // LDAPURSH_32_ldapstl_unscaled
3631 COMPARE_PREFIX(dci(0x99000000), "stlur"); // STLUR_32_ldapstl_unscaled
3632 COMPARE_PREFIX(dci(0x99400000), "ldapur"); // LDAPUR_32_ldapstl_unscaled
3633 COMPARE_PREFIX(dci(0x99800000), "ldapursw"); // LDAPURSW_64_ldapstl_unscaled
3634 COMPARE_PREFIX(dci(0xd9000000), "stlur"); // STLUR_64_ldapstl_unscaled
3635 COMPARE_PREFIX(dci(0xd9400000), "ldapur"); // LDAPUR_64_ldapstl_unscaled
3636
3637 // ARMv8.4 - TRF
3638 // COMPARE_PREFIX(dci(0xd503225f), "tsb"); // TSB_HC_hints
3639
3640 // ARMv8.5 - BTI
3641 COMPARE_PREFIX(dci(0xd503241f), "bti"); // BTI_HB_hints
3642
3643 // ARMv8.5 - FRINTTS
3644 COMPARE_PREFIX(dci(0x0e21e800), "frint32z"); // FRINT32Z_asimdmisc_R
3645 COMPARE_PREFIX(dci(0x0e21f800), "frint64z"); // FRINT64Z_asimdmisc_R
3646 COMPARE_PREFIX(dci(0x2e21e800), "frint32x"); // FRINT32X_asimdmisc_R
3647 COMPARE_PREFIX(dci(0x2e21f800), "frint64x"); // FRINT64X_asimdmisc_R
3648 COMPARE_PREFIX(dci(0x1e284000), "frint32z"); // FRINT32Z_S_floatdp1
3649 COMPARE_PREFIX(dci(0x1e28c000), "frint32x"); // FRINT32X_S_floatdp1
3650 COMPARE_PREFIX(dci(0x1e294000), "frint64z"); // FRINT64Z_S_floatdp1
3651 COMPARE_PREFIX(dci(0x1e29c000), "frint64x"); // FRINT64X_S_floatdp1
3652 COMPARE_PREFIX(dci(0x1e684000), "frint32z"); // FRINT32Z_D_floatdp1
3653 COMPARE_PREFIX(dci(0x1e68c000), "frint32x"); // FRINT32X_D_floatdp1
3654 COMPARE_PREFIX(dci(0x1e694000), "frint64z"); // FRINT64Z_D_floatdp1
3655 COMPARE_PREFIX(dci(0x1e69c000), "frint64x"); // FRINT64X_D_floatdp1
3656
3657 // ARMv8.5 - FlagM2
3658 COMPARE_PREFIX(dci(0xd500403f), "xaflag"); // XAFLAG_M_pstate
3659 COMPARE_PREFIX(dci(0xd500405f), "axflag"); // AXFLAG_M_pstate
3660
3661 // ARMv8.5 - MTE
3662 // COMPARE_PREFIX(dci(0x68800000), "stgp"); // STGP_64_ldstpair_post
3663 // COMPARE_PREFIX(dci(0x69000000), "stgp"); // STGP_64_ldstpair_off
3664 // COMPARE_PREFIX(dci(0x69800000), "stgp"); // STGP_64_ldstpair_pre
3665 // COMPARE_PREFIX(dci(0x91800000), "addg"); // ADDG_64_addsub_immtags
3666 // COMPARE_PREFIX(dci(0x9ac00000), "subp"); // SUBP_64S_dp_2src
3667 // COMPARE_PREFIX(dci(0x9ac01000), "irg"); // IRG_64I_dp_2src
3668 // COMPARE_PREFIX(dci(0x9ac01400), "gmi"); // GMI_64G_dp_2src
3669 // COMPARE_PREFIX(dci(0xbac00000), "subps"); // SUBPS_64S_dp_2src
3670 // COMPARE_PREFIX(dci(0xd1800000), "subg"); // SUBG_64_addsub_immtags
3671 // COMPARE_PREFIX(dci(0xd9200400), "stg"); // STG_64Spost_ldsttags
3672 // COMPARE_PREFIX(dci(0xd9200800), "stg"); // STG_64Soffset_ldsttags
3673 // COMPARE_PREFIX(dci(0xd9200c00), "stg"); // STG_64Spre_ldsttags
3674 // COMPARE_PREFIX(dci(0xd9600000), "ldg"); // LDG_64Loffset_ldsttags
3675 // COMPARE_PREFIX(dci(0xd9600400), "stzg"); // STZG_64Spost_ldsttags
3676 // COMPARE_PREFIX(dci(0xd9600800), "stzg"); // STZG_64Soffset_ldsttags
3677 // COMPARE_PREFIX(dci(0xd9600c00), "stzg"); // STZG_64Spre_ldsttags
3678 // COMPARE_PREFIX(dci(0xd9a00400), "st2g"); // ST2G_64Spost_ldsttags
3679 // COMPARE_PREFIX(dci(0xd9a00800), "st2g"); // ST2G_64Soffset_ldsttags
3680 // COMPARE_PREFIX(dci(0xd9a00c00), "st2g"); // ST2G_64Spre_ldsttags
3681 // COMPARE_PREFIX(dci(0xd9e00400), "stz2g"); // STZ2G_64Spost_ldsttags
3682 // COMPARE_PREFIX(dci(0xd9e00800), "stz2g"); // STZ2G_64Soffset_ldsttags
3683 // COMPARE_PREFIX(dci(0xd9e00c00), "stz2g"); // STZ2G_64Spre_ldsttags
3684
3685 // ARMv8.5 - MTE2
3686 // COMPARE_PREFIX(dci(0xd9200000), "stzgm"); // STZGM_64bulk_ldsttags
3687 // COMPARE_PREFIX(dci(0xd9a00000), "stgm"); // STGM_64bulk_ldsttags
3688 // COMPARE_PREFIX(dci(0xd9e00000), "ldgm"); // LDGM_64bulk_ldsttags
3689
3690 // ARMv8.6 - BF16
3691 // COMPARE_PREFIX(dci(0x0ea16800), "bfcvtn"); // BFCVTN_asimdmisc_4S
3692 // COMPARE_PREFIX(dci(0x0f40f000), "bfdot"); // BFDOT_asimdelem_E
3693 // COMPARE_PREFIX(dci(0x0fc0f000), "bfmlal"); // BFMLAL_asimdelem_F
3694 // COMPARE_PREFIX(dci(0x2e40fc00), "bfdot"); // BFDOT_asimdsame2_D
3695 // COMPARE_PREFIX(dci(0x2ec0fc00), "bfmlal"); // BFMLAL_asimdsame2_F_
3696 // COMPARE_PREFIX(dci(0x1e634000), "bfcvt"); // BFCVT_BS_floatdp1
3697 // COMPARE_PREFIX(dci(0x6e40ec00), "bfmmla"); // BFMMLA_asimdsame2_E
3698
3699 // ARMv8.6 - DGH
3700 // COMPARE_PREFIX(dci(0xd50320df), "dgh"); // DGH_HI_hints
3701
3702 // ARMv8.6 - I8MM
3703 COMPARE_PREFIX(dci(0x0e809c00), "usdot"); // USDOT_asimdsame2_D
3704 COMPARE_PREFIX(dci(0x0f00f000), "sudot"); // SUDOT_asimdelem_D
3705 COMPARE_PREFIX(dci(0x0f80f000), "usdot"); // USDOT_asimdelem_D
3706 COMPARE_PREFIX(dci(0x4e80a400), "smmla"); // SMMLA_asimdsame2_G
3707 COMPARE_PREFIX(dci(0x4e80ac00), "usmmla"); // USMMLA_asimdsame2_G
3708 COMPARE_PREFIX(dci(0x6e80a400), "ummla"); // UMMLA_asimdsame2_G
3709
3710 // ARMv8.7 - LS64
3711 // COMPARE_PREFIX(dci(0xf83f9000), "st64b"); // ST64B_64L_memop
3712 // COMPARE_PREFIX(dci(0xf83fd000), "ld64b"); // LD64B_64L_memop
3713
3714 // ARMv8.7 - LS64_V
3715 // COMPARE_PREFIX(dci(0xf820a000), "st64bv0"); // ST64BV0_64_memop
3716 // COMPARE_PREFIX(dci(0xf820b000), "st64bv"); // ST64BV_64_memop
3717
3718 // ARMv8.7 - WFxT
3719 // COMPARE_PREFIX(dci(0xd5031000), "wfet"); // WFET_only_systeminstrswithreg
3720 // COMPARE_PREFIX(dci(0xd5031020), "wfit"); // WFIT_only_systeminstrswithreg
3721
3722 // TME
3723 // COMPARE_PREFIX(dci(0xd4600000), "tcancel"); // TCANCEL_EX_exception
3724 // COMPARE_PREFIX(dci(0xd503307f), "tcommit"); // TCOMMIT_only_barriers
3725 // COMPARE_PREFIX(dci(0xd5233060), "tstart"); // TSTART_BR_systemresult
3726 // COMPARE_PREFIX(dci(0xd5233160), "ttest"); // TTEST_BR_systemresult
3727
3728 CLEANUP();
3729 }
3730
3731 } // namespace aarch64
3732 } // namespace vixl
3733