blob: 06628e63868c6c9fc9ac7a3d30dc4050b626e7bd [file] [log] [blame]
armvixl5289c592015-03-02 13:52:04 +00001// Copyright 2015, ARM Limited
armvixlad96eda2013-06-14 11:42:37 +01002// 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#include <stdio.h>
28#include <cstring>
armvixl0f35e362016-05-10 13:57:58 +010029#include <string>
armvixl330dc712014-11-25 10:38:32 +000030#include "test-runner.h"
armvixlad96eda2013-06-14 11:42:37 +010031
Alexandre Rames39c32a62016-05-23 15:47:22 +010032#include "a64/macro-assembler-a64.h"
33#include "a64/disasm-a64.h"
armvixlad96eda2013-06-14 11:42:37 +010034
35#define TEST(name) TEST_(DISASM_##name)
36
37#define EXP_SIZE (256)
38#define INSTR_SIZE (1024)
39#define SETUP_CLASS(ASMCLASS) \
armvixlc68cb642014-09-25 18:49:30 +010040 byte* buf = new byte[INSTR_SIZE]; \
armvixlad96eda2013-06-14 11:42:37 +010041 uint32_t encoding = 0; \
42 ASMCLASS* masm = new ASMCLASS(buf, INSTR_SIZE); \
43 Decoder* decoder = new Decoder(); \
44 Disassembler* disasm = new Disassembler(); \
45 decoder->AppendVisitor(disasm)
46
47#define SETUP() SETUP_CLASS(Assembler)
48
armvixl684cd2a2015-10-23 13:38:33 +010049#ifdef VIXL_INCLUDE_SIMULATOR
50// Run tests with the simulator.
51#define SETUP_MACRO() \
52 SETUP_CLASS(MacroAssembler); \
53 masm->SetAllowSimulatorInstructions(true)
54
55#else // ifdef VIXL_INCLUDE_SIMULATOR.
56#define SETUP_MACRO() \
57 SETUP_CLASS(MacroAssembler); \
58 masm->SetAllowSimulatorInstructions(false)
59
60#endif // ifdef VIXL_INCLUDE_SIMULATOR.
armvixlc68cb642014-09-25 18:49:30 +010061
armvixlad96eda2013-06-14 11:42:37 +010062#define COMPARE(ASM, EXP) \
63 masm->Reset(); \
armvixlc68cb642014-09-25 18:49:30 +010064 { \
65 CodeBufferCheckScope blind(masm); \
66 masm->ASM; \
67 } \
armvixlad96eda2013-06-14 11:42:37 +010068 masm->FinalizeCode(); \
69 decoder->Decode(reinterpret_cast<Instruction*>(buf)); \
70 encoding = *reinterpret_cast<uint32_t*>(buf); \
71 if (strcmp(disasm->GetOutput(), EXP) != 0) { \
armvixl330dc712014-11-25 10:38:32 +000072 printf("\nEncoding: %08" PRIx32 "\nExpected: %s\nFound: %s\n", \
armvixlad96eda2013-06-14 11:42:37 +010073 encoding, EXP, disasm->GetOutput()); \
74 abort(); \
armvixl330dc712014-11-25 10:38:32 +000075 } \
76 if (Test::trace_sim()) { \
77 printf("%08" PRIx32 "\t%s\n", encoding, disasm->GetOutput()); \
armvixlad96eda2013-06-14 11:42:37 +010078 }
79
armvixl578645f2013-08-15 17:21:42 +010080#define COMPARE_PREFIX(ASM, EXP) \
81 masm->Reset(); \
armvixlc68cb642014-09-25 18:49:30 +010082 { \
83 CodeBufferCheckScope blind(masm); \
84 masm->ASM; \
85 } \
86 masm->FinalizeCode(); \
87 decoder->Decode(reinterpret_cast<Instruction*>(buf)); \
88 encoding = *reinterpret_cast<uint32_t*>(buf); \
89 if (strncmp(disasm->GetOutput(), EXP, strlen(EXP)) != 0) { \
armvixl330dc712014-11-25 10:38:32 +000090 printf("\nEncoding: %08" PRIx32 "\nExpected: %s\nFound: %s\n", \
armvixlc68cb642014-09-25 18:49:30 +010091 encoding, EXP, disasm->GetOutput()); \
92 abort(); \
armvixl330dc712014-11-25 10:38:32 +000093 } \
94 if (Test::trace_sim()) { \
95 printf("%08" PRIx32 "\t%s\n", encoding, disasm->GetOutput()); \
armvixlc68cb642014-09-25 18:49:30 +010096 }
97
armvixl0f35e362016-05-10 13:57:58 +010098#define COMPARE_MACRO_BASE(ASM, EXP) \
armvixlc68cb642014-09-25 18:49:30 +010099 masm->Reset(); \
armvixl578645f2013-08-15 17:21:42 +0100100 masm->ASM; \
101 masm->FinalizeCode(); \
armvixl0f35e362016-05-10 13:57:58 +0100102 std::string res; \
103 \
104 Instruction* instruction = masm->GetOffsetAddress<Instruction*>(0); \
105 Instruction* end = masm->GetOffsetAddress<Instruction*>( \
106 masm->SizeOfCodeGenerated()); \
107 while (instruction != end) { \
108 decoder->Decode(instruction); \
109 res.append(disasm->GetOutput()); \
110 if (Test::trace_sim()) { \
111 encoding = *reinterpret_cast<uint32_t*>(instruction); \
112 printf("%08" PRIx32 "\t%s\n", encoding, disasm->GetOutput()); \
113 } \
114 instruction += kInstructionSize; \
115 if (instruction != end) { \
116 res.append("\n"); \
117 } \
118 }
119
120#define COMPARE_MACRO(ASM, EXP) \
121 { \
122 COMPARE_MACRO_BASE(ASM, EXP) \
123 if (strcmp(res.c_str(), EXP) != 0) { \
124 printf("Expected: %s\nFound: %s\n", EXP, res.c_str()); \
125 abort(); \
126 } \
127 }
128
129#define COMPARE_MACRO_PREFIX(ASM, EXP) \
130 { \
131 COMPARE_MACRO_BASE(ASM, EXP) \
132 if (strncmp(res.c_str(), EXP, strlen(EXP)) != 0) { \
133 printf("Expected (prefix): %s\nFound: %s\n", EXP, res.c_str()); \
134 abort(); \
135 } \
armvixl578645f2013-08-15 17:21:42 +0100136 }
137
armvixlad96eda2013-06-14 11:42:37 +0100138#define CLEANUP() \
139 delete disasm; \
140 delete decoder; \
armvixlc68cb642014-09-25 18:49:30 +0100141 delete masm; \
armvixldb644342015-07-21 11:37:10 +0100142 delete[] buf
armvixlad96eda2013-06-14 11:42:37 +0100143
144namespace vixl {
145
146TEST(bootstrap) {
147 SETUP();
148
149 // Instructions generated by C compiler, disassembled by objdump, and
150 // reformatted to suit our disassembly style.
151 COMPARE(dci(0xa9ba7bfd), "stp x29, x30, [sp, #-96]!");
152 COMPARE(dci(0x910003fd), "mov x29, sp");
153 COMPARE(dci(0x9100e3a0), "add x0, x29, #0x38 (56)");
154 COMPARE(dci(0xb900001f), "str wzr, [x0]");
armvixl330dc712014-11-25 10:38:32 +0000155 COMPARE(dci(0x528000e1), "mov w1, #0x7");
armvixlad96eda2013-06-14 11:42:37 +0100156 COMPARE(dci(0xb9001c01), "str w1, [x0, #28]");
157 COMPARE(dci(0x390043a0), "strb w0, [x29, #16]");
158 COMPARE(dci(0x790027a0), "strh w0, [x29, #18]");
159 COMPARE(dci(0xb9400400), "ldr w0, [x0, #4]");
160 COMPARE(dci(0x0b000021), "add w1, w1, w0");
161 COMPARE(dci(0x531b6800), "lsl w0, w0, #5");
162 COMPARE(dci(0x521e0400), "eor w0, w0, #0xc");
163 COMPARE(dci(0x72af0f00), "movk w0, #0x7878, lsl #16");
164 COMPARE(dci(0xd360fc00), "lsr x0, x0, #32");
165 COMPARE(dci(0x13037c01), "asr w1, w0, #3");
166 COMPARE(dci(0x4b000021), "sub w1, w1, w0");
167 COMPARE(dci(0x2a0103e0), "mov w0, w1");
168 COMPARE(dci(0x93407c00), "sxtw x0, w0");
169 COMPARE(dci(0x2a000020), "orr w0, w1, w0");
170 COMPARE(dci(0xa8c67bfd), "ldp x29, x30, [sp], #96");
171
172 CLEANUP();
173}
174
armvixl4a102ba2014-07-14 09:02:40 +0100175
armvixlad96eda2013-06-14 11:42:37 +0100176TEST(mov_mvn) {
armvixl684cd2a2015-10-23 13:38:33 +0100177 SETUP_MACRO();
armvixlad96eda2013-06-14 11:42:37 +0100178
armvixl330dc712014-11-25 10:38:32 +0000179 COMPARE(Mov(w0, Operand(0x1234)), "mov w0, #0x1234");
180 COMPARE(Mov(x1, Operand(0x1234)), "mov x1, #0x1234");
armvixlad96eda2013-06-14 11:42:37 +0100181 COMPARE(Mov(w2, Operand(w3)), "mov w2, w3");
182 COMPARE(Mov(x4, Operand(x5)), "mov x4, x5");
183 COMPARE(Mov(w6, Operand(w7, LSL, 5)), "lsl w6, w7, #5");
184 COMPARE(Mov(x8, Operand(x9, ASR, 42)), "asr x8, x9, #42");
185 COMPARE(Mov(w10, Operand(w11, UXTB)), "uxtb w10, w11");
186 COMPARE(Mov(x12, Operand(x13, UXTB, 1)), "ubfiz x12, x13, #1, #8");
187 COMPARE(Mov(w14, Operand(w15, SXTH, 2)), "sbfiz w14, w15, #2, #16");
188 COMPARE(Mov(x16, Operand(x17, SXTW, 3)), "sbfiz x16, x17, #3, #32");
189
armvixl330dc712014-11-25 10:38:32 +0000190 COMPARE(Mvn(w0, Operand(0x101)), "mov w0, #0xfffffefe");
191 COMPARE(Mvn(x1, Operand(0xfff1)), "mov x1, #0xffffffffffff000e");
armvixlad96eda2013-06-14 11:42:37 +0100192 COMPARE(Mvn(w2, Operand(w3)), "mvn w2, w3");
193 COMPARE(Mvn(x4, Operand(x5)), "mvn x4, x5");
194 COMPARE(Mvn(w6, Operand(w7, LSL, 12)), "mvn w6, w7, lsl #12");
195 COMPARE(Mvn(x8, Operand(x9, ASR, 63)), "mvn x8, x9, asr #63");
196
197 CLEANUP();
198}
199
armvixl4a102ba2014-07-14 09:02:40 +0100200
armvixlad96eda2013-06-14 11:42:37 +0100201TEST(move_immediate) {
202 SETUP();
203
armvixl330dc712014-11-25 10:38:32 +0000204 COMPARE(movz(w0, 0x1234), "mov w0, #0x1234");
205 COMPARE(movz(x1, 0xabcd0000), "mov x1, #0xabcd0000");
206 COMPARE(movz(x2, 0x555500000000), "mov x2, #0x555500000000");
207 COMPARE(movz(x3, 0xaaaa000000000000), "mov x3, #0xaaaa000000000000");
208 COMPARE(movz(x4, 0xabcd, 16), "mov x4, #0xabcd0000");
209 COMPARE(movz(x5, 0x5555, 32), "mov x5, #0x555500000000");
210 COMPARE(movz(x6, 0xaaaa, 48), "mov x6, #0xaaaa000000000000");
armvixlad96eda2013-06-14 11:42:37 +0100211
212 COMPARE(movk(w7, 0x1234), "movk w7, #0x1234");
213 COMPARE(movk(x8, 0xabcd0000), "movk x8, #0xabcd, lsl #16");
214 COMPARE(movk(x9, 0x555500000000), "movk x9, #0x5555, lsl #32");
215 COMPARE(movk(x10, 0xaaaa000000000000), "movk x10, #0xaaaa, lsl #48");
216 COMPARE(movk(w11, 0xabcd, 16), "movk w11, #0xabcd, lsl #16");
217 COMPARE(movk(x12, 0x5555, 32), "movk x12, #0x5555, lsl #32");
218 COMPARE(movk(x13, 0xaaaa, 48), "movk x13, #0xaaaa, lsl #48");
219
armvixl330dc712014-11-25 10:38:32 +0000220 COMPARE(movn(w14, 0x1234), "mov w14, #0xffffedcb");
221 COMPARE(movn(x15, 0xabcd0000), "mov x15, #0xffffffff5432ffff");
222 COMPARE(movn(x16, 0x555500000000), "mov x16, #0xffffaaaaffffffff");
223 COMPARE(movn(x17, 0xaaaa000000000000), "mov x17, #0x5555ffffffffffff");
224 COMPARE(movn(w18, 0xabcd, 16), "mov w18, #0x5432ffff");
225 COMPARE(movn(x19, 0x5555, 32), "mov x19, #0xffffaaaaffffffff");
226 COMPARE(movn(x20, 0xaaaa, 48), "mov x20, #0x5555ffffffffffff");
armvixlad96eda2013-06-14 11:42:37 +0100227
228 COMPARE(movk(w21, 0), "movk w21, #0x0");
229 COMPARE(movk(x22, 0, 0), "movk x22, #0x0");
230 COMPARE(movk(w23, 0, 16), "movk w23, #0x0, lsl #16");
231 COMPARE(movk(x24, 0, 32), "movk x24, #0x0, lsl #32");
232 COMPARE(movk(x25, 0, 48), "movk x25, #0x0, lsl #48");
233
armvixl330dc712014-11-25 10:38:32 +0000234 COMPARE(movz(x26, 0, 48), "movz x26, #0x0");
235 COMPARE(movn(x27, 0, 48), "movn x27, #0x0");
236 COMPARE(movn(w28, 0xffff), "movn w28, #0xffff");
237
armvixlad96eda2013-06-14 11:42:37 +0100238 CLEANUP();
239}
240
armvixl4a102ba2014-07-14 09:02:40 +0100241
armvixlf37fdc02014-02-05 13:22:16 +0000242TEST(move_immediate_2) {
armvixl684cd2a2015-10-23 13:38:33 +0100243 SETUP_MACRO();
armvixlf37fdc02014-02-05 13:22:16 +0000244
245 // Move instructions expected for certain immediates. This is really a macro
246 // assembler test, to ensure it generates immediates efficiently.
armvixl330dc712014-11-25 10:38:32 +0000247 COMPARE(Mov(w0, 0), "mov w0, #0x0");
248 COMPARE(Mov(w0, 0x0000ffff), "mov w0, #0xffff");
249 COMPARE(Mov(w0, 0x00010000), "mov w0, #0x10000");
250 COMPARE(Mov(w0, 0xffff0000), "mov w0, #0xffff0000");
251 COMPARE(Mov(w0, 0x0001ffff), "mov w0, #0x1ffff");
252 COMPARE(Mov(w0, 0xffff8000), "mov w0, #0xffff8000");
253 COMPARE(Mov(w0, 0xfffffffe), "mov w0, #0xfffffffe");
254 COMPARE(Mov(w0, 0xffffffff), "mov w0, #0xffffffff");
armvixlf37fdc02014-02-05 13:22:16 +0000255 COMPARE(Mov(w0, 0x00ffff00), "mov w0, #0xffff00");
256 COMPARE(Mov(w0, 0xfffe7fff), "mov w0, #0xfffe7fff");
armvixl330dc712014-11-25 10:38:32 +0000257 COMPARE(Mov(w0, 0xfffeffff), "mov w0, #0xfffeffff");
258 COMPARE(Mov(w0, 0xffff7fff), "mov w0, #0xffff7fff");
armvixlf37fdc02014-02-05 13:22:16 +0000259
armvixl330dc712014-11-25 10:38:32 +0000260 COMPARE(Mov(x0, 0), "mov x0, #0x0");
261 COMPARE(Mov(x0, 0x0000ffff), "mov x0, #0xffff");
262 COMPARE(Mov(x0, 0x00010000), "mov x0, #0x10000");
263 COMPARE(Mov(x0, 0xffff0000), "mov x0, #0xffff0000");
armvixlf37fdc02014-02-05 13:22:16 +0000264 COMPARE(Mov(x0, 0x0001ffff), "mov x0, #0x1ffff");
265 COMPARE(Mov(x0, 0xffff8000), "mov x0, #0xffff8000");
266 COMPARE(Mov(x0, 0xfffffffe), "mov x0, #0xfffffffe");
267 COMPARE(Mov(x0, 0xffffffff), "mov x0, #0xffffffff");
268 COMPARE(Mov(x0, 0x00ffff00), "mov x0, #0xffff00");
armvixl330dc712014-11-25 10:38:32 +0000269 COMPARE(Mov(x0, 0xffff000000000000), "mov x0, #0xffff000000000000");
270 COMPARE(Mov(x0, 0x0000ffff00000000), "mov x0, #0xffff00000000");
271 COMPARE(Mov(x0, 0x00000000ffff0000), "mov x0, #0xffff0000");
272 COMPARE(Mov(x0, 0xffffffffffff0000), "mov x0, #0xffffffffffff0000");
273 COMPARE(Mov(x0, 0xffffffff0000ffff), "mov x0, #0xffffffff0000ffff");
274 COMPARE(Mov(x0, 0xffff0000ffffffff), "mov x0, #0xffff0000ffffffff");
275 COMPARE(Mov(x0, 0x0000ffffffffffff), "mov x0, #0xffffffffffff");
armvixlf37fdc02014-02-05 13:22:16 +0000276 COMPARE(Mov(x0, 0xfffe7fffffffffff), "mov x0, #0xfffe7fffffffffff");
armvixl330dc712014-11-25 10:38:32 +0000277 COMPARE(Mov(x0, 0xfffeffffffffffff), "mov x0, #0xfffeffffffffffff");
278 COMPARE(Mov(x0, 0xffff7fffffffffff), "mov x0, #0xffff7fffffffffff");
armvixlf37fdc02014-02-05 13:22:16 +0000279 COMPARE(Mov(x0, 0xfffffffe7fffffff), "mov x0, #0xfffffffe7fffffff");
armvixl330dc712014-11-25 10:38:32 +0000280 COMPARE(Mov(x0, 0xfffffffeffffffff), "mov x0, #0xfffffffeffffffff");
281 COMPARE(Mov(x0, 0xffffffff7fffffff), "mov x0, #0xffffffff7fffffff");
armvixlf37fdc02014-02-05 13:22:16 +0000282 COMPARE(Mov(x0, 0xfffffffffffe7fff), "mov x0, #0xfffffffffffe7fff");
armvixl330dc712014-11-25 10:38:32 +0000283 COMPARE(Mov(x0, 0xfffffffffffeffff), "mov x0, #0xfffffffffffeffff");
284 COMPARE(Mov(x0, 0xffffffffffff7fff), "mov x0, #0xffffffffffff7fff");
285 COMPARE(Mov(x0, 0xffffffffffffffff), "mov x0, #0xffffffffffffffff");
armvixlf37fdc02014-02-05 13:22:16 +0000286
287 COMPARE(Movk(w0, 0x1234, 0), "movk w0, #0x1234");
288 COMPARE(Movk(x1, 0x2345, 0), "movk x1, #0x2345");
289 COMPARE(Movk(w2, 0x3456, 16), "movk w2, #0x3456, lsl #16");
290 COMPARE(Movk(x3, 0x4567, 16), "movk x3, #0x4567, lsl #16");
291 COMPARE(Movk(x4, 0x5678, 32), "movk x4, #0x5678, lsl #32");
292 COMPARE(Movk(x5, 0x6789, 48), "movk x5, #0x6789, lsl #48");
293
294 CLEANUP();
295}
296
armvixl4a102ba2014-07-14 09:02:40 +0100297
armvixlad96eda2013-06-14 11:42:37 +0100298TEST(add_immediate) {
299 SETUP();
300
301 COMPARE(add(w0, w1, Operand(0xff)), "add w0, w1, #0xff (255)");
302 COMPARE(add(x2, x3, Operand(0x3ff)), "add x2, x3, #0x3ff (1023)");
303 COMPARE(add(w4, w5, Operand(0xfff)), "add w4, w5, #0xfff (4095)");
304 COMPARE(add(x6, x7, Operand(0x1000)), "add x6, x7, #0x1000 (4096)");
305 COMPARE(add(w8, w9, Operand(0xff000)), "add w8, w9, #0xff000 (1044480)");
306 COMPARE(add(x10, x11, Operand(0x3ff000)),
307 "add x10, x11, #0x3ff000 (4190208)");
308 COMPARE(add(w12, w13, Operand(0xfff000)),
309 "add w12, w13, #0xfff000 (16773120)");
armvixlf37fdc02014-02-05 13:22:16 +0000310 COMPARE(adds(w14, w15, Operand(0xff)), "adds w14, w15, #0xff (255)");
311 COMPARE(adds(x16, x17, Operand(0xaa000)), "adds x16, x17, #0xaa000 (696320)");
312
armvixlad96eda2013-06-14 11:42:37 +0100313 COMPARE(cmn(w18, Operand(0xff)), "cmn w18, #0xff (255)");
314 COMPARE(cmn(x19, Operand(0xff000)), "cmn x19, #0xff000 (1044480)");
315 COMPARE(add(w0, wsp, Operand(0)), "mov w0, wsp");
316 COMPARE(add(sp, x0, Operand(0)), "mov sp, x0");
317
318 COMPARE(add(w1, wsp, Operand(8)), "add w1, wsp, #0x8 (8)");
319 COMPARE(add(x2, sp, Operand(16)), "add x2, sp, #0x10 (16)");
320 COMPARE(add(wsp, wsp, Operand(42)), "add wsp, wsp, #0x2a (42)");
321 COMPARE(cmn(sp, Operand(24)), "cmn sp, #0x18 (24)");
armvixlf37fdc02014-02-05 13:22:16 +0000322 COMPARE(adds(wzr, wsp, Operand(9)), "cmn wsp, #0x9 (9)");
armvixlad96eda2013-06-14 11:42:37 +0100323
324 CLEANUP();
325}
326
armvixl4a102ba2014-07-14 09:02:40 +0100327
armvixlad96eda2013-06-14 11:42:37 +0100328TEST(sub_immediate) {
329 SETUP();
330
331 COMPARE(sub(w0, w1, Operand(0xff)), "sub w0, w1, #0xff (255)");
332 COMPARE(sub(x2, x3, Operand(0x3ff)), "sub x2, x3, #0x3ff (1023)");
333 COMPARE(sub(w4, w5, Operand(0xfff)), "sub w4, w5, #0xfff (4095)");
334 COMPARE(sub(x6, x7, Operand(0x1000)), "sub x6, x7, #0x1000 (4096)");
335 COMPARE(sub(w8, w9, Operand(0xff000)), "sub w8, w9, #0xff000 (1044480)");
336 COMPARE(sub(x10, x11, Operand(0x3ff000)),
337 "sub x10, x11, #0x3ff000 (4190208)");
338 COMPARE(sub(w12, w13, Operand(0xfff000)),
339 "sub w12, w13, #0xfff000 (16773120)");
armvixlf37fdc02014-02-05 13:22:16 +0000340 COMPARE(subs(w14, w15, Operand(0xff)), "subs w14, w15, #0xff (255)");
341 COMPARE(subs(x16, x17, Operand(0xaa000)), "subs x16, x17, #0xaa000 (696320)");
armvixlad96eda2013-06-14 11:42:37 +0100342 COMPARE(cmp(w18, Operand(0xff)), "cmp w18, #0xff (255)");
343 COMPARE(cmp(x19, Operand(0xff000)), "cmp x19, #0xff000 (1044480)");
344
345 COMPARE(sub(w1, wsp, Operand(8)), "sub w1, wsp, #0x8 (8)");
346 COMPARE(sub(x2, sp, Operand(16)), "sub x2, sp, #0x10 (16)");
347 COMPARE(sub(wsp, wsp, Operand(42)), "sub wsp, wsp, #0x2a (42)");
348 COMPARE(cmp(sp, Operand(24)), "cmp sp, #0x18 (24)");
armvixlf37fdc02014-02-05 13:22:16 +0000349 COMPARE(subs(wzr, wsp, Operand(9)), "cmp wsp, #0x9 (9)");
armvixlad96eda2013-06-14 11:42:37 +0100350
351 CLEANUP();
352}
353
354
355TEST(add_shifted) {
356 SETUP();
357
358 COMPARE(add(w0, w1, Operand(w2)), "add w0, w1, w2");
359 COMPARE(add(x3, x4, Operand(x5)), "add x3, x4, x5");
360 COMPARE(add(w6, w7, Operand(w8, LSL, 1)), "add w6, w7, w8, lsl #1");
361 COMPARE(add(x9, x10, Operand(x11, LSL, 2)), "add x9, x10, x11, lsl #2");
362 COMPARE(add(w12, w13, Operand(w14, LSR, 3)), "add w12, w13, w14, lsr #3");
363 COMPARE(add(x15, x16, Operand(x17, LSR, 4)), "add x15, x16, x17, lsr #4");
364 COMPARE(add(w18, w19, Operand(w20, ASR, 5)), "add w18, w19, w20, asr #5");
365 COMPARE(add(x21, x22, Operand(x23, ASR, 6)), "add x21, x22, x23, asr #6");
366 COMPARE(cmn(w24, Operand(w25)), "cmn w24, w25");
367 COMPARE(cmn(x26, Operand(x27, LSL, 63)), "cmn x26, x27, lsl #63");
368
369 COMPARE(add(x0, sp, Operand(x1)), "add x0, sp, x1");
370 COMPARE(add(w2, wsp, Operand(w3)), "add w2, wsp, w3");
371 COMPARE(add(x4, sp, Operand(x5, LSL, 1)), "add x4, sp, x5, lsl #1");
372 COMPARE(add(x4, xzr, Operand(x5, LSL, 1)), "add x4, xzr, x5, lsl #1");
373 COMPARE(add(w6, wsp, Operand(w7, LSL, 3)), "add w6, wsp, w7, lsl #3");
armvixlf37fdc02014-02-05 13:22:16 +0000374 COMPARE(adds(xzr, sp, Operand(x8, LSL, 4)), "cmn sp, x8, lsl #4");
375 COMPARE(adds(xzr, xzr, Operand(x8, LSL, 5)), "cmn xzr, x8, lsl #5");
armvixlad96eda2013-06-14 11:42:37 +0100376
377 CLEANUP();
378}
379
380
381TEST(sub_shifted) {
382 SETUP();
383
384 COMPARE(sub(w0, w1, Operand(w2)), "sub w0, w1, w2");
385 COMPARE(sub(x3, x4, Operand(x5)), "sub x3, x4, x5");
386 COMPARE(sub(w6, w7, Operand(w8, LSL, 1)), "sub w6, w7, w8, lsl #1");
387 COMPARE(sub(x9, x10, Operand(x11, LSL, 2)), "sub x9, x10, x11, lsl #2");
388 COMPARE(sub(w12, w13, Operand(w14, LSR, 3)), "sub w12, w13, w14, lsr #3");
389 COMPARE(sub(x15, x16, Operand(x17, LSR, 4)), "sub x15, x16, x17, lsr #4");
390 COMPARE(sub(w18, w19, Operand(w20, ASR, 5)), "sub w18, w19, w20, asr #5");
391 COMPARE(sub(x21, x22, Operand(x23, ASR, 6)), "sub x21, x22, x23, asr #6");
392 COMPARE(cmp(w24, Operand(w25)), "cmp w24, w25");
393 COMPARE(cmp(x26, Operand(x27, LSL, 63)), "cmp x26, x27, lsl #63");
394 COMPARE(neg(w28, Operand(w29)), "neg w28, w29");
395 COMPARE(neg(x30, Operand(x0, LSR, 62)), "neg x30, x0, lsr #62");
armvixlf37fdc02014-02-05 13:22:16 +0000396 COMPARE(negs(w1, Operand(w2)), "negs w1, w2");
397 COMPARE(negs(x3, Operand(x4, ASR, 61)), "negs x3, x4, asr #61");
armvixlad96eda2013-06-14 11:42:37 +0100398
399 COMPARE(sub(x0, sp, Operand(x1)), "sub x0, sp, x1");
400 COMPARE(sub(w2, wsp, Operand(w3)), "sub w2, wsp, w3");
401 COMPARE(sub(x4, sp, Operand(x5, LSL, 1)), "sub x4, sp, x5, lsl #1");
402 COMPARE(sub(x4, xzr, Operand(x5, LSL, 1)), "neg x4, x5, lsl #1");
403 COMPARE(sub(w6, wsp, Operand(w7, LSL, 3)), "sub w6, wsp, w7, lsl #3");
armvixlf37fdc02014-02-05 13:22:16 +0000404 COMPARE(subs(xzr, sp, Operand(x8, LSL, 4)), "cmp sp, x8, lsl #4");
405 COMPARE(subs(xzr, xzr, Operand(x8, LSL, 5)), "cmp xzr, x8, lsl #5");
armvixlad96eda2013-06-14 11:42:37 +0100406
407 CLEANUP();
408}
409
410
411TEST(add_extended) {
412 SETUP();
413
414 COMPARE(add(w0, w1, Operand(w2, UXTB)), "add w0, w1, w2, uxtb");
armvixlf37fdc02014-02-05 13:22:16 +0000415 COMPARE(adds(x3, x4, Operand(w5, UXTB, 1)), "adds x3, x4, w5, uxtb #1");
armvixlad96eda2013-06-14 11:42:37 +0100416 COMPARE(add(w6, w7, Operand(w8, UXTH, 2)), "add w6, w7, w8, uxth #2");
armvixlf37fdc02014-02-05 13:22:16 +0000417 COMPARE(adds(x9, x10, Operand(x11, UXTW, 3)), "adds x9, x10, w11, uxtw #3");
armvixlad96eda2013-06-14 11:42:37 +0100418 COMPARE(add(x12, x13, Operand(x14, UXTX, 4)), "add x12, x13, x14, uxtx #4");
armvixlf37fdc02014-02-05 13:22:16 +0000419 COMPARE(adds(w15, w16, Operand(w17, SXTB, 4)), "adds w15, w16, w17, sxtb #4");
armvixlad96eda2013-06-14 11:42:37 +0100420 COMPARE(add(x18, x19, Operand(x20, SXTB, 3)), "add x18, x19, w20, sxtb #3");
armvixlf37fdc02014-02-05 13:22:16 +0000421 COMPARE(adds(w21, w22, Operand(w23, SXTH, 2)), "adds w21, w22, w23, sxth #2");
armvixlad96eda2013-06-14 11:42:37 +0100422 COMPARE(add(x24, x25, Operand(x26, SXTW, 1)), "add x24, x25, w26, sxtw #1");
armvixlf37fdc02014-02-05 13:22:16 +0000423 COMPARE(adds(x27, x28, Operand(x29, SXTX)), "adds x27, x28, x29, sxtx");
armvixlad96eda2013-06-14 11:42:37 +0100424 COMPARE(cmn(w0, Operand(w1, UXTB, 2)), "cmn w0, w1, uxtb #2");
425 COMPARE(cmn(x2, Operand(x3, SXTH, 4)), "cmn x2, w3, sxth #4");
426
427 COMPARE(add(w0, wsp, Operand(w1, UXTB)), "add w0, wsp, w1, uxtb");
428 COMPARE(add(x2, sp, Operand(x3, UXTH, 1)), "add x2, sp, w3, uxth #1");
429 COMPARE(add(wsp, wsp, Operand(w4, UXTW, 2)), "add wsp, wsp, w4, lsl #2");
430 COMPARE(cmn(sp, Operand(xzr, UXTX, 3)), "cmn sp, xzr, lsl #3");
431 COMPARE(cmn(sp, Operand(xzr, LSL, 4)), "cmn sp, xzr, lsl #4");
432
433 CLEANUP();
434}
435
436
437TEST(sub_extended) {
438 SETUP();
439
440 COMPARE(sub(w0, w1, Operand(w2, UXTB)), "sub w0, w1, w2, uxtb");
armvixlf37fdc02014-02-05 13:22:16 +0000441 COMPARE(subs(x3, x4, Operand(w5, UXTB, 1)), "subs x3, x4, w5, uxtb #1");
armvixlad96eda2013-06-14 11:42:37 +0100442 COMPARE(sub(w6, w7, Operand(w8, UXTH, 2)), "sub w6, w7, w8, uxth #2");
armvixlf37fdc02014-02-05 13:22:16 +0000443 COMPARE(subs(x9, x10, Operand(x11, UXTW, 3)), "subs x9, x10, w11, uxtw #3");
armvixlad96eda2013-06-14 11:42:37 +0100444 COMPARE(sub(x12, x13, Operand(x14, UXTX, 4)), "sub x12, x13, x14, uxtx #4");
armvixlf37fdc02014-02-05 13:22:16 +0000445 COMPARE(subs(w15, w16, Operand(w17, SXTB, 4)), "subs w15, w16, w17, sxtb #4");
armvixlad96eda2013-06-14 11:42:37 +0100446 COMPARE(sub(x18, x19, Operand(x20, SXTB, 3)), "sub x18, x19, w20, sxtb #3");
armvixlf37fdc02014-02-05 13:22:16 +0000447 COMPARE(subs(w21, w22, Operand(w23, SXTH, 2)), "subs w21, w22, w23, sxth #2");
armvixlad96eda2013-06-14 11:42:37 +0100448 COMPARE(sub(x24, x25, Operand(x26, SXTW, 1)), "sub x24, x25, w26, sxtw #1");
armvixlf37fdc02014-02-05 13:22:16 +0000449 COMPARE(subs(x27, x28, Operand(x29, SXTX)), "subs x27, x28, x29, sxtx");
armvixlad96eda2013-06-14 11:42:37 +0100450 COMPARE(cmp(w0, Operand(w1, SXTB, 1)), "cmp w0, w1, sxtb #1");
451 COMPARE(cmp(x2, Operand(x3, UXTH, 3)), "cmp x2, w3, uxth #3");
452
453 COMPARE(sub(w0, wsp, Operand(w1, UXTB)), "sub w0, wsp, w1, uxtb");
454 COMPARE(sub(x2, sp, Operand(x3, UXTH, 1)), "sub x2, sp, w3, uxth #1");
455 COMPARE(sub(wsp, wsp, Operand(w4, UXTW, 2)), "sub wsp, wsp, w4, lsl #2");
456 COMPARE(cmp(sp, Operand(xzr, UXTX, 3)), "cmp sp, xzr, lsl #3");
457 COMPARE(cmp(sp, Operand(xzr, LSL, 4)), "cmp sp, xzr, lsl #4");
458
459 CLEANUP();
460}
461
462
463TEST(adc_subc_ngc) {
464 SETUP();
465
466 COMPARE(adc(w0, w1, Operand(w2)), "adc w0, w1, w2");
467 COMPARE(adc(x3, x4, Operand(x5)), "adc x3, x4, x5");
armvixlf37fdc02014-02-05 13:22:16 +0000468 COMPARE(adcs(w6, w7, Operand(w8)), "adcs w6, w7, w8");
469 COMPARE(adcs(x9, x10, Operand(x11)), "adcs x9, x10, x11");
armvixlad96eda2013-06-14 11:42:37 +0100470 COMPARE(sbc(w12, w13, Operand(w14)), "sbc w12, w13, w14");
471 COMPARE(sbc(x15, x16, Operand(x17)), "sbc x15, x16, x17");
armvixlf37fdc02014-02-05 13:22:16 +0000472 COMPARE(sbcs(w18, w19, Operand(w20)), "sbcs w18, w19, w20");
473 COMPARE(sbcs(x21, x22, Operand(x23)), "sbcs x21, x22, x23");
armvixlad96eda2013-06-14 11:42:37 +0100474 COMPARE(ngc(w24, Operand(w25)), "ngc w24, w25");
475 COMPARE(ngc(x26, Operand(x27)), "ngc x26, x27");
armvixlf37fdc02014-02-05 13:22:16 +0000476 COMPARE(ngcs(w28, Operand(w29)), "ngcs w28, w29");
477 COMPARE(ngcs(x30, Operand(x0)), "ngcs x30, x0");
armvixlad96eda2013-06-14 11:42:37 +0100478
479 CLEANUP();
480}
481
482
483TEST(mul_and_div) {
484 SETUP();
485
486 COMPARE(mul(w0, w1, w2), "mul w0, w1, w2");
487 COMPARE(mul(x3, x4, x5), "mul x3, x4, x5");
488 COMPARE(mul(w30, w0, w1), "mul w30, w0, w1");
489 COMPARE(mul(x30, x0, x1), "mul x30, x0, x1");
490 COMPARE(mneg(w0, w1, w2), "mneg w0, w1, w2");
491 COMPARE(mneg(x3, x4, x5), "mneg x3, x4, x5");
492 COMPARE(mneg(w30, w0, w1), "mneg w30, w0, w1");
493 COMPARE(mneg(x30, x0, x1), "mneg x30, x0, x1");
494 COMPARE(smull(x0, w0, w1), "smull x0, w0, w1");
495 COMPARE(smull(x30, w30, w0), "smull x30, w30, w0");
496 COMPARE(smulh(x0, x1, x2), "smulh x0, x1, x2");
armvixl6e2c8272015-03-31 11:04:14 +0100497 COMPARE(umulh(x0, x2, x1), "umulh x0, x2, x1");
armvixlad96eda2013-06-14 11:42:37 +0100498
499 COMPARE(sdiv(w0, w1, w2), "sdiv w0, w1, w2");
500 COMPARE(sdiv(x3, x4, x5), "sdiv x3, x4, x5");
501 COMPARE(udiv(w6, w7, w8), "udiv w6, w7, w8");
502 COMPARE(udiv(x9, x10, x11), "udiv x9, x10, x11");
503
504 CLEANUP();
505}
506
507
508TEST(madd) {
509 SETUP();
510
511 COMPARE(madd(w0, w1, w2, w3), "madd w0, w1, w2, w3");
512 COMPARE(madd(w30, w21, w22, w16), "madd w30, w21, w22, w16");
513 COMPARE(madd(x0, x1, x2, x3), "madd x0, x1, x2, x3");
514 COMPARE(madd(x30, x21, x22, x16), "madd x30, x21, x22, x16");
515
516 COMPARE(smaddl(x0, w1, w2, x3), "smaddl x0, w1, w2, x3");
517 COMPARE(smaddl(x30, w21, w22, x16), "smaddl x30, w21, w22, x16");
518 COMPARE(umaddl(x0, w1, w2, x3), "umaddl x0, w1, w2, x3");
519 COMPARE(umaddl(x30, w21, w22, x16), "umaddl x30, w21, w22, x16");
armvixl5289c592015-03-02 13:52:04 +0000520 COMPARE(umull(x0, w1, w2), "umull x0, w1, w2");
521 COMPARE(umull(x30, w21, w22), "umull x30, w21, w22");
armvixlad96eda2013-06-14 11:42:37 +0100522
523 CLEANUP();
524}
525
526
527TEST(msub) {
528 SETUP();
529
530 COMPARE(msub(w0, w1, w2, w3), "msub w0, w1, w2, w3");
531 COMPARE(msub(w30, w21, w22, w16), "msub w30, w21, w22, w16");
532 COMPARE(msub(x0, x1, x2, x3), "msub x0, x1, x2, x3");
533 COMPARE(msub(x30, x21, x22, x16), "msub x30, x21, x22, x16");
534
535 COMPARE(smsubl(x0, w1, w2, x3), "smsubl x0, w1, w2, x3");
536 COMPARE(smsubl(x30, w21, w22, x16), "smsubl x30, w21, w22, x16");
537 COMPARE(umsubl(x0, w1, w2, x3), "umsubl x0, w1, w2, x3");
538 COMPARE(umsubl(x30, w21, w22, x16), "umsubl x30, w21, w22, x16");
539
540 CLEANUP();
541}
542
543
544TEST(dp_1_source) {
545 SETUP();
546
547 COMPARE(rbit(w0, w1), "rbit w0, w1");
548 COMPARE(rbit(x2, x3), "rbit x2, x3");
549 COMPARE(rev16(w4, w5), "rev16 w4, w5");
550 COMPARE(rev16(x6, x7), "rev16 x6, x7");
551 COMPARE(rev32(x8, x9), "rev32 x8, x9");
552 COMPARE(rev(w10, w11), "rev w10, w11");
553 COMPARE(rev(x12, x13), "rev x12, x13");
554 COMPARE(clz(w14, w15), "clz w14, w15");
555 COMPARE(clz(x16, x17), "clz x16, x17");
556 COMPARE(cls(w18, w19), "cls w18, w19");
557 COMPARE(cls(x20, x21), "cls x20, x21");
558
559 CLEANUP();
560}
561
562
563TEST(bitfield) {
564 SETUP();
565
566 COMPARE(sxtb(w0, w1), "sxtb w0, w1");
567 COMPARE(sxtb(x2, x3), "sxtb x2, w3");
568 COMPARE(sxth(w4, w5), "sxth w4, w5");
569 COMPARE(sxth(x6, x7), "sxth x6, w7");
570 COMPARE(sxtw(x8, x9), "sxtw x8, w9");
armvixlf37fdc02014-02-05 13:22:16 +0000571 COMPARE(sxtb(x0, w1), "sxtb x0, w1");
572 COMPARE(sxth(x2, w3), "sxth x2, w3");
573 COMPARE(sxtw(x4, w5), "sxtw x4, w5");
574
armvixlad96eda2013-06-14 11:42:37 +0100575 COMPARE(uxtb(w10, w11), "uxtb w10, w11");
576 COMPARE(uxtb(x12, x13), "uxtb x12, w13");
577 COMPARE(uxth(w14, w15), "uxth w14, w15");
578 COMPARE(uxth(x16, x17), "uxth x16, w17");
579 COMPARE(uxtw(x18, x19), "ubfx x18, x19, #0, #32");
580
581 COMPARE(asr(w20, w21, 10), "asr w20, w21, #10");
582 COMPARE(asr(x22, x23, 20), "asr x22, x23, #20");
583 COMPARE(lsr(w24, w25, 10), "lsr w24, w25, #10");
584 COMPARE(lsr(x26, x27, 20), "lsr x26, x27, #20");
585 COMPARE(lsl(w28, w29, 10), "lsl w28, w29, #10");
586 COMPARE(lsl(x30, x0, 20), "lsl x30, x0, #20");
587
588 COMPARE(sbfiz(w1, w2, 1, 20), "sbfiz w1, w2, #1, #20");
589 COMPARE(sbfiz(x3, x4, 2, 19), "sbfiz x3, x4, #2, #19");
590 COMPARE(sbfx(w5, w6, 3, 18), "sbfx w5, w6, #3, #18");
591 COMPARE(sbfx(x7, x8, 4, 17), "sbfx x7, x8, #4, #17");
592 COMPARE(bfi(w9, w10, 5, 16), "bfi w9, w10, #5, #16");
593 COMPARE(bfi(x11, x12, 6, 15), "bfi x11, x12, #6, #15");
594 COMPARE(bfxil(w13, w14, 7, 14), "bfxil w13, w14, #7, #14");
595 COMPARE(bfxil(x15, x16, 8, 13), "bfxil x15, x16, #8, #13");
596 COMPARE(ubfiz(w17, w18, 9, 12), "ubfiz w17, w18, #9, #12");
597 COMPARE(ubfiz(x19, x20, 10, 11), "ubfiz x19, x20, #10, #11");
598 COMPARE(ubfx(w21, w22, 11, 10), "ubfx w21, w22, #11, #10");
599 COMPARE(ubfx(x23, x24, 12, 9), "ubfx x23, x24, #12, #9");
600
601 CLEANUP();
602}
603
604
armvixl5289c592015-03-02 13:52:04 +0000605TEST(crc32b) {
606 SETUP();
607
608 COMPARE(crc32b(w0, w1, w2), "crc32b w0, w1, w2");
609 COMPARE(crc32b(w0, w11, w22), "crc32b w0, w11, w22");
610 COMPARE(crc32b(w10, w20, w30), "crc32b w10, w20, w30");
611
612 CLEANUP();
613}
614
615
616TEST(crc32h) {
617 SETUP();
618
619 COMPARE(crc32h(w1, w2, w3), "crc32h w1, w2, w3");
620 COMPARE(crc32h(w2, w13, w23), "crc32h w2, w13, w23");
621 COMPARE(crc32h(w11, w12, w15), "crc32h w11, w12, w15");
622
623 CLEANUP();
624}
625
626
627TEST(crc32w) {
628 SETUP();
629
630 COMPARE(crc32w(w2, w3, w4), "crc32w w2, w3, w4");
631 COMPARE(crc32w(w3, w14, w24), "crc32w w3, w14, w24");
632 COMPARE(crc32w(w13, w13, w16), "crc32w w13, w13, w16");
633
634 CLEANUP();
635}
636
637
638TEST(crc32x) {
639 SETUP();
640
641 COMPARE(crc32x(w3, w4, x5), "crc32x w3, w4, x5");
642 COMPARE(crc32x(w4, w15, x25), "crc32x w4, w15, x25");
643 COMPARE(crc32x(w14, w14, x30), "crc32x w14, w14, x30");
644
645 CLEANUP();
646}
647
648
649TEST(crc32cb) {
650 SETUP();
651
652 COMPARE(crc32cb(w4, w5, w6), "crc32cb w4, w5, w6");
653 COMPARE(crc32cb(w5, w16, w26), "crc32cb w5, w16, w26");
654 COMPARE(crc32cb(w15, w15, w5), "crc32cb w15, w15, w5");
655
656 CLEANUP();
657}
658
659
660TEST(crc32ch) {
661 SETUP();
662
663 COMPARE(crc32ch(w5, w6, w7), "crc32ch w5, w6, w7");
664 COMPARE(crc32ch(w6, w17, w27), "crc32ch w6, w17, w27");
665 COMPARE(crc32ch(w16, w16, w2), "crc32ch w16, w16, w2");
666
667 CLEANUP();
668}
669
670
671TEST(crc32cw) {
672 SETUP();
673
674 COMPARE(crc32cw(w6, w7, w8), "crc32cw w6, w7, w8");
675 COMPARE(crc32cw(w7, w18, w28), "crc32cw w7, w18, w28");
676 COMPARE(crc32cw(w17, w17, w3), "crc32cw w17, w17, w3");
677
678 CLEANUP();
679}
680
681
682TEST(crc32cx) {
683 SETUP();
684
685 COMPARE(crc32cx(w7, w8, x9), "crc32cx w7, w8, x9");
686 COMPARE(crc32cx(w8, w19, x29), "crc32cx w8, w19, x29");
687 COMPARE(crc32cx(w18, w18, x4), "crc32cx w18, w18, x4");
688
689 CLEANUP();
690}
691
692
armvixlad96eda2013-06-14 11:42:37 +0100693TEST(extract) {
694 SETUP();
695
696 COMPARE(extr(w0, w1, w2, 0), "extr w0, w1, w2, #0");
697 COMPARE(extr(x3, x4, x5, 1), "extr x3, x4, x5, #1");
698 COMPARE(extr(w6, w7, w8, 31), "extr w6, w7, w8, #31");
699 COMPARE(extr(x9, x10, x11, 63), "extr x9, x10, x11, #63");
700 COMPARE(extr(w12, w13, w13, 10), "ror w12, w13, #10");
701 COMPARE(extr(x14, x15, x15, 42), "ror x14, x15, #42");
702
703 CLEANUP();
704}
705
706
707TEST(logical_immediate) {
708 SETUP();
709 #define RESULT_SIZE (256)
710
711 char result[RESULT_SIZE];
712
713 // Test immediate encoding - 64-bit destination.
714 // 64-bit patterns.
715 uint64_t value = 0x7fffffff;
716 for (int i = 0; i < 64; i++) {
717 snprintf(result, RESULT_SIZE, "and x0, x0, #0x%" PRIx64, value);
718 COMPARE(and_(x0, x0, Operand(value)), result);
719 value = ((value & 1) << 63) | (value >> 1); // Rotate right 1 bit.
720 }
721
722 // 32-bit patterns.
armvixlb0c8ae22014-03-21 14:03:59 +0000723 value = 0x00003fff00003fff;
armvixlad96eda2013-06-14 11:42:37 +0100724 for (int i = 0; i < 32; i++) {
725 snprintf(result, RESULT_SIZE, "and x0, x0, #0x%" PRIx64, value);
726 COMPARE(and_(x0, x0, Operand(value)), result);
727 value = ((value & 1) << 63) | (value >> 1); // Rotate right 1 bit.
728 }
729
730 // 16-bit patterns.
armvixlb0c8ae22014-03-21 14:03:59 +0000731 value = 0x001f001f001f001f;
armvixlad96eda2013-06-14 11:42:37 +0100732 for (int i = 0; i < 16; i++) {
733 snprintf(result, RESULT_SIZE, "and x0, x0, #0x%" PRIx64, value);
734 COMPARE(and_(x0, x0, Operand(value)), result);
735 value = ((value & 1) << 63) | (value >> 1); // Rotate right 1 bit.
736 }
737
738 // 8-bit patterns.
armvixlb0c8ae22014-03-21 14:03:59 +0000739 value = 0x0e0e0e0e0e0e0e0e;
armvixlad96eda2013-06-14 11:42:37 +0100740 for (int i = 0; i < 8; i++) {
741 snprintf(result, RESULT_SIZE, "and x0, x0, #0x%" PRIx64, value);
742 COMPARE(and_(x0, x0, Operand(value)), result);
743 value = ((value & 1) << 63) | (value >> 1); // Rotate right 1 bit.
744 }
745
746 // 4-bit patterns.
armvixlb0c8ae22014-03-21 14:03:59 +0000747 value = 0x6666666666666666;
armvixlad96eda2013-06-14 11:42:37 +0100748 for (int i = 0; i < 4; i++) {
749 snprintf(result, RESULT_SIZE, "and x0, x0, #0x%" PRIx64, value);
750 COMPARE(and_(x0, x0, Operand(value)), result);
751 value = ((value & 1) << 63) | (value >> 1); // Rotate right 1 bit.
752 }
753
754 // 2-bit patterns.
armvixlb0c8ae22014-03-21 14:03:59 +0000755 COMPARE(and_(x0, x0, Operand(0x5555555555555555)),
armvixlad96eda2013-06-14 11:42:37 +0100756 "and x0, x0, #0x5555555555555555");
armvixlb0c8ae22014-03-21 14:03:59 +0000757 COMPARE(and_(x0, x0, Operand(0xaaaaaaaaaaaaaaaa)),
armvixlad96eda2013-06-14 11:42:37 +0100758 "and x0, x0, #0xaaaaaaaaaaaaaaaa");
759
760 // Test immediate encoding - 32-bit destination.
761 COMPARE(and_(w0, w0, Operand(0xff8007ff)),
762 "and w0, w0, #0xff8007ff"); // 32-bit pattern.
763 COMPARE(and_(w0, w0, Operand(0xf87ff87f)),
764 "and w0, w0, #0xf87ff87f"); // 16-bit pattern.
765 COMPARE(and_(w0, w0, Operand(0x87878787)),
766 "and w0, w0, #0x87878787"); // 8-bit pattern.
767 COMPARE(and_(w0, w0, Operand(0x66666666)),
768 "and w0, w0, #0x66666666"); // 4-bit pattern.
769 COMPARE(and_(w0, w0, Operand(0x55555555)),
770 "and w0, w0, #0x55555555"); // 2-bit pattern.
771
772 // Test other instructions.
773 COMPARE(tst(w1, Operand(0x11111111)),
774 "tst w1, #0x11111111");
armvixlb0c8ae22014-03-21 14:03:59 +0000775 COMPARE(tst(x2, Operand(0x8888888888888888)),
armvixlad96eda2013-06-14 11:42:37 +0100776 "tst x2, #0x8888888888888888");
777 COMPARE(orr(w7, w8, Operand(0xaaaaaaaa)),
778 "orr w7, w8, #0xaaaaaaaa");
armvixlb0c8ae22014-03-21 14:03:59 +0000779 COMPARE(orr(x9, x10, Operand(0x5555555555555555)),
armvixlad96eda2013-06-14 11:42:37 +0100780 "orr x9, x10, #0x5555555555555555");
781 COMPARE(eor(w15, w16, Operand(0x00000001)),
782 "eor w15, w16, #0x1");
armvixlb0c8ae22014-03-21 14:03:59 +0000783 COMPARE(eor(x17, x18, Operand(0x0000000000000003)),
armvixlad96eda2013-06-14 11:42:37 +0100784 "eor x17, x18, #0x3");
armvixlf37fdc02014-02-05 13:22:16 +0000785 COMPARE(ands(w23, w24, Operand(0x0000000f)), "ands w23, w24, #0xf");
armvixlb0c8ae22014-03-21 14:03:59 +0000786 COMPARE(ands(x25, x26, Operand(0x800000000000000f)),
armvixlad96eda2013-06-14 11:42:37 +0100787 "ands x25, x26, #0x800000000000000f");
788
789 // Test inverse.
790 COMPARE(bic(w3, w4, Operand(0x20202020)),
791 "and w3, w4, #0xdfdfdfdf");
armvixlb0c8ae22014-03-21 14:03:59 +0000792 COMPARE(bic(x5, x6, Operand(0x4040404040404040)),
armvixlad96eda2013-06-14 11:42:37 +0100793 "and x5, x6, #0xbfbfbfbfbfbfbfbf");
794 COMPARE(orn(w11, w12, Operand(0x40004000)),
795 "orr w11, w12, #0xbfffbfff");
armvixlb0c8ae22014-03-21 14:03:59 +0000796 COMPARE(orn(x13, x14, Operand(0x8181818181818181)),
armvixlad96eda2013-06-14 11:42:37 +0100797 "orr x13, x14, #0x7e7e7e7e7e7e7e7e");
798 COMPARE(eon(w19, w20, Operand(0x80000001)),
799 "eor w19, w20, #0x7ffffffe");
armvixlb0c8ae22014-03-21 14:03:59 +0000800 COMPARE(eon(x21, x22, Operand(0xc000000000000003)),
armvixlad96eda2013-06-14 11:42:37 +0100801 "eor x21, x22, #0x3ffffffffffffffc");
armvixlf37fdc02014-02-05 13:22:16 +0000802 COMPARE(bics(w27, w28, Operand(0xfffffff7)), "ands w27, w28, #0x8");
armvixlb0c8ae22014-03-21 14:03:59 +0000803 COMPARE(bics(x29, x0, Operand(0xfffffffeffffffff)),
armvixlad96eda2013-06-14 11:42:37 +0100804 "ands x29, x0, #0x100000000");
805
806 // Test stack pointer.
807 COMPARE(and_(wsp, wzr, Operand(7)), "and wsp, wzr, #0x7");
armvixlf37fdc02014-02-05 13:22:16 +0000808 COMPARE(ands(xzr, xzr, Operand(7)), "tst xzr, #0x7");
armvixlad96eda2013-06-14 11:42:37 +0100809 COMPARE(orr(sp, xzr, Operand(15)), "orr sp, xzr, #0xf");
810 COMPARE(eor(wsp, w0, Operand(31)), "eor wsp, w0, #0x1f");
811
812 // Test move aliases.
813 COMPARE(orr(w0, wzr, Operand(0x00000780)), "orr w0, wzr, #0x780");
814 COMPARE(orr(w1, wzr, Operand(0x00007800)), "orr w1, wzr, #0x7800");
815 COMPARE(orr(w2, wzr, Operand(0x00078000)), "mov w2, #0x78000");
816 COMPARE(orr(w3, wzr, Operand(0x00780000)), "orr w3, wzr, #0x780000");
817 COMPARE(orr(w4, wzr, Operand(0x07800000)), "orr w4, wzr, #0x7800000");
armvixlb0c8ae22014-03-21 14:03:59 +0000818 COMPARE(orr(x5, xzr, Operand(0xffffffffffffc001)),
armvixlad96eda2013-06-14 11:42:37 +0100819 "orr x5, xzr, #0xffffffffffffc001");
armvixlb0c8ae22014-03-21 14:03:59 +0000820 COMPARE(orr(x6, xzr, Operand(0xfffffffffffc001f)),
armvixlad96eda2013-06-14 11:42:37 +0100821 "mov x6, #0xfffffffffffc001f");
armvixlb0c8ae22014-03-21 14:03:59 +0000822 COMPARE(orr(x7, xzr, Operand(0xffffffffffc001ff)),
armvixlad96eda2013-06-14 11:42:37 +0100823 "mov x7, #0xffffffffffc001ff");
armvixlb0c8ae22014-03-21 14:03:59 +0000824 COMPARE(orr(x8, xzr, Operand(0xfffffffffc001fff)),
armvixlad96eda2013-06-14 11:42:37 +0100825 "mov x8, #0xfffffffffc001fff");
armvixlb0c8ae22014-03-21 14:03:59 +0000826 COMPARE(orr(x9, xzr, Operand(0xffffffffc001ffff)),
armvixlad96eda2013-06-14 11:42:37 +0100827 "orr x9, xzr, #0xffffffffc001ffff");
828
829 CLEANUP();
830}
831
832
833TEST(logical_shifted) {
834 SETUP();
835
836 COMPARE(and_(w0, w1, Operand(w2)), "and w0, w1, w2");
837 COMPARE(and_(x3, x4, Operand(x5, LSL, 1)), "and x3, x4, x5, lsl #1");
838 COMPARE(and_(w6, w7, Operand(w8, LSR, 2)), "and w6, w7, w8, lsr #2");
839 COMPARE(and_(x9, x10, Operand(x11, ASR, 3)), "and x9, x10, x11, asr #3");
840 COMPARE(and_(w12, w13, Operand(w14, ROR, 4)), "and w12, w13, w14, ror #4");
841
842 COMPARE(bic(w15, w16, Operand(w17)), "bic w15, w16, w17");
843 COMPARE(bic(x18, x19, Operand(x20, LSL, 5)), "bic x18, x19, x20, lsl #5");
844 COMPARE(bic(w21, w22, Operand(w23, LSR, 6)), "bic w21, w22, w23, lsr #6");
845 COMPARE(bic(x24, x25, Operand(x26, ASR, 7)), "bic x24, x25, x26, asr #7");
846 COMPARE(bic(w27, w28, Operand(w29, ROR, 8)), "bic w27, w28, w29, ror #8");
847
848 COMPARE(orr(w0, w1, Operand(w2)), "orr w0, w1, w2");
849 COMPARE(orr(x3, x4, Operand(x5, LSL, 9)), "orr x3, x4, x5, lsl #9");
850 COMPARE(orr(w6, w7, Operand(w8, LSR, 10)), "orr w6, w7, w8, lsr #10");
851 COMPARE(orr(x9, x10, Operand(x11, ASR, 11)), "orr x9, x10, x11, asr #11");
852 COMPARE(orr(w12, w13, Operand(w14, ROR, 12)), "orr w12, w13, w14, ror #12");
853
854 COMPARE(orn(w15, w16, Operand(w17)), "orn w15, w16, w17");
855 COMPARE(orn(x18, x19, Operand(x20, LSL, 13)), "orn x18, x19, x20, lsl #13");
856 COMPARE(orn(w21, w22, Operand(w23, LSR, 14)), "orn w21, w22, w23, lsr #14");
857 COMPARE(orn(x24, x25, Operand(x26, ASR, 15)), "orn x24, x25, x26, asr #15");
858 COMPARE(orn(w27, w28, Operand(w29, ROR, 16)), "orn w27, w28, w29, ror #16");
859
860 COMPARE(eor(w0, w1, Operand(w2)), "eor w0, w1, w2");
861 COMPARE(eor(x3, x4, Operand(x5, LSL, 17)), "eor x3, x4, x5, lsl #17");
862 COMPARE(eor(w6, w7, Operand(w8, LSR, 18)), "eor w6, w7, w8, lsr #18");
863 COMPARE(eor(x9, x10, Operand(x11, ASR, 19)), "eor x9, x10, x11, asr #19");
864 COMPARE(eor(w12, w13, Operand(w14, ROR, 20)), "eor w12, w13, w14, ror #20");
865
866 COMPARE(eon(w15, w16, Operand(w17)), "eon w15, w16, w17");
867 COMPARE(eon(x18, x19, Operand(x20, LSL, 21)), "eon x18, x19, x20, lsl #21");
868 COMPARE(eon(w21, w22, Operand(w23, LSR, 22)), "eon w21, w22, w23, lsr #22");
869 COMPARE(eon(x24, x25, Operand(x26, ASR, 23)), "eon x24, x25, x26, asr #23");
870 COMPARE(eon(w27, w28, Operand(w29, ROR, 24)), "eon w27, w28, w29, ror #24");
871
armvixlf37fdc02014-02-05 13:22:16 +0000872 COMPARE(ands(w0, w1, Operand(w2)), "ands w0, w1, w2");
873 COMPARE(ands(x3, x4, Operand(x5, LSL, 1)), "ands x3, x4, x5, lsl #1");
874 COMPARE(ands(w6, w7, Operand(w8, LSR, 2)), "ands w6, w7, w8, lsr #2");
875 COMPARE(ands(x9, x10, Operand(x11, ASR, 3)), "ands x9, x10, x11, asr #3");
876 COMPARE(ands(w12, w13, Operand(w14, ROR, 4)), "ands w12, w13, w14, ror #4");
armvixlad96eda2013-06-14 11:42:37 +0100877
armvixlf37fdc02014-02-05 13:22:16 +0000878 COMPARE(bics(w15, w16, Operand(w17)), "bics w15, w16, w17");
879 COMPARE(bics(x18, x19, Operand(x20, LSL, 5)), "bics x18, x19, x20, lsl #5");
880 COMPARE(bics(w21, w22, Operand(w23, LSR, 6)), "bics w21, w22, w23, lsr #6");
881 COMPARE(bics(x24, x25, Operand(x26, ASR, 7)), "bics x24, x25, x26, asr #7");
882 COMPARE(bics(w27, w28, Operand(w29, ROR, 8)), "bics w27, w28, w29, ror #8");
armvixlad96eda2013-06-14 11:42:37 +0100883
884 COMPARE(tst(w0, Operand(w1)), "tst w0, w1");
885 COMPARE(tst(w2, Operand(w3, ROR, 10)), "tst w2, w3, ror #10");
886 COMPARE(tst(x0, Operand(x1)), "tst x0, x1");
887 COMPARE(tst(x2, Operand(x3, ROR, 42)), "tst x2, x3, ror #42");
888
889 COMPARE(orn(w0, wzr, Operand(w1)), "mvn w0, w1");
890 COMPARE(orn(w2, wzr, Operand(w3, ASR, 5)), "mvn w2, w3, asr #5");
891 COMPARE(orn(x0, xzr, Operand(x1)), "mvn x0, x1");
892 COMPARE(orn(x2, xzr, Operand(x3, ASR, 42)), "mvn x2, x3, asr #42");
893
894 COMPARE(orr(w0, wzr, Operand(w1)), "mov w0, w1");
895 COMPARE(orr(x0, xzr, Operand(x1)), "mov x0, x1");
896 COMPARE(orr(w16, wzr, Operand(w17, LSL, 1)), "orr w16, wzr, w17, lsl #1");
897 COMPARE(orr(x16, xzr, Operand(x17, ASR, 2)), "orr x16, xzr, x17, asr #2");
898
899 CLEANUP();
900}
901
902
903TEST(dp_2_source) {
904 SETUP();
905
906 COMPARE(lslv(w0, w1, w2), "lsl w0, w1, w2");
907 COMPARE(lslv(x3, x4, x5), "lsl x3, x4, x5");
908 COMPARE(lsrv(w6, w7, w8), "lsr w6, w7, w8");
909 COMPARE(lsrv(x9, x10, x11), "lsr x9, x10, x11");
910 COMPARE(asrv(w12, w13, w14), "asr w12, w13, w14");
911 COMPARE(asrv(x15, x16, x17), "asr x15, x16, x17");
912 COMPARE(rorv(w18, w19, w20), "ror w18, w19, w20");
913 COMPARE(rorv(x21, x22, x23), "ror x21, x22, x23");
914
915 CLEANUP();
916}
917
armvixl4a102ba2014-07-14 09:02:40 +0100918
armvixlad96eda2013-06-14 11:42:37 +0100919TEST(adr) {
920 SETUP();
921
armvixlb0c8ae22014-03-21 14:03:59 +0000922 COMPARE_PREFIX(adr(x0, 0), "adr x0, #+0x0");
923 COMPARE_PREFIX(adr(x1, 1), "adr x1, #+0x1");
924 COMPARE_PREFIX(adr(x2, -1), "adr x2, #-0x1");
925 COMPARE_PREFIX(adr(x3, 4), "adr x3, #+0x4");
926 COMPARE_PREFIX(adr(x4, -4), "adr x4, #-0x4");
927 COMPARE_PREFIX(adr(x5, 0x000fffff), "adr x5, #+0xfffff");
928 COMPARE_PREFIX(adr(x6, -0x00100000), "adr x6, #-0x100000");
929 COMPARE_PREFIX(adr(xzr, 0), "adr xzr, #+0x0");
armvixlad96eda2013-06-14 11:42:37 +0100930
931 CLEANUP();
932}
933
armvixl4a102ba2014-07-14 09:02:40 +0100934
935TEST(adrp) {
936 SETUP();
937
938 COMPARE_PREFIX(adrp(x0, 0), "adrp x0, #+0x0");
armvixl330dc712014-11-25 10:38:32 +0000939 COMPARE_PREFIX(adrp(x1, 1), "adrp x1, #+0x1000");
940 COMPARE_PREFIX(adrp(x2, -1), "adrp x2, #-0x1000");
941 COMPARE_PREFIX(adrp(x3, 4), "adrp x3, #+0x4000");
942 COMPARE_PREFIX(adrp(x4, -4), "adrp x4, #-0x4000");
943 COMPARE_PREFIX(adrp(x5, 0x000fffff), "adrp x5, #+0xfffff000");
944 COMPARE_PREFIX(adrp(x6, -0x00100000), "adrp x6, #-0x100000000");
armvixl4a102ba2014-07-14 09:02:40 +0100945 COMPARE_PREFIX(adrp(xzr, 0), "adrp xzr, #+0x0");
946
947 CLEANUP();
948}
949
950
armvixlad96eda2013-06-14 11:42:37 +0100951TEST(branch) {
952 SETUP();
953
954 #define INST_OFF(x) ((x) >> kInstructionSizeLog2)
armvixlb0c8ae22014-03-21 14:03:59 +0000955 COMPARE_PREFIX(b(INST_OFF(0x4)), "b #+0x4");
956 COMPARE_PREFIX(b(INST_OFF(-0x4)), "b #-0x4");
957 COMPARE_PREFIX(b(INST_OFF(0x7fffffc)), "b #+0x7fffffc");
958 COMPARE_PREFIX(b(INST_OFF(-0x8000000)), "b #-0x8000000");
959 COMPARE_PREFIX(b(INST_OFF(0xffffc), eq), "b.eq #+0xffffc");
960 COMPARE_PREFIX(b(INST_OFF(-0x100000), mi), "b.mi #-0x100000");
961 COMPARE_PREFIX(b(INST_OFF(0xffffc), al), "b.al #+0xffffc");
962 COMPARE_PREFIX(b(INST_OFF(-0x100000), nv), "b.nv #-0x100000");
963 COMPARE_PREFIX(bl(INST_OFF(0x4)), "bl #+0x4");
964 COMPARE_PREFIX(bl(INST_OFF(-0x4)), "bl #-0x4");
965 COMPARE_PREFIX(bl(INST_OFF(0xffffc)), "bl #+0xffffc");
966 COMPARE_PREFIX(bl(INST_OFF(-0x100000)), "bl #-0x100000");
967 COMPARE_PREFIX(cbz(w0, INST_OFF(0xffffc)), "cbz w0, #+0xffffc");
968 COMPARE_PREFIX(cbz(x1, INST_OFF(-0x100000)), "cbz x1, #-0x100000");
969 COMPARE_PREFIX(cbnz(w2, INST_OFF(0xffffc)), "cbnz w2, #+0xffffc");
970 COMPARE_PREFIX(cbnz(x3, INST_OFF(-0x100000)), "cbnz x3, #-0x100000");
971 COMPARE_PREFIX(tbz(w4, 0, INST_OFF(0x7ffc)), "tbz w4, #0, #+0x7ffc");
972 COMPARE_PREFIX(tbz(x5, 63, INST_OFF(-0x8000)), "tbz x5, #63, #-0x8000");
973 COMPARE_PREFIX(tbz(w6, 31, INST_OFF(0)), "tbz w6, #31, #+0x0");
974 COMPARE_PREFIX(tbz(x7, 31, INST_OFF(0x4)), "tbz w7, #31, #+0x4");
975 COMPARE_PREFIX(tbz(x8, 32, INST_OFF(0x8)), "tbz x8, #32, #+0x8");
976 COMPARE_PREFIX(tbnz(w8, 0, INST_OFF(0x7ffc)), "tbnz w8, #0, #+0x7ffc");
977 COMPARE_PREFIX(tbnz(x9, 63, INST_OFF(-0x8000)), "tbnz x9, #63, #-0x8000");
978 COMPARE_PREFIX(tbnz(w10, 31, INST_OFF(0)), "tbnz w10, #31, #+0x0");
979 COMPARE_PREFIX(tbnz(x11, 31, INST_OFF(0x4)), "tbnz w11, #31, #+0x4");
980 COMPARE_PREFIX(tbnz(x12, 32, INST_OFF(0x8)), "tbnz x12, #32, #+0x8");
armvixlad96eda2013-06-14 11:42:37 +0100981 COMPARE(br(x0), "br x0");
982 COMPARE(blr(x1), "blr x1");
983 COMPARE(ret(x2), "ret x2");
984 COMPARE(ret(lr), "ret")
985
986 CLEANUP();
987}
988
armvixl4a102ba2014-07-14 09:02:40 +0100989
armvixlad96eda2013-06-14 11:42:37 +0100990TEST(load_store) {
991 SETUP();
992
993 COMPARE(ldr(w0, MemOperand(x1)), "ldr w0, [x1]");
994 COMPARE(ldr(w2, MemOperand(x3, 4)), "ldr w2, [x3, #4]");
995 COMPARE(ldr(w4, MemOperand(x5, 16380)), "ldr w4, [x5, #16380]");
996 COMPARE(ldr(x6, MemOperand(x7)), "ldr x6, [x7]");
997 COMPARE(ldr(x8, MemOperand(x9, 8)), "ldr x8, [x9, #8]");
998 COMPARE(ldr(x10, MemOperand(x11, 32760)), "ldr x10, [x11, #32760]");
999 COMPARE(str(w12, MemOperand(x13)), "str w12, [x13]");
1000 COMPARE(str(w14, MemOperand(x15, 4)), "str w14, [x15, #4]");
1001 COMPARE(str(w16, MemOperand(x17, 16380)), "str w16, [x17, #16380]");
1002 COMPARE(str(x18, MemOperand(x19)), "str x18, [x19]");
1003 COMPARE(str(x20, MemOperand(x21, 8)), "str x20, [x21, #8]");
1004 COMPARE(str(x22, MemOperand(x23, 32760)), "str x22, [x23, #32760]");
1005
1006 COMPARE(ldr(w0, MemOperand(x1, 4, PreIndex)), "ldr w0, [x1, #4]!");
1007 COMPARE(ldr(w2, MemOperand(x3, 255, PreIndex)), "ldr w2, [x3, #255]!");
1008 COMPARE(ldr(w4, MemOperand(x5, -256, PreIndex)), "ldr w4, [x5, #-256]!");
1009 COMPARE(ldr(x6, MemOperand(x7, 8, PreIndex)), "ldr x6, [x7, #8]!");
1010 COMPARE(ldr(x8, MemOperand(x9, 255, PreIndex)), "ldr x8, [x9, #255]!");
1011 COMPARE(ldr(x10, MemOperand(x11, -256, PreIndex)), "ldr x10, [x11, #-256]!");
1012 COMPARE(str(w12, MemOperand(x13, 4, PreIndex)), "str w12, [x13, #4]!");
1013 COMPARE(str(w14, MemOperand(x15, 255, PreIndex)), "str w14, [x15, #255]!");
1014 COMPARE(str(w16, MemOperand(x17, -256, PreIndex)), "str w16, [x17, #-256]!");
1015 COMPARE(str(x18, MemOperand(x19, 8, PreIndex)), "str x18, [x19, #8]!");
1016 COMPARE(str(x20, MemOperand(x21, 255, PreIndex)), "str x20, [x21, #255]!");
1017 COMPARE(str(x22, MemOperand(x23, -256, PreIndex)), "str x22, [x23, #-256]!");
1018
1019 COMPARE(ldr(w0, MemOperand(x1, 4, PostIndex)), "ldr w0, [x1], #4");
1020 COMPARE(ldr(w2, MemOperand(x3, 255, PostIndex)), "ldr w2, [x3], #255");
1021 COMPARE(ldr(w4, MemOperand(x5, -256, PostIndex)), "ldr w4, [x5], #-256");
1022 COMPARE(ldr(x6, MemOperand(x7, 8, PostIndex)), "ldr x6, [x7], #8");
1023 COMPARE(ldr(x8, MemOperand(x9, 255, PostIndex)), "ldr x8, [x9], #255");
1024 COMPARE(ldr(x10, MemOperand(x11, -256, PostIndex)), "ldr x10, [x11], #-256");
1025 COMPARE(str(w12, MemOperand(x13, 4, PostIndex)), "str w12, [x13], #4");
1026 COMPARE(str(w14, MemOperand(x15, 255, PostIndex)), "str w14, [x15], #255");
1027 COMPARE(str(w16, MemOperand(x17, -256, PostIndex)), "str w16, [x17], #-256");
1028 COMPARE(str(x18, MemOperand(x19, 8, PostIndex)), "str x18, [x19], #8");
1029 COMPARE(str(x20, MemOperand(x21, 255, PostIndex)), "str x20, [x21], #255");
1030 COMPARE(str(x22, MemOperand(x23, -256, PostIndex)), "str x22, [x23], #-256");
1031
1032 COMPARE(ldr(w24, MemOperand(sp)), "ldr w24, [sp]");
1033 COMPARE(ldr(x25, MemOperand(sp, 8)), "ldr x25, [sp, #8]");
1034 COMPARE(str(w26, MemOperand(sp, 4, PreIndex)), "str w26, [sp, #4]!");
1035 COMPARE(str(x27, MemOperand(sp, -8, PostIndex)), "str x27, [sp], #-8");
1036
1037 COMPARE(ldrsw(x0, MemOperand(x1)), "ldrsw x0, [x1]");
1038 COMPARE(ldrsw(x2, MemOperand(x3, 8)), "ldrsw x2, [x3, #8]");
1039 COMPARE(ldrsw(x4, MemOperand(x5, 42, PreIndex)), "ldrsw x4, [x5, #42]!");
1040 COMPARE(ldrsw(x6, MemOperand(x7, -11, PostIndex)), "ldrsw x6, [x7], #-11");
1041
1042 CLEANUP();
1043}
1044
1045
1046TEST(load_store_regoffset) {
1047 SETUP();
1048
1049 COMPARE(ldr(w0, MemOperand(x1, w2, UXTW)), "ldr w0, [x1, w2, uxtw]");
1050 COMPARE(ldr(w3, MemOperand(x4, w5, UXTW, 2)), "ldr w3, [x4, w5, uxtw #2]");
1051 COMPARE(ldr(w6, MemOperand(x7, x8)), "ldr w6, [x7, x8]");
1052 COMPARE(ldr(w9, MemOperand(x10, x11, LSL, 2)), "ldr w9, [x10, x11, lsl #2]");
1053 COMPARE(ldr(w12, MemOperand(x13, w14, SXTW)), "ldr w12, [x13, w14, sxtw]");
1054 COMPARE(ldr(w15, MemOperand(x16, w17, SXTW, 2)),
1055 "ldr w15, [x16, w17, sxtw #2]");
1056 COMPARE(ldr(w18, MemOperand(x19, x20, SXTX)), "ldr w18, [x19, x20, sxtx]");
1057 COMPARE(ldr(w21, MemOperand(x22, x23, SXTX, 2)),
1058 "ldr w21, [x22, x23, sxtx #2]");
1059 COMPARE(ldr(x0, MemOperand(x1, w2, UXTW)), "ldr x0, [x1, w2, uxtw]");
1060 COMPARE(ldr(x3, MemOperand(x4, w5, UXTW, 3)), "ldr x3, [x4, w5, uxtw #3]");
1061 COMPARE(ldr(x6, MemOperand(x7, x8)), "ldr x6, [x7, x8]");
1062 COMPARE(ldr(x9, MemOperand(x10, x11, LSL, 3)), "ldr x9, [x10, x11, lsl #3]");
1063 COMPARE(ldr(x12, MemOperand(x13, w14, SXTW)), "ldr x12, [x13, w14, sxtw]");
1064 COMPARE(ldr(x15, MemOperand(x16, w17, SXTW, 3)),
1065 "ldr x15, [x16, w17, sxtw #3]");
1066 COMPARE(ldr(x18, MemOperand(x19, x20, SXTX)), "ldr x18, [x19, x20, sxtx]");
1067 COMPARE(ldr(x21, MemOperand(x22, x23, SXTX, 3)),
1068 "ldr x21, [x22, x23, sxtx #3]");
1069
1070 COMPARE(str(w0, MemOperand(x1, w2, UXTW)), "str w0, [x1, w2, uxtw]");
1071 COMPARE(str(w3, MemOperand(x4, w5, UXTW, 2)), "str w3, [x4, w5, uxtw #2]");
1072 COMPARE(str(w6, MemOperand(x7, x8)), "str w6, [x7, x8]");
1073 COMPARE(str(w9, MemOperand(x10, x11, LSL, 2)), "str w9, [x10, x11, lsl #2]");
1074 COMPARE(str(w12, MemOperand(x13, w14, SXTW)), "str w12, [x13, w14, sxtw]");
1075 COMPARE(str(w15, MemOperand(x16, w17, SXTW, 2)),
1076 "str w15, [x16, w17, sxtw #2]");
1077 COMPARE(str(w18, MemOperand(x19, x20, SXTX)), "str w18, [x19, x20, sxtx]");
1078 COMPARE(str(w21, MemOperand(x22, x23, SXTX, 2)),
1079 "str w21, [x22, x23, sxtx #2]");
1080 COMPARE(str(x0, MemOperand(x1, w2, UXTW)), "str x0, [x1, w2, uxtw]");
1081 COMPARE(str(x3, MemOperand(x4, w5, UXTW, 3)), "str x3, [x4, w5, uxtw #3]");
1082 COMPARE(str(x6, MemOperand(x7, x8)), "str x6, [x7, x8]");
1083 COMPARE(str(x9, MemOperand(x10, x11, LSL, 3)), "str x9, [x10, x11, lsl #3]");
1084 COMPARE(str(x12, MemOperand(x13, w14, SXTW)), "str x12, [x13, w14, sxtw]");
1085 COMPARE(str(x15, MemOperand(x16, w17, SXTW, 3)),
1086 "str x15, [x16, w17, sxtw #3]");
1087 COMPARE(str(x18, MemOperand(x19, x20, SXTX)), "str x18, [x19, x20, sxtx]");
1088 COMPARE(str(x21, MemOperand(x22, x23, SXTX, 3)),
1089 "str x21, [x22, x23, sxtx #3]");
1090
1091 COMPARE(ldrb(w0, MemOperand(x1, w2, UXTW)), "ldrb w0, [x1, w2, uxtw]");
1092 COMPARE(ldrb(w6, MemOperand(x7, x8)), "ldrb w6, [x7, x8]");
1093 COMPARE(ldrb(w12, MemOperand(x13, w14, SXTW)), "ldrb w12, [x13, w14, sxtw]");
1094 COMPARE(ldrb(w18, MemOperand(x19, x20, SXTX)), "ldrb w18, [x19, x20, sxtx]");
1095 COMPARE(strb(w0, MemOperand(x1, w2, UXTW)), "strb w0, [x1, w2, uxtw]");
1096 COMPARE(strb(w6, MemOperand(x7, x8)), "strb w6, [x7, x8]");
1097 COMPARE(strb(w12, MemOperand(x13, w14, SXTW)), "strb w12, [x13, w14, sxtw]");
1098 COMPARE(strb(w18, MemOperand(x19, x20, SXTX)), "strb w18, [x19, x20, sxtx]");
1099
1100 COMPARE(ldrh(w0, MemOperand(x1, w2, UXTW)), "ldrh w0, [x1, w2, uxtw]");
1101 COMPARE(ldrh(w3, MemOperand(x4, w5, UXTW, 1)), "ldrh w3, [x4, w5, uxtw #1]");
1102 COMPARE(ldrh(w6, MemOperand(x7, x8)), "ldrh w6, [x7, x8]");
1103 COMPARE(ldrh(w9, MemOperand(x10, x11, LSL, 1)),
1104 "ldrh w9, [x10, x11, lsl #1]");
1105 COMPARE(ldrh(w12, MemOperand(x13, w14, SXTW)), "ldrh w12, [x13, w14, sxtw]");
1106 COMPARE(ldrh(w15, MemOperand(x16, w17, SXTW, 1)),
1107 "ldrh w15, [x16, w17, sxtw #1]");
1108 COMPARE(ldrh(w18, MemOperand(x19, x20, SXTX)), "ldrh w18, [x19, x20, sxtx]");
1109 COMPARE(ldrh(w21, MemOperand(x22, x23, SXTX, 1)),
1110 "ldrh w21, [x22, x23, sxtx #1]");
1111 COMPARE(strh(w0, MemOperand(x1, w2, UXTW)), "strh w0, [x1, w2, uxtw]");
1112 COMPARE(strh(w3, MemOperand(x4, w5, UXTW, 1)), "strh w3, [x4, w5, uxtw #1]");
1113 COMPARE(strh(w6, MemOperand(x7, x8)), "strh w6, [x7, x8]");
1114 COMPARE(strh(w9, MemOperand(x10, x11, LSL, 1)),
1115 "strh w9, [x10, x11, lsl #1]");
1116 COMPARE(strh(w12, MemOperand(x13, w14, SXTW)), "strh w12, [x13, w14, sxtw]");
1117 COMPARE(strh(w15, MemOperand(x16, w17, SXTW, 1)),
1118 "strh w15, [x16, w17, sxtw #1]");
1119 COMPARE(strh(w18, MemOperand(x19, x20, SXTX)), "strh w18, [x19, x20, sxtx]");
1120 COMPARE(strh(w21, MemOperand(x22, x23, SXTX, 1)),
1121 "strh w21, [x22, x23, sxtx #1]");
1122
1123 COMPARE(ldr(x0, MemOperand(sp, wzr, SXTW)), "ldr x0, [sp, wzr, sxtw]");
1124 COMPARE(str(x1, MemOperand(sp, xzr)), "str x1, [sp, xzr]");
1125
1126 CLEANUP();
1127}
1128
1129
1130TEST(load_store_byte) {
1131 SETUP();
1132
1133 COMPARE(ldrb(w0, MemOperand(x1)), "ldrb w0, [x1]");
1134 COMPARE(ldrb(x2, MemOperand(x3)), "ldrb w2, [x3]");
1135 COMPARE(ldrb(w4, MemOperand(x5, 4095)), "ldrb w4, [x5, #4095]");
1136 COMPARE(ldrb(w6, MemOperand(x7, 255, PreIndex)), "ldrb w6, [x7, #255]!");
1137 COMPARE(ldrb(w8, MemOperand(x9, -256, PreIndex)), "ldrb w8, [x9, #-256]!");
1138 COMPARE(ldrb(w10, MemOperand(x11, 255, PostIndex)), "ldrb w10, [x11], #255");
1139 COMPARE(ldrb(w12, MemOperand(x13, -256, PostIndex)),
1140 "ldrb w12, [x13], #-256");
1141 COMPARE(strb(w14, MemOperand(x15)), "strb w14, [x15]");
1142 COMPARE(strb(x16, MemOperand(x17)), "strb w16, [x17]");
1143 COMPARE(strb(w18, MemOperand(x19, 4095)), "strb w18, [x19, #4095]");
1144 COMPARE(strb(w20, MemOperand(x21, 255, PreIndex)), "strb w20, [x21, #255]!");
1145 COMPARE(strb(w22, MemOperand(x23, -256, PreIndex)),
1146 "strb w22, [x23, #-256]!");
1147 COMPARE(strb(w24, MemOperand(x25, 255, PostIndex)), "strb w24, [x25], #255");
1148 COMPARE(strb(w26, MemOperand(x27, -256, PostIndex)),
1149 "strb w26, [x27], #-256");
1150 COMPARE(ldrb(w28, MemOperand(sp, 3, PostIndex)), "ldrb w28, [sp], #3");
1151 COMPARE(strb(x29, MemOperand(sp, -42, PreIndex)), "strb w29, [sp, #-42]!");
1152 COMPARE(ldrsb(w0, MemOperand(x1)), "ldrsb w0, [x1]");
1153 COMPARE(ldrsb(x2, MemOperand(x3, 8)), "ldrsb x2, [x3, #8]");
1154 COMPARE(ldrsb(w4, MemOperand(x5, 42, PreIndex)), "ldrsb w4, [x5, #42]!");
1155 COMPARE(ldrsb(x6, MemOperand(x7, -11, PostIndex)), "ldrsb x6, [x7], #-11");
1156
1157 CLEANUP();
1158}
1159
1160
1161TEST(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(strh(w14, MemOperand(x15)), "strh w14, [x15]");
1173 COMPARE(strh(x16, MemOperand(x17)), "strh w16, [x17]");
1174 COMPARE(strh(w18, MemOperand(x19, 8190)), "strh w18, [x19, #8190]");
1175 COMPARE(strh(w20, MemOperand(x21, 255, PreIndex)), "strh w20, [x21, #255]!");
1176 COMPARE(strh(w22, MemOperand(x23, -256, PreIndex)),
1177 "strh w22, [x23, #-256]!");
1178 COMPARE(strh(w24, MemOperand(x25, 255, PostIndex)), "strh w24, [x25], #255");
1179 COMPARE(strh(w26, MemOperand(x27, -256, PostIndex)),
1180 "strh w26, [x27], #-256");
1181 COMPARE(ldrh(w28, MemOperand(sp, 3, PostIndex)), "ldrh w28, [sp], #3");
1182 COMPARE(strh(x29, MemOperand(sp, -42, PreIndex)), "strh w29, [sp, #-42]!");
1183 COMPARE(ldrh(w30, MemOperand(x0, 255)), "ldurh w30, [x0, #255]");
1184 COMPARE(ldrh(x1, MemOperand(x2, -256)), "ldurh w1, [x2, #-256]");
1185 COMPARE(strh(w3, MemOperand(x4, 255)), "sturh w3, [x4, #255]");
1186 COMPARE(strh(x5, MemOperand(x6, -256)), "sturh w5, [x6, #-256]");
1187 COMPARE(ldrsh(w0, MemOperand(x1)), "ldrsh w0, [x1]");
1188 COMPARE(ldrsh(w2, MemOperand(x3, 8)), "ldrsh w2, [x3, #8]");
1189 COMPARE(ldrsh(w4, MemOperand(x5, 42, PreIndex)), "ldrsh w4, [x5, #42]!");
1190 COMPARE(ldrsh(x6, MemOperand(x7, -11, PostIndex)), "ldrsh x6, [x7], #-11");
1191
1192 CLEANUP();
1193}
1194
1195
armvixl5289c592015-03-02 13:52:04 +00001196TEST(load_store_v_offset) {
armvixlad96eda2013-06-14 11:42:37 +01001197 SETUP();
1198
1199 COMPARE(ldr(s0, MemOperand(x1)), "ldr s0, [x1]");
1200 COMPARE(ldr(s2, MemOperand(x3, 4)), "ldr s2, [x3, #4]");
1201 COMPARE(ldr(s4, MemOperand(x5, 16380)), "ldr s4, [x5, #16380]");
1202 COMPARE(ldr(d6, MemOperand(x7)), "ldr d6, [x7]");
1203 COMPARE(ldr(d8, MemOperand(x9, 8)), "ldr d8, [x9, #8]");
1204 COMPARE(ldr(d10, MemOperand(x11, 32760)), "ldr d10, [x11, #32760]");
1205 COMPARE(str(s12, MemOperand(x13)), "str s12, [x13]");
1206 COMPARE(str(s14, MemOperand(x15, 4)), "str s14, [x15, #4]");
1207 COMPARE(str(s16, MemOperand(x17, 16380)), "str s16, [x17, #16380]");
1208 COMPARE(str(d18, MemOperand(x19)), "str d18, [x19]");
1209 COMPARE(str(d20, MemOperand(x21, 8)), "str d20, [x21, #8]");
1210 COMPARE(str(d22, MemOperand(x23, 32760)), "str d22, [x23, #32760]");
1211
armvixl5289c592015-03-02 13:52:04 +00001212 COMPARE(ldr(b0, MemOperand(x1)), "ldr b0, [x1]");
1213 COMPARE(ldr(b2, MemOperand(x3, 1)), "ldr b2, [x3, #1]");
1214 COMPARE(ldr(b4, MemOperand(x5, 4095)), "ldr b4, [x5, #4095]");
1215 COMPARE(ldr(h6, MemOperand(x7)), "ldr h6, [x7]");
1216 COMPARE(ldr(h8, MemOperand(x9, 2)), "ldr h8, [x9, #2]");
1217 COMPARE(ldr(h10, MemOperand(x11, 8190)), "ldr h10, [x11, #8190]");
1218 COMPARE(ldr(q12, MemOperand(x13)), "ldr q12, [x13]");
1219 COMPARE(ldr(q14, MemOperand(x15, 16)), "ldr q14, [x15, #16]");
1220 COMPARE(ldr(q16, MemOperand(x17, 65520)), "ldr q16, [x17, #65520]");
1221 COMPARE(str(b18, MemOperand(x19)), "str b18, [x19]");
1222 COMPARE(str(b20, MemOperand(x21, 1)), "str b20, [x21, #1]");
1223 COMPARE(str(b22, MemOperand(x23, 4095)), "str b22, [x23, #4095]");
1224 COMPARE(str(h24, MemOperand(x25)), "str h24, [x25]");
1225 COMPARE(str(h26, MemOperand(x27, 2)), "str h26, [x27, #2]");
1226 COMPARE(str(h28, MemOperand(x29, 8190)), "str h28, [x29, #8190]");
1227 COMPARE(str(q30, MemOperand(x30)), "str q30, [x30]");
1228 COMPARE(str(q31, MemOperand(x1, 16)), "str q31, [x1, #16]");
1229 COMPARE(str(q0, MemOperand(x3, 65520)), "str q0, [x3, #65520]");
1230
1231 COMPARE(ldr(s24, MemOperand(sp)), "ldr s24, [sp]");
1232 COMPARE(ldr(d25, MemOperand(sp, 8)), "ldr d25, [sp, #8]");
1233 COMPARE(ldr(b26, MemOperand(sp, 1)), "ldr b26, [sp, #1]");
1234 COMPARE(ldr(h27, MemOperand(sp, 2)), "ldr h27, [sp, #2]");
1235 COMPARE(ldr(q28, MemOperand(sp, 16)), "ldr q28, [sp, #16]");
1236
1237 CLEANUP();
1238}
1239
1240
1241TEST(load_store_v_pre) {
1242 SETUP();
1243
armvixlad96eda2013-06-14 11:42:37 +01001244 COMPARE(ldr(s0, MemOperand(x1, 4, PreIndex)), "ldr s0, [x1, #4]!");
1245 COMPARE(ldr(s2, MemOperand(x3, 255, PreIndex)), "ldr s2, [x3, #255]!");
1246 COMPARE(ldr(s4, MemOperand(x5, -256, PreIndex)), "ldr s4, [x5, #-256]!");
1247 COMPARE(ldr(d6, MemOperand(x7, 8, PreIndex)), "ldr d6, [x7, #8]!");
1248 COMPARE(ldr(d8, MemOperand(x9, 255, PreIndex)), "ldr d8, [x9, #255]!");
1249 COMPARE(ldr(d10, MemOperand(x11, -256, PreIndex)), "ldr d10, [x11, #-256]!");
armvixl5289c592015-03-02 13:52:04 +00001250
armvixlad96eda2013-06-14 11:42:37 +01001251 COMPARE(str(s12, MemOperand(x13, 4, PreIndex)), "str s12, [x13, #4]!");
1252 COMPARE(str(s14, MemOperand(x15, 255, PreIndex)), "str s14, [x15, #255]!");
1253 COMPARE(str(s16, MemOperand(x17, -256, PreIndex)), "str s16, [x17, #-256]!");
1254 COMPARE(str(d18, MemOperand(x19, 8, PreIndex)), "str d18, [x19, #8]!");
1255 COMPARE(str(d20, MemOperand(x21, 255, PreIndex)), "str d20, [x21, #255]!");
1256 COMPARE(str(d22, MemOperand(x23, -256, PreIndex)), "str d22, [x23, #-256]!");
1257
armvixl5289c592015-03-02 13:52:04 +00001258 COMPARE(ldr(b0, MemOperand(x1, 1, PreIndex)), "ldr b0, [x1, #1]!");
1259 COMPARE(ldr(b2, MemOperand(x3, 255, PreIndex)), "ldr b2, [x3, #255]!");
1260 COMPARE(ldr(b4, MemOperand(x5, -256, PreIndex)), "ldr b4, [x5, #-256]!");
1261 COMPARE(ldr(h6, MemOperand(x7, 2, PreIndex)), "ldr h6, [x7, #2]!");
1262 COMPARE(ldr(h8, MemOperand(x9, 255, PreIndex)), "ldr h8, [x9, #255]!");
1263 COMPARE(ldr(h10, MemOperand(x11, -256, PreIndex)), "ldr h10, [x11, #-256]!");
1264 COMPARE(ldr(q12, MemOperand(x13, 16, PreIndex)), "ldr q12, [x13, #16]!");
1265 COMPARE(ldr(q14, MemOperand(x15, 255, PreIndex)), "ldr q14, [x15, #255]!");
1266 COMPARE(ldr(q16, MemOperand(x17, -256, PreIndex)), "ldr q16, [x17, #-256]!");
1267
1268 COMPARE(str(b18, MemOperand(x19, 1, PreIndex)), "str b18, [x19, #1]!");
1269 COMPARE(str(b20, MemOperand(x21, 255, PreIndex)), "str b20, [x21, #255]!");
1270 COMPARE(str(b22, MemOperand(x23, -256, PreIndex)), "str b22, [x23, #-256]!");
1271 COMPARE(str(h24, MemOperand(x25, 2, PreIndex)), "str h24, [x25, #2]!");
1272 COMPARE(str(h26, MemOperand(x27, 255, PreIndex)), "str h26, [x27, #255]!");
1273 COMPARE(str(h28, MemOperand(x29, -256, PreIndex)), "str h28, [x29, #-256]!");
1274 COMPARE(str(q30, MemOperand(x1, 16, PreIndex)), "str q30, [x1, #16]!");
1275 COMPARE(str(q31, MemOperand(x3, 255, PreIndex)), "str q31, [x3, #255]!");
1276 COMPARE(str(q0, MemOperand(x5, -256, PreIndex)), "str q0, [x5, #-256]!");
1277
1278 COMPARE(str(b24, MemOperand(sp, 1, PreIndex)), "str b24, [sp, #1]!");
1279 COMPARE(str(h25, MemOperand(sp, -2, PreIndex)), "str h25, [sp, #-2]!");
1280 COMPARE(str(s26, MemOperand(sp, 4, PreIndex)), "str s26, [sp, #4]!");
1281 COMPARE(str(d27, MemOperand(sp, -8, PreIndex)), "str d27, [sp, #-8]!");
1282 COMPARE(str(q28, MemOperand(sp, 16, PreIndex)), "str q28, [sp, #16]!");
1283
1284 CLEANUP();
1285}
1286
1287
1288TEST(load_store_v_post) {
1289 SETUP();
1290
armvixlad96eda2013-06-14 11:42:37 +01001291 COMPARE(ldr(s0, MemOperand(x1, 4, PostIndex)), "ldr s0, [x1], #4");
1292 COMPARE(ldr(s2, MemOperand(x3, 255, PostIndex)), "ldr s2, [x3], #255");
1293 COMPARE(ldr(s4, MemOperand(x5, -256, PostIndex)), "ldr s4, [x5], #-256");
1294 COMPARE(ldr(d6, MemOperand(x7, 8, PostIndex)), "ldr d6, [x7], #8");
1295 COMPARE(ldr(d8, MemOperand(x9, 255, PostIndex)), "ldr d8, [x9], #255");
1296 COMPARE(ldr(d10, MemOperand(x11, -256, PostIndex)), "ldr d10, [x11], #-256");
armvixl5289c592015-03-02 13:52:04 +00001297
armvixlad96eda2013-06-14 11:42:37 +01001298 COMPARE(str(s12, MemOperand(x13, 4, PostIndex)), "str s12, [x13], #4");
1299 COMPARE(str(s14, MemOperand(x15, 255, PostIndex)), "str s14, [x15], #255");
1300 COMPARE(str(s16, MemOperand(x17, -256, PostIndex)), "str s16, [x17], #-256");
1301 COMPARE(str(d18, MemOperand(x19, 8, PostIndex)), "str d18, [x19], #8");
1302 COMPARE(str(d20, MemOperand(x21, 255, PostIndex)), "str d20, [x21], #255");
1303 COMPARE(str(d22, MemOperand(x23, -256, PostIndex)), "str d22, [x23], #-256");
1304
armvixl5289c592015-03-02 13:52:04 +00001305 COMPARE(ldr(b0, MemOperand(x1, 4, PostIndex)), "ldr b0, [x1], #4");
1306 COMPARE(ldr(b2, MemOperand(x3, 255, PostIndex)), "ldr b2, [x3], #255");
1307 COMPARE(ldr(b4, MemOperand(x5, -256, PostIndex)), "ldr b4, [x5], #-256");
1308 COMPARE(ldr(h6, MemOperand(x7, 8, PostIndex)), "ldr h6, [x7], #8");
1309 COMPARE(ldr(h8, MemOperand(x9, 255, PostIndex)), "ldr h8, [x9], #255");
1310 COMPARE(ldr(h10, MemOperand(x11, -256, PostIndex)), "ldr h10, [x11], #-256");
1311 COMPARE(ldr(q12, MemOperand(x13, 8, PostIndex)), "ldr q12, [x13], #8");
1312 COMPARE(ldr(q14, MemOperand(x15, 255, PostIndex)), "ldr q14, [x15], #255");
1313 COMPARE(ldr(q16, MemOperand(x17, -256, PostIndex)), "ldr q16, [x17], #-256");
1314
1315 COMPARE(str(b18, MemOperand(x19, 4, PostIndex)), "str b18, [x19], #4");
1316 COMPARE(str(b20, MemOperand(x21, 255, PostIndex)), "str b20, [x21], #255");
1317 COMPARE(str(b22, MemOperand(x23, -256, PostIndex)), "str b22, [x23], #-256");
1318 COMPARE(str(h24, MemOperand(x25, 8, PostIndex)), "str h24, [x25], #8");
1319 COMPARE(str(h26, MemOperand(x27, 255, PostIndex)), "str h26, [x27], #255");
1320 COMPARE(str(h28, MemOperand(x29, -256, PostIndex)), "str h28, [x29], #-256");
1321 COMPARE(str(q30, MemOperand(x1, 8, PostIndex)), "str q30, [x1], #8");
1322 COMPARE(str(q31, MemOperand(x3, 255, PostIndex)), "str q31, [x3], #255");
1323 COMPARE(str(q0, MemOperand(x5, -256, PostIndex)), "str q0, [x5], #-256");
1324
1325 COMPARE(ldr(b24, MemOperand(sp, -1, PreIndex)), "ldr b24, [sp, #-1]!");
1326 COMPARE(ldr(h25, MemOperand(sp, 2, PreIndex)), "ldr h25, [sp, #2]!");
1327 COMPARE(ldr(s26, MemOperand(sp, -4, PreIndex)), "ldr s26, [sp, #-4]!");
1328 COMPARE(ldr(d27, MemOperand(sp, 8, PreIndex)), "ldr d27, [sp, #8]!");
1329 COMPARE(ldr(q28, MemOperand(sp, -16, PreIndex)), "ldr q28, [sp, #-16]!");
1330
1331 CLEANUP();
1332}
1333
1334
1335TEST(load_store_v_regoffset) {
1336 SETUP();
1337
1338 COMPARE(ldr(b0, MemOperand(x1, x2)), "ldr b0, [x1, x2]");
1339 COMPARE(ldr(b1, MemOperand(x2, w3, UXTW)), "ldr b1, [x2, w3, uxtw]");
1340 COMPARE(ldr(b2, MemOperand(x3, w4, SXTW)), "ldr b2, [x3, w4, sxtw]");
1341 // We can't assemble this instruction, but we check it disassembles correctly.
1342 COMPARE(dci(0x3c657883), "ldr b3, [x4, x5, lsl #0]");
1343 COMPARE(ldr(b30, MemOperand(sp, xzr)), "ldr b30, [sp, xzr]");
1344 COMPARE(ldr(b31, MemOperand(sp, wzr, UXTW)), "ldr b31, [sp, wzr, uxtw]");
1345
1346 COMPARE(ldr(h0, MemOperand(x1, x2)), "ldr h0, [x1, x2]");
1347 COMPARE(ldr(h1, MemOperand(x2, w3, UXTW)), "ldr h1, [x2, w3, uxtw]");
1348 COMPARE(ldr(h2, MemOperand(x3, w4, SXTW)), "ldr h2, [x3, w4, sxtw]");
1349 COMPARE(ldr(h3, MemOperand(x4, w5, UXTW, 1)), "ldr h3, [x4, w5, uxtw #1]");
1350 COMPARE(ldr(h4, MemOperand(x5, w5, SXTW, 1)), "ldr h4, [x5, w5, sxtw #1]");
1351 COMPARE(ldr(h30, MemOperand(sp, xzr)), "ldr h30, [sp, xzr]");
1352 COMPARE(ldr(h31, MemOperand(sp, wzr, SXTW, 1)),
1353 "ldr h31, [sp, wzr, sxtw #1]");
1354
1355 COMPARE(ldr(s0, MemOperand(x1, x2)), "ldr s0, [x1, x2]");
1356 COMPARE(ldr(s1, MemOperand(x2, w3, UXTW)), "ldr s1, [x2, w3, uxtw]");
1357 COMPARE(ldr(s2, MemOperand(x3, w4, SXTW)), "ldr s2, [x3, w4, sxtw]");
1358 COMPARE(ldr(s3, MemOperand(x4, w5, UXTW, 2)), "ldr s3, [x4, w5, uxtw #2]");
1359 COMPARE(ldr(s4, MemOperand(x5, w5, SXTW, 2)), "ldr s4, [x5, w5, sxtw #2]");
1360 COMPARE(ldr(s30, MemOperand(sp, xzr)), "ldr s30, [sp, xzr]");
1361 COMPARE(ldr(s31, MemOperand(sp, wzr, SXTW, 2)),
1362 "ldr s31, [sp, wzr, sxtw #2]");
1363
1364 COMPARE(ldr(d0, MemOperand(x1, x2)), "ldr d0, [x1, x2]");
1365 COMPARE(ldr(d1, MemOperand(x2, w3, UXTW)), "ldr d1, [x2, w3, uxtw]");
1366 COMPARE(ldr(d2, MemOperand(x3, w4, SXTW)), "ldr d2, [x3, w4, sxtw]");
1367 COMPARE(ldr(d3, MemOperand(x4, w5, UXTW, 3)), "ldr d3, [x4, w5, uxtw #3]");
1368 COMPARE(ldr(d4, MemOperand(x5, w5, SXTW, 3)), "ldr d4, [x5, w5, sxtw #3]");
1369 COMPARE(ldr(d30, MemOperand(sp, xzr)), "ldr d30, [sp, xzr]");
1370 COMPARE(ldr(d31, MemOperand(sp, wzr, SXTW, 3)),
1371 "ldr d31, [sp, wzr, sxtw #3]");
1372
1373 COMPARE(ldr(q0, MemOperand(x1, x2)), "ldr q0, [x1, x2]");
1374 COMPARE(ldr(q1, MemOperand(x2, w3, UXTW)), "ldr q1, [x2, w3, uxtw]");
1375 COMPARE(ldr(q2, MemOperand(x3, w4, SXTW)), "ldr q2, [x3, w4, sxtw]");
1376 COMPARE(ldr(q3, MemOperand(x4, w5, UXTW, 4)), "ldr q3, [x4, w5, uxtw #4]");
1377 COMPARE(ldr(q4, MemOperand(x5, w5, SXTW, 4)), "ldr q4, [x5, w5, sxtw #4]");
1378 COMPARE(ldr(q30, MemOperand(sp, xzr)), "ldr q30, [sp, xzr]");
1379 COMPARE(ldr(q31, MemOperand(sp, wzr, SXTW, 4)),
1380 "ldr q31, [sp, wzr, sxtw #4]");
1381
1382 COMPARE(str(b0, MemOperand(x1, x2)), "str b0, [x1, x2]");
1383 COMPARE(str(b1, MemOperand(x2, w3, UXTW)), "str b1, [x2, w3, uxtw]");
1384 COMPARE(str(b2, MemOperand(x3, w4, SXTW)), "str b2, [x3, w4, sxtw]");
1385 // We can't assemble this instruction, but we check it disassembles correctly.
1386 COMPARE(dci(0x3c257883), "str b3, [x4, x5, lsl #0]");
1387 COMPARE(str(b30, MemOperand(sp, xzr)), "str b30, [sp, xzr]");
1388 COMPARE(str(b31, MemOperand(sp, wzr, UXTW)), "str b31, [sp, wzr, uxtw]");
1389
1390 COMPARE(str(h0, MemOperand(x1, x2)), "str h0, [x1, x2]");
1391 COMPARE(str(h1, MemOperand(x2, w3, UXTW)), "str h1, [x2, w3, uxtw]");
1392 COMPARE(str(h2, MemOperand(x3, w4, SXTW)), "str h2, [x3, w4, sxtw]");
1393 COMPARE(str(h3, MemOperand(x4, w5, UXTW, 1)), "str h3, [x4, w5, uxtw #1]");
1394 COMPARE(str(h4, MemOperand(x5, w5, SXTW, 1)), "str h4, [x5, w5, sxtw #1]");
1395 COMPARE(str(h30, MemOperand(sp, xzr)), "str h30, [sp, xzr]");
1396 COMPARE(str(h31, MemOperand(sp, wzr, SXTW, 1)),
1397 "str h31, [sp, wzr, sxtw #1]");
1398
1399 COMPARE(str(s0, MemOperand(x1, x2)), "str s0, [x1, x2]");
1400 COMPARE(str(s1, MemOperand(x2, w3, UXTW)), "str s1, [x2, w3, uxtw]");
1401 COMPARE(str(s2, MemOperand(x3, w4, SXTW)), "str s2, [x3, w4, sxtw]");
1402 COMPARE(str(s3, MemOperand(x4, w5, UXTW, 2)), "str s3, [x4, w5, uxtw #2]");
1403 COMPARE(str(s4, MemOperand(x5, w5, SXTW, 2)), "str s4, [x5, w5, sxtw #2]");
1404 COMPARE(str(s30, MemOperand(sp, xzr)), "str s30, [sp, xzr]");
1405 COMPARE(str(s31, MemOperand(sp, wzr, SXTW, 2)),
1406 "str s31, [sp, wzr, sxtw #2]");
1407
1408 COMPARE(str(d0, MemOperand(x1, x2)), "str d0, [x1, x2]");
1409 COMPARE(str(d1, MemOperand(x2, w3, UXTW)), "str d1, [x2, w3, uxtw]");
1410 COMPARE(str(d2, MemOperand(x3, w4, SXTW)), "str d2, [x3, w4, sxtw]");
1411 COMPARE(str(d3, MemOperand(x4, w5, UXTW, 3)), "str d3, [x4, w5, uxtw #3]");
1412 COMPARE(str(d4, MemOperand(x5, w5, SXTW, 3)), "str d4, [x5, w5, sxtw #3]");
1413 COMPARE(str(d30, MemOperand(sp, xzr)), "str d30, [sp, xzr]");
1414 COMPARE(str(d31, MemOperand(sp, wzr, SXTW, 3)),
1415 "str d31, [sp, wzr, sxtw #3]");
1416
1417 COMPARE(str(q0, MemOperand(x1, x2)), "str q0, [x1, x2]");
1418 COMPARE(str(q1, MemOperand(x2, w3, UXTW)), "str q1, [x2, w3, uxtw]");
1419 COMPARE(str(q2, MemOperand(x3, w4, SXTW)), "str q2, [x3, w4, sxtw]");
1420 COMPARE(str(q3, MemOperand(x4, w5, UXTW, 4)), "str q3, [x4, w5, uxtw #4]");
1421 COMPARE(str(q4, MemOperand(x5, w5, SXTW, 4)), "str q4, [x5, w5, sxtw #4]");
1422 COMPARE(str(q30, MemOperand(sp, xzr)), "str q30, [sp, xzr]");
1423 COMPARE(str(q31, MemOperand(sp, wzr, SXTW, 4)),
1424 "str q31, [sp, wzr, sxtw #4]");
armvixlad96eda2013-06-14 11:42:37 +01001425
1426 CLEANUP();
1427}
1428
1429
1430TEST(load_store_unscaled) {
1431 SETUP();
1432
armvixl4a102ba2014-07-14 09:02:40 +01001433 // If an unscaled-offset instruction is requested, it is used, even if the
1434 // offset could be encoded in a scaled-offset instruction.
1435 COMPARE(ldurb(w0, MemOperand(x1)), "ldurb w0, [x1]");
1436 COMPARE(ldurb(x2, MemOperand(x3, 1)), "ldurb w2, [x3, #1]");
1437 COMPARE(ldurb(w4, MemOperand(x5, 255)), "ldurb w4, [x5, #255]");
1438 COMPARE(sturb(w14, MemOperand(x15)), "sturb w14, [x15]");
1439 COMPARE(sturb(x16, MemOperand(x17, 1)), "sturb w16, [x17, #1]");
1440 COMPARE(sturb(w18, MemOperand(x19, 255)), "sturb w18, [x19, #255]");
1441 COMPARE(ldursb(w0, MemOperand(x1)), "ldursb w0, [x1]");
1442 COMPARE(ldursb(w2, MemOperand(x3, 1)), "ldursb w2, [x3, #1]");
1443 COMPARE(ldursb(x2, MemOperand(x3, 255)), "ldursb x2, [x3, #255]");
1444
1445 COMPARE(ldurh(w0, MemOperand(x1)), "ldurh w0, [x1]");
1446 COMPARE(ldurh(x2, MemOperand(x3, 2)), "ldurh w2, [x3, #2]");
1447 COMPARE(ldurh(w4, MemOperand(x5, 254)), "ldurh w4, [x5, #254]");
1448 COMPARE(sturh(w14, MemOperand(x15)), "sturh w14, [x15]");
1449 COMPARE(sturh(x16, MemOperand(x17, 2)), "sturh w16, [x17, #2]");
1450 COMPARE(sturh(w18, MemOperand(x19, 254)), "sturh w18, [x19, #254]");
1451 COMPARE(ldursh(w0, MemOperand(x1)), "ldursh w0, [x1]");
1452 COMPARE(ldursh(w2, MemOperand(x3, 2)), "ldursh w2, [x3, #2]");
1453 COMPARE(ldursh(x4, MemOperand(x5, 254)), "ldursh x4, [x5, #254]");
1454
1455 COMPARE(ldur(w0, MemOperand(x1)), "ldur w0, [x1]");
1456 COMPARE(ldur(w2, MemOperand(x3, 4)), "ldur w2, [x3, #4]");
1457 COMPARE(ldur(w4, MemOperand(x5, 248)), "ldur w4, [x5, #248]");
1458 COMPARE(stur(w12, MemOperand(x13)), "stur w12, [x13]");
1459 COMPARE(stur(w14, MemOperand(x15, 4)), "stur w14, [x15, #4]");
1460 COMPARE(stur(w16, MemOperand(x17, 248)), "stur w16, [x17, #248]");
1461 COMPARE(ldursw(x0, MemOperand(x1)), "ldursw x0, [x1]");
1462 COMPARE(ldursw(x2, MemOperand(x3, 4)), "ldursw x2, [x3, #4]");
1463 COMPARE(ldursw(x4, MemOperand(x5, 248)), "ldursw x4, [x5, #248]");
1464
1465 COMPARE(ldur(x6, MemOperand(x7)), "ldur x6, [x7]");
1466 COMPARE(ldur(x8, MemOperand(x9, 8)), "ldur x8, [x9, #8]");
1467 COMPARE(ldur(x10, MemOperand(x11, 248)), "ldur x10, [x11, #248]");
1468 COMPARE(stur(x18, MemOperand(x19)), "stur x18, [x19]");
1469 COMPARE(stur(x20, MemOperand(x21, 8)), "stur x20, [x21, #8]");
1470 COMPARE(stur(x22, MemOperand(x23, 248)), "stur x22, [x23, #248]");
1471
armvixl5289c592015-03-02 13:52:04 +00001472 COMPARE(ldur(b0, MemOperand(x1)), "ldur b0, [x1]");
1473 COMPARE(ldur(h2, MemOperand(x3, -1)), "ldur h2, [x3, #-1]");
1474 COMPARE(ldur(s4, MemOperand(x5, 2)), "ldur s4, [x5, #2]");
1475 COMPARE(ldur(d6, MemOperand(x7, -3)), "ldur d6, [x7, #-3]");
1476 COMPARE(ldur(q8, MemOperand(x9, 4)), "ldur q8, [x9, #4]");
1477 COMPARE(stur(b10, MemOperand(x11)), "stur b10, [x11]");
1478 COMPARE(stur(h12, MemOperand(x13, -1)), "stur h12, [x13, #-1]");
1479 COMPARE(stur(s14, MemOperand(x15, 2)), "stur s14, [x15, #2]");
1480 COMPARE(stur(d16, MemOperand(x17, -3)), "stur d16, [x17, #-3]");
1481 COMPARE(stur(q18, MemOperand(x19, 4)), "stur q18, [x19, #4]");
1482
armvixl4a102ba2014-07-14 09:02:40 +01001483 // Normal loads and stores are converted to unscaled loads and stores if the
1484 // offset requires it.
armvixlad96eda2013-06-14 11:42:37 +01001485 COMPARE(ldr(w0, MemOperand(x1, 1)), "ldur w0, [x1, #1]");
1486 COMPARE(ldr(w2, MemOperand(x3, -1)), "ldur w2, [x3, #-1]");
1487 COMPARE(ldr(w4, MemOperand(x5, 255)), "ldur w4, [x5, #255]");
1488 COMPARE(ldr(w6, MemOperand(x7, -256)), "ldur w6, [x7, #-256]");
1489 COMPARE(ldr(x8, MemOperand(x9, 1)), "ldur x8, [x9, #1]");
1490 COMPARE(ldr(x10, MemOperand(x11, -1)), "ldur x10, [x11, #-1]");
1491 COMPARE(ldr(x12, MemOperand(x13, 255)), "ldur x12, [x13, #255]");
1492 COMPARE(ldr(x14, MemOperand(x15, -256)), "ldur x14, [x15, #-256]");
1493 COMPARE(str(w16, MemOperand(x17, 1)), "stur w16, [x17, #1]");
1494 COMPARE(str(w18, MemOperand(x19, -1)), "stur w18, [x19, #-1]");
1495 COMPARE(str(w20, MemOperand(x21, 255)), "stur w20, [x21, #255]");
1496 COMPARE(str(w22, MemOperand(x23, -256)), "stur w22, [x23, #-256]");
1497 COMPARE(str(x24, MemOperand(x25, 1)), "stur x24, [x25, #1]");
1498 COMPARE(str(x26, MemOperand(x27, -1)), "stur x26, [x27, #-1]");
1499 COMPARE(str(x28, MemOperand(x29, 255)), "stur x28, [x29, #255]");
1500 COMPARE(str(x30, MemOperand(x0, -256)), "stur x30, [x0, #-256]");
1501 COMPARE(ldr(w0, MemOperand(sp, 1)), "ldur w0, [sp, #1]");
1502 COMPARE(str(x1, MemOperand(sp, -1)), "stur x1, [sp, #-1]");
1503 COMPARE(ldrb(w2, MemOperand(x3, -2)), "ldurb w2, [x3, #-2]");
1504 COMPARE(ldrsb(w4, MemOperand(x5, -3)), "ldursb w4, [x5, #-3]");
1505 COMPARE(ldrsb(x6, MemOperand(x7, -4)), "ldursb x6, [x7, #-4]");
1506 COMPARE(ldrh(w8, MemOperand(x9, -5)), "ldurh w8, [x9, #-5]");
1507 COMPARE(ldrsh(w10, MemOperand(x11, -6)), "ldursh w10, [x11, #-6]");
1508 COMPARE(ldrsh(x12, MemOperand(x13, -7)), "ldursh x12, [x13, #-7]");
1509 COMPARE(ldrsw(x14, MemOperand(x15, -8)), "ldursw x14, [x15, #-8]");
1510
1511 CLEANUP();
1512}
1513
armvixl4a102ba2014-07-14 09:02:40 +01001514
1515TEST(load_store_unscaled_option) {
1516 SETUP();
1517
1518 // Just like load_store_unscaled, but specify the scaling option explicitly.
1519 LoadStoreScalingOption options[] = {
1520 PreferUnscaledOffset,
1521 RequireUnscaledOffset
1522 };
1523
1524 for (size_t i = 0; i < sizeof(options)/sizeof(options[0]); i++) {
1525 LoadStoreScalingOption option = options[i];
1526
1527 // If an unscaled-offset instruction is requested, it is used, even if the
1528 // offset could be encoded in a scaled-offset instruction.
1529 COMPARE(ldurb(w0, MemOperand(x1), option), "ldurb w0, [x1]");
1530 COMPARE(ldurb(x2, MemOperand(x3, 1), option), "ldurb w2, [x3, #1]");
1531 COMPARE(ldurb(w4, MemOperand(x5, 255), option), "ldurb w4, [x5, #255]");
1532 COMPARE(sturb(w14, MemOperand(x15), option), "sturb w14, [x15]");
1533 COMPARE(sturb(x16, MemOperand(x17, 1), option), "sturb w16, [x17, #1]");
1534 COMPARE(sturb(w18, MemOperand(x19, 255), option), "sturb w18, [x19, #255]");
1535 COMPARE(ldursb(w0, MemOperand(x1), option), "ldursb w0, [x1]");
1536 COMPARE(ldursb(w2, MemOperand(x3, 1), option), "ldursb w2, [x3, #1]");
1537 COMPARE(ldursb(x2, MemOperand(x3, 255), option), "ldursb x2, [x3, #255]");
1538
1539 COMPARE(ldurh(w0, MemOperand(x1), option), "ldurh w0, [x1]");
1540 COMPARE(ldurh(x2, MemOperand(x3, 2), option), "ldurh w2, [x3, #2]");
1541 COMPARE(ldurh(w4, MemOperand(x5, 254), option), "ldurh w4, [x5, #254]");
1542 COMPARE(sturh(w14, MemOperand(x15), option), "sturh w14, [x15]");
1543 COMPARE(sturh(x16, MemOperand(x17, 2), option), "sturh w16, [x17, #2]");
1544 COMPARE(sturh(w18, MemOperand(x19, 254), option), "sturh w18, [x19, #254]");
1545 COMPARE(ldursh(w0, MemOperand(x1), option), "ldursh w0, [x1]");
1546 COMPARE(ldursh(w2, MemOperand(x3, 2), option), "ldursh w2, [x3, #2]");
1547 COMPARE(ldursh(x4, MemOperand(x5, 254), option), "ldursh x4, [x5, #254]");
1548
1549 COMPARE(ldur(w0, MemOperand(x1), option), "ldur w0, [x1]");
1550 COMPARE(ldur(w2, MemOperand(x3, 4), option), "ldur w2, [x3, #4]");
1551 COMPARE(ldur(w4, MemOperand(x5, 248), option), "ldur w4, [x5, #248]");
1552 COMPARE(stur(w12, MemOperand(x13), option), "stur w12, [x13]");
1553 COMPARE(stur(w14, MemOperand(x15, 4), option), "stur w14, [x15, #4]");
1554 COMPARE(stur(w16, MemOperand(x17, 248), option), "stur w16, [x17, #248]");
1555 COMPARE(ldursw(x0, MemOperand(x1), option), "ldursw x0, [x1]");
1556 COMPARE(ldursw(x2, MemOperand(x3, 4), option), "ldursw x2, [x3, #4]");
1557 COMPARE(ldursw(x4, MemOperand(x5, 248), option), "ldursw x4, [x5, #248]");
1558
1559 COMPARE(ldur(x6, MemOperand(x7), option), "ldur x6, [x7]");
1560 COMPARE(ldur(x8, MemOperand(x9, 8), option), "ldur x8, [x9, #8]");
1561 COMPARE(ldur(x10, MemOperand(x11, 248), option), "ldur x10, [x11, #248]");
1562 COMPARE(stur(x18, MemOperand(x19), option), "stur x18, [x19]");
1563 COMPARE(stur(x20, MemOperand(x21, 8), option), "stur x20, [x21, #8]");
1564 COMPARE(stur(x22, MemOperand(x23, 248), option), "stur x22, [x23, #248]");
armvixl5289c592015-03-02 13:52:04 +00001565
1566 COMPARE(ldur(b0, MemOperand(x1), option), "ldur b0, [x1]");
1567 COMPARE(ldur(h2, MemOperand(x3, 2), option), "ldur h2, [x3, #2]");
1568 COMPARE(ldur(s4, MemOperand(x5, 4), option), "ldur s4, [x5, #4]");
1569 COMPARE(ldur(d6, MemOperand(x7, 8), option), "ldur d6, [x7, #8]");
1570 COMPARE(ldur(q8, MemOperand(x9, 16), option), "ldur q8, [x9, #16]");
1571 COMPARE(stur(b10, MemOperand(x11), option), "stur b10, [x11]");
1572 COMPARE(stur(h12, MemOperand(x13, 2), option), "stur h12, [x13, #2]");
1573 COMPARE(stur(s14, MemOperand(x15, 4), option), "stur s14, [x15, #4]");
1574 COMPARE(stur(d16, MemOperand(x17, 8), option), "stur d16, [x17, #8]");
1575 COMPARE(stur(q18, MemOperand(x19, 16), option), "stur q18, [x19, #16]");
armvixl4a102ba2014-07-14 09:02:40 +01001576 }
1577
1578 // Normal loads and stores are converted to unscaled loads and stores if the
1579 // offset requires it. PreferScaledOffset is the default for these cases, so
1580 // the behaviour here is the same when no option is specified.
1581 LoadStoreScalingOption option = PreferScaledOffset;
1582 COMPARE(ldr(w0, MemOperand(x1, 1), option), "ldur w0, [x1, #1]");
1583 COMPARE(ldr(w2, MemOperand(x3, -1), option), "ldur w2, [x3, #-1]");
1584 COMPARE(ldr(w4, MemOperand(x5, 255), option), "ldur w4, [x5, #255]");
1585 COMPARE(ldr(w6, MemOperand(x7, -256), option), "ldur w6, [x7, #-256]");
1586 COMPARE(ldr(x8, MemOperand(x9, 1), option), "ldur x8, [x9, #1]");
1587 COMPARE(ldr(x10, MemOperand(x11, -1), option), "ldur x10, [x11, #-1]");
1588 COMPARE(ldr(x12, MemOperand(x13, 255), option), "ldur x12, [x13, #255]");
1589 COMPARE(ldr(x14, MemOperand(x15, -256), option), "ldur x14, [x15, #-256]");
1590 COMPARE(str(w16, MemOperand(x17, 1), option), "stur w16, [x17, #1]");
1591 COMPARE(str(w18, MemOperand(x19, -1), option), "stur w18, [x19, #-1]");
1592 COMPARE(str(w20, MemOperand(x21, 255), option), "stur w20, [x21, #255]");
1593 COMPARE(str(w22, MemOperand(x23, -256), option), "stur w22, [x23, #-256]");
1594 COMPARE(str(x24, MemOperand(x25, 1), option), "stur x24, [x25, #1]");
1595 COMPARE(str(x26, MemOperand(x27, -1), option), "stur x26, [x27, #-1]");
1596 COMPARE(str(x28, MemOperand(x29, 255), option), "stur x28, [x29, #255]");
1597 COMPARE(str(x30, MemOperand(x0, -256), option), "stur x30, [x0, #-256]");
1598 COMPARE(ldr(w0, MemOperand(sp, 1), option), "ldur w0, [sp, #1]");
1599 COMPARE(str(x1, MemOperand(sp, -1), option), "stur x1, [sp, #-1]");
1600 COMPARE(ldrb(w2, MemOperand(x3, -2), option), "ldurb w2, [x3, #-2]");
1601 COMPARE(ldrsb(w4, MemOperand(x5, -3), option), "ldursb w4, [x5, #-3]");
1602 COMPARE(ldrsb(x6, MemOperand(x7, -4), option), "ldursb x6, [x7, #-4]");
1603 COMPARE(ldrh(w8, MemOperand(x9, -5), option), "ldurh w8, [x9, #-5]");
1604 COMPARE(ldrsh(w10, MemOperand(x11, -6), option), "ldursh w10, [x11, #-6]");
1605 COMPARE(ldrsh(x12, MemOperand(x13, -7), option), "ldursh x12, [x13, #-7]");
1606 COMPARE(ldrsw(x14, MemOperand(x15, -8), option), "ldursw x14, [x15, #-8]");
armvixl5289c592015-03-02 13:52:04 +00001607 COMPARE(ldr(b0, MemOperand(x1, 1), option), "ldr b0, [x1, #1]");
1608 COMPARE(ldr(h2, MemOperand(x3, 1), option), "ldur h2, [x3, #1]");
1609 COMPARE(ldr(s4, MemOperand(x5, 3), option), "ldur s4, [x5, #3]");
1610 COMPARE(ldr(d6, MemOperand(x7, 7), option), "ldur d6, [x7, #7]");
1611 COMPARE(ldr(q8, MemOperand(x9, 15), option), "ldur q8, [x9, #15]");
1612 COMPARE(str(b10, MemOperand(x11, 1), option), "str b10, [x11, #1]");
1613 COMPARE(str(h12, MemOperand(x13, 1), option), "stur h12, [x13, #1]");
1614 COMPARE(str(s14, MemOperand(x15, 3), option), "stur s14, [x15, #3]");
1615 COMPARE(str(d16, MemOperand(x17, 7), option), "stur d16, [x17, #7]");
1616 COMPARE(str(q18, MemOperand(x19, 15), option), "stur q18, [x19, #15]");
armvixl4a102ba2014-07-14 09:02:40 +01001617
1618 CLEANUP();
1619}
1620
1621
armvixlad96eda2013-06-14 11:42:37 +01001622TEST(load_store_pair) {
1623 SETUP();
1624
1625 COMPARE(ldp(w0, w1, MemOperand(x2)), "ldp w0, w1, [x2]");
1626 COMPARE(ldp(x3, x4, MemOperand(x5)), "ldp x3, x4, [x5]");
1627 COMPARE(ldp(w6, w7, MemOperand(x8, 4)), "ldp w6, w7, [x8, #4]");
1628 COMPARE(ldp(x9, x10, MemOperand(x11, 8)), "ldp x9, x10, [x11, #8]");
1629 COMPARE(ldp(w12, w13, MemOperand(x14, 252)), "ldp w12, w13, [x14, #252]");
1630 COMPARE(ldp(x15, x16, MemOperand(x17, 504)), "ldp x15, x16, [x17, #504]");
1631 COMPARE(ldp(w18, w19, MemOperand(x20, -256)), "ldp w18, w19, [x20, #-256]");
1632 COMPARE(ldp(x21, x22, MemOperand(x23, -512)), "ldp x21, x22, [x23, #-512]");
1633 COMPARE(ldp(w24, w25, MemOperand(x26, 252, PreIndex)),
1634 "ldp w24, w25, [x26, #252]!");
1635 COMPARE(ldp(x27, x28, MemOperand(x29, 504, PreIndex)),
1636 "ldp x27, x28, [x29, #504]!");
1637 COMPARE(ldp(w30, w0, MemOperand(x1, -256, PreIndex)),
1638 "ldp w30, w0, [x1, #-256]!");
1639 COMPARE(ldp(x2, x3, MemOperand(x4, -512, PreIndex)),
1640 "ldp x2, x3, [x4, #-512]!");
1641 COMPARE(ldp(w5, w6, MemOperand(x7, 252, PostIndex)),
1642 "ldp w5, w6, [x7], #252");
1643 COMPARE(ldp(x8, x9, MemOperand(x10, 504, PostIndex)),
1644 "ldp x8, x9, [x10], #504");
1645 COMPARE(ldp(w11, w12, MemOperand(x13, -256, PostIndex)),
1646 "ldp w11, w12, [x13], #-256");
1647 COMPARE(ldp(x14, x15, MemOperand(x16, -512, PostIndex)),
1648 "ldp x14, x15, [x16], #-512");
1649
1650 COMPARE(ldp(s17, s18, MemOperand(x19)), "ldp s17, s18, [x19]");
1651 COMPARE(ldp(s20, s21, MemOperand(x22, 252)), "ldp s20, s21, [x22, #252]");
1652 COMPARE(ldp(s23, s24, MemOperand(x25, -256)), "ldp s23, s24, [x25, #-256]");
1653 COMPARE(ldp(s26, s27, MemOperand(x28, 252, PreIndex)),
1654 "ldp s26, s27, [x28, #252]!");
1655 COMPARE(ldp(s29, s30, MemOperand(x29, -256, PreIndex)),
1656 "ldp s29, s30, [x29, #-256]!");
1657 COMPARE(ldp(s31, s0, MemOperand(x1, 252, PostIndex)),
1658 "ldp s31, s0, [x1], #252");
1659 COMPARE(ldp(s2, s3, MemOperand(x4, -256, PostIndex)),
1660 "ldp s2, s3, [x4], #-256");
1661 COMPARE(ldp(d17, d18, MemOperand(x19)), "ldp d17, d18, [x19]");
1662 COMPARE(ldp(d20, d21, MemOperand(x22, 504)), "ldp d20, d21, [x22, #504]");
1663 COMPARE(ldp(d23, d24, MemOperand(x25, -512)), "ldp d23, d24, [x25, #-512]");
1664 COMPARE(ldp(d26, d27, MemOperand(x28, 504, PreIndex)),
1665 "ldp d26, d27, [x28, #504]!");
1666 COMPARE(ldp(d29, d30, MemOperand(x29, -512, PreIndex)),
1667 "ldp d29, d30, [x29, #-512]!");
1668 COMPARE(ldp(d31, d0, MemOperand(x1, 504, PostIndex)),
1669 "ldp d31, d0, [x1], #504");
1670 COMPARE(ldp(d2, d3, MemOperand(x4, -512, PostIndex)),
1671 "ldp d2, d3, [x4], #-512");
1672
armvixl5289c592015-03-02 13:52:04 +00001673 COMPARE(ldp(q5, q6, MemOperand(x7)), "ldp q5, q6, [x7]");
1674 COMPARE(ldp(q8, q9, MemOperand(x10, 1008)), "ldp q8, q9, [x10, #1008]");
1675 COMPARE(ldp(q11, q12, MemOperand(x13, -1024)), "ldp q11, q12, [x13, #-1024]");
1676 COMPARE(ldp(q14, q15, MemOperand(x16, 1008, PreIndex)),
1677 "ldp q14, q15, [x16, #1008]!");
1678 COMPARE(ldp(q17, q18, MemOperand(x19, -1024, PreIndex)),
1679 "ldp q17, q18, [x19, #-1024]!");
1680 COMPARE(ldp(q20, q21, MemOperand(x22, 1008, PostIndex)),
1681 "ldp q20, q21, [x22], #1008");
1682 COMPARE(ldp(q23, q24, MemOperand(x25, -1024, PostIndex)),
1683 "ldp q23, q24, [x25], #-1024");
1684
armvixlad96eda2013-06-14 11:42:37 +01001685 COMPARE(stp(w0, w1, MemOperand(x2)), "stp w0, w1, [x2]");
1686 COMPARE(stp(x3, x4, MemOperand(x5)), "stp x3, x4, [x5]");
1687 COMPARE(stp(w6, w7, MemOperand(x8, 4)), "stp w6, w7, [x8, #4]");
1688 COMPARE(stp(x9, x10, MemOperand(x11, 8)), "stp x9, x10, [x11, #8]");
1689 COMPARE(stp(w12, w13, MemOperand(x14, 252)), "stp w12, w13, [x14, #252]");
1690 COMPARE(stp(x15, x16, MemOperand(x17, 504)), "stp x15, x16, [x17, #504]");
1691 COMPARE(stp(w18, w19, MemOperand(x20, -256)), "stp w18, w19, [x20, #-256]");
1692 COMPARE(stp(x21, x22, MemOperand(x23, -512)), "stp x21, x22, [x23, #-512]");
1693 COMPARE(stp(w24, w25, MemOperand(x26, 252, PreIndex)),
1694 "stp w24, w25, [x26, #252]!");
1695 COMPARE(stp(x27, x28, MemOperand(x29, 504, PreIndex)),
1696 "stp x27, x28, [x29, #504]!");
1697 COMPARE(stp(w30, w0, MemOperand(x1, -256, PreIndex)),
1698 "stp w30, w0, [x1, #-256]!");
1699 COMPARE(stp(x2, x3, MemOperand(x4, -512, PreIndex)),
1700 "stp x2, x3, [x4, #-512]!");
1701 COMPARE(stp(w5, w6, MemOperand(x7, 252, PostIndex)),
1702 "stp w5, w6, [x7], #252");
1703 COMPARE(stp(x8, x9, MemOperand(x10, 504, PostIndex)),
1704 "stp x8, x9, [x10], #504");
1705 COMPARE(stp(w11, w12, MemOperand(x13, -256, PostIndex)),
1706 "stp w11, w12, [x13], #-256");
1707 COMPARE(stp(x14, x15, MemOperand(x16, -512, PostIndex)),
1708 "stp x14, x15, [x16], #-512");
1709
1710 COMPARE(stp(s17, s18, MemOperand(x19)), "stp s17, s18, [x19]");
1711 COMPARE(stp(s20, s21, MemOperand(x22, 252)), "stp s20, s21, [x22, #252]");
1712 COMPARE(stp(s23, s24, MemOperand(x25, -256)), "stp s23, s24, [x25, #-256]");
1713 COMPARE(stp(s26, s27, MemOperand(x28, 252, PreIndex)),
1714 "stp s26, s27, [x28, #252]!");
1715 COMPARE(stp(s29, s30, MemOperand(x29, -256, PreIndex)),
1716 "stp s29, s30, [x29, #-256]!");
1717 COMPARE(stp(s31, s0, MemOperand(x1, 252, PostIndex)),
1718 "stp s31, s0, [x1], #252");
1719 COMPARE(stp(s2, s3, MemOperand(x4, -256, PostIndex)),
1720 "stp s2, s3, [x4], #-256");
1721 COMPARE(stp(d17, d18, MemOperand(x19)), "stp d17, d18, [x19]");
1722 COMPARE(stp(d20, d21, MemOperand(x22, 504)), "stp d20, d21, [x22, #504]");
1723 COMPARE(stp(d23, d24, MemOperand(x25, -512)), "stp d23, d24, [x25, #-512]");
1724 COMPARE(stp(d26, d27, MemOperand(x28, 504, PreIndex)),
1725 "stp d26, d27, [x28, #504]!");
1726 COMPARE(stp(d29, d30, MemOperand(x29, -512, PreIndex)),
1727 "stp d29, d30, [x29, #-512]!");
1728 COMPARE(stp(d31, d0, MemOperand(x1, 504, PostIndex)),
1729 "stp d31, d0, [x1], #504");
1730 COMPARE(stp(d2, d3, MemOperand(x4, -512, PostIndex)),
1731 "stp d2, d3, [x4], #-512");
1732
armvixl5289c592015-03-02 13:52:04 +00001733 COMPARE(stp(q5, q6, MemOperand(x7)), "stp q5, q6, [x7]");
1734 COMPARE(stp(q8, q9, MemOperand(x10, 1008)), "stp q8, q9, [x10, #1008]");
1735 COMPARE(stp(q11, q12, MemOperand(x13, -1024)), "stp q11, q12, [x13, #-1024]");
1736 COMPARE(stp(q14, q15, MemOperand(x16, 1008, PreIndex)),
1737 "stp q14, q15, [x16, #1008]!");
1738 COMPARE(stp(q17, q18, MemOperand(x19, -1024, PreIndex)),
1739 "stp q17, q18, [x19, #-1024]!");
1740 COMPARE(stp(q20, q21, MemOperand(x22, 1008, PostIndex)),
1741 "stp q20, q21, [x22], #1008");
1742 COMPARE(stp(q23, q24, MemOperand(x25, -1024, PostIndex)),
1743 "stp q23, q24, [x25], #-1024");
1744
armvixlad96eda2013-06-14 11:42:37 +01001745 COMPARE(ldp(w16, w17, MemOperand(sp, 4, PostIndex)),
1746 "ldp w16, w17, [sp], #4");
1747 COMPARE(stp(x18, x19, MemOperand(sp, -8, PreIndex)),
1748 "stp x18, x19, [sp, #-8]!");
1749 COMPARE(ldp(s30, s31, MemOperand(sp, 12, PostIndex)),
1750 "ldp s30, s31, [sp], #12");
1751 COMPARE(stp(d30, d31, MemOperand(sp, -16)),
1752 "stp d30, d31, [sp, #-16]");
armvixl5289c592015-03-02 13:52:04 +00001753 COMPARE(ldp(q30, q31, MemOperand(sp, 32, PostIndex)),
1754 "ldp q30, q31, [sp], #32");
armvixlad96eda2013-06-14 11:42:37 +01001755
1756 COMPARE(ldpsw(x0, x1, MemOperand(x2)), "ldpsw x0, x1, [x2]");
1757 COMPARE(ldpsw(x3, x4, MemOperand(x5, 16)), "ldpsw x3, x4, [x5, #16]");
1758 COMPARE(ldpsw(x6, x7, MemOperand(x8, -32, PreIndex)),
1759 "ldpsw x6, x7, [x8, #-32]!");
1760 COMPARE(ldpsw(x9, x10, MemOperand(x11, 128, PostIndex)),
1761 "ldpsw x9, x10, [x11], #128");
1762
1763 CLEANUP();
1764}
1765
armvixl4a102ba2014-07-14 09:02:40 +01001766
1767TEST(load_store_exclusive) {
1768 SETUP();
1769
1770 COMPARE(stxrb(w0, w1, MemOperand(x2)), "stxrb w0, w1, [x2]");
1771 COMPARE(stxrb(x3, w4, MemOperand(sp)), "stxrb w3, w4, [sp]");
1772 COMPARE(stxrb(w5, x6, MemOperand(x7)), "stxrb w5, w6, [x7]");
1773 COMPARE(stxrb(x8, x9, MemOperand(sp)), "stxrb w8, w9, [sp]");
1774 COMPARE(stxrh(w10, w11, MemOperand(x12)), "stxrh w10, w11, [x12]");
1775 COMPARE(stxrh(x13, w14, MemOperand(sp)), "stxrh w13, w14, [sp]");
1776 COMPARE(stxrh(w15, x16, MemOperand(x17)), "stxrh w15, w16, [x17]");
1777 COMPARE(stxrh(x18, x19, MemOperand(sp)), "stxrh w18, w19, [sp]");
1778 COMPARE(stxr(w20, w21, MemOperand(x22)), "stxr w20, w21, [x22]");
1779 COMPARE(stxr(x23, w24, MemOperand(sp)), "stxr w23, w24, [sp]");
1780 COMPARE(stxr(w25, x26, MemOperand(x27)), "stxr w25, x26, [x27]");
1781 COMPARE(stxr(x28, x29, MemOperand(sp)), "stxr w28, x29, [sp]");
1782 COMPARE(ldxrb(w30, MemOperand(x0)), "ldxrb w30, [x0]");
1783 COMPARE(ldxrb(w1, MemOperand(sp)), "ldxrb w1, [sp]");
1784 COMPARE(ldxrb(x2, MemOperand(x3)), "ldxrb w2, [x3]");
1785 COMPARE(ldxrb(x4, MemOperand(sp)), "ldxrb w4, [sp]");
1786 COMPARE(ldxrh(w5, MemOperand(x6)), "ldxrh w5, [x6]");
1787 COMPARE(ldxrh(w7, MemOperand(sp)), "ldxrh w7, [sp]");
1788 COMPARE(ldxrh(x8, MemOperand(x9)), "ldxrh w8, [x9]");
1789 COMPARE(ldxrh(x10, MemOperand(sp)), "ldxrh w10, [sp]");
1790 COMPARE(ldxr(w11, MemOperand(x12)), "ldxr w11, [x12]");
1791 COMPARE(ldxr(w13, MemOperand(sp)), "ldxr w13, [sp]");
1792 COMPARE(ldxr(x14, MemOperand(x15)), "ldxr x14, [x15]");
1793 COMPARE(ldxr(x16, MemOperand(sp)), "ldxr x16, [sp]");
1794 COMPARE(stxp(w17, w18, w19, MemOperand(x20)), "stxp w17, w18, w19, [x20]");
1795 COMPARE(stxp(x21, w22, w23, MemOperand(sp)), "stxp w21, w22, w23, [sp]");
1796 COMPARE(stxp(w24, x25, x26, MemOperand(x27)), "stxp w24, x25, x26, [x27]");
1797 COMPARE(stxp(x28, x29, x30, MemOperand(sp)), "stxp w28, x29, x30, [sp]");
1798 COMPARE(ldxp(w0, w1, MemOperand(x2)), "ldxp w0, w1, [x2]");
1799 COMPARE(ldxp(w3, w4, MemOperand(sp)), "ldxp w3, w4, [sp]");
1800 COMPARE(ldxp(x5, x6, MemOperand(x7)), "ldxp x5, x6, [x7]");
1801 COMPARE(ldxp(x8, x9, MemOperand(sp)), "ldxp x8, x9, [sp]");
1802 COMPARE(stlxrb(w10, w11, MemOperand(x12)), "stlxrb w10, w11, [x12]");
1803 COMPARE(stlxrb(x13, w14, MemOperand(sp)), "stlxrb w13, w14, [sp]");
1804 COMPARE(stlxrb(w15, x16, MemOperand(x17)), "stlxrb w15, w16, [x17]");
1805 COMPARE(stlxrb(x18, x19, MemOperand(sp)), "stlxrb w18, w19, [sp]");
1806 COMPARE(stlxrh(w20, w21, MemOperand(x22)), "stlxrh w20, w21, [x22]");
1807 COMPARE(stlxrh(x23, w24, MemOperand(sp)), "stlxrh w23, w24, [sp]");
1808 COMPARE(stlxrh(w25, x26, MemOperand(x27)), "stlxrh w25, w26, [x27]");
1809 COMPARE(stlxrh(x28, x29, MemOperand(sp)), "stlxrh w28, w29, [sp]");
1810 COMPARE(stlxr(w30, w0, MemOperand(x1)), "stlxr w30, w0, [x1]");
1811 COMPARE(stlxr(x2, w3, MemOperand(sp)), "stlxr w2, w3, [sp]");
1812 COMPARE(stlxr(w4, x5, MemOperand(x6)), "stlxr w4, x5, [x6]");
1813 COMPARE(stlxr(x7, x8, MemOperand(sp)), "stlxr w7, x8, [sp]");
1814 COMPARE(ldaxrb(w9, MemOperand(x10)), "ldaxrb w9, [x10]");
1815 COMPARE(ldaxrb(w11, MemOperand(sp)), "ldaxrb w11, [sp]");
1816 COMPARE(ldaxrb(x12, MemOperand(x13)), "ldaxrb w12, [x13]");
1817 COMPARE(ldaxrb(x14, MemOperand(sp)), "ldaxrb w14, [sp]");
1818 COMPARE(ldaxrh(w15, MemOperand(x16)), "ldaxrh w15, [x16]");
1819 COMPARE(ldaxrh(w17, MemOperand(sp)), "ldaxrh w17, [sp]");
1820 COMPARE(ldaxrh(x18, MemOperand(x19)), "ldaxrh w18, [x19]");
1821 COMPARE(ldaxrh(x20, MemOperand(sp)), "ldaxrh w20, [sp]");
1822 COMPARE(ldaxr(w21, MemOperand(x22)), "ldaxr w21, [x22]");
1823 COMPARE(ldaxr(w23, MemOperand(sp)), "ldaxr w23, [sp]");
1824 COMPARE(ldaxr(x24, MemOperand(x25)), "ldaxr x24, [x25]");
1825 COMPARE(ldaxr(x26, MemOperand(sp)), "ldaxr x26, [sp]");
1826 COMPARE(stlxp(w27, w28, w29, MemOperand(x30)), "stlxp w27, w28, w29, [x30]");
1827 COMPARE(stlxp(x0, w1, w2, MemOperand(sp)), "stlxp w0, w1, w2, [sp]");
1828 COMPARE(stlxp(w3, x4, x5, MemOperand(x6)), "stlxp w3, x4, x5, [x6]");
1829 COMPARE(stlxp(x7, x8, x9, MemOperand(sp)), "stlxp w7, x8, x9, [sp]");
1830 COMPARE(ldaxp(w10, w11, MemOperand(x12)), "ldaxp w10, w11, [x12]");
1831 COMPARE(ldaxp(w13, w14, MemOperand(sp)), "ldaxp w13, w14, [sp]");
1832 COMPARE(ldaxp(x15, x16, MemOperand(x17)), "ldaxp x15, x16, [x17]");
1833 COMPARE(ldaxp(x18, x19, MemOperand(sp)), "ldaxp x18, x19, [sp]");
1834 COMPARE(stlrb(w20, MemOperand(x21)), "stlrb w20, [x21]");
1835 COMPARE(stlrb(w22, MemOperand(sp)), "stlrb w22, [sp]");
1836 COMPARE(stlrb(x23, MemOperand(x24)), "stlrb w23, [x24]");
1837 COMPARE(stlrb(x25, MemOperand(sp)), "stlrb w25, [sp]");
1838 COMPARE(stlrh(w26, MemOperand(x27)), "stlrh w26, [x27]");
1839 COMPARE(stlrh(w28, MemOperand(sp)), "stlrh w28, [sp]");
1840 COMPARE(stlrh(x29, MemOperand(x30)), "stlrh w29, [x30]");
1841 COMPARE(stlrh(x0, MemOperand(sp)), "stlrh w0, [sp]");
1842 COMPARE(stlr(w1, MemOperand(x2)), "stlr w1, [x2]");
1843 COMPARE(stlr(w3, MemOperand(sp)), "stlr w3, [sp]");
1844 COMPARE(stlr(x4, MemOperand(x5)), "stlr x4, [x5]");
1845 COMPARE(stlr(x6, MemOperand(sp)), "stlr x6, [sp]");
1846 COMPARE(ldarb(w7, MemOperand(x8)), "ldarb w7, [x8]");
1847 COMPARE(ldarb(w9, MemOperand(sp)), "ldarb w9, [sp]");
1848 COMPARE(ldarb(x10, MemOperand(x11)), "ldarb w10, [x11]");
1849 COMPARE(ldarb(x12, MemOperand(sp)), "ldarb w12, [sp]");
1850 COMPARE(ldarh(w13, MemOperand(x14)), "ldarh w13, [x14]");
1851 COMPARE(ldarh(w15, MemOperand(sp)), "ldarh w15, [sp]");
1852 COMPARE(ldarh(x16, MemOperand(x17)), "ldarh w16, [x17]");
1853 COMPARE(ldarh(x18, MemOperand(sp)), "ldarh w18, [sp]");
1854 COMPARE(ldar(w19, MemOperand(x20)), "ldar w19, [x20]");
1855 COMPARE(ldar(w21, MemOperand(sp)), "ldar w21, [sp]");
1856 COMPARE(ldar(x22, MemOperand(x23)), "ldar x22, [x23]");
1857 COMPARE(ldar(x24, MemOperand(sp)), "ldar x24, [sp]");
1858
1859 CLEANUP();
1860}
1861
1862
armvixlad96eda2013-06-14 11:42:37 +01001863TEST(load_store_pair_nontemp) {
1864 SETUP();
1865
1866 COMPARE(ldnp(w0, w1, MemOperand(x2)), "ldnp w0, w1, [x2]");
1867 COMPARE(stnp(w3, w4, MemOperand(x5, 252)), "stnp w3, w4, [x5, #252]");
1868 COMPARE(ldnp(w6, w7, MemOperand(x8, -256)), "ldnp w6, w7, [x8, #-256]");
1869 COMPARE(stnp(x9, x10, MemOperand(x11)), "stnp x9, x10, [x11]");
1870 COMPARE(ldnp(x12, x13, MemOperand(x14, 504)), "ldnp x12, x13, [x14, #504]");
1871 COMPARE(stnp(x15, x16, MemOperand(x17, -512)), "stnp x15, x16, [x17, #-512]");
1872 COMPARE(ldnp(s18, s19, MemOperand(x20)), "ldnp s18, s19, [x20]");
1873 COMPARE(stnp(s21, s22, MemOperand(x23, 252)), "stnp s21, s22, [x23, #252]");
1874 COMPARE(ldnp(s24, s25, MemOperand(x26, -256)), "ldnp s24, s25, [x26, #-256]");
1875 COMPARE(stnp(d27, d28, MemOperand(x29)), "stnp d27, d28, [x29]");
1876 COMPARE(ldnp(d30, d31, MemOperand(x0, 504)), "ldnp d30, d31, [x0, #504]");
1877 COMPARE(stnp(d1, d2, MemOperand(x3, -512)), "stnp d1, d2, [x3, #-512]");
armvixl5289c592015-03-02 13:52:04 +00001878 COMPARE(ldnp(q4, q5, MemOperand(x6)), "ldnp q4, q5, [x6]");
1879 COMPARE(stnp(q7, q8, MemOperand(x9, 1008)), "stnp q7, q8, [x9, #1008]");
1880 COMPARE(ldnp(q10, q11, MemOperand(x12, -1024)),
1881 "ldnp q10, q11, [x12, #-1024]");
armvixlad96eda2013-06-14 11:42:37 +01001882
1883 CLEANUP();
1884}
1885
armvixl4a102ba2014-07-14 09:02:40 +01001886
armvixl330dc712014-11-25 10:38:32 +00001887TEST(load_literal_macro) {
armvixl684cd2a2015-10-23 13:38:33 +01001888 SETUP_MACRO();
armvixlad96eda2013-06-14 11:42:37 +01001889
armvixl330dc712014-11-25 10:38:32 +00001890 // In each case, the literal will be placed at PC+8:
1891 // ldr x10, pc+8 // Test instruction.
1892 // ldr xzr, pc+12 // Pool marker.
1893 // .word64 #0x1234567890abcdef // Test literal.
1894
1895 COMPARE_PREFIX(Ldr(x10, 0x1234567890abcdef), "ldr x10, pc+8");
1896 COMPARE_PREFIX(Ldr(w20, 0xfedcba09), "ldr w20, pc+8");
1897 COMPARE_PREFIX(Ldr(d11, 1.234), "ldr d11, pc+8");
1898 COMPARE_PREFIX(Ldr(s22, 2.5f), "ldr s22, pc+8");
1899 COMPARE_PREFIX(Ldrsw(x21, 0x80000000), "ldrsw x21, pc+8");
1900
1901 CLEANUP();
1902}
1903
1904
1905TEST(load_literal) {
1906 SETUP();
1907
1908 COMPARE_PREFIX(ldr(x20, 0), "ldr x20, pc+0");
1909 COMPARE_PREFIX(ldr(x20, 1), "ldr x20, pc+4");
1910 COMPARE_PREFIX(ldr(x20, -1), "ldr x20, pc-4");
1911 COMPARE_PREFIX(ldr(x20, 0x3ffff), "ldr x20, pc+1048572");
1912 COMPARE_PREFIX(ldr(x20, -0x40000), "ldr x20, pc-1048576");
1913 COMPARE_PREFIX(ldr(w21, 0), "ldr w21, pc+0");
1914 COMPARE_PREFIX(ldr(w21, 1), "ldr w21, pc+4");
1915 COMPARE_PREFIX(ldr(w21, -1), "ldr w21, pc-4");
1916 COMPARE_PREFIX(ldr(w21, 0x3ffff), "ldr w21, pc+1048572");
1917 COMPARE_PREFIX(ldr(w21, -0x40000), "ldr w21, pc-1048576");
1918 COMPARE_PREFIX(ldr(d22, 0), "ldr d22, pc+0");
1919 COMPARE_PREFIX(ldr(d22, 1), "ldr d22, pc+4");
1920 COMPARE_PREFIX(ldr(d22, -1), "ldr d22, pc-4");
1921 COMPARE_PREFIX(ldr(d22, 0x3ffff), "ldr d22, pc+1048572");
1922 COMPARE_PREFIX(ldr(d22, -0x40000), "ldr d22, pc-1048576");
1923 COMPARE_PREFIX(ldr(s23, 0), "ldr s23, pc+0");
1924 COMPARE_PREFIX(ldr(s23, 1), "ldr s23, pc+4");
1925 COMPARE_PREFIX(ldr(s23, -1), "ldr s23, pc-4");
1926 COMPARE_PREFIX(ldr(s23, 0x3ffff), "ldr s23, pc+1048572");
1927 COMPARE_PREFIX(ldr(s23, -0x40000), "ldr s23, pc-1048576");
1928 COMPARE_PREFIX(ldrsw(x24, 0), "ldrsw x24, pc+0");
1929 COMPARE_PREFIX(ldrsw(x24, 1), "ldrsw x24, pc+4");
1930 COMPARE_PREFIX(ldrsw(x24, -1), "ldrsw x24, pc-4");
1931 COMPARE_PREFIX(ldrsw(x24, 0x3ffff), "ldrsw x24, pc+1048572");
1932 COMPARE_PREFIX(ldrsw(x24, -0x40000), "ldrsw x24, pc-1048576");
1933
1934 CLEANUP();
1935}
1936
1937
1938TEST(prfm_operations) {
1939 SETUP();
1940
1941 // Test every encodable prefetch operation.
1942 const char* expected[] = {
1943 "prfm pldl1keep, ",
1944 "prfm pldl1strm, ",
1945 "prfm pldl2keep, ",
1946 "prfm pldl2strm, ",
1947 "prfm pldl3keep, ",
1948 "prfm pldl3strm, ",
1949 "prfm #0b00110, ",
1950 "prfm #0b00111, ",
1951 "prfm plil1keep, ",
1952 "prfm plil1strm, ",
1953 "prfm plil2keep, ",
1954 "prfm plil2strm, ",
1955 "prfm plil3keep, ",
1956 "prfm plil3strm, ",
1957 "prfm #0b01110, ",
1958 "prfm #0b01111, ",
1959 "prfm pstl1keep, ",
1960 "prfm pstl1strm, ",
1961 "prfm pstl2keep, ",
1962 "prfm pstl2strm, ",
1963 "prfm pstl3keep, ",
1964 "prfm pstl3strm, ",
1965 "prfm #0b10110, ",
1966 "prfm #0b10111, ",
1967 "prfm #0b11000, ",
1968 "prfm #0b11001, ",
1969 "prfm #0b11010, ",
1970 "prfm #0b11011, ",
1971 "prfm #0b11100, ",
1972 "prfm #0b11101, ",
1973 "prfm #0b11110, ",
1974 "prfm #0b11111, ",
1975 };
1976 const int expected_count = sizeof(expected) / sizeof(expected[0]);
1977 VIXL_STATIC_ASSERT((1 << ImmPrefetchOperation_width) == expected_count);
1978
1979 for (int i = 0; i < (1 << ImmPrefetchOperation_width); i++) {
1980 PrefetchOperation op = static_cast<PrefetchOperation>(i);
1981 COMPARE_PREFIX(prfm(op, 0), expected[i]);
1982 COMPARE_PREFIX(prfm(op, MemOperand(x0, 0)), expected[i]);
1983 COMPARE_PREFIX(prfm(op, MemOperand(x0, x1)), expected[i]);
1984 }
1985
1986 CLEANUP();
1987}
1988
1989
1990TEST(prfum_operations) {
1991 SETUP();
1992
1993 // Test every encodable prefetch operation.
1994 const char* expected[] = {
1995 "prfum pldl1keep, ",
1996 "prfum pldl1strm, ",
1997 "prfum pldl2keep, ",
1998 "prfum pldl2strm, ",
1999 "prfum pldl3keep, ",
2000 "prfum pldl3strm, ",
2001 "prfum #0b00110, ",
2002 "prfum #0b00111, ",
2003 "prfum plil1keep, ",
2004 "prfum plil1strm, ",
2005 "prfum plil2keep, ",
2006 "prfum plil2strm, ",
2007 "prfum plil3keep, ",
2008 "prfum plil3strm, ",
2009 "prfum #0b01110, ",
2010 "prfum #0b01111, ",
2011 "prfum pstl1keep, ",
2012 "prfum pstl1strm, ",
2013 "prfum pstl2keep, ",
2014 "prfum pstl2strm, ",
2015 "prfum pstl3keep, ",
2016 "prfum pstl3strm, ",
2017 "prfum #0b10110, ",
2018 "prfum #0b10111, ",
2019 "prfum #0b11000, ",
2020 "prfum #0b11001, ",
2021 "prfum #0b11010, ",
2022 "prfum #0b11011, ",
2023 "prfum #0b11100, ",
2024 "prfum #0b11101, ",
2025 "prfum #0b11110, ",
2026 "prfum #0b11111, ",
2027 };
2028 const int expected_count = sizeof(expected) / sizeof(expected[0]);
2029 VIXL_STATIC_ASSERT((1 << ImmPrefetchOperation_width) == expected_count);
2030
2031 for (int i = 0; i < (1 << ImmPrefetchOperation_width); i++) {
2032 PrefetchOperation op = static_cast<PrefetchOperation>(i);
2033 COMPARE_PREFIX(prfum(op, MemOperand(x0, 0)), expected[i]);
2034 }
2035
2036 CLEANUP();
2037}
2038
2039
2040TEST(prfm_offset) {
2041 SETUP();
2042
2043 COMPARE(prfm(PLDL1KEEP, MemOperand(x1)), "prfm pldl1keep, [x1]");
2044 COMPARE(prfm(PLDL1STRM, MemOperand(x3, 8)), "prfm pldl1strm, [x3, #8]");
2045 COMPARE(prfm(PLDL2KEEP, MemOperand(x5, 32760)),
2046 "prfm pldl2keep, [x5, #32760]");
2047
2048 COMPARE(prfm(PLDL2STRM, MemOperand(sp)), "prfm pldl2strm, [sp]");
2049 COMPARE(prfm(PLDL3KEEP, MemOperand(sp, 8)), "prfm pldl3keep, [sp, #8]");
2050 COMPARE(prfm(PLDL3STRM, MemOperand(sp, 32760)),
2051 "prfm pldl3strm, [sp, #32760]");
2052
2053 CLEANUP();
2054}
2055
2056
2057TEST(prfm_regoffset) {
2058 SETUP();
2059
2060 COMPARE(prfm(PLIL1KEEP, MemOperand(x1, x2)), "prfm plil1keep, [x1, x2]");
2061 COMPARE(prfm(PLIL1STRM, MemOperand(x3, w4, SXTW)),
2062 "prfm plil1strm, [x3, w4, sxtw]");
2063 COMPARE(prfm(PLIL2KEEP, MemOperand(x5, x6, LSL, 3)),
2064 "prfm plil2keep, [x5, x6, lsl #3]");
2065
2066 COMPARE(prfm(PLIL2STRM, MemOperand(sp, xzr)), "prfm plil2strm, [sp, xzr]");
2067 COMPARE(prfm(PLIL3KEEP, MemOperand(sp, wzr, SXTW)),
2068 "prfm plil3keep, [sp, wzr, sxtw]");
2069 COMPARE(prfm(PLIL3STRM, MemOperand(sp, xzr, LSL, 3)),
2070 "prfm plil3strm, [sp, xzr, lsl #3]");
2071
2072 CLEANUP();
2073}
2074
2075
2076TEST(prfm_literal) {
2077 SETUP();
2078
2079 COMPARE_PREFIX(prfm(PSTL1KEEP, 0), "prfm pstl1keep, pc+0");
2080 COMPARE_PREFIX(prfm(PSTL1STRM, 1), "prfm pstl1strm, pc+4");
2081 COMPARE_PREFIX(prfm(PSTL2KEEP, -1), "prfm pstl2keep, pc-4");
2082 COMPARE_PREFIX(prfm(PSTL2STRM, 0x3ffff), "prfm pstl2strm, pc+1048572");
2083 COMPARE_PREFIX(prfm(PSTL3KEEP, -0x3ffff), "prfm pstl3keep, pc-1048572");
2084 COMPARE_PREFIX(prfm(PSTL3STRM, -0x40000), "prfm pstl3strm, pc-1048576");
2085
2086 CLEANUP();
2087}
2088
2089
2090TEST(prfm_unscaled) {
2091 SETUP();
2092
2093 // If an unscaled-offset instruction is requested, it is used, even if the
2094 // offset could be encoded in a scaled-offset instruction.
2095 COMPARE(prfum(PLDL1KEEP, MemOperand(x1)), "prfum pldl1keep, [x1]");
2096 COMPARE(prfum(PLDL1STRM, MemOperand(x1, 8)), "prfum pldl1strm, [x1, #8]");
2097 COMPARE(prfum(PLDL2KEEP, MemOperand(x1, 248)), "prfum pldl2keep, [x1, #248]");
2098
2099 // Normal offsets are converted to unscaled offsets if necssary.
2100 COMPARE(prfm(PLDL2STRM, MemOperand(x1, 1)), "prfum pldl2strm, [x1, #1]");
2101 COMPARE(prfm(PLDL3KEEP, MemOperand(x1, -1)), "prfum pldl3keep, [x1, #-1]");
2102 COMPARE(prfm(PLDL3STRM, MemOperand(x1, 255)), "prfum pldl3strm, [x1, #255]");
2103 COMPARE(prfm(PLDL3STRM, MemOperand(x1, -256)),
2104 "prfum pldl3strm, [x1, #-256]");
2105
2106 CLEANUP();
2107}
2108
2109
2110TEST(prfm_unscaled_option) {
2111 SETUP();
2112
2113 // Just like prfm_unscaled, but specify the scaling option explicitly.
2114
2115 // Require unscaled-offset forms.
2116 LoadStoreScalingOption option = RequireUnscaledOffset;
2117
2118 COMPARE(prfum(PLDL1KEEP, MemOperand(x1), option), "prfum pldl1keep, [x1]");
2119 COMPARE(prfum(PLDL1STRM, MemOperand(x1, 8), option),
2120 "prfum pldl1strm, [x1, #8]");
2121 COMPARE(prfum(PLDL2KEEP, MemOperand(x1, 248), option),
2122 "prfum pldl2keep, [x1, #248]");
2123 COMPARE(prfum(PLDL2STRM, MemOperand(x1, 1), option),
2124 "prfum pldl2strm, [x1, #1]");
2125 COMPARE(prfum(PLDL3KEEP, MemOperand(x1, -1), option),
2126 "prfum pldl3keep, [x1, #-1]");
2127 COMPARE(prfum(PLDL3STRM, MemOperand(x1, 255), option),
2128 "prfum pldl3strm, [x1, #255]");
2129 COMPARE(prfum(PLIL1KEEP, MemOperand(x1, -256), option),
2130 "prfum plil1keep, [x1, #-256]");
2131
2132 // Require scaled-offset forms..
2133 option = RequireScaledOffset;
2134
2135 COMPARE(prfm(PLDL1KEEP, MemOperand(x1), option), "prfm pldl1keep, [x1]");
2136 COMPARE(prfm(PLDL1STRM, MemOperand(x1, 8), option),
2137 "prfm pldl1strm, [x1, #8]");
2138 COMPARE(prfm(PLDL2KEEP, MemOperand(x1, 248), option),
2139 "prfm pldl2keep, [x1, #248]");
2140 COMPARE(prfm(PLIL2STRM, MemOperand(x1, 256), option),
2141 "prfm plil2strm, [x1, #256]");
2142 COMPARE(prfm(PLIL3KEEP, MemOperand(x1, 32760), option),
2143 "prfm plil3keep, [x1, #32760]");
2144
2145 // Prefer unscaled-offset forms, but allow scaled-offset forms if necessary.
2146 option = PreferUnscaledOffset;
2147
2148 COMPARE(prfum(PLDL1KEEP, MemOperand(x1), option), "prfum pldl1keep, [x1]");
2149 COMPARE(prfum(PLDL1STRM, MemOperand(x1, 8), option),
2150 "prfum pldl1strm, [x1, #8]");
2151 COMPARE(prfum(PLDL2KEEP, MemOperand(x1, 248), option),
2152 "prfum pldl2keep, [x1, #248]");
2153 COMPARE(prfum(PLDL2STRM, MemOperand(x1, 1), option),
2154 "prfum pldl2strm, [x1, #1]");
2155 COMPARE(prfum(PLDL3KEEP, MemOperand(x1, -1), option),
2156 "prfum pldl3keep, [x1, #-1]");
2157 COMPARE(prfum(PLDL3STRM, MemOperand(x1, 255), option),
2158 "prfum pldl3strm, [x1, #255]");
2159 COMPARE(prfum(PLIL1KEEP, MemOperand(x1, -256), option),
2160 "prfum plil1keep, [x1, #-256]");
2161 COMPARE(prfum(PLIL1STRM, MemOperand(x1, 256), option),
2162 "prfm plil1strm, [x1, #256]");
2163 COMPARE(prfum(PLIL2KEEP, MemOperand(x1, 32760), option),
2164 "prfm plil2keep, [x1, #32760]");
2165
2166 // Prefer scaled-offset forms, but allow unscaled-offset forms if necessary.
2167 option = PreferScaledOffset;
2168
2169 COMPARE(prfm(PLDL1KEEP, MemOperand(x1), option), "prfm pldl1keep, [x1]");
2170 COMPARE(prfm(PLDL1STRM, MemOperand(x1, 8), option),
2171 "prfm pldl1strm, [x1, #8]");
2172 COMPARE(prfm(PLDL2KEEP, MemOperand(x1, 248), option),
2173 "prfm pldl2keep, [x1, #248]");
2174 COMPARE(prfm(PLDL2STRM, MemOperand(x1, 1), option),
2175 "prfum pldl2strm, [x1, #1]");
2176 COMPARE(prfm(PLDL3KEEP, MemOperand(x1, -1), option),
2177 "prfum pldl3keep, [x1, #-1]");
2178 COMPARE(prfm(PLDL3STRM, MemOperand(x1, 255), option),
2179 "prfum pldl3strm, [x1, #255]");
2180 COMPARE(prfm(PLIL1KEEP, MemOperand(x1, -256), option),
2181 "prfum plil1keep, [x1, #-256]");
2182 COMPARE(prfm(PLIL1STRM, MemOperand(x1, 256), option),
2183 "prfm plil1strm, [x1, #256]");
2184 COMPARE(prfm(PLIL2KEEP, MemOperand(x1, 32760), option),
2185 "prfm plil2keep, [x1, #32760]");
armvixlad96eda2013-06-14 11:42:37 +01002186
2187 CLEANUP();
2188}
2189
armvixl4a102ba2014-07-14 09:02:40 +01002190
armvixlad96eda2013-06-14 11:42:37 +01002191TEST(cond_select) {
2192 SETUP();
2193
2194 COMPARE(csel(w0, w1, w2, eq), "csel w0, w1, w2, eq");
2195 COMPARE(csel(x3, x4, x5, ne), "csel x3, x4, x5, ne");
2196 COMPARE(csinc(w6, w7, w8, hs), "csinc w6, w7, w8, hs");
2197 COMPARE(csinc(x9, x10, x11, lo), "csinc x9, x10, x11, lo");
2198 COMPARE(csinv(w12, w13, w14, mi), "csinv w12, w13, w14, mi");
2199 COMPARE(csinv(x15, x16, x17, pl), "csinv x15, x16, x17, pl");
2200 COMPARE(csneg(w18, w19, w20, vs), "csneg w18, w19, w20, vs");
2201 COMPARE(csneg(x21, x22, x23, vc), "csneg x21, x22, x23, vc");
2202 COMPARE(cset(w24, hi), "cset w24, hi");
2203 COMPARE(cset(x25, ls), "cset x25, ls");
2204 COMPARE(csetm(w26, ge), "csetm w26, ge");
2205 COMPARE(csetm(x27, lt), "csetm x27, lt");
2206 COMPARE(cinc(w28, w29, gt), "cinc w28, w29, gt");
2207 COMPARE(cinc(x30, x0, le), "cinc x30, x0, le");
2208 COMPARE(cinv(w1, w2, eq), "cinv w1, w2, eq");
2209 COMPARE(cinv(x3, x4, ne), "cinv x3, x4, ne");
2210 COMPARE(cneg(w5, w6, hs), "cneg w5, w6, hs");
2211 COMPARE(cneg(x7, x8, lo), "cneg x7, x8, lo");
2212
armvixl578645f2013-08-15 17:21:42 +01002213 COMPARE(csel(x0, x1, x2, al), "csel x0, x1, x2, al");
2214 COMPARE(csel(x1, x2, x3, nv), "csel x1, x2, x3, nv");
2215 COMPARE(csinc(x2, x3, x4, al), "csinc x2, x3, x4, al");
2216 COMPARE(csinc(x3, x4, x5, nv), "csinc x3, x4, x5, nv");
2217 COMPARE(csinv(x4, x5, x6, al), "csinv x4, x5, x6, al");
2218 COMPARE(csinv(x5, x6, x7, nv), "csinv x5, x6, x7, nv");
2219 COMPARE(csneg(x6, x7, x8, al), "csneg x6, x7, x8, al");
2220 COMPARE(csneg(x7, x8, x9, nv), "csneg x7, x8, x9, nv");
2221
armvixlad96eda2013-06-14 11:42:37 +01002222 CLEANUP();
2223}
2224
armvixl4a102ba2014-07-14 09:02:40 +01002225
armvixlf37fdc02014-02-05 13:22:16 +00002226TEST(cond_select_macro) {
armvixl684cd2a2015-10-23 13:38:33 +01002227 SETUP_MACRO();
armvixlf37fdc02014-02-05 13:22:16 +00002228
armvixl0f35e362016-05-10 13:57:58 +01002229 // In the tests below we also test the `GetCselSynthesisInformation()` helper.
2230 // These tests are here (rather than in test-assembler-a64.cc) because the
2231 // disassembly makes it easy to see whether or not the inputs are synthesised.
2232 bool synthesises_left = false;
2233 bool synthesises_right = false;
2234
armvixlf37fdc02014-02-05 13:22:16 +00002235 COMPARE(Csel(w0, w1, -1, eq), "csinv w0, w1, wzr, eq");
armvixl0f35e362016-05-10 13:57:58 +01002236 MacroAssembler::GetCselSynthesisInformation(w0, w1, -1,
2237 &synthesises_left,
2238 &synthesises_right);
2239 VIXL_CHECK(!synthesises_left && !synthesises_right);
2240
armvixlf37fdc02014-02-05 13:22:16 +00002241 COMPARE(Csel(w2, w3, 0, ne), "csel w2, w3, wzr, ne");
armvixl0f35e362016-05-10 13:57:58 +01002242 MacroAssembler::GetCselSynthesisInformation(w2, w3, wzr,
2243 &synthesises_left,
2244 &synthesises_right);
2245 VIXL_CHECK(!synthesises_left && !synthesises_right);
2246
armvixlf37fdc02014-02-05 13:22:16 +00002247 COMPARE(Csel(w4, w5, 1, hs), "csinc w4, w5, wzr, hs");
armvixl0f35e362016-05-10 13:57:58 +01002248 MacroAssembler::GetCselSynthesisInformation(w4, w5, 1,
2249 &synthesises_left,
2250 &synthesises_right);
2251 VIXL_CHECK(!synthesises_left && !synthesises_right);
2252
armvixlf37fdc02014-02-05 13:22:16 +00002253 COMPARE(Csel(x6, x7, -1, lo), "csinv x6, x7, xzr, lo");
armvixl0f35e362016-05-10 13:57:58 +01002254 MacroAssembler::GetCselSynthesisInformation(x6, x7, xzr,
2255 &synthesises_left,
2256 &synthesises_right);
2257 VIXL_CHECK(!synthesises_left && !synthesises_right);
2258
armvixlf37fdc02014-02-05 13:22:16 +00002259 COMPARE(Csel(x8, x9, 0, mi), "csel x8, x9, xzr, mi");
armvixl0f35e362016-05-10 13:57:58 +01002260 MacroAssembler::GetCselSynthesisInformation(x8, x9, xzr,
2261 &synthesises_left,
2262 &synthesises_right);
2263 VIXL_CHECK(!synthesises_left && !synthesises_right);
2264
armvixlf37fdc02014-02-05 13:22:16 +00002265 COMPARE(Csel(x10, x11, 1, pl), "csinc x10, x11, xzr, pl");
armvixl0f35e362016-05-10 13:57:58 +01002266 MacroAssembler::GetCselSynthesisInformation(x10, x11, xzr,
2267 &synthesises_left,
2268 &synthesises_right);
2269 VIXL_CHECK(!synthesises_left && !synthesises_right);
2270
2271 COMPARE_MACRO(Csel(x12, 0, 0, eq), "mov x12, #0x0");
2272 MacroAssembler::GetCselSynthesisInformation(x12, 0, 0,
2273 &synthesises_left,
2274 &synthesises_right);
2275 VIXL_CHECK(!synthesises_left && !synthesises_right);
2276
2277 COMPARE_MACRO(Csel(w13, 0, 1, eq), "cset w13, eq");
2278 MacroAssembler::GetCselSynthesisInformation(w13, 0, 1,
2279 &synthesises_left,
2280 &synthesises_right);
2281 VIXL_CHECK(!synthesises_left && !synthesises_right);
2282
2283 COMPARE_MACRO(Csel(x14, 1, 0, eq), "cset x14, ne");
2284 MacroAssembler::GetCselSynthesisInformation(x14, 1, 0,
2285 &synthesises_left,
2286 &synthesises_right);
2287 VIXL_CHECK(!synthesises_left && !synthesises_right);
2288
2289 COMPARE_MACRO(Csel(w15, 0, -1, eq), "csetm w15, eq");
2290 MacroAssembler::GetCselSynthesisInformation(w15, 0, -1,
2291 &synthesises_left,
2292 &synthesises_right);
2293 VIXL_CHECK(!synthesises_left && !synthesises_right);
2294
2295 COMPARE_MACRO(Csel(x18, -1, 0, eq), "csetm x18, ne");
2296 MacroAssembler::GetCselSynthesisInformation(x18, -1, 0,
2297 &synthesises_left,
2298 &synthesises_right);
2299 VIXL_CHECK(!synthesises_left && !synthesises_right);
2300
2301 COMPARE_MACRO(Csel(w19, -1, 1, eq), "mov w19, #0x1\n"
2302 "cneg w19, w19, eq");
2303 MacroAssembler::GetCselSynthesisInformation(w19, -1, 1,
2304 &synthesises_left,
2305 &synthesises_right);
2306 VIXL_CHECK(!synthesises_left && synthesises_right);
2307
2308 COMPARE_MACRO(Csel(x20, 1, -1, eq), "mov x20, #0xffffffffffffffff\n"
2309 "cneg x20, x20, eq");
2310 MacroAssembler::GetCselSynthesisInformation(x20, 1, -1,
2311 &synthesises_left,
2312 &synthesises_right);
2313 VIXL_CHECK(!synthesises_left && synthesises_right);
2314
2315 COMPARE_MACRO(Csel(w21, 0xaa, 0xbb, eq), "mov w16, #0xaa\n"
2316 "mov w17, #0xbb\n"
2317 "csel w21, w16, w17, eq");
2318 MacroAssembler::GetCselSynthesisInformation(w21, 0xaa, 0xbb,
2319 &synthesises_left,
2320 &synthesises_right);
2321 VIXL_CHECK(synthesises_left && synthesises_right);
2322
2323 COMPARE_MACRO(Csel(x22, 0xaa, -0xbb, eq), "mov x16, #0xaa\n"
2324 "mov x17, #0xffffffffffffff45\n"
2325 "csel x22, x16, x17, eq");
2326 MacroAssembler::GetCselSynthesisInformation(x22, 0xaa, -0xbb,
2327 &synthesises_left,
2328 &synthesises_right);
2329 VIXL_CHECK(synthesises_left && synthesises_right);
2330
2331 COMPARE_MACRO(Csel(w23, 0, 0xaa, eq), "mov w16, #0xaa\n"
2332 "csel w23, w16, wzr, ne");
2333 MacroAssembler::GetCselSynthesisInformation(w23, 0, 0xaa,
2334 &synthesises_left,
2335 &synthesises_right);
2336 VIXL_CHECK(!synthesises_left && synthesises_right);
2337
2338 COMPARE_MACRO(Csel(x24, -0xaa, 0, eq), "mov x16, #0xffffffffffffff56\n"
2339 "csel x24, x16, xzr, eq");
2340 MacroAssembler::GetCselSynthesisInformation(x24, -0xaa, 0,
2341 &synthesises_left,
2342 &synthesises_right);
2343 VIXL_CHECK(synthesises_left && !synthesises_right);
2344
2345 COMPARE_MACRO(Csel(w25, 0xcc, -0xcc, eq), "mov w25, #0xffffff34\n"
2346 "cneg w25, w25, eq");
2347 MacroAssembler::GetCselSynthesisInformation(w25, 0xcc, -0xcc,
2348 &synthesises_left,
2349 &synthesises_right);
2350 VIXL_CHECK(!synthesises_left && synthesises_right);
2351
2352 COMPARE_MACRO(Csel(x26, -0xcc, 0xcc, eq), "mov x26, #0xcc\n"
2353 "cneg x26, x26, eq");
2354 MacroAssembler::GetCselSynthesisInformation(w25, -0xcc, 0xcc,
2355 &synthesises_left,
2356 &synthesises_right);
2357 VIXL_CHECK(!synthesises_left && synthesises_right);
2358
2359 // Test with `Operand` inputs.
2360 COMPARE_MACRO(Csel(x0, x1, Operand(x2, LSL, 3), eq), "lsl x16, x2, #3\n"
2361 "csel x0, x1, x16, eq");
2362 MacroAssembler::GetCselSynthesisInformation(x0, x1, Operand(x2, LSL, 3),
2363 &synthesises_left,
2364 &synthesises_right);
2365 VIXL_CHECK(!synthesises_left && synthesises_right);
2366
2367 COMPARE_MACRO(Csel(x3, x4, Operand(x5, SXTH), eq), "sxth x16, w5\n"
2368 "csel x3, x4, x16, eq");
2369 MacroAssembler::GetCselSynthesisInformation(x3, x4, Operand(x5, SXTH),
2370 &synthesises_left,
2371 &synthesises_right);
2372 VIXL_CHECK(!synthesises_left && synthesises_right);
2373
2374 COMPARE_MACRO(Csel(x6, Operand(x7, LSL, 7), x8, eq), "lsl x16, x7, #7\n"
2375 "csel x6, x16, x8, eq");
2376 MacroAssembler::GetCselSynthesisInformation(x6, Operand(x7, LSL, 7), x8,
2377 &synthesises_left,
2378 &synthesises_right);
2379 VIXL_CHECK(synthesises_left && !synthesises_right);
2380
2381 COMPARE_MACRO(Csel(x9, Operand(x10, SXTH), x11, eq), "sxth x16, w10\n"
2382 "csel x9, x16, x11, eq");
2383 MacroAssembler::GetCselSynthesisInformation(x9, Operand(x10, SXTH), x11,
2384 &synthesises_left,
2385 &synthesises_right);
2386 VIXL_CHECK(synthesises_left && !synthesises_right);
2387
2388 COMPARE_MACRO(Csel(x12, Operand(x13, LSL, 13), Operand(x14, SXTB), eq),
2389 "lsl x16, x13, #13\n"
2390 "sxtb x17, w14\n"
2391 "csel x12, x16, x17, eq");
2392 MacroAssembler::GetCselSynthesisInformation(x12,
2393 Operand(x13, LSL, 13),
2394 Operand(x14, SXTB),
2395 &synthesises_left,
2396 &synthesises_right);
2397 VIXL_CHECK(synthesises_left && synthesises_right);
2398
2399 COMPARE_MACRO(Csel(x15, 0, Operand(x18, LSR, 18), eq),
2400 "lsr x16, x18, #18\n"
2401 "csel x15, x16, xzr, ne");
2402 MacroAssembler::GetCselSynthesisInformation(x15, 0, Operand(x18, LSR, 18),
2403 &synthesises_left,
2404 &synthesises_right);
2405 VIXL_CHECK(!synthesises_left && synthesises_right);
2406
2407 // Test with the zero register.
2408 COMPARE_MACRO(Csel(w19, wzr, wzr, eq), "mov w19, #0x0");
2409 MacroAssembler::GetCselSynthesisInformation(w19, wzr, wzr,
2410 &synthesises_left,
2411 &synthesises_right);
2412 VIXL_CHECK(!synthesises_left && !synthesises_right);
2413
2414 COMPARE_MACRO(Csel(x20, x21, xzr, eq), "csel x20, x21, xzr, eq");
2415 MacroAssembler::GetCselSynthesisInformation(x20, x21, xzr,
2416 &synthesises_left,
2417 &synthesises_right);
2418 VIXL_CHECK(!synthesises_left && !synthesises_right);
2419
2420 COMPARE_MACRO(Csel(w22, wzr, w23, eq), "csel w22, w23, wzr, ne");
2421 MacroAssembler::GetCselSynthesisInformation(w22, wzr, w23,
2422 &synthesises_left,
2423 &synthesises_right);
2424 VIXL_CHECK(!synthesises_left && !synthesises_right);
2425
2426 COMPARE_MACRO(Csel(x24, xzr, 0, eq), "mov x24, #0x0");
2427 MacroAssembler::GetCselSynthesisInformation(x24, xzr, 0,
2428 &synthesises_left,
2429 &synthesises_right);
2430 VIXL_CHECK(!synthesises_left && !synthesises_right);
2431
2432 COMPARE_MACRO(Csel(w25, wzr, 1, eq), "cset w25, eq");
2433 MacroAssembler::GetCselSynthesisInformation(w25, wzr, 1,
2434 &synthesises_left,
2435 &synthesises_right);
2436 VIXL_CHECK(!synthesises_left && !synthesises_right);
2437
armvixlf37fdc02014-02-05 13:22:16 +00002438
2439 CLEANUP();
2440}
2441
armvixl4a102ba2014-07-14 09:02:40 +01002442
armvixlad96eda2013-06-14 11:42:37 +01002443TEST(cond_cmp) {
2444 SETUP();
2445
armvixl578645f2013-08-15 17:21:42 +01002446 COMPARE(ccmn(w0, w1, NZCVFlag, eq), "ccmn w0, w1, #NZCV, eq");
2447 COMPARE(ccmn(x2, x3, NZCFlag, ne), "ccmn x2, x3, #NZCv, ne");
2448 COMPARE(ccmp(w4, w5, NZVFlag, hs), "ccmp w4, w5, #NZcV, hs");
2449 COMPARE(ccmp(x6, x7, NZFlag, lo), "ccmp x6, x7, #NZcv, lo");
2450 COMPARE(ccmn(w8, 31, NFlag, mi), "ccmn w8, #31, #Nzcv, mi");
2451 COMPARE(ccmn(x9, 30, NCFlag, pl), "ccmn x9, #30, #NzCv, pl");
2452 COMPARE(ccmp(w10, 29, NVFlag, vs), "ccmp w10, #29, #NzcV, vs");
2453 COMPARE(ccmp(x11, 28, NFlag, vc), "ccmp x11, #28, #Nzcv, vc");
2454 COMPARE(ccmn(w12, w13, NoFlag, al), "ccmn w12, w13, #nzcv, al");
2455 COMPARE(ccmp(x14, 27, ZVFlag, nv), "ccmp x14, #27, #nZcV, nv");
armvixlad96eda2013-06-14 11:42:37 +01002456
2457 CLEANUP();
2458}
2459
armvixl4a102ba2014-07-14 09:02:40 +01002460
armvixlf37fdc02014-02-05 13:22:16 +00002461TEST(cond_cmp_macro) {
armvixl684cd2a2015-10-23 13:38:33 +01002462 SETUP_MACRO();
armvixlf37fdc02014-02-05 13:22:16 +00002463
2464 COMPARE(Ccmp(w0, -1, VFlag, hi), "ccmn w0, #1, #nzcV, hi");
2465 COMPARE(Ccmp(x1, -31, CFlag, ge), "ccmn x1, #31, #nzCv, ge");
2466 COMPARE(Ccmn(w2, -1, CVFlag, gt), "ccmp w2, #1, #nzCV, gt");
2467 COMPARE(Ccmn(x3, -31, ZCVFlag, ls), "ccmp x3, #31, #nZCV, ls");
2468
2469 CLEANUP();
2470}
2471
armvixl4a102ba2014-07-14 09:02:40 +01002472
armvixlad96eda2013-06-14 11:42:37 +01002473TEST(fmov_imm) {
2474 SETUP();
2475
armvixlb0c8ae22014-03-21 14:03:59 +00002476 COMPARE(fmov(s0, 1.0f), "fmov s0, #0x70 (1.0000)");
2477 COMPARE(fmov(s31, -13.0f), "fmov s31, #0xaa (-13.0000)");
armvixlad96eda2013-06-14 11:42:37 +01002478 COMPARE(fmov(d1, 1.0), "fmov d1, #0x70 (1.0000)");
2479 COMPARE(fmov(d29, -13.0), "fmov d29, #0xaa (-13.0000)");
2480
2481 CLEANUP();
2482}
2483
armvixl4a102ba2014-07-14 09:02:40 +01002484
armvixlad96eda2013-06-14 11:42:37 +01002485TEST(fmov_reg) {
2486 SETUP();
2487
2488 COMPARE(fmov(w3, s13), "fmov w3, s13");
2489 COMPARE(fmov(x6, d26), "fmov x6, d26");
2490 COMPARE(fmov(s11, w30), "fmov s11, w30");
2491 COMPARE(fmov(d31, x2), "fmov d31, x2");
2492 COMPARE(fmov(s12, s13), "fmov s12, s13");
2493 COMPARE(fmov(d22, d23), "fmov d22, d23");
armvixl5289c592015-03-02 13:52:04 +00002494 COMPARE(fmov(v0.D(), 1, x13), "fmov v0.D[1], x13");
2495 COMPARE(fmov(x13, v0.D(), 1), "fmov x13, v0.D[1]");
armvixlad96eda2013-06-14 11:42:37 +01002496
2497 CLEANUP();
2498}
2499
2500
2501TEST(fp_dp1) {
2502 SETUP();
2503
2504 COMPARE(fabs(s0, s1), "fabs s0, s1");
2505 COMPARE(fabs(s31, s30), "fabs s31, s30");
2506 COMPARE(fabs(d2, d3), "fabs d2, d3");
2507 COMPARE(fabs(d31, d30), "fabs d31, d30");
2508 COMPARE(fneg(s4, s5), "fneg s4, s5");
2509 COMPARE(fneg(s31, s30), "fneg s31, s30");
2510 COMPARE(fneg(d6, d7), "fneg d6, d7");
2511 COMPARE(fneg(d31, d30), "fneg d31, d30");
2512 COMPARE(fsqrt(s8, s9), "fsqrt s8, s9");
2513 COMPARE(fsqrt(s31, s30), "fsqrt s31, s30");
2514 COMPARE(fsqrt(d10, d11), "fsqrt d10, d11");
2515 COMPARE(fsqrt(d31, d30), "fsqrt d31, d30");
armvixlf37fdc02014-02-05 13:22:16 +00002516 COMPARE(frinta(s10, s11), "frinta s10, s11");
2517 COMPARE(frinta(s31, s30), "frinta s31, s30");
2518 COMPARE(frinta(d12, d13), "frinta d12, d13");
2519 COMPARE(frinta(d31, d30), "frinta d31, d30");
armvixl330dc712014-11-25 10:38:32 +00002520 COMPARE(frinti(s10, s11), "frinti s10, s11");
2521 COMPARE(frinti(s31, s30), "frinti s31, s30");
2522 COMPARE(frinti(d12, d13), "frinti d12, d13");
2523 COMPARE(frinti(d31, d30), "frinti d31, d30");
2524 COMPARE(frintm(s10, s11), "frintm s10, s11");
2525 COMPARE(frintm(s31, s30), "frintm s31, s30");
2526 COMPARE(frintm(d12, d13), "frintm d12, d13");
2527 COMPARE(frintm(d31, d30), "frintm d31, d30");
armvixlad96eda2013-06-14 11:42:37 +01002528 COMPARE(frintn(s10, s11), "frintn s10, s11");
2529 COMPARE(frintn(s31, s30), "frintn s31, s30");
2530 COMPARE(frintn(d12, d13), "frintn d12, d13");
2531 COMPARE(frintn(d31, d30), "frintn d31, d30");
armvixl330dc712014-11-25 10:38:32 +00002532 COMPARE(frintx(s10, s11), "frintx s10, s11");
2533 COMPARE(frintx(s31, s30), "frintx s31, s30");
2534 COMPARE(frintx(d12, d13), "frintx d12, d13");
2535 COMPARE(frintx(d31, d30), "frintx d31, d30");
armvixlad96eda2013-06-14 11:42:37 +01002536 COMPARE(frintz(s10, s11), "frintz s10, s11");
2537 COMPARE(frintz(s31, s30), "frintz s31, s30");
2538 COMPARE(frintz(d12, d13), "frintz d12, d13");
2539 COMPARE(frintz(d31, d30), "frintz d31, d30");
2540 COMPARE(fcvt(d14, s15), "fcvt d14, s15");
2541 COMPARE(fcvt(d31, s31), "fcvt d31, s31");
armvixl5289c592015-03-02 13:52:04 +00002542 COMPARE(fcvt(s0, d1), "fcvt s0, d1");
2543 COMPARE(fcvt(s2, h3), "fcvt s2, h3");
2544 COMPARE(fcvt(d4, h5), "fcvt d4, h5");
2545 COMPARE(fcvt(h6, s7), "fcvt h6, s7");
2546 COMPARE(fcvt(h8, d9), "fcvt h8, d9");
armvixlad96eda2013-06-14 11:42:37 +01002547
2548 CLEANUP();
2549}
2550
2551
2552TEST(fp_dp2) {
2553 SETUP();
2554
2555 COMPARE(fadd(s0, s1, s2), "fadd s0, s1, s2");
2556 COMPARE(fadd(d3, d4, d5), "fadd d3, d4, d5");
2557 COMPARE(fsub(s31, s30, s29), "fsub s31, s30, s29");
2558 COMPARE(fsub(d31, d30, d29), "fsub d31, d30, d29");
2559 COMPARE(fmul(s7, s8, s9), "fmul s7, s8, s9");
2560 COMPARE(fmul(d10, d11, d12), "fmul d10, d11, d12");
armvixl5289c592015-03-02 13:52:04 +00002561 COMPARE(fnmul(s7, s8, s9), "fnmul s7, s8, s9");
2562 COMPARE(fnmul(d10, d11, d12), "fnmul d10, d11, d12");
armvixlad96eda2013-06-14 11:42:37 +01002563 COMPARE(fdiv(s13, s14, s15), "fdiv s13, s14, s15");
2564 COMPARE(fdiv(d16, d17, d18), "fdiv d16, d17, d18");
2565 COMPARE(fmax(s19, s20, s21), "fmax s19, s20, s21");
2566 COMPARE(fmax(d22, d23, d24), "fmax d22, d23, d24");
2567 COMPARE(fmin(s25, s26, s27), "fmin s25, s26, s27");
2568 COMPARE(fmin(d28, d29, d30), "fmin d28, d29, d30");
armvixlf37fdc02014-02-05 13:22:16 +00002569 COMPARE(fmaxnm(s31, s0, s1), "fmaxnm s31, s0, s1");
2570 COMPARE(fmaxnm(d2, d3, d4), "fmaxnm d2, d3, d4");
2571 COMPARE(fminnm(s5, s6, s7), "fminnm s5, s6, s7");
2572 COMPARE(fminnm(d8, d9, d10), "fminnm d8, d9, d10");
armvixlad96eda2013-06-14 11:42:37 +01002573
2574 CLEANUP();
2575}
2576
2577
2578TEST(fp_dp3) {
2579 SETUP();
2580
armvixlf37fdc02014-02-05 13:22:16 +00002581 COMPARE(fmadd(s7, s8, s9, s10), "fmadd s7, s8, s9, s10");
2582 COMPARE(fmadd(d10, d11, d12, d10), "fmadd d10, d11, d12, d10");
armvixlad96eda2013-06-14 11:42:37 +01002583 COMPARE(fmsub(s7, s8, s9, s10), "fmsub s7, s8, s9, s10");
2584 COMPARE(fmsub(d10, d11, d12, d10), "fmsub d10, d11, d12, d10");
2585
armvixlf37fdc02014-02-05 13:22:16 +00002586 COMPARE(fnmadd(s7, s8, s9, s10), "fnmadd s7, s8, s9, s10");
2587 COMPARE(fnmadd(d10, d11, d12, d10), "fnmadd d10, d11, d12, d10");
2588 COMPARE(fnmsub(s7, s8, s9, s10), "fnmsub s7, s8, s9, s10");
2589 COMPARE(fnmsub(d10, d11, d12, d10), "fnmsub d10, d11, d12, d10");
2590
armvixlad96eda2013-06-14 11:42:37 +01002591 CLEANUP();
2592}
2593
2594
2595TEST(fp_compare) {
2596 SETUP();
2597
2598 COMPARE(fcmp(s0, s1), "fcmp s0, s1");
2599 COMPARE(fcmp(s31, s30), "fcmp s31, s30");
2600 COMPARE(fcmp(d0, d1), "fcmp d0, d1");
2601 COMPARE(fcmp(d31, d30), "fcmp d31, d30");
2602 COMPARE(fcmp(s12, 0), "fcmp s12, #0.0");
2603 COMPARE(fcmp(d12, 0), "fcmp d12, #0.0");
2604
armvixl6e2c8272015-03-31 11:04:14 +01002605 COMPARE(fcmpe(s0, s1), "fcmpe s0, s1");
2606 COMPARE(fcmpe(s31, s30), "fcmpe s31, s30");
2607 COMPARE(fcmpe(d0, d1), "fcmpe d0, d1");
2608 COMPARE(fcmpe(d31, d30), "fcmpe d31, d30");
2609 COMPARE(fcmpe(s12, 0), "fcmpe s12, #0.0");
2610 COMPARE(fcmpe(d12, 0), "fcmpe d12, #0.0");
2611
armvixlad96eda2013-06-14 11:42:37 +01002612 CLEANUP();
2613}
2614
2615
2616TEST(fp_cond_compare) {
2617 SETUP();
2618
2619 COMPARE(fccmp(s0, s1, NoFlag, eq), "fccmp s0, s1, #nzcv, eq");
2620 COMPARE(fccmp(s2, s3, ZVFlag, ne), "fccmp s2, s3, #nZcV, ne");
2621 COMPARE(fccmp(s30, s16, NCFlag, pl), "fccmp s30, s16, #NzCv, pl");
2622 COMPARE(fccmp(s31, s31, NZCVFlag, le), "fccmp s31, s31, #NZCV, le");
2623 COMPARE(fccmp(d4, d5, VFlag, gt), "fccmp d4, d5, #nzcV, gt");
2624 COMPARE(fccmp(d6, d7, NFlag, vs), "fccmp d6, d7, #Nzcv, vs");
2625 COMPARE(fccmp(d30, d0, NZFlag, vc), "fccmp d30, d0, #NZcv, vc");
2626 COMPARE(fccmp(d31, d31, ZFlag, hs), "fccmp d31, d31, #nZcv, hs");
armvixl578645f2013-08-15 17:21:42 +01002627 COMPARE(fccmp(s14, s15, CVFlag, al), "fccmp s14, s15, #nzCV, al");
2628 COMPARE(fccmp(d16, d17, CFlag, nv), "fccmp d16, d17, #nzCv, nv");
armvixlad96eda2013-06-14 11:42:37 +01002629
armvixl6e2c8272015-03-31 11:04:14 +01002630 COMPARE(fccmpe(s0, s1, NoFlag, eq), "fccmpe s0, s1, #nzcv, eq");
2631 COMPARE(fccmpe(s2, s3, ZVFlag, ne), "fccmpe s2, s3, #nZcV, ne");
2632 COMPARE(fccmpe(s30, s16, NCFlag, pl), "fccmpe s30, s16, #NzCv, pl");
2633 COMPARE(fccmpe(s31, s31, NZCVFlag, le), "fccmpe s31, s31, #NZCV, le");
2634 COMPARE(fccmpe(d4, d5, VFlag, gt), "fccmpe d4, d5, #nzcV, gt");
2635 COMPARE(fccmpe(d6, d7, NFlag, vs), "fccmpe d6, d7, #Nzcv, vs");
2636 COMPARE(fccmpe(d30, d0, NZFlag, vc), "fccmpe d30, d0, #NZcv, vc");
2637 COMPARE(fccmpe(d31, d31, ZFlag, hs), "fccmpe d31, d31, #nZcv, hs");
2638 COMPARE(fccmpe(s14, s15, CVFlag, al), "fccmpe s14, s15, #nzCV, al");
2639 COMPARE(fccmpe(d16, d17, CFlag, nv), "fccmpe d16, d17, #nzCv, nv");
2640
armvixlad96eda2013-06-14 11:42:37 +01002641 CLEANUP();
2642}
2643
2644
2645TEST(fp_select) {
2646 SETUP();
2647
2648 COMPARE(fcsel(s0, s1, s2, eq), "fcsel s0, s1, s2, eq")
2649 COMPARE(fcsel(s31, s31, s30, ne), "fcsel s31, s31, s30, ne");
2650 COMPARE(fcsel(d0, d1, d2, mi), "fcsel d0, d1, d2, mi");
2651 COMPARE(fcsel(d31, d30, d31, pl), "fcsel d31, d30, d31, pl");
armvixl578645f2013-08-15 17:21:42 +01002652 COMPARE(fcsel(s14, s15, s16, al), "fcsel s14, s15, s16, al");
2653 COMPARE(fcsel(d17, d18, d19, nv), "fcsel d17, d18, d19, nv");
armvixlad96eda2013-06-14 11:42:37 +01002654
2655 CLEANUP();
2656}
2657
2658
2659TEST(fcvt_scvtf_ucvtf) {
2660 SETUP();
2661
armvixlf37fdc02014-02-05 13:22:16 +00002662 COMPARE(fcvtas(w0, s1), "fcvtas w0, s1");
2663 COMPARE(fcvtas(x2, s3), "fcvtas x2, s3");
2664 COMPARE(fcvtas(w4, d5), "fcvtas w4, d5");
2665 COMPARE(fcvtas(x6, d7), "fcvtas x6, d7");
2666 COMPARE(fcvtau(w8, s9), "fcvtau w8, s9");
2667 COMPARE(fcvtau(x10, s11), "fcvtau x10, s11");
2668 COMPARE(fcvtau(w12, d13), "fcvtau w12, d13");
2669 COMPARE(fcvtau(x14, d15), "fcvtau x14, d15");
armvixlad96eda2013-06-14 11:42:37 +01002670 COMPARE(fcvtns(w0, s1), "fcvtns w0, s1");
2671 COMPARE(fcvtns(x2, s3), "fcvtns x2, s3");
2672 COMPARE(fcvtns(w4, d5), "fcvtns w4, d5");
2673 COMPARE(fcvtns(x6, d7), "fcvtns x6, d7");
2674 COMPARE(fcvtnu(w8, s9), "fcvtnu w8, s9");
2675 COMPARE(fcvtnu(x10, s11), "fcvtnu x10, s11");
2676 COMPARE(fcvtnu(w12, d13), "fcvtnu w12, d13");
2677 COMPARE(fcvtnu(x14, d15), "fcvtnu x14, d15");
2678 COMPARE(fcvtzu(x16, d17), "fcvtzu x16, d17");
2679 COMPARE(fcvtzu(w18, d19), "fcvtzu w18, d19");
2680 COMPARE(fcvtzs(x20, d21), "fcvtzs x20, d21");
2681 COMPARE(fcvtzs(w22, d23), "fcvtzs w22, d23");
2682 COMPARE(fcvtzu(x16, s17), "fcvtzu x16, s17");
2683 COMPARE(fcvtzu(w18, s19), "fcvtzu w18, s19");
2684 COMPARE(fcvtzs(x20, s21), "fcvtzs x20, s21");
2685 COMPARE(fcvtzs(w22, s23), "fcvtzs w22, s23");
armvixl5289c592015-03-02 13:52:04 +00002686 COMPARE(fcvtzs(w2, d1, 1), "fcvtzs w2, d1, #1");
2687 COMPARE(fcvtzs(w2, s1, 1), "fcvtzs w2, s1, #1");
2688 COMPARE(fcvtzs(x4, d3, 15), "fcvtzs x4, d3, #15");
2689 COMPARE(fcvtzs(x4, s3, 15), "fcvtzs x4, s3, #15");
2690 COMPARE(fcvtzs(w6, d5, 32), "fcvtzs w6, d5, #32");
2691 COMPARE(fcvtzs(w6, s5, 32), "fcvtzs w6, s5, #32");
2692 COMPARE(fcvtzu(w2, d1, 1), "fcvtzu w2, d1, #1");
2693 COMPARE(fcvtzu(w2, s1, 1), "fcvtzu w2, s1, #1");
2694 COMPARE(fcvtzu(x4, d3, 15), "fcvtzu x4, d3, #15");
2695 COMPARE(fcvtzu(x4, s3, 15), "fcvtzu x4, s3, #15");
2696 COMPARE(fcvtzu(w6, d5, 32), "fcvtzu w6, d5, #32");
2697 COMPARE(fcvtzu(w6, s5, 32), "fcvtzu w6, s5, #32");
2698 COMPARE(fcvtpu(x24, d25), "fcvtpu x24, d25");
2699 COMPARE(fcvtpu(w26, d27), "fcvtpu w26, d27");
2700 COMPARE(fcvtps(x28, d29), "fcvtps x28, d29");
2701 COMPARE(fcvtps(w30, d31), "fcvtps w30, d31");
2702 COMPARE(fcvtpu(x0, s1), "fcvtpu x0, s1");
2703 COMPARE(fcvtpu(w2, s3), "fcvtpu w2, s3");
2704 COMPARE(fcvtps(x4, s5), "fcvtps x4, s5");
2705 COMPARE(fcvtps(w6, s7), "fcvtps w6, s7");
armvixlad96eda2013-06-14 11:42:37 +01002706 COMPARE(scvtf(d24, w25), "scvtf d24, w25");
armvixl578645f2013-08-15 17:21:42 +01002707 COMPARE(scvtf(s24, w25), "scvtf s24, w25");
2708 COMPARE(scvtf(d26, x0), "scvtf d26, x0");
2709 COMPARE(scvtf(s26, x0), "scvtf s26, x0");
armvixlad96eda2013-06-14 11:42:37 +01002710 COMPARE(ucvtf(d28, w29), "ucvtf d28, w29");
armvixl578645f2013-08-15 17:21:42 +01002711 COMPARE(ucvtf(s28, w29), "ucvtf s28, w29");
armvixlad96eda2013-06-14 11:42:37 +01002712 COMPARE(ucvtf(d0, x1), "ucvtf d0, x1");
armvixl578645f2013-08-15 17:21:42 +01002713 COMPARE(ucvtf(s0, x1), "ucvtf s0, x1");
2714 COMPARE(ucvtf(d0, x1, 0), "ucvtf d0, x1");
2715 COMPARE(ucvtf(s0, x1, 0), "ucvtf s0, x1");
armvixlad96eda2013-06-14 11:42:37 +01002716 COMPARE(scvtf(d1, x2, 1), "scvtf d1, x2, #1");
armvixl578645f2013-08-15 17:21:42 +01002717 COMPARE(scvtf(s1, x2, 1), "scvtf s1, x2, #1");
armvixlad96eda2013-06-14 11:42:37 +01002718 COMPARE(scvtf(d3, x4, 15), "scvtf d3, x4, #15");
armvixl578645f2013-08-15 17:21:42 +01002719 COMPARE(scvtf(s3, x4, 15), "scvtf s3, x4, #15");
armvixlad96eda2013-06-14 11:42:37 +01002720 COMPARE(scvtf(d5, x6, 32), "scvtf d5, x6, #32");
armvixl578645f2013-08-15 17:21:42 +01002721 COMPARE(scvtf(s5, x6, 32), "scvtf s5, x6, #32");
armvixlad96eda2013-06-14 11:42:37 +01002722 COMPARE(ucvtf(d7, x8, 2), "ucvtf d7, x8, #2");
armvixl578645f2013-08-15 17:21:42 +01002723 COMPARE(ucvtf(s7, x8, 2), "ucvtf s7, x8, #2");
armvixlad96eda2013-06-14 11:42:37 +01002724 COMPARE(ucvtf(d9, x10, 16), "ucvtf d9, x10, #16");
armvixl578645f2013-08-15 17:21:42 +01002725 COMPARE(ucvtf(s9, x10, 16), "ucvtf s9, x10, #16");
armvixlad96eda2013-06-14 11:42:37 +01002726 COMPARE(ucvtf(d11, x12, 33), "ucvtf d11, x12, #33");
armvixl578645f2013-08-15 17:21:42 +01002727 COMPARE(ucvtf(s11, x12, 33), "ucvtf s11, x12, #33");
armvixlad96eda2013-06-14 11:42:37 +01002728 COMPARE(fcvtms(w0, s1), "fcvtms w0, s1");
2729 COMPARE(fcvtms(x2, s3), "fcvtms x2, s3");
2730 COMPARE(fcvtms(w4, d5), "fcvtms w4, d5");
2731 COMPARE(fcvtms(x6, d7), "fcvtms x6, d7");
2732 COMPARE(fcvtmu(w8, s9), "fcvtmu w8, s9");
2733 COMPARE(fcvtmu(x10, s11), "fcvtmu x10, s11");
2734 COMPARE(fcvtmu(w12, d13), "fcvtmu w12, d13");
2735 COMPARE(fcvtmu(x14, d15), "fcvtmu x14, d15");
2736
2737 CLEANUP();
2738}
2739
2740
armvixl4a102ba2014-07-14 09:02:40 +01002741TEST(system_clrex) {
2742 SETUP();
2743
2744 COMPARE(clrex(0), "clrex #0x0");
2745 COMPARE(clrex(14), "clrex #0xe");
2746 COMPARE(clrex(15), "clrex");
2747 COMPARE(clrex(), "clrex");
2748
2749 CLEANUP();
2750}
2751
2752
armvixlad96eda2013-06-14 11:42:37 +01002753TEST(system_mrs) {
2754 SETUP();
2755
2756 COMPARE(mrs(x0, NZCV), "mrs x0, nzcv");
2757 COMPARE(mrs(x30, NZCV), "mrs x30, nzcv");
armvixl578645f2013-08-15 17:21:42 +01002758 COMPARE(mrs(x15, FPCR), "mrs x15, fpcr");
armvixlad96eda2013-06-14 11:42:37 +01002759
2760 CLEANUP();
2761}
2762
2763
2764TEST(system_msr) {
2765 SETUP();
2766
2767 COMPARE(msr(NZCV, x0), "msr nzcv, x0");
2768 COMPARE(msr(NZCV, x30), "msr nzcv, x30");
armvixl578645f2013-08-15 17:21:42 +01002769 COMPARE(msr(FPCR, x15), "msr fpcr, x15");
armvixlad96eda2013-06-14 11:42:37 +01002770
2771 CLEANUP();
2772}
2773
2774
armvixl5289c592015-03-02 13:52:04 +00002775TEST(system_sys) {
2776 SETUP();
2777
2778 COMPARE(sys(0x3, 0x7, 0x5, 0x1, x1), "ic ivau, x1");
2779 COMPARE(sys(0x3, 0x7, 0xa, 0x1, x2), "dc cvac, x2");
2780 COMPARE(sys(0x3, 0x7, 0xb, 0x1, x3), "dc cvau, x3");
2781 COMPARE(sys(0x3, 0x7, 0xe, 0x1, x4), "dc civac, x4");
2782 COMPARE(sys(0x3, 0x7, 0x4, 0x1, x0), "dc zva, x0");
2783 COMPARE(sys(0x0, 0x0, 0x0, 0x0, x0), "sys #0, C0, C0, #0, x0");
2784 COMPARE(sys(0x1, 0x2, 0x5, 0x2, x5), "sys #1, C2, C5, #2, x5");
2785 COMPARE(sys(0x2, 0x8, 0xa, 0x3, x6), "sys #2, C8, C10, #3, x6");
2786 COMPARE(sys(0x2, 0xf, 0xf, 0x1, xzr), "sys #2, C15, C15, #1");
2787 COMPARE(sys(0x2, 0xf, 0xf, 0x1), "sys #2, C15, C15, #1");
2788
2789 CLEANUP();
2790}
2791
2792
2793TEST(system_ic) {
2794 SETUP();
2795
2796 COMPARE(ic(IVAU, x0), "ic ivau, x0");
2797 COMPARE(ic(IVAU, x1), "ic ivau, x1");
2798 COMPARE(ic(IVAU, xzr), "ic ivau, xzr");
2799
2800 CLEANUP();
2801}
2802
2803
2804TEST(system_dc) {
2805 SETUP();
2806
2807 COMPARE(dc(CVAC, x2), "dc cvac, x2");
2808 COMPARE(dc(CVAU, x3), "dc cvau, x3");
2809 COMPARE(dc(CIVAC, x4), "dc civac, x4");
2810 COMPARE(dc(ZVA, x0), "dc zva, x0");
2811 COMPARE(dc(ZVA, xzr), "dc zva, xzr");
2812
2813 CLEANUP();
2814}
2815
2816
armvixlad96eda2013-06-14 11:42:37 +01002817TEST(system_nop) {
2818 SETUP();
2819
2820 COMPARE(nop(), "nop");
2821
2822 CLEANUP();
2823}
2824
2825
2826TEST(unreachable) {
armvixl684cd2a2015-10-23 13:38:33 +01002827 SETUP_MACRO();
armvixlad96eda2013-06-14 11:42:37 +01002828
armvixl684cd2a2015-10-23 13:38:33 +01002829#ifdef VIXL_INCLUDE_SIMULATOR
armvixlb0c8ae22014-03-21 14:03:59 +00002830 VIXL_ASSERT(kUnreachableOpcode == 0xdeb0);
armvixlad96eda2013-06-14 11:42:37 +01002831 COMPARE(Unreachable(), "hlt #0xdeb0");
2832#else
2833 COMPARE(Unreachable(), "blr xzr");
2834#endif
2835
2836 CLEANUP();
2837}
2838
2839
armvixl684cd2a2015-10-23 13:38:33 +01002840#ifdef VIXL_INCLUDE_SIMULATOR
armvixlad96eda2013-06-14 11:42:37 +01002841TEST(trace) {
armvixl684cd2a2015-10-23 13:38:33 +01002842 SETUP_MACRO();
armvixlad96eda2013-06-14 11:42:37 +01002843
armvixlb0c8ae22014-03-21 14:03:59 +00002844 VIXL_ASSERT(kTraceOpcode == 0xdeb2);
armvixlad96eda2013-06-14 11:42:37 +01002845
2846 // All Trace calls should produce the same instruction.
armvixl0f35e362016-05-10 13:57:58 +01002847 COMPARE_MACRO_PREFIX(Trace(LOG_ALL, TRACE_ENABLE), "hlt #0xdeb2");
2848 COMPARE_MACRO_PREFIX(Trace(LOG_REGS, TRACE_DISABLE), "hlt #0xdeb2");
armvixlad96eda2013-06-14 11:42:37 +01002849
2850 CLEANUP();
2851}
2852#endif
2853
2854
armvixl684cd2a2015-10-23 13:38:33 +01002855#ifdef VIXL_INCLUDE_SIMULATOR
armvixlad96eda2013-06-14 11:42:37 +01002856TEST(log) {
armvixl684cd2a2015-10-23 13:38:33 +01002857 SETUP_MACRO();
armvixlad96eda2013-06-14 11:42:37 +01002858
armvixlb0c8ae22014-03-21 14:03:59 +00002859 VIXL_ASSERT(kLogOpcode == 0xdeb3);
armvixlad96eda2013-06-14 11:42:37 +01002860
2861 // All Log calls should produce the same instruction.
armvixl0f35e362016-05-10 13:57:58 +01002862 COMPARE_MACRO_PREFIX(Log(LOG_ALL), "hlt #0xdeb3");
2863 COMPARE_MACRO_PREFIX(Log(LOG_SYSREGS), "hlt #0xdeb3");
armvixlad96eda2013-06-14 11:42:37 +01002864
2865 CLEANUP();
2866}
2867#endif
2868
2869
2870TEST(hlt) {
2871 SETUP();
2872
2873 COMPARE(hlt(0), "hlt #0x0");
2874 COMPARE(hlt(1), "hlt #0x1");
2875 COMPARE(hlt(65535), "hlt #0xffff");
2876
2877 CLEANUP();
2878}
2879
2880
2881TEST(brk) {
2882 SETUP();
2883
2884 COMPARE(brk(0), "brk #0x0");
2885 COMPARE(brk(1), "brk #0x1");
2886 COMPARE(brk(65535), "brk #0xffff");
2887
2888 CLEANUP();
2889}
2890
2891
armvixl5289c592015-03-02 13:52:04 +00002892TEST(svc) {
2893 SETUP();
2894
2895 COMPARE(svc(0), "svc #0x0");
2896 COMPARE(svc(1), "svc #0x1");
2897 COMPARE(svc(65535), "svc #0xffff");
2898
2899 CLEANUP();
2900}
2901
2902
armvixlad96eda2013-06-14 11:42:37 +01002903TEST(add_sub_negative) {
armvixl684cd2a2015-10-23 13:38:33 +01002904 SETUP_MACRO();
armvixlad96eda2013-06-14 11:42:37 +01002905
2906 COMPARE(Add(x10, x0, -42), "sub x10, x0, #0x2a (42)");
2907 COMPARE(Add(x11, x1, -687), "sub x11, x1, #0x2af (687)");
2908 COMPARE(Add(x12, x2, -0x88), "sub x12, x2, #0x88 (136)");
2909
2910 COMPARE(Sub(x13, x0, -600), "add x13, x0, #0x258 (600)");
2911 COMPARE(Sub(x14, x1, -313), "add x14, x1, #0x139 (313)");
2912 COMPARE(Sub(x15, x2, -0x555), "add x15, x2, #0x555 (1365)");
2913
2914 COMPARE(Add(w19, w3, -0x344), "sub w19, w3, #0x344 (836)");
2915 COMPARE(Add(w20, w4, -2000), "sub w20, w4, #0x7d0 (2000)");
2916
armvixl6e2c8272015-03-31 11:04:14 +01002917 COMPARE(Add(w0, w1, 5, LeaveFlags), "add w0, w1, #0x5 (5)");
2918 COMPARE(Add(w1, w2, 15, SetFlags), "adds w1, w2, #0xf (15)");
2919
2920 COMPARE(Sub(w0, w1, 5, LeaveFlags), "sub w0, w1, #0x5 (5)");
2921 COMPARE(Sub(w1, w2, 15, SetFlags), "subs w1, w2, #0xf (15)");
2922
armvixlad96eda2013-06-14 11:42:37 +01002923 COMPARE(Sub(w21, w3, -0xbc), "add w21, w3, #0xbc (188)");
2924 COMPARE(Sub(w22, w4, -2000), "add w22, w4, #0x7d0 (2000)");
2925
armvixlf37fdc02014-02-05 13:22:16 +00002926 COMPARE(Cmp(w0, -1), "cmn w0, #0x1 (1)");
2927 COMPARE(Cmp(x1, -1), "cmn x1, #0x1 (1)");
2928 COMPARE(Cmp(w2, -4095), "cmn w2, #0xfff (4095)");
2929 COMPARE(Cmp(x3, -4095), "cmn x3, #0xfff (4095)");
2930
2931 COMPARE(Cmn(w0, -1), "cmp w0, #0x1 (1)");
2932 COMPARE(Cmn(x1, -1), "cmp x1, #0x1 (1)");
2933 COMPARE(Cmn(w2, -4095), "cmp w2, #0xfff (4095)");
2934 COMPARE(Cmn(x3, -4095), "cmp x3, #0xfff (4095)");
2935
armvixlad96eda2013-06-14 11:42:37 +01002936 CLEANUP();
2937}
2938
2939
2940TEST(logical_immediate_move) {
armvixl684cd2a2015-10-23 13:38:33 +01002941 SETUP_MACRO();
armvixlad96eda2013-06-14 11:42:37 +01002942
armvixl330dc712014-11-25 10:38:32 +00002943 COMPARE(And(w0, w1, 0), "mov w0, #0x0");
2944 COMPARE(And(x0, x1, 0), "mov x0, #0x0");
armvixlad96eda2013-06-14 11:42:37 +01002945 COMPARE(Orr(w2, w3, 0), "mov w2, w3");
2946 COMPARE(Orr(x2, x3, 0), "mov x2, x3");
2947 COMPARE(Eor(w4, w5, 0), "mov w4, w5");
2948 COMPARE(Eor(x4, x5, 0), "mov x4, x5");
2949 COMPARE(Bic(w6, w7, 0), "mov w6, w7");
2950 COMPARE(Bic(x6, x7, 0), "mov x6, x7");
armvixl330dc712014-11-25 10:38:32 +00002951 COMPARE(Orn(w8, w9, 0), "mov w8, #0xffffffff");
2952 COMPARE(Orn(x8, x9, 0), "mov x8, #0xffffffffffffffff");
armvixlad96eda2013-06-14 11:42:37 +01002953 COMPARE(Eon(w10, w11, 0), "mvn w10, w11");
2954 COMPARE(Eon(x10, x11, 0), "mvn x10, x11");
2955
2956 COMPARE(And(w12, w13, 0xffffffff), "mov w12, w13");
2957 COMPARE(And(x12, x13, 0xffffffff), "and x12, x13, #0xffffffff");
2958 COMPARE(And(x12, x13, 0xffffffffffffffff), "mov x12, x13");
armvixl330dc712014-11-25 10:38:32 +00002959 COMPARE(Orr(w14, w15, 0xffffffff), "mov w14, #0xffffffff");
armvixlad96eda2013-06-14 11:42:37 +01002960 COMPARE(Orr(x14, x15, 0xffffffff), "orr x14, x15, #0xffffffff");
armvixl330dc712014-11-25 10:38:32 +00002961 COMPARE(Orr(x14, x15, 0xffffffffffffffff), "mov x14, #0xffffffffffffffff");
armvixlad96eda2013-06-14 11:42:37 +01002962 COMPARE(Eor(w16, w17, 0xffffffff), "mvn w16, w17");
2963 COMPARE(Eor(x16, x17, 0xffffffff), "eor x16, x17, #0xffffffff");
2964 COMPARE(Eor(x16, x17, 0xffffffffffffffff), "mvn x16, x17");
armvixl330dc712014-11-25 10:38:32 +00002965 COMPARE(Bic(w18, w19, 0xffffffff), "mov w18, #0x0");
armvixlad96eda2013-06-14 11:42:37 +01002966 COMPARE(Bic(x18, x19, 0xffffffff), "and x18, x19, #0xffffffff00000000");
armvixl330dc712014-11-25 10:38:32 +00002967 COMPARE(Bic(x18, x19, 0xffffffffffffffff), "mov x18, #0x0");
armvixlad96eda2013-06-14 11:42:37 +01002968 COMPARE(Orn(w20, w21, 0xffffffff), "mov w20, w21");
2969 COMPARE(Orn(x20, x21, 0xffffffff), "orr x20, x21, #0xffffffff00000000");
2970 COMPARE(Orn(x20, x21, 0xffffffffffffffff), "mov x20, x21");
2971 COMPARE(Eon(w22, w23, 0xffffffff), "mov w22, w23");
2972 COMPARE(Eon(x22, x23, 0xffffffff), "eor x22, x23, #0xffffffff00000000");
2973 COMPARE(Eon(x22, x23, 0xffffffffffffffff), "mov x22, x23");
2974
2975 CLEANUP();
2976}
armvixlf37fdc02014-02-05 13:22:16 +00002977
armvixl4a102ba2014-07-14 09:02:40 +01002978
armvixlf37fdc02014-02-05 13:22:16 +00002979TEST(barriers) {
armvixl684cd2a2015-10-23 13:38:33 +01002980 SETUP_MACRO();
armvixlf37fdc02014-02-05 13:22:16 +00002981
2982 // DMB
2983 COMPARE(Dmb(FullSystem, BarrierAll), "dmb sy");
2984 COMPARE(Dmb(FullSystem, BarrierReads), "dmb ld");
2985 COMPARE(Dmb(FullSystem, BarrierWrites), "dmb st");
2986
2987 COMPARE(Dmb(InnerShareable, BarrierAll), "dmb ish");
2988 COMPARE(Dmb(InnerShareable, BarrierReads), "dmb ishld");
2989 COMPARE(Dmb(InnerShareable, BarrierWrites), "dmb ishst");
2990
2991 COMPARE(Dmb(NonShareable, BarrierAll), "dmb nsh");
2992 COMPARE(Dmb(NonShareable, BarrierReads), "dmb nshld");
2993 COMPARE(Dmb(NonShareable, BarrierWrites), "dmb nshst");
2994
2995 COMPARE(Dmb(OuterShareable, BarrierAll), "dmb osh");
2996 COMPARE(Dmb(OuterShareable, BarrierReads), "dmb oshld");
2997 COMPARE(Dmb(OuterShareable, BarrierWrites), "dmb oshst");
2998
2999 COMPARE(Dmb(FullSystem, BarrierOther), "dmb sy (0b1100)");
3000 COMPARE(Dmb(InnerShareable, BarrierOther), "dmb sy (0b1000)");
3001 COMPARE(Dmb(NonShareable, BarrierOther), "dmb sy (0b0100)");
3002 COMPARE(Dmb(OuterShareable, BarrierOther), "dmb sy (0b0000)");
3003
3004 // DSB
3005 COMPARE(Dsb(FullSystem, BarrierAll), "dsb sy");
3006 COMPARE(Dsb(FullSystem, BarrierReads), "dsb ld");
3007 COMPARE(Dsb(FullSystem, BarrierWrites), "dsb st");
3008
3009 COMPARE(Dsb(InnerShareable, BarrierAll), "dsb ish");
3010 COMPARE(Dsb(InnerShareable, BarrierReads), "dsb ishld");
3011 COMPARE(Dsb(InnerShareable, BarrierWrites), "dsb ishst");
3012
3013 COMPARE(Dsb(NonShareable, BarrierAll), "dsb nsh");
3014 COMPARE(Dsb(NonShareable, BarrierReads), "dsb nshld");
3015 COMPARE(Dsb(NonShareable, BarrierWrites), "dsb nshst");
3016
3017 COMPARE(Dsb(OuterShareable, BarrierAll), "dsb osh");
3018 COMPARE(Dsb(OuterShareable, BarrierReads), "dsb oshld");
3019 COMPARE(Dsb(OuterShareable, BarrierWrites), "dsb oshst");
3020
3021 COMPARE(Dsb(FullSystem, BarrierOther), "dsb sy (0b1100)");
3022 COMPARE(Dsb(InnerShareable, BarrierOther), "dsb sy (0b1000)");
3023 COMPARE(Dsb(NonShareable, BarrierOther), "dsb sy (0b0100)");
3024 COMPARE(Dsb(OuterShareable, BarrierOther), "dsb sy (0b0000)");
3025
3026 // ISB
3027 COMPARE(Isb(), "isb");
3028
3029 CLEANUP();
3030}
armvixl330dc712014-11-25 10:38:32 +00003031
3032
armvixl5289c592015-03-02 13:52:04 +00003033#define VLIST2(v) v, VRegister((v.code()+1)%32, v.size(), v.lanes())
3034#define VLIST3(v) VLIST2(v), VRegister((v.code()+2)%32, v.size(), v.lanes())
3035#define VLIST4(v) VLIST3(v), VRegister((v.code()+3)%32, v.size(), v.lanes())
3036
3037
3038#define NEON_FORMAT_LIST(V) \
3039 V(V8B(), "8b") \
3040 V(V16B(), "16b") \
3041 V(V4H(), "4h") \
3042 V(V8H(), "8h") \
3043 V(V2S(), "2s") \
3044 V(V4S(), "4s") \
3045 V(V2D(), "2d")
3046
3047#define NEON_FORMAT_LIST_LP(V) \
3048 V(V4H(), "4h", V8B(), "8b") \
3049 V(V2S(), "2s", V4H(), "4h") \
3050 V(V1D(), "1d", V2S(), "2s") \
3051 V(V8H(), "8h", V16B(), "16b") \
3052 V(V4S(), "4s", V8H(), "8h") \
3053 V(V2D(), "2d", V4S(), "4s")
3054
3055#define NEON_FORMAT_LIST_LW(V) \
3056 V(V8H(), "8h", V8B(), "8b") \
3057 V(V4S(), "4s", V4H(), "4h") \
3058 V(V2D(), "2d", V2S(), "2s")
3059
3060#define NEON_FORMAT_LIST_LW2(V) \
3061 V(V8H(), "8h", V16B(), "16b") \
3062 V(V4S(), "4s", V8H(), "8h") \
3063 V(V2D(), "2d", V4S(), "4s")
3064
3065#define NEON_FORMAT_LIST_BHS(V) \
3066 V(V8B(), "8b") \
3067 V(V16B(), "16b") \
3068 V(V4H(), "4h") \
3069 V(V8H(), "8h") \
3070 V(V2S(), "2s") \
3071 V(V4S(), "4s")
3072
3073#define NEON_FORMAT_LIST_HS(V) \
3074 V(V4H(), "4h") \
3075 V(V8H(), "8h") \
3076 V(V2S(), "2s") \
3077 V(V4S(), "4s")
3078
3079TEST(neon_load_store_vector) {
armvixl684cd2a2015-10-23 13:38:33 +01003080 SETUP_MACRO();
armvixl5289c592015-03-02 13:52:04 +00003081
3082 #define DISASM_INST(M, S) \
3083 COMPARE(Ld1(v0.M, MemOperand(x15)), \
3084 "ld1 {v0." S "}, [x15]"); \
3085 COMPARE(Ld1(v1.M, v2.M, MemOperand(x16)), \
3086 "ld1 {v1." S ", v2." S "}, [x16]"); \
3087 COMPARE(Ld1(v3.M, v4.M, v5.M, MemOperand(x17)), \
3088 "ld1 {v3." S ", v4." S ", v5." S "}, [x17]"); \
3089 COMPARE(Ld1(v6.M, v7.M, v8.M, v9.M, MemOperand(x18)), \
3090 "ld1 {v6." S ", v7." S ", v8." S ", v9." S "}, [x18]") \
3091 COMPARE(Ld1(v30.M, v31.M, v0.M, v1.M, MemOperand(sp)), \
3092 "ld1 {v30." S ", v31." S ", v0." S ", v1." S "}, [sp]") \
3093 COMPARE(Ld2(v1.M, v2.M, MemOperand(x16)), \
3094 "ld2 {v1." S ", v2." S "}, [x16]"); \
3095 COMPARE(Ld3(v3.M, v4.M, v5.M, MemOperand(x17)), \
3096 "ld3 {v3." S ", v4." S ", v5." S "}, [x17]"); \
3097 COMPARE(Ld4(v6.M, v7.M, v8.M, v9.M, MemOperand(x18)), \
3098 "ld4 {v6." S ", v7." S ", v8." S ", v9." S "}, [x18]") \
3099 COMPARE(Ld4(v30.M, v31.M, v0.M, v1.M, MemOperand(sp)), \
3100 "ld4 {v30." S ", v31." S ", v0." S ", v1." S "}, [sp]") \
3101 NEON_FORMAT_LIST(DISASM_INST);
3102 #undef DISASM_INST
3103
3104 #define DISASM_INST(M, S) \
3105 COMPARE(Ld1(v0.M, MemOperand(x15, x20, PostIndex)), \
3106 "ld1 {v0." S "}, [x15], x20"); \
3107 COMPARE(Ld1(v1.M, v2.M, MemOperand(x16, x21, PostIndex)), \
3108 "ld1 {v1." S ", v2." S "}, [x16], x21"); \
3109 COMPARE(Ld1(v3.M, v4.M, v5.M, MemOperand(x17, x22, PostIndex)), \
3110 "ld1 {v3." S ", v4." S ", v5." S "}, [x17], x22"); \
3111 COMPARE(Ld1(v6.M, v7.M, v8.M, v9.M, MemOperand(x18, x23, PostIndex)), \
3112 "ld1 {v6." S ", v7." S ", v8." S ", v9." S "}, [x18], x23") \
3113 COMPARE(Ld1(v30.M, v31.M, v0.M, v1.M, MemOperand(sp, x24, PostIndex)), \
3114 "ld1 {v30." S ", v31." S ", v0." S ", v1." S "}, [sp], x24") \
3115 COMPARE(Ld2(v1.M, v2.M, MemOperand(x16, x21, PostIndex)), \
3116 "ld2 {v1." S ", v2." S "}, [x16], x21"); \
3117 COMPARE(Ld3(v3.M, v4.M, v5.M, MemOperand(x17, x22, PostIndex)), \
3118 "ld3 {v3." S ", v4." S ", v5." S "}, [x17], x22"); \
3119 COMPARE(Ld4(v6.M, v7.M, v8.M, v9.M, MemOperand(x18, x23, PostIndex)), \
3120 "ld4 {v6." S ", v7." S ", v8." S ", v9." S "}, [x18], x23") \
3121 COMPARE(Ld4(v30.M, v31.M, v0.M, v1.M, MemOperand(sp, x24, PostIndex)), \
3122 "ld4 {v30." S ", v31." S ", v0." S ", v1." S "}, [sp], x24") \
3123 NEON_FORMAT_LIST(DISASM_INST);
3124 #undef DISASM_INST
3125
3126 COMPARE(Ld1(v0.V8B(), MemOperand(x15, 8, PostIndex)),
3127 "ld1 {v0.8b}, [x15], #8");
3128 COMPARE(Ld1(v1.V16B(), MemOperand(x16, 16, PostIndex)),
3129 "ld1 {v1.16b}, [x16], #16");
3130 COMPARE(Ld1(v2.V4H(), v3.V4H(), MemOperand(x17, 16, PostIndex)),
3131 "ld1 {v2.4h, v3.4h}, [x17], #16");
3132 COMPARE(Ld1(v4.V8H(), v5.V8H(), MemOperand(x18, 32, PostIndex)),
3133 "ld1 {v4.8h, v5.8h}, [x18], #32");
3134 COMPARE(Ld1(v16.V2S(), v17.V2S(), v18.V2S(), MemOperand(x19, 24, PostIndex)),
3135 "ld1 {v16.2s, v17.2s, v18.2s}, [x19], #24");
3136 COMPARE(Ld1(v16.V4S(), v17.V4S(), v18.V4S(), MemOperand(x19, 48, PostIndex)),
3137 "ld1 {v16.4s, v17.4s, v18.4s}, [x19], #48");
3138 COMPARE(Ld1(v19.V2S(), v20.V2S(), v21.V2S(), v22.V2S(),
3139 MemOperand(x20, 32, PostIndex)),
3140 "ld1 {v19.2s, v20.2s, v21.2s, v22.2s}, [x20], #32");
3141 COMPARE(Ld1(v23.V2D(), v24.V2D(), v25.V2D(), v26.V2D(),
3142 MemOperand(x21, 64, PostIndex)),
3143 "ld1 {v23.2d, v24.2d, v25.2d, v26.2d}, [x21], #64");
3144
3145 COMPARE(Ld2(v2.V4H(), v3.V4H(), MemOperand(x17, 16, PostIndex)),
3146 "ld2 {v2.4h, v3.4h}, [x17], #16");
3147 COMPARE(Ld2(v4.V8H(), v5.V8H(), MemOperand(x18, 32, PostIndex)),
3148 "ld2 {v4.8h, v5.8h}, [x18], #32");
3149 COMPARE(Ld3(v16.V2S(), v17.V2S(), v18.V2S(), MemOperand(x19, 24, PostIndex)),
3150 "ld3 {v16.2s, v17.2s, v18.2s}, [x19], #24");
3151 COMPARE(Ld3(v16.V4S(), v17.V4S(), v18.V4S(), MemOperand(x19, 48, PostIndex)),
3152 "ld3 {v16.4s, v17.4s, v18.4s}, [x19], #48");
3153 COMPARE(Ld4(v19.V2S(), v20.V2S(), v21.V2S(), v22.V2S(),
3154 MemOperand(x20, 32, PostIndex)),
3155 "ld4 {v19.2s, v20.2s, v21.2s, v22.2s}, [x20], #32");
3156 COMPARE(Ld4(v23.V2D(), v24.V2D(), v25.V2D(), v26.V2D(),
3157 MemOperand(x21, 64, PostIndex)),
3158 "ld4 {v23.2d, v24.2d, v25.2d, v26.2d}, [x21], #64");
3159
3160 COMPARE(Ld1(v0.V1D(), MemOperand(x16)), "ld1 {v0.1d}, [x16]");
3161 COMPARE(Ld1(v1.V1D(), v2.V1D(), MemOperand(x17, 16, PostIndex)),
3162 "ld1 {v1.1d, v2.1d}, [x17], #16");
3163 COMPARE(Ld1(v3.V1D(), v4.V1D(), v5.V1D(), MemOperand(x18, x19, PostIndex)),
3164 "ld1 {v3.1d, v4.1d, v5.1d}, [x18], x19");
3165 COMPARE(Ld1(v30.V1D(), v31.V1D(), v0.V1D(), v1.V1D(),
3166 MemOperand(x20, 32, PostIndex)),
3167 "ld1 {v30.1d, v31.1d, v0.1d, v1.1d}, [x20], #32");
3168 COMPARE(Ld1(d30, d31, d0, d1, MemOperand(x21, x22, PostIndex)),
3169 "ld1 {v30.1d, v31.1d, v0.1d, v1.1d}, [x21], x22");
3170
3171 #define DISASM_INST(M, S) \
3172 COMPARE(St1(v20.M, MemOperand(x15)), \
3173 "st1 {v20." S "}, [x15]"); \
3174 COMPARE(St1(v21.M, v22.M, MemOperand(x16)), \
3175 "st1 {v21." S ", v22." S "}, [x16]"); \
3176 COMPARE(St1(v23.M, v24.M, v25.M, MemOperand(x17)), \
3177 "st1 {v23." S ", v24." S ", v25." S "}, [x17]"); \
3178 COMPARE(St1(v26.M, v27.M, v28.M, v29.M, MemOperand(x18)), \
3179 "st1 {v26." S ", v27." S ", v28." S ", v29." S "}, [x18]") \
3180 COMPARE(St1(v30.M, v31.M, v0.M, v1.M, MemOperand(sp)), \
3181 "st1 {v30." S ", v31." S ", v0." S ", v1." S "}, [sp]") \
3182 COMPARE(St2(VLIST2(v21.M), MemOperand(x16)), \
3183 "st2 {v21." S ", v22." S "}, [x16]"); \
3184 COMPARE(St3(v23.M, v24.M, v25.M, MemOperand(x17)), \
3185 "st3 {v23." S ", v24." S ", v25." S "}, [x17]"); \
3186 COMPARE(St4(v30.M, v31.M, v0.M, v1.M, MemOperand(sp)), \
3187 "st4 {v30." S ", v31." S ", v0." S ", v1." S "}, [sp]")
3188 NEON_FORMAT_LIST(DISASM_INST);
3189 #undef DISASM_INST
3190
3191 #define DISASM_INST(M, S) \
3192 COMPARE(St1(v0.M, MemOperand(x15, x20, PostIndex)), \
3193 "st1 {v0." S "}, [x15], x20"); \
3194 COMPARE(St1(v1.M, v2.M, MemOperand(x16, x21, PostIndex)), \
3195 "st1 {v1." S ", v2." S "}, [x16], x21"); \
3196 COMPARE(St1(v3.M, v4.M, v5.M, MemOperand(x17, x22, PostIndex)), \
3197 "st1 {v3." S ", v4." S ", v5." S "}, [x17], x22"); \
3198 COMPARE(St1(v6.M, v7.M, v8.M, v9.M, MemOperand(x18, x23, PostIndex)), \
3199 "st1 {v6." S ", v7." S ", v8." S ", v9." S "}, [x18], x23") \
3200 COMPARE(St1(v30.M, v31.M, v0.M, v1.M, MemOperand(sp, x24, PostIndex)), \
3201 "st1 {v30." S ", v31." S ", v0." S ", v1." S "}, [sp], x24") \
3202 COMPARE(St2(v1.M, v2.M, MemOperand(x16, x21, PostIndex)), \
3203 "st2 {v1." S ", v2." S "}, [x16], x21"); \
3204 COMPARE(St3(v3.M, v4.M, v5.M, MemOperand(x17, x22, PostIndex)), \
3205 "st3 {v3." S ", v4." S ", v5." S "}, [x17], x22"); \
3206 COMPARE(St4(v6.M, v7.M, v8.M, v9.M, MemOperand(x18, x23, PostIndex)), \
3207 "st4 {v6." S ", v7." S ", v8." S ", v9." S "}, [x18], x23") \
3208 COMPARE(St4(v30.M, v31.M, v0.M, v1.M, MemOperand(sp, x24, PostIndex)), \
3209 "st4 {v30." S ", v31." S ", v0." S ", v1." S "}, [sp], x24")
3210 NEON_FORMAT_LIST(DISASM_INST);
3211 #undef DISASM_INST
3212
3213 COMPARE(St1(v0.V8B(), MemOperand(x15, 8, PostIndex)),
3214 "st1 {v0.8b}, [x15], #8");
3215 COMPARE(St1(v1.V16B(), MemOperand(x16, 16, PostIndex)),
3216 "st1 {v1.16b}, [x16], #16");
3217 COMPARE(St1(v2.V4H(), v3.V4H(), MemOperand(x17, 16, PostIndex)),
3218 "st1 {v2.4h, v3.4h}, [x17], #16");
3219 COMPARE(St1(v4.V8H(), v5.V8H(), MemOperand(x18, 32, PostIndex)),
3220 "st1 {v4.8h, v5.8h}, [x18], #32");
3221 COMPARE(St1(v16.V2S(), v17.V2S(), v18.V2S(), MemOperand(x19, 24, PostIndex)),
3222 "st1 {v16.2s, v17.2s, v18.2s}, [x19], #24");
3223 COMPARE(St1(v16.V4S(), v17.V4S(), v18.V4S(), MemOperand(x19, 48, PostIndex)),
3224 "st1 {v16.4s, v17.4s, v18.4s}, [x19], #48");
3225 COMPARE(St1(v19.V2S(), v20.V2S(), v21.V2S(), v22.V2S(),
3226 MemOperand(x20, 32, PostIndex)),
3227 "st1 {v19.2s, v20.2s, v21.2s, v22.2s}, [x20], #32");
3228 COMPARE(St1(v23.V2D(), v24.V2D(), v25.V2D(), v26.V2D(),
3229 MemOperand(x21, 64, PostIndex)),
3230 "st1 {v23.2d, v24.2d, v25.2d, v26.2d}, [x21], #64");
3231 COMPARE(St2(v1.V16B(), v2.V16B(), MemOperand(x16, 32, PostIndex)),
3232 "st2 {v1.16b, v2.16b}, [x16], #32");
3233 COMPARE(St2(v2.V4H(), v3.V4H(), MemOperand(x17, 16, PostIndex)),
3234 "st2 {v2.4h, v3.4h}, [x17], #16");
3235 COMPARE(St2(v4.V8H(), v5.V8H(), MemOperand(x18, 32, PostIndex)),
3236 "st2 {v4.8h, v5.8h}, [x18], #32");
3237 COMPARE(St3(v16.V2S(), v17.V2S(), v18.V2S(),
3238 MemOperand(x19, 24, PostIndex)),
3239 "st3 {v16.2s, v17.2s, v18.2s}, [x19], #24");
3240 COMPARE(St3(v16.V4S(), v17.V4S(), v18.V4S(),
3241 MemOperand(x19, 48, PostIndex)),
3242 "st3 {v16.4s, v17.4s, v18.4s}, [x19], #48");
3243 COMPARE(St4(v19.V2S(), v20.V2S(), v21.V2S(), v22.V2S(),
3244 MemOperand(x20, 32, PostIndex)),
3245 "st4 {v19.2s, v20.2s, v21.2s, v22.2s}, [x20], #32");
3246 COMPARE(St4(v23.V2D(), v24.V2D(), v25.V2D(), v26.V2D(),
3247 MemOperand(x21, 64, PostIndex)),
3248 "st4 {v23.2d, v24.2d, v25.2d, v26.2d}, [x21], #64");
3249
3250 COMPARE(St1(v0.V1D(), MemOperand(x16)), "st1 {v0.1d}, [x16]");
3251 COMPARE(St1(v1.V1D(), v2.V1D(), MemOperand(x17, 16, PostIndex)),
3252 "st1 {v1.1d, v2.1d}, [x17], #16");
3253 COMPARE(St1(v3.V1D(), v4.V1D(), v5.V1D(), MemOperand(x18, x19, PostIndex)),
3254 "st1 {v3.1d, v4.1d, v5.1d}, [x18], x19");
3255 COMPARE(St1(v30.V1D(), v31.V1D(), v0.V1D(), v1.V1D(),
3256 MemOperand(x20, 32, PostIndex)),
3257 "st1 {v30.1d, v31.1d, v0.1d, v1.1d}, [x20], #32");
3258 COMPARE(St1(d30, d31, d0, d1, MemOperand(x21, x22, PostIndex)),
3259 "st1 {v30.1d, v31.1d, v0.1d, v1.1d}, [x21], x22");
3260
3261 CLEANUP();
3262}
3263
3264
armvixl0f35e362016-05-10 13:57:58 +01003265TEST(neon_load_store_vector_unallocated) {
3266 SETUP();
3267
3268 const char* expected = "unallocated (NEONLoadStoreMultiStruct)";
3269 // LD[1-4] (multiple structures) (no offset)
3270 COMPARE(dci(0x0c401000), expected); // opcode = 0b0001
3271 COMPARE(dci(0x0c403000), expected); // opcode = 0b0011
3272 COMPARE(dci(0x0c405000), expected); // opcode = 0b0101
3273 COMPARE(dci(0x0c409000), expected); // opcode = 0b1001
3274 COMPARE(dci(0x0c40b000), expected); // opcode = 0b1011
3275 COMPARE(dci(0x0c40c000), expected); // opcode = 0b1100
3276 COMPARE(dci(0x0c40d000), expected); // opcode = 0b1101
3277 COMPARE(dci(0x0c40e000), expected); // opcode = 0b1110
3278 COMPARE(dci(0x0c40f000), expected); // opcode = 0b1111
3279 COMPARE(dci(0x0c400c00), expected); // opcode = 0b0000, size:Q = 0b110
3280 COMPARE(dci(0x0c404c00), expected); // opcode = 0b0100, size:Q = 0b110
3281 COMPARE(dci(0x0c408c00), expected); // opcode = 0b1000, size:Q = 0b110
3282
3283 // ST[1-4] (multiple structures) (no offset)
3284 COMPARE(dci(0x0c001000), expected); // opcode = 0b0001
3285 COMPARE(dci(0x0c003000), expected); // opcode = 0b0011
3286 COMPARE(dci(0x0c005000), expected); // opcode = 0b0101
3287 COMPARE(dci(0x0c009000), expected); // opcode = 0b1001
3288 COMPARE(dci(0x0c00b000), expected); // opcode = 0b1011
3289 COMPARE(dci(0x0c00c000), expected); // opcode = 0b1100
3290 COMPARE(dci(0x0c00d000), expected); // opcode = 0b1101
3291 COMPARE(dci(0x0c00e000), expected); // opcode = 0b1110
3292 COMPARE(dci(0x0c00f000), expected); // opcode = 0b1111
3293 COMPARE(dci(0x0c000c00), expected); // opcode = 0b0000, size:Q = 0b110
3294 COMPARE(dci(0x0c004c00), expected); // opcode = 0b0100, size:Q = 0b110
3295 COMPARE(dci(0x0c008c00), expected); // opcode = 0b1000, size:Q = 0b110
3296
3297 expected = "unallocated (NEONLoadStoreMultiStructPostIndex)";
3298 // LD[1-4] (multiple structures) (post index)
3299 COMPARE(dci(0x0cc01000), expected); // opcode = 0b0001
3300 COMPARE(dci(0x0cc03000), expected); // opcode = 0b0011
3301 COMPARE(dci(0x0cc05000), expected); // opcode = 0b0101
3302 COMPARE(dci(0x0cc09000), expected); // opcode = 0b1001
3303 COMPARE(dci(0x0cc0b000), expected); // opcode = 0b1011
3304 COMPARE(dci(0x0cc0c000), expected); // opcode = 0b1100
3305 COMPARE(dci(0x0cc0d000), expected); // opcode = 0b1101
3306 COMPARE(dci(0x0cc0e000), expected); // opcode = 0b1110
3307 COMPARE(dci(0x0cc0f000), expected); // opcode = 0b1111
3308 COMPARE(dci(0x0cc00c00), expected); // opcode = 0b0000, size:Q = 0b110
3309 COMPARE(dci(0x0cc04c00), expected); // opcode = 0b0100, size:Q = 0b110
3310 COMPARE(dci(0x0cc08c00), expected); // opcode = 0b1000, size:Q = 0b110
3311
3312 // ST[1-4] (multiple structures) (post index)
3313 COMPARE(dci(0x0c801000), expected); // opcode = 0b0001
3314 COMPARE(dci(0x0c803000), expected); // opcode = 0b0011
3315 COMPARE(dci(0x0c805000), expected); // opcode = 0b0101
3316 COMPARE(dci(0x0c809000), expected); // opcode = 0b1001
3317 COMPARE(dci(0x0c80b000), expected); // opcode = 0b1011
3318 COMPARE(dci(0x0c80c000), expected); // opcode = 0b1100
3319 COMPARE(dci(0x0c80d000), expected); // opcode = 0b1101
3320 COMPARE(dci(0x0c80e000), expected); // opcode = 0b1110
3321 COMPARE(dci(0x0c80f000), expected); // opcode = 0b1111
3322 COMPARE(dci(0x0c800c00), expected); // opcode = 0b0000, size:Q = 0b110
3323 COMPARE(dci(0x0c804c00), expected); // opcode = 0b0100, size:Q = 0b110
3324 COMPARE(dci(0x0c808c00), expected); // opcode = 0b1000, size:Q = 0b110
3325
3326 CLEANUP();
3327}
3328
3329
armvixl5289c592015-03-02 13:52:04 +00003330TEST(neon_load_store_lane) {
armvixl684cd2a2015-10-23 13:38:33 +01003331 SETUP_MACRO();
armvixl5289c592015-03-02 13:52:04 +00003332
3333 COMPARE(Ld1(v0.V8B(), 0, MemOperand(x15)), "ld1 {v0.b}[0], [x15]");
3334 COMPARE(Ld1(v1.V16B(), 1, MemOperand(x16)), "ld1 {v1.b}[1], [x16]");
3335 COMPARE(Ld1(v2.V4H(), 2, MemOperand(x17)), "ld1 {v2.h}[2], [x17]");
3336 COMPARE(Ld1(v3.V8H(), 3, MemOperand(x18)), "ld1 {v3.h}[3], [x18]");
3337 COMPARE(Ld1(v4.V2S(), 0, MemOperand(x19)), "ld1 {v4.s}[0], [x19]");
3338 COMPARE(Ld1(v5.V4S(), 1, MemOperand(x20)), "ld1 {v5.s}[1], [x20]");
3339 COMPARE(Ld1(v6.V2D(), 0, MemOperand(x21)), "ld1 {v6.d}[0], [x21]");
3340 COMPARE(Ld1(v7.B(), 7, MemOperand(x22)), "ld1 {v7.b}[7], [x22]");
3341 COMPARE(Ld1(v8.B(), 15, MemOperand(x23)), "ld1 {v8.b}[15], [x23]");
3342 COMPARE(Ld1(v9.H(), 3, MemOperand(x24)), "ld1 {v9.h}[3], [x24]");
3343 COMPARE(Ld1(v10.H(), 7, MemOperand(x25)), "ld1 {v10.h}[7], [x25]");
3344 COMPARE(Ld1(v11.S(), 1, MemOperand(x26)), "ld1 {v11.s}[1], [x26]");
3345 COMPARE(Ld1(v12.S(), 3, MemOperand(x27)), "ld1 {v12.s}[3], [x27]");
3346 COMPARE(Ld1(v13.D(), 1, MemOperand(sp)), "ld1 {v13.d}[1], [sp]");
3347
3348 COMPARE(Ld1(v0.V8B(), 0, MemOperand(x15, x0, PostIndex)),
3349 "ld1 {v0.b}[0], [x15], x0");
3350 COMPARE(Ld1(v1.V16B(), 1, MemOperand(x16, 1, PostIndex)),
3351 "ld1 {v1.b}[1], [x16], #1");
3352 COMPARE(Ld1(v2.V4H(), 2, MemOperand(x17, 2, PostIndex)),
3353 "ld1 {v2.h}[2], [x17], #2");
3354 COMPARE(Ld1(v3.V8H(), 3, MemOperand(x18, x1, PostIndex)),
3355 "ld1 {v3.h}[3], [x18], x1");
3356 COMPARE(Ld1(v4.V2S(), 0, MemOperand(x19, x2, PostIndex)),
3357 "ld1 {v4.s}[0], [x19], x2");
3358 COMPARE(Ld1(v5.V4S(), 1, MemOperand(x20, 4, PostIndex)),
3359 "ld1 {v5.s}[1], [x20], #4");
3360 COMPARE(Ld1(v6.V2D(), 0, MemOperand(x21, 8, PostIndex)),
3361 "ld1 {v6.d}[0], [x21], #8");
3362 COMPARE(Ld1(v7.B(), 7, MemOperand(x22, 1, PostIndex)),
3363 "ld1 {v7.b}[7], [x22], #1");
3364 COMPARE(Ld1(v8.B(), 15, MemOperand(x23, x3, PostIndex)),
3365 "ld1 {v8.b}[15], [x23], x3");
3366 COMPARE(Ld1(v9.H(), 3, MemOperand(x24, x4, PostIndex)),
3367 "ld1 {v9.h}[3], [x24], x4");
3368 COMPARE(Ld1(v10.H(), 7, MemOperand(x25, 2, PostIndex)),
3369 "ld1 {v10.h}[7], [x25], #2");
3370 COMPARE(Ld1(v11.S(), 1, MemOperand(x26, 4, PostIndex)),
3371 "ld1 {v11.s}[1], [x26], #4");
3372 COMPARE(Ld1(v12.S(), 3, MemOperand(x27, x5, PostIndex)),
3373 "ld1 {v12.s}[3], [x27], x5");
armvixl0f35e362016-05-10 13:57:58 +01003374 COMPARE(Ld1(v12.S(), 3, MemOperand(x27, 4, PostIndex)),
3375 "ld1 {v12.s}[3], [x27], #4");
armvixl5289c592015-03-02 13:52:04 +00003376 COMPARE(Ld1(v13.D(), 1, MemOperand(sp, x6, PostIndex)),
3377 "ld1 {v13.d}[1], [sp], x6");
armvixl0f35e362016-05-10 13:57:58 +01003378 COMPARE(Ld1(v13.D(), 1, MemOperand(sp, 8, PostIndex)),
3379 "ld1 {v13.d}[1], [sp], #8");
armvixl5289c592015-03-02 13:52:04 +00003380
3381 COMPARE(Ld2(v0.V8B(), v1.V8B(), 0, MemOperand(x15)),
3382 "ld2 {v0.b, v1.b}[0], [x15]");
3383 COMPARE(Ld2(v1.V16B(), v2.V16B(), 1, MemOperand(x16)),
3384 "ld2 {v1.b, v2.b}[1], [x16]");
3385 COMPARE(Ld2(v2.V4H(), v3.V4H(), 2, MemOperand(x17)),
3386 "ld2 {v2.h, v3.h}[2], [x17]");
3387 COMPARE(Ld2(v3.V8H(), v4.V8H(), 3, MemOperand(x18)),
3388 "ld2 {v3.h, v4.h}[3], [x18]");
3389 COMPARE(Ld2(v4.V2S(), v5.V2S(), 0, MemOperand(x19)),
3390 "ld2 {v4.s, v5.s}[0], [x19]");
3391 COMPARE(Ld2(v5.V4S(), v6.V4S(), 1, MemOperand(x20)),
3392 "ld2 {v5.s, v6.s}[1], [x20]");
3393 COMPARE(Ld2(v6.V2D(), v7.V2D(), 0, MemOperand(x21)),
3394 "ld2 {v6.d, v7.d}[0], [x21]");
3395 COMPARE(Ld2(v7.B(), v8.B(), 7, MemOperand(x22)),
3396 "ld2 {v7.b, v8.b}[7], [x22]");
3397 COMPARE(Ld2(v8.B(), v9.B(), 15, MemOperand(x23)),
3398 "ld2 {v8.b, v9.b}[15], [x23]");
3399 COMPARE(Ld2(v9.H(), v10.H(), 3, MemOperand(x24)),
3400 "ld2 {v9.h, v10.h}[3], [x24]");
3401 COMPARE(Ld2(v10.H(), v11.H(), 7, MemOperand(x25)),
3402 "ld2 {v10.h, v11.h}[7], [x25]");
3403 COMPARE(Ld2(v11.S(), v12.S(), 1, MemOperand(x26)),
3404 "ld2 {v11.s, v12.s}[1], [x26]");
3405 COMPARE(Ld2(v12.S(), v13.S(), 3, MemOperand(x27)),
3406 "ld2 {v12.s, v13.s}[3], [x27]");
3407 COMPARE(Ld2(v13.D(), v14.D(), 1, MemOperand(sp)),
3408 "ld2 {v13.d, v14.d}[1], [sp]");
3409
3410 COMPARE(Ld2(v0.V8B(), v1.V8B(), 0, MemOperand(x15, x0, PostIndex)),
3411 "ld2 {v0.b, v1.b}[0], [x15], x0");
3412 COMPARE(Ld2(v1.V16B(), v2.V16B(), 1, MemOperand(x16, 2, PostIndex)),
3413 "ld2 {v1.b, v2.b}[1], [x16], #2");
3414 COMPARE(Ld2(v2.V4H(), v3.V4H(), 2, MemOperand(x17, 4, PostIndex)),
3415 "ld2 {v2.h, v3.h}[2], [x17], #4");
3416 COMPARE(Ld2(v3.V8H(), v4.V8H(), 3, MemOperand(x18, x1, PostIndex)),
3417 "ld2 {v3.h, v4.h}[3], [x18], x1");
3418 COMPARE(Ld2(v4.V2S(), v5.V2S(), 0, MemOperand(x19, x2, PostIndex)),
3419 "ld2 {v4.s, v5.s}[0], [x19], x2");
3420 COMPARE(Ld2(v5.V4S(), v6.V4S(), 1, MemOperand(x20, 8, PostIndex)),
3421 "ld2 {v5.s, v6.s}[1], [x20], #8");
3422 COMPARE(Ld2(v6.V2D(), v7.V2D(), 0, MemOperand(x21, 16, PostIndex)),
3423 "ld2 {v6.d, v7.d}[0], [x21], #16");
3424 COMPARE(Ld2(v7.B(), v8.B(), 7, MemOperand(x22, 2, PostIndex)),
3425 "ld2 {v7.b, v8.b}[7], [x22], #2");
3426 COMPARE(Ld2(v8.B(), v9.B(), 15, MemOperand(x23, x3, PostIndex)),
3427 "ld2 {v8.b, v9.b}[15], [x23], x3");
3428 COMPARE(Ld2(v9.H(), v10.H(), 3, MemOperand(x24, x4, PostIndex)),
3429 "ld2 {v9.h, v10.h}[3], [x24], x4");
3430 COMPARE(Ld2(v10.H(), v11.H(), 7, MemOperand(x25, 4, PostIndex)),
3431 "ld2 {v10.h, v11.h}[7], [x25], #4");
3432 COMPARE(Ld2(v11.S(), v12.S(), 1, MemOperand(x26, 8, PostIndex)),
3433 "ld2 {v11.s, v12.s}[1], [x26], #8");
3434 COMPARE(Ld2(v12.S(), v13.S(), 3, MemOperand(x27, x5, PostIndex)),
3435 "ld2 {v12.s, v13.s}[3], [x27], x5");
armvixl0f35e362016-05-10 13:57:58 +01003436 COMPARE(Ld2(v11.S(), v12.S(), 3, MemOperand(x26, 8, PostIndex)),
3437 "ld2 {v11.s, v12.s}[3], [x26], #8");
armvixl5289c592015-03-02 13:52:04 +00003438 COMPARE(Ld2(v13.D(), v14.D(), 1, MemOperand(sp, x6, PostIndex)),
3439 "ld2 {v13.d, v14.d}[1], [sp], x6");
armvixl0f35e362016-05-10 13:57:58 +01003440 COMPARE(Ld2(v13.D(), v14.D(), 1, MemOperand(sp, 16, PostIndex)),
3441 "ld2 {v13.d, v14.d}[1], [sp], #16");
armvixl5289c592015-03-02 13:52:04 +00003442
3443 COMPARE(Ld3(v0.V8B(), v1.V8B(), v2.V8B(), 0, MemOperand(x15)),
3444 "ld3 {v0.b, v1.b, v2.b}[0], [x15]");
3445 COMPARE(Ld3(v1.V16B(), v2.V16B(), v3.V16B(), 1, MemOperand(x16)),
3446 "ld3 {v1.b, v2.b, v3.b}[1], [x16]");
3447 COMPARE(Ld3(v2.V4H(), v3.V4H(), v4.V4H(), 2, MemOperand(x17)),
3448 "ld3 {v2.h, v3.h, v4.h}[2], [x17]");
3449 COMPARE(Ld3(v3.V8H(), v4.V8H(), v5.V8H(), 3, MemOperand(x18)),
3450 "ld3 {v3.h, v4.h, v5.h}[3], [x18]");
3451 COMPARE(Ld3(v4.V2S(), v5.V2S(), v6.V2S(), 0, MemOperand(x19)),
3452 "ld3 {v4.s, v5.s, v6.s}[0], [x19]");
3453 COMPARE(Ld3(v5.V4S(), v6.V4S(), v7.V4S(), 1, MemOperand(x20)),
3454 "ld3 {v5.s, v6.s, v7.s}[1], [x20]");
3455 COMPARE(Ld3(v6.V2D(), v7.V2D(), v8.V2D(), 0, MemOperand(x21)),
3456 "ld3 {v6.d, v7.d, v8.d}[0], [x21]");
3457 COMPARE(Ld3(v7.B(), v8.B(), v9.B(), 7, MemOperand(x22)),
3458 "ld3 {v7.b, v8.b, v9.b}[7], [x22]");
3459 COMPARE(Ld3(v8.B(), v9.B(), v10.B(), 15, MemOperand(x23)),
3460 "ld3 {v8.b, v9.b, v10.b}[15], [x23]");
3461 COMPARE(Ld3(v9.H(), v10.H(), v11.H(), 3, MemOperand(x24)),
3462 "ld3 {v9.h, v10.h, v11.h}[3], [x24]");
3463 COMPARE(Ld3(v10.H(), v11.H(), v12.H(), 7, MemOperand(x25)),
3464 "ld3 {v10.h, v11.h, v12.h}[7], [x25]");
3465 COMPARE(Ld3(v11.S(), v12.S(), v13.S(), 1, MemOperand(x26)),
3466 "ld3 {v11.s, v12.s, v13.s}[1], [x26]");
3467 COMPARE(Ld3(v12.S(), v13.S(), v14.S(), 3, MemOperand(x27)),
3468 "ld3 {v12.s, v13.s, v14.s}[3], [x27]");
3469 COMPARE(Ld3(v13.D(), v14.D(), v15.D(), 1, MemOperand(sp)),
3470 "ld3 {v13.d, v14.d, v15.d}[1], [sp]");
3471
3472 COMPARE(Ld3(v0.V8B(), v1.V8B(), v2.V8B(), 0,
3473 MemOperand(x15, x0, PostIndex)),
3474 "ld3 {v0.b, v1.b, v2.b}[0], [x15], x0");
3475 COMPARE(Ld3(v1.V16B(), v2.V16B(), v3.V16B(), 1,
3476 MemOperand(x16, 3, PostIndex)),
3477 "ld3 {v1.b, v2.b, v3.b}[1], [x16], #3");
3478 COMPARE(Ld3(v2.V4H(), v3.V4H(), v4.V4H(), 2,
3479 MemOperand(x17, 6, PostIndex)),
3480 "ld3 {v2.h, v3.h, v4.h}[2], [x17], #6");
3481 COMPARE(Ld3(v3.V8H(), v4.V8H(), v5.V8H(), 3,
3482 MemOperand(x18, x1, PostIndex)),
3483 "ld3 {v3.h, v4.h, v5.h}[3], [x18], x1");
3484 COMPARE(Ld3(v4.V2S(), v5.V2S(), v6.V2S(), 0,
3485 MemOperand(x19, x2, PostIndex)),
3486 "ld3 {v4.s, v5.s, v6.s}[0], [x19], x2");
3487 COMPARE(Ld3(v5.V4S(), v6.V4S(), v7.V4S(), 1,
3488 MemOperand(x20, 12, PostIndex)),
3489 "ld3 {v5.s, v6.s, v7.s}[1], [x20], #12");
3490 COMPARE(Ld3(v6.V2D(), v7.V2D(), v8.V2D(), 0,
3491 MemOperand(x21, 24, PostIndex)),
3492 "ld3 {v6.d, v7.d, v8.d}[0], [x21], #24");
3493 COMPARE(Ld3(v7.B(), v8.B(), v9.B(), 7,
3494 MemOperand(x22, 3, PostIndex)),
3495 "ld3 {v7.b, v8.b, v9.b}[7], [x22], #3");
3496 COMPARE(Ld3(v8.B(), v9.B(), v10.B(), 15,
3497 MemOperand(x23, x3, PostIndex)),
3498 "ld3 {v8.b, v9.b, v10.b}[15], [x23], x3");
3499 COMPARE(Ld3(v9.H(), v10.H(), v11.H(), 3,
3500 MemOperand(x24, x4, PostIndex)),
3501 "ld3 {v9.h, v10.h, v11.h}[3], [x24], x4");
3502 COMPARE(Ld3(v10.H(), v11.H(), v12.H(), 7,
3503 MemOperand(x25, 6, PostIndex)),
3504 "ld3 {v10.h, v11.h, v12.h}[7], [x25], #6");
3505 COMPARE(Ld3(v11.S(), v12.S(), v13.S(), 1,
3506 MemOperand(x26, 12, PostIndex)),
3507 "ld3 {v11.s, v12.s, v13.s}[1], [x26], #12");
3508 COMPARE(Ld3(v12.S(), v13.S(), v14.S(), 3,
3509 MemOperand(x27, x5, PostIndex)),
3510 "ld3 {v12.s, v13.s, v14.s}[3], [x27], x5");
armvixl0f35e362016-05-10 13:57:58 +01003511 COMPARE(Ld3(v12.S(), v13.S(), v14.S(), 3,
3512 MemOperand(x27, 12, PostIndex)),
3513 "ld3 {v12.s, v13.s, v14.s}[3], [x27], #12");
armvixl5289c592015-03-02 13:52:04 +00003514 COMPARE(Ld3(v13.D(), v14.D(), v15.D(), 1,
3515 MemOperand(sp, x6, PostIndex)),
3516 "ld3 {v13.d, v14.d, v15.d}[1], [sp], x6");
armvixl0f35e362016-05-10 13:57:58 +01003517 COMPARE(Ld3(v13.D(), v14.D(), v15.D(), 1,
3518 MemOperand(sp, 24, PostIndex)),
3519 "ld3 {v13.d, v14.d, v15.d}[1], [sp], #24");
armvixl5289c592015-03-02 13:52:04 +00003520
3521 COMPARE(Ld4(v0.V8B(), v1.V8B(), v2.V8B(), v3.V8B(), 0,
3522 MemOperand(x15)),
3523 "ld4 {v0.b, v1.b, v2.b, v3.b}[0], [x15]");
3524 COMPARE(Ld4(v1.V16B(), v2.V16B(), v3.V16B(), v4.V16B(), 1,
3525 MemOperand(x16)),
3526 "ld4 {v1.b, v2.b, v3.b, v4.b}[1], [x16]");
3527 COMPARE(Ld4(v2.V4H(), v3.V4H(), v4.V4H(), v5.V4H(), 2,
3528 MemOperand(x17)),
3529 "ld4 {v2.h, v3.h, v4.h, v5.h}[2], [x17]");
3530 COMPARE(Ld4(v3.V8H(), v4.V8H(), v5.V8H(), v6.V8H(), 3,
3531 MemOperand(x18)),
3532 "ld4 {v3.h, v4.h, v5.h, v6.h}[3], [x18]");
3533 COMPARE(Ld4(v4.V2S(), v5.V2S(), v6.V2S(), v7.V2S(), 0,
3534 MemOperand(x19)),
3535 "ld4 {v4.s, v5.s, v6.s, v7.s}[0], [x19]");
3536 COMPARE(Ld4(v5.V4S(), v6.V4S(), v7.V4S(), v8.V4S(), 1,
3537 MemOperand(x20)),
3538 "ld4 {v5.s, v6.s, v7.s, v8.s}[1], [x20]");
3539 COMPARE(Ld4(v6.V2D(), v7.V2D(), v8.V2D(), v9.V2D(), 0,
3540 MemOperand(x21)),
3541 "ld4 {v6.d, v7.d, v8.d, v9.d}[0], [x21]");
3542 COMPARE(Ld4(v7.B(), v8.B(), v9.B(), v10.B(), 7,
3543 MemOperand(x22)),
3544 "ld4 {v7.b, v8.b, v9.b, v10.b}[7], [x22]");
3545 COMPARE(Ld4(v8.B(), v9.B(), v10.B(), v11.B(), 15,
3546 MemOperand(x23)),
3547 "ld4 {v8.b, v9.b, v10.b, v11.b}[15], [x23]");
3548 COMPARE(Ld4(v9.H(), v10.H(), v11.H(), v12.H(), 3,
3549 MemOperand(x24)),
3550 "ld4 {v9.h, v10.h, v11.h, v12.h}[3], [x24]");
3551 COMPARE(Ld4(v10.H(), v11.H(), v12.H(), v13.H(), 7,
3552 MemOperand(x25)),
3553 "ld4 {v10.h, v11.h, v12.h, v13.h}[7], [x25]");
3554 COMPARE(Ld4(v11.S(), v12.S(), v13.S(), v14.S(), 1,
3555 MemOperand(x26)),
3556 "ld4 {v11.s, v12.s, v13.s, v14.s}[1], [x26]");
3557 COMPARE(Ld4(v12.S(), v13.S(), v14.S(), v15.S(), 3,
3558 MemOperand(x27)),
3559 "ld4 {v12.s, v13.s, v14.s, v15.s}[3], [x27]");
3560 COMPARE(Ld4(v13.D(), v14.D(), v15.D(), v16.D(), 1,
3561 MemOperand(sp)),
3562 "ld4 {v13.d, v14.d, v15.d, v16.d}[1], [sp]");
3563
3564 COMPARE(Ld4(v0.V8B(), v1.V8B(), v2.V8B(), v3.V8B(), 0,
3565 MemOperand(x15, x0, PostIndex)),
3566 "ld4 {v0.b, v1.b, v2.b, v3.b}[0], [x15], x0");
3567 COMPARE(Ld4(v1.V16B(), v2.V16B(), v3.V16B(), v4.V16B(), 1,
3568 MemOperand(x16, 4, PostIndex)),
3569 "ld4 {v1.b, v2.b, v3.b, v4.b}[1], [x16], #4");
3570 COMPARE(Ld4(v2.V4H(), v3.V4H(), v4.V4H(), v5.V4H(), 2,
3571 MemOperand(x17, 8, PostIndex)),
3572 "ld4 {v2.h, v3.h, v4.h, v5.h}[2], [x17], #8");
3573 COMPARE(Ld4(v3.V8H(), v4.V8H(), v5.V8H(), v6.V8H(), 3,
3574 MemOperand(x18, x1, PostIndex)),
3575 "ld4 {v3.h, v4.h, v5.h, v6.h}[3], [x18], x1");
3576 COMPARE(Ld4(v4.V2S(), v5.V2S(), v6.V2S(), v7.V2S(), 0,
3577 MemOperand(x19, x2, PostIndex)),
3578 "ld4 {v4.s, v5.s, v6.s, v7.s}[0], [x19], x2");
3579 COMPARE(Ld4(v5.V4S(), v6.V4S(), v7.V4S(), v8.V4S(), 1,
3580 MemOperand(x20, 16, PostIndex)),
3581 "ld4 {v5.s, v6.s, v7.s, v8.s}[1], [x20], #16");
3582 COMPARE(Ld4(v6.V2D(), v7.V2D(), v8.V2D(), v9.V2D(), 0,
3583 MemOperand(x21, 32, PostIndex)),
3584 "ld4 {v6.d, v7.d, v8.d, v9.d}[0], [x21], #32");
3585 COMPARE(Ld4(v7.B(), v8.B(), v9.B(), v10.B(), 7,
3586 MemOperand(x22, 4, PostIndex)),
3587 "ld4 {v7.b, v8.b, v9.b, v10.b}[7], [x22], #4");
3588 COMPARE(Ld4(v8.B(), v9.B(), v10.B(), v11.B(), 15,
3589 MemOperand(x23, x3, PostIndex)),
3590 "ld4 {v8.b, v9.b, v10.b, v11.b}[15], [x23], x3");
3591 COMPARE(Ld4(v9.H(), v10.H(), v11.H(), v12.H(), 3,
3592 MemOperand(x24, x4, PostIndex)),
3593 "ld4 {v9.h, v10.h, v11.h, v12.h}[3], [x24], x4");
3594 COMPARE(Ld4(v10.H(), v11.H(), v12.H(), v13.H(), 7,
3595 MemOperand(x25, 8, PostIndex)),
3596 "ld4 {v10.h, v11.h, v12.h, v13.h}[7], [x25], #8");
3597 COMPARE(Ld4(v11.S(), v12.S(), v13.S(), v14.S(), 1,
3598 MemOperand(x26, 16, PostIndex)),
3599 "ld4 {v11.s, v12.s, v13.s, v14.s}[1], [x26], #16");
3600 COMPARE(Ld4(v12.S(), v13.S(), v14.S(), v15.S(), 3,
3601 MemOperand(x27, x5, PostIndex)),
3602 "ld4 {v12.s, v13.s, v14.s, v15.s}[3], [x27], x5");
armvixl0f35e362016-05-10 13:57:58 +01003603 COMPARE(Ld4(v11.S(), v12.S(), v13.S(), v14.S(), 3,
3604 MemOperand(x26, 16, PostIndex)),
3605 "ld4 {v11.s, v12.s, v13.s, v14.s}[3], [x26], #16");
armvixl5289c592015-03-02 13:52:04 +00003606 COMPARE(Ld4(v13.D(), v14.D(), v15.D(), v16.D(), 1,
3607 MemOperand(sp, x6, PostIndex)),
3608 "ld4 {v13.d, v14.d, v15.d, v16.d}[1], [sp], x6");
armvixl0f35e362016-05-10 13:57:58 +01003609 COMPARE(Ld4(v13.D(), v14.D(), v15.D(), v16.D(), 1,
3610 MemOperand(sp, 32, PostIndex)),
3611 "ld4 {v13.d, v14.d, v15.d, v16.d}[1], [sp], #32");
armvixl5289c592015-03-02 13:52:04 +00003612
3613 COMPARE(St1(v0.V8B(), 0, MemOperand(x15)), "st1 {v0.b}[0], [x15]");
3614 COMPARE(St1(v1.V16B(), 1, MemOperand(x16)), "st1 {v1.b}[1], [x16]");
3615 COMPARE(St1(v2.V4H(), 2, MemOperand(x17)), "st1 {v2.h}[2], [x17]");
3616 COMPARE(St1(v3.V8H(), 3, MemOperand(x18)), "st1 {v3.h}[3], [x18]");
3617 COMPARE(St1(v4.V2S(), 0, MemOperand(x19)), "st1 {v4.s}[0], [x19]");
3618 COMPARE(St1(v5.V4S(), 1, MemOperand(x20)), "st1 {v5.s}[1], [x20]");
3619 COMPARE(St1(v6.V2D(), 0, MemOperand(x21)), "st1 {v6.d}[0], [x21]");
3620 COMPARE(St1(v7.B(), 7, MemOperand(x22)), "st1 {v7.b}[7], [x22]");
3621 COMPARE(St1(v8.B(), 15, MemOperand(x23)), "st1 {v8.b}[15], [x23]");
3622 COMPARE(St1(v9.H(), 3, MemOperand(x24)), "st1 {v9.h}[3], [x24]");
3623 COMPARE(St1(v10.H(), 7, MemOperand(x25)), "st1 {v10.h}[7], [x25]");
3624 COMPARE(St1(v11.S(), 1, MemOperand(x26)), "st1 {v11.s}[1], [x26]");
3625 COMPARE(St1(v12.S(), 3, MemOperand(x27)), "st1 {v12.s}[3], [x27]");
3626 COMPARE(St1(v13.D(), 1, MemOperand(sp)), "st1 {v13.d}[1], [sp]");
3627
3628 COMPARE(St1(v0.V8B(), 0, MemOperand(x15, x0, PostIndex)),
3629 "st1 {v0.b}[0], [x15], x0");
3630 COMPARE(St1(v1.V16B(), 1, MemOperand(x16, 1, PostIndex)),
3631 "st1 {v1.b}[1], [x16], #1");
3632 COMPARE(St1(v2.V4H(), 2, MemOperand(x17, 2, PostIndex)),
3633 "st1 {v2.h}[2], [x17], #2");
3634 COMPARE(St1(v3.V8H(), 3, MemOperand(x18, x1, PostIndex)),
3635 "st1 {v3.h}[3], [x18], x1");
3636 COMPARE(St1(v4.V2S(), 0, MemOperand(x19, x2, PostIndex)),
3637 "st1 {v4.s}[0], [x19], x2");
3638 COMPARE(St1(v5.V4S(), 1, MemOperand(x20, 4, PostIndex)),
3639 "st1 {v5.s}[1], [x20], #4");
3640 COMPARE(St1(v6.V2D(), 0, MemOperand(x21, 8, PostIndex)),
3641 "st1 {v6.d}[0], [x21], #8");
3642 COMPARE(St1(v7.B(), 7, MemOperand(x22, 1, PostIndex)),
3643 "st1 {v7.b}[7], [x22], #1");
3644 COMPARE(St1(v8.B(), 15, MemOperand(x23, x3, PostIndex)),
3645 "st1 {v8.b}[15], [x23], x3");
3646 COMPARE(St1(v9.H(), 3, MemOperand(x24, x4, PostIndex)),
3647 "st1 {v9.h}[3], [x24], x4");
3648 COMPARE(St1(v10.H(), 7, MemOperand(x25, 2, PostIndex)),
3649 "st1 {v10.h}[7], [x25], #2");
3650 COMPARE(St1(v11.S(), 1, MemOperand(x26, 4, PostIndex)),
3651 "st1 {v11.s}[1], [x26], #4");
3652 COMPARE(St1(v12.S(), 3, MemOperand(x27, x5, PostIndex)),
3653 "st1 {v12.s}[3], [x27], x5");
3654 COMPARE(St1(v13.D(), 1, MemOperand(sp, x6, PostIndex)),
3655 "st1 {v13.d}[1], [sp], x6");
3656 COMPARE(St2(v0.V8B(), v1.V8B(), 0, MemOperand(x15, x0, PostIndex)),
3657 "st2 {v0.b, v1.b}[0], [x15], x0");
3658 COMPARE(St2(v1.V16B(), v2.V16B(), 1, MemOperand(x16, 2, PostIndex)),
3659 "st2 {v1.b, v2.b}[1], [x16], #2");
3660 COMPARE(St2(v2.V4H(), v3.V4H(), 2, MemOperand(x17, 4, PostIndex)),
3661 "st2 {v2.h, v3.h}[2], [x17], #4");
3662 COMPARE(St2(v3.V8H(), v4.V8H(), 3, MemOperand(x18, x1, PostIndex)),
3663 "st2 {v3.h, v4.h}[3], [x18], x1");
3664 COMPARE(St2(v4.V2S(), v5.V2S(), 0, MemOperand(x19, x2, PostIndex)),
3665 "st2 {v4.s, v5.s}[0], [x19], x2");
3666 COMPARE(St2(v5.V4S(), v6.V4S(), 1, MemOperand(x20, 8, PostIndex)),
3667 "st2 {v5.s, v6.s}[1], [x20], #8");
3668 COMPARE(St2(v6.V2D(), v7.V2D(), 0, MemOperand(x21, 16, PostIndex)),
3669 "st2 {v6.d, v7.d}[0], [x21], #16");
3670 COMPARE(St2(v7.B(), v8.B(), 7, MemOperand(x22, 2, PostIndex)),
3671 "st2 {v7.b, v8.b}[7], [x22], #2");
3672 COMPARE(St2(v8.B(), v9.B(), 15, MemOperand(x23, x3, PostIndex)),
3673 "st2 {v8.b, v9.b}[15], [x23], x3");
3674 COMPARE(St2(v9.H(), v10.H(), 3, MemOperand(x24, x4, PostIndex)),
3675 "st2 {v9.h, v10.h}[3], [x24], x4");
3676 COMPARE(St2(v10.H(), v11.H(), 7, MemOperand(x25, 4, PostIndex)),
3677 "st2 {v10.h, v11.h}[7], [x25], #4");
3678 COMPARE(St2(v11.S(), v12.S(), 1, MemOperand(x26, 8, PostIndex)),
3679 "st2 {v11.s, v12.s}[1], [x26], #8");
3680 COMPARE(St2(v12.S(), v13.S(), 3, MemOperand(x27, x5, PostIndex)),
3681 "st2 {v12.s, v13.s}[3], [x27], x5");
3682 COMPARE(St2(v13.D(), v14.D(), 1, MemOperand(sp, x6, PostIndex)),
3683 "st2 {v13.d, v14.d}[1], [sp], x6");
3684 COMPARE(St3(VLIST3(v0.V8B()), 0, MemOperand(x15, x0, PostIndex)),
3685 "st3 {v0.b, v1.b, v2.b}[0], [x15], x0");
3686 COMPARE(St3(VLIST3(v1.V16B()), 1, MemOperand(x16, 3, PostIndex)),
3687 "st3 {v1.b, v2.b, v3.b}[1], [x16], #3");
3688 COMPARE(St3(VLIST3(v2.V4H()), 2, MemOperand(x17, 6, PostIndex)),
3689 "st3 {v2.h, v3.h, v4.h}[2], [x17], #6");
3690 COMPARE(St3(VLIST3(v3.V8H()), 3, MemOperand(x18, x1, PostIndex)),
3691 "st3 {v3.h, v4.h, v5.h}[3], [x18], x1");
3692 COMPARE(St3(VLIST3(v4.V2S()), 0, MemOperand(x19, x2, PostIndex)),
3693 "st3 {v4.s, v5.s, v6.s}[0], [x19], x2");
3694 COMPARE(St3(VLIST3(v5.V4S()), 1, MemOperand(x20, 12, PostIndex)),
3695 "st3 {v5.s, v6.s, v7.s}[1], [x20], #12");
3696 COMPARE(St3(VLIST3(v6.V2D()), 0, MemOperand(x21, 24, PostIndex)),
3697 "st3 {v6.d, v7.d, v8.d}[0], [x21], #24");
3698 COMPARE(St3(VLIST3(v7.B()), 7, MemOperand(x22, 3, PostIndex)),
3699 "st3 {v7.b, v8.b, v9.b}[7], [x22], #3");
3700 COMPARE(St3(VLIST3(v8.B()), 15, MemOperand(x23, x3, PostIndex)),
3701 "st3 {v8.b, v9.b, v10.b}[15], [x23], x3");
3702 COMPARE(St3(VLIST3(v9.H()), 3, MemOperand(x24, x4, PostIndex)),
3703 "st3 {v9.h, v10.h, v11.h}[3], [x24], x4");
3704 COMPARE(St3(VLIST3(v10.H()), 7, MemOperand(x25, 6, PostIndex)),
3705 "st3 {v10.h, v11.h, v12.h}[7], [x25], #6");
3706 COMPARE(St3(VLIST3(v11.S()), 1, MemOperand(x26, 12, PostIndex)),
3707 "st3 {v11.s, v12.s, v13.s}[1], [x26], #12");
3708 COMPARE(St3(VLIST3(v12.S()), 3, MemOperand(x27, x5, PostIndex)),
3709 "st3 {v12.s, v13.s, v14.s}[3], [x27], x5");
3710 COMPARE(St3(VLIST3(v13.D()), 1, MemOperand(sp, x6, PostIndex)),
3711 "st3 {v13.d, v14.d, v15.d}[1], [sp], x6");
3712
3713 COMPARE(St4(VLIST4(v0.V8B()), 0, MemOperand(x15, x0, PostIndex)),
3714 "st4 {v0.b, v1.b, v2.b, v3.b}[0], [x15], x0");
3715 COMPARE(St4(VLIST4(v1.V16B()), 1, MemOperand(x16, 4, PostIndex)),
3716 "st4 {v1.b, v2.b, v3.b, v4.b}[1], [x16], #4");
3717 COMPARE(St4(VLIST4(v2.V4H()), 2, MemOperand(x17, 8, PostIndex)),
3718 "st4 {v2.h, v3.h, v4.h, v5.h}[2], [x17], #8");
3719 COMPARE(St4(VLIST4(v3.V8H()), 3, MemOperand(x18, x1, PostIndex)),
3720 "st4 {v3.h, v4.h, v5.h, v6.h}[3], [x18], x1");
3721 COMPARE(St4(VLIST4(v4.V2S()), 0, MemOperand(x19, x2, PostIndex)),
3722 "st4 {v4.s, v5.s, v6.s, v7.s}[0], [x19], x2");
3723 COMPARE(St4(VLIST4(v5.V4S()), 1, MemOperand(x20, 16, PostIndex)),
3724 "st4 {v5.s, v6.s, v7.s, v8.s}[1], [x20], #16");
3725 COMPARE(St4(VLIST4(v6.V2D()), 0, MemOperand(x21, 32, PostIndex)),
3726 "st4 {v6.d, v7.d, v8.d, v9.d}[0], [x21], #32");
3727 COMPARE(St4(VLIST4(v7.B()), 7, MemOperand(x22, 4, PostIndex)),
3728 "st4 {v7.b, v8.b, v9.b, v10.b}[7], [x22], #4");
3729 COMPARE(St4(VLIST4(v8.B()), 15, MemOperand(x23, x3, PostIndex)),
3730 "st4 {v8.b, v9.b, v10.b, v11.b}[15], [x23], x3");
3731 COMPARE(St4(VLIST4(v9.H()), 3, MemOperand(x24, x4, PostIndex)),
3732 "st4 {v9.h, v10.h, v11.h, v12.h}[3], [x24], x4");
3733 COMPARE(St4(VLIST4(v10.H()), 7, MemOperand(x25, 8, PostIndex)),
3734 "st4 {v10.h, v11.h, v12.h, v13.h}[7], [x25], #8");
3735 COMPARE(St4(VLIST4(v11.S()), 1, MemOperand(x26, 16, PostIndex)),
3736 "st4 {v11.s, v12.s, v13.s, v14.s}[1], [x26], #16");
3737 COMPARE(St4(VLIST4(v12.S()), 3, MemOperand(x27, x5, PostIndex)),
3738 "st4 {v12.s, v13.s, v14.s, v15.s}[3], [x27], x5");
3739 COMPARE(St4(VLIST4(v13.D()), 1, MemOperand(sp, x6, PostIndex)),
3740 "st4 {v13.d, v14.d, v15.d, v16.d}[1], [sp], x6");
3741
3742 CLEANUP();
3743}
3744
3745
armvixl0f35e362016-05-10 13:57:58 +01003746TEST(neon_load_store_lane_unallocated) {
3747 SETUP();
3748
3749 const char* expected = "unallocated (NEONLoadStoreSingleStruct)";
3750 // LD1 (single structure) (no offset)
3751 COMPARE(dci(0x0d404400), expected); // .h, size<0> = 1
3752 COMPARE(dci(0x0d408800), expected); // .s, size<1> = 1
3753 COMPARE(dci(0x0d409400), expected); // .d, size<0> = 1, S = 1
3754 // LD2 (single structure) (no offset)
3755 COMPARE(dci(0x0d604400), expected); // .h, size<0> = 1
3756 COMPARE(dci(0x0d608800), expected); // .s, size<1> = 1
3757 COMPARE(dci(0x0d609400), expected); // .d, size<0> = 1, S = 1
3758 // LD3 (single structure) (no offset)
3759 COMPARE(dci(0x0d406400), expected); // .h, size<0> = 1
3760 COMPARE(dci(0x0d40a800), expected); // .s, size<1> = 1
3761 COMPARE(dci(0x0d40b400), expected); // .d, size<0> = 1, S = 1
3762 // LD4 (single structure) (no offset)
3763 COMPARE(dci(0x0d606400), expected); // .h, size<0> = 1
3764 COMPARE(dci(0x0d60a800), expected); // .s, size<1> = 1
3765 COMPARE(dci(0x0d60b400), expected); // .d, size<0> = 1, S = 1
3766 // ST1 (single structure) (no offset)
3767 COMPARE(dci(0x0d004400), expected); // .h, size<0> = 1
3768 COMPARE(dci(0x0d008800), expected); // .s, size<1> = 1
3769 COMPARE(dci(0x0d009400), expected); // .d, size<0> = 1, S = 1
3770 // ST2 (single structure) (no offset)
3771 COMPARE(dci(0x0d204400), expected); // .h, size<0> = 1
3772 COMPARE(dci(0x0d208800), expected); // .s, size<1> = 1
3773 COMPARE(dci(0x0d209400), expected); // .d, size<0> = 1, S = 1
3774 // ST3 (single structure) (no offset)
3775 COMPARE(dci(0x0d006400), expected); // .h, size<0> = 1
3776 COMPARE(dci(0x0d00a800), expected); // .s, size<1> = 1
3777 COMPARE(dci(0x0d00b400), expected); // .d, size<0> = 1, S = 1
3778 // ST4 (single structure) (no offset)
3779 COMPARE(dci(0x0d206400), expected); // .h, size<0> = 1
3780 COMPARE(dci(0x0d20a800), expected); // .s, size<1> = 1
3781 COMPARE(dci(0x0d20b400), expected); // .d, size<0> = 1, S = 1
3782
3783 expected = "unallocated (NEONLoadStoreSingleStructPostIndex)";
3784 // LD1 (single structure) (post index)
3785 COMPARE(dci(0x0dc04400), expected); // .h, size<0> = 1
3786 COMPARE(dci(0x0dc08800), expected); // .s, size<1> = 1
3787 COMPARE(dci(0x0dc09400), expected); // .d, size<0> = 1, S = 1
3788 // LD2 (single structure) (post index)
3789 COMPARE(dci(0x0de04400), expected); // .h, size<0> = 1
3790 COMPARE(dci(0x0de08800), expected); // .s, size<1> = 1
3791 COMPARE(dci(0x0de09400), expected); // .d, size<0> = 1, S = 1
3792 // LD3 (single structure) (post index)
3793 COMPARE(dci(0x0dc06400), expected); // .h, size<0> = 1
3794 COMPARE(dci(0x0dc0a800), expected); // .s, size<1> = 1
3795 COMPARE(dci(0x0dc0b400), expected); // .d, size<0> = 1, S = 1
3796 // LD4 (single structure) (post index)
3797 COMPARE(dci(0x0de06400), expected); // .h, size<0> = 1
3798 COMPARE(dci(0x0de0a800), expected); // .s, size<1> = 1
3799 COMPARE(dci(0x0de0b400), expected); // .d, size<0> = 1, S = 1
3800 // ST1 (single structure) (post index)
3801 COMPARE(dci(0x0d804400), expected); // .h, size<0> = 1
3802 COMPARE(dci(0x0d808800), expected); // .s, size<1> = 1
3803 COMPARE(dci(0x0d809400), expected); // .d, size<0> = 1, S = 1
3804 // ST2 (single structure) (post index)
3805 COMPARE(dci(0x0da04400), expected); // .h, size<0> = 1
3806 COMPARE(dci(0x0da08800), expected); // .s, size<1> = 1
3807 COMPARE(dci(0x0da09400), expected); // .d, size<0> = 1, S = 1
3808 // ST3 (single structure) (post index)
3809 COMPARE(dci(0x0d806400), expected); // .h, size<0> = 1
3810 COMPARE(dci(0x0d80a800), expected); // .s, size<1> = 1
3811 COMPARE(dci(0x0d80b400), expected); // .d, size<0> = 1, S = 1
3812 // ST4 (single structure) (post index)
3813 COMPARE(dci(0x0da06400), expected); // .h, size<0> = 1
3814 COMPARE(dci(0x0da0a800), expected); // .s, size<1> = 1
3815 COMPARE(dci(0x0da0b400), expected); // .d, size<0> = 1, S = 1
3816
3817 CLEANUP();
3818}
3819
3820
armvixl5289c592015-03-02 13:52:04 +00003821TEST(neon_load_all_lanes) {
armvixl684cd2a2015-10-23 13:38:33 +01003822 SETUP_MACRO();
armvixl5289c592015-03-02 13:52:04 +00003823
3824 COMPARE(Ld1r(v14.V8B(), MemOperand(x0)), "ld1r {v14.8b}, [x0]");
3825 COMPARE(Ld1r(v15.V16B(), MemOperand(x1)), "ld1r {v15.16b}, [x1]");
3826 COMPARE(Ld1r(v16.V4H(), MemOperand(x2)), "ld1r {v16.4h}, [x2]");
3827 COMPARE(Ld1r(v17.V8H(), MemOperand(x3)), "ld1r {v17.8h}, [x3]");
3828 COMPARE(Ld1r(v18.V2S(), MemOperand(x4)), "ld1r {v18.2s}, [x4]");
3829 COMPARE(Ld1r(v19.V4S(), MemOperand(x5)), "ld1r {v19.4s}, [x5]");
3830 COMPARE(Ld1r(v20.V2D(), MemOperand(sp)), "ld1r {v20.2d}, [sp]");
3831 COMPARE(Ld1r(v21.V1D(), MemOperand(x30)), "ld1r {v21.1d}, [x30]");
3832
3833 COMPARE(Ld1r(v22.V8B(), MemOperand(x6, 1, PostIndex)),
3834 "ld1r {v22.8b}, [x6], #1");
3835 COMPARE(Ld1r(v23.V16B(), MemOperand(x7, x16, PostIndex)),
3836 "ld1r {v23.16b}, [x7], x16");
3837 COMPARE(Ld1r(v24.V4H(), MemOperand(x8, x17, PostIndex)),
3838 "ld1r {v24.4h}, [x8], x17");
3839 COMPARE(Ld1r(v25.V8H(), MemOperand(x9, 2, PostIndex)),
3840 "ld1r {v25.8h}, [x9], #2");
3841 COMPARE(Ld1r(v26.V2S(), MemOperand(x10, 4, PostIndex)),
3842 "ld1r {v26.2s}, [x10], #4");
3843 COMPARE(Ld1r(v27.V4S(), MemOperand(x11, x18, PostIndex)),
3844 "ld1r {v27.4s}, [x11], x18");
3845 COMPARE(Ld1r(v28.V2D(), MemOperand(x12, 8, PostIndex)),
3846 "ld1r {v28.2d}, [x12], #8");
3847 COMPARE(Ld1r(v29.V1D(), MemOperand(x13, 8, PostIndex)),
3848 "ld1r {v29.1d}, [x13], #8");
3849
3850 COMPARE(Ld2r(v14.V8B(), v15.V8B(), MemOperand(x0)),
3851 "ld2r {v14.8b, v15.8b}, [x0]");
3852 COMPARE(Ld2r(v15.V16B(), v16.V16B(), MemOperand(x1)),
3853 "ld2r {v15.16b, v16.16b}, [x1]");
3854 COMPARE(Ld2r(v16.V4H(), v17.V4H(), MemOperand(x2)),
3855 "ld2r {v16.4h, v17.4h}, [x2]");
3856 COMPARE(Ld2r(v17.V8H(), v18.V8H(), MemOperand(x3)),
3857 "ld2r {v17.8h, v18.8h}, [x3]");
3858 COMPARE(Ld2r(v18.V2S(), v19.V2S(), MemOperand(x4)),
3859 "ld2r {v18.2s, v19.2s}, [x4]");
3860 COMPARE(Ld2r(v19.V4S(), v20.V4S(), MemOperand(x5)),
3861 "ld2r {v19.4s, v20.4s}, [x5]");
3862 COMPARE(Ld2r(v20.V2D(), v21.V2D(), MemOperand(sp)),
3863 "ld2r {v20.2d, v21.2d}, [sp]");
3864 COMPARE(Ld2r(v21.V8B(), v22.V8B(), MemOperand(x6, 2, PostIndex)),
3865 "ld2r {v21.8b, v22.8b}, [x6], #2");
3866 COMPARE(Ld2r(v22.V16B(), v23.V16B(), MemOperand(x7, x16, PostIndex)),
3867 "ld2r {v22.16b, v23.16b}, [x7], x16");
3868 COMPARE(Ld2r(v23.V4H(), v24.V4H(), MemOperand(x8, x17, PostIndex)),
3869 "ld2r {v23.4h, v24.4h}, [x8], x17");
3870 COMPARE(Ld2r(v24.V8H(), v25.V8H(), MemOperand(x9, 4, PostIndex)),
3871 "ld2r {v24.8h, v25.8h}, [x9], #4");
3872 COMPARE(Ld2r(v25.V2S(), v26.V2S(), MemOperand(x10, 8, PostIndex)),
3873 "ld2r {v25.2s, v26.2s}, [x10], #8");
3874 COMPARE(Ld2r(v26.V4S(), v27.V4S(), MemOperand(x11, x18, PostIndex)),
3875 "ld2r {v26.4s, v27.4s}, [x11], x18");
3876 COMPARE(Ld2r(v27.V2D(), v28.V2D(), MemOperand(x12, 16, PostIndex)),
3877 "ld2r {v27.2d, v28.2d}, [x12], #16");
3878
3879 COMPARE(Ld3r(v14.V8B(), v15.V8B(), v16.V8B(),
3880 MemOperand(x0)),
3881 "ld3r {v14.8b, v15.8b, v16.8b}, [x0]");
3882 COMPARE(Ld3r(v15.V16B(), v16.V16B(), v17.V16B(),
3883 MemOperand(x1)),
3884 "ld3r {v15.16b, v16.16b, v17.16b}, [x1]");
3885 COMPARE(Ld3r(v16.V4H(), v17.V4H(), v18.V4H(),
3886 MemOperand(x2)),
3887 "ld3r {v16.4h, v17.4h, v18.4h}, [x2]");
3888 COMPARE(Ld3r(v17.V8H(), v18.V8H(), v19.V8H(),
3889 MemOperand(x3)),
3890 "ld3r {v17.8h, v18.8h, v19.8h}, [x3]");
3891 COMPARE(Ld3r(v18.V2S(), v19.V2S(), v20.V2S(),
3892 MemOperand(x4)),
3893 "ld3r {v18.2s, v19.2s, v20.2s}, [x4]");
3894 COMPARE(Ld3r(v19.V4S(), v20.V4S(), v21.V4S(),
3895 MemOperand(x5)),
3896 "ld3r {v19.4s, v20.4s, v21.4s}, [x5]");
3897 COMPARE(Ld3r(v20.V2D(), v21.V2D(), v22.V2D(),
3898 MemOperand(sp)),
3899 "ld3r {v20.2d, v21.2d, v22.2d}, [sp]");
3900 COMPARE(Ld3r(v21.V8B(), v22.V8B(), v23.V8B(),
3901 MemOperand(x6, 3, PostIndex)),
3902 "ld3r {v21.8b, v22.8b, v23.8b}, [x6], #3");
3903 COMPARE(Ld3r(v22.V16B(), v23.V16B(), v24.V16B(),
3904 MemOperand(x7, x16, PostIndex)),
3905 "ld3r {v22.16b, v23.16b, v24.16b}, [x7], x16");
3906 COMPARE(Ld3r(v23.V4H(), v24.V4H(), v25.V4H(),
3907 MemOperand(x8, x17, PostIndex)),
3908 "ld3r {v23.4h, v24.4h, v25.4h}, [x8], x17");
3909 COMPARE(Ld3r(v24.V8H(), v25.V8H(), v26.V8H(),
3910 MemOperand(x9, 6, PostIndex)),
3911 "ld3r {v24.8h, v25.8h, v26.8h}, [x9], #6");
3912 COMPARE(Ld3r(v25.V2S(), v26.V2S(), v27.V2S(),
3913 MemOperand(x10, 12, PostIndex)),
3914 "ld3r {v25.2s, v26.2s, v27.2s}, [x10], #12");
3915 COMPARE(Ld3r(v26.V4S(), v27.V4S(), v28.V4S(),
3916 MemOperand(x11, x18, PostIndex)),
3917 "ld3r {v26.4s, v27.4s, v28.4s}, [x11], x18");
3918 COMPARE(Ld3r(v27.V2D(), v28.V2D(), v29.V2D(),
3919 MemOperand(x12, 24, PostIndex)),
3920 "ld3r {v27.2d, v28.2d, v29.2d}, [x12], #24");
3921
3922 COMPARE(Ld4r(v14.V8B(), v15.V8B(), v16.V8B(), v17.V8B(),
3923 MemOperand(x0)),
3924 "ld4r {v14.8b, v15.8b, v16.8b, v17.8b}, [x0]");
3925 COMPARE(Ld4r(v15.V16B(), v16.V16B(), v17.V16B(), v18.V16B(),
3926 MemOperand(x1)),
3927 "ld4r {v15.16b, v16.16b, v17.16b, v18.16b}, [x1]");
3928 COMPARE(Ld4r(v16.V4H(), v17.V4H(), v18.V4H(), v19.V4H(),
3929 MemOperand(x2)),
3930 "ld4r {v16.4h, v17.4h, v18.4h, v19.4h}, [x2]");
3931 COMPARE(Ld4r(v17.V8H(), v18.V8H(), v19.V8H(), v20.V8H(),
3932 MemOperand(x3)),
3933 "ld4r {v17.8h, v18.8h, v19.8h, v20.8h}, [x3]");
3934 COMPARE(Ld4r(v18.V2S(), v19.V2S(), v20.V2S(), v21.V2S(),
3935 MemOperand(x4)),
3936 "ld4r {v18.2s, v19.2s, v20.2s, v21.2s}, [x4]");
3937 COMPARE(Ld4r(v19.V4S(), v20.V4S(), v21.V4S(), v22.V4S(),
3938 MemOperand(x5)),
3939 "ld4r {v19.4s, v20.4s, v21.4s, v22.4s}, [x5]");
3940 COMPARE(Ld4r(v20.V2D(), v21.V2D(), v22.V2D(), v23.V2D(),
3941 MemOperand(sp)),
3942 "ld4r {v20.2d, v21.2d, v22.2d, v23.2d}, [sp]");
3943 COMPARE(Ld4r(v21.V8B(), v22.V8B(), v23.V8B(), v24.V8B(),
3944 MemOperand(x6, 4, PostIndex)),
3945 "ld4r {v21.8b, v22.8b, v23.8b, v24.8b}, [x6], #4");
3946 COMPARE(Ld4r(v22.V16B(), v23.V16B(), v24.V16B(), v25.V16B(),
3947 MemOperand(x7, x16, PostIndex)),
3948 "ld4r {v22.16b, v23.16b, v24.16b, v25.16b}, [x7], x16");
3949 COMPARE(Ld4r(v23.V4H(), v24.V4H(), v25.V4H(), v26.V4H(),
3950 MemOperand(x8, x17, PostIndex)),
3951 "ld4r {v23.4h, v24.4h, v25.4h, v26.4h}, [x8], x17");
3952 COMPARE(Ld4r(v24.V8H(), v25.V8H(), v26.V8H(), v27.V8H(),
3953 MemOperand(x9, 8, PostIndex)),
3954 "ld4r {v24.8h, v25.8h, v26.8h, v27.8h}, [x9], #8");
3955 COMPARE(Ld4r(v25.V2S(), v26.V2S(), v27.V2S(), v28.V2S(),
3956 MemOperand(x10, 16, PostIndex)),
3957 "ld4r {v25.2s, v26.2s, v27.2s, v28.2s}, [x10], #16");
3958 COMPARE(Ld4r(v26.V4S(), v27.V4S(), v28.V4S(), v29.V4S(),
3959 MemOperand(x11, x18, PostIndex)),
3960 "ld4r {v26.4s, v27.4s, v28.4s, v29.4s}, [x11], x18");
3961 COMPARE(Ld4r(v27.V2D(), v28.V2D(), v29.V2D(), v30.V2D(),
3962 MemOperand(x12, 32, PostIndex)),
3963 "ld4r {v27.2d, v28.2d, v29.2d, v30.2d}, [x12], #32");
3964
3965 CLEANUP();
3966}
3967
3968
armvixl0f35e362016-05-10 13:57:58 +01003969TEST(neon_load_all_lanes_unallocated) {
3970 SETUP();
3971
3972 const char* expected = "unallocated (NEONLoadStoreSingleStruct)";
3973 // LD1R (single structure) (no offset)
3974 COMPARE(dci(0x0d00c000), expected); // L = 0
3975 COMPARE(dci(0x0d40d000), expected); // S = 1
3976 // LD2R (single structure) (no offset)
3977 COMPARE(dci(0x0d20c000), expected); // L = 0
3978 COMPARE(dci(0x0d60d000), expected); // S = 1
3979 // LD3R (single structure) (no offset)
3980 COMPARE(dci(0x0d00e000), expected); // L = 0
3981 COMPARE(dci(0x0d40f000), expected); // S = 1
3982 // LD4R (single structure) (no offset)
3983 COMPARE(dci(0x0d20e000), expected); // L = 0
3984 COMPARE(dci(0x0d60f000), expected); // S = 1
3985
3986 expected = "unallocated (NEONLoadStoreSingleStructPostIndex)";
3987 // LD1R (single structure) (post index)
3988 COMPARE(dci(0x0d80c000), expected); // L = 0
3989 COMPARE(dci(0x0dc0d000), expected); // S = 1
3990 // LD2R (single structure) (post index)
3991 COMPARE(dci(0x0da0c000), expected); // L = 0
3992 COMPARE(dci(0x0de0d000), expected); // S = 1
3993 // LD3R (single structure) (post index)
3994 COMPARE(dci(0x0d80e000), expected); // L = 0
3995 COMPARE(dci(0x0dc0f000), expected); // S = 1
3996 // LD4R (single structure) (post index)
3997 COMPARE(dci(0x0da0e000), expected); // L = 0
3998 COMPARE(dci(0x0de0f000), expected); // S = 1
3999
4000 CLEANUP();
4001}
4002
4003
armvixl5289c592015-03-02 13:52:04 +00004004TEST(neon_3same) {
armvixl684cd2a2015-10-23 13:38:33 +01004005 SETUP_MACRO();
armvixl5289c592015-03-02 13:52:04 +00004006
4007 #define DISASM_INST(M, S) \
4008 COMPARE(Cmeq(v0.M, v1.M, v2.M), "cmeq v0." S ", v1." S ", v2." S);
4009 NEON_FORMAT_LIST(DISASM_INST)
4010 #undef DISASM_INST
4011
4012 #define DISASM_INST(M, S) \
4013 COMPARE(Cmge(v0.M, v1.M, v2.M), "cmge v0." S ", v1." S ", v2." S);
4014 NEON_FORMAT_LIST(DISASM_INST)
4015 #undef DISASM_INST
4016
4017 #define DISASM_INST(M, S) \
4018 COMPARE(Cmgt(v0.M, v1.M, v2.M), "cmgt v0." S ", v1." S ", v2." S);
4019 NEON_FORMAT_LIST(DISASM_INST)
4020 #undef DISASM_INST
4021
4022 #define DISASM_INST(M, S) \
4023 COMPARE(Cmhi(v0.M, v1.M, v2.M), "cmhi v0." S ", v1." S ", v2." S);
4024 NEON_FORMAT_LIST(DISASM_INST)
4025 #undef DISASM_INST
4026
4027 #define DISASM_INST(M, S) \
4028 COMPARE(Cmhs(v0.M, v1.M, v2.M), "cmhs v0." S ", v1." S ", v2." S);
4029 NEON_FORMAT_LIST(DISASM_INST)
4030 #undef DISASM_INST
4031
4032 #define DISASM_INST(M, S) \
4033 COMPARE(Cmtst(v0.M, v1.M, v2.M), "cmtst v0." S ", v1." S ", v2." S);
4034 NEON_FORMAT_LIST(DISASM_INST)
4035 #undef DISASM_INST
4036
4037 #define DISASM_INST(M, S) \
4038 COMPARE(Add(v0.M, v1.M, v2.M), "add v0." S ", v1." S ", v2." S);
4039 NEON_FORMAT_LIST(DISASM_INST)
4040 #undef DISASM_INST
4041
4042 #define DISASM_INST(M, S) \
4043 COMPARE(Sub(v3.M, v4.M, v5.M), "sub v3." S ", v4." S ", v5." S);
4044 NEON_FORMAT_LIST(DISASM_INST)
4045 #undef DISASM_INST
4046
4047 #define DISASM_INST(M, S) \
4048 COMPARE(Sabd(v3.M, v4.M, v5.M), "sabd v3." S ", v4." S ", v5." S);
4049 NEON_FORMAT_LIST_BHS(DISASM_INST)
4050 #undef DISASM_INST
4051
4052 #define DISASM_INST(M, S) \
4053 COMPARE(Uabd(v3.M, v4.M, v5.M), "uabd v3." S ", v4." S ", v5." S);
4054 NEON_FORMAT_LIST_BHS(DISASM_INST)
4055 #undef DISASM_INST
4056
4057 #define DISASM_INST(M, S) \
4058 COMPARE(Saba(v3.M, v4.M, v5.M), "saba v3." S ", v4." S ", v5." S);
4059 NEON_FORMAT_LIST_BHS(DISASM_INST)
4060 #undef DISASM_INST
4061
4062 #define DISASM_INST(M, S) \
4063 COMPARE(Uaba(v3.M, v4.M, v5.M), "uaba v3." S ", v4." S ", v5." S);
4064 NEON_FORMAT_LIST_BHS(DISASM_INST)
4065 #undef DISASM_INST
4066
4067 #define DISASM_INST(M, S) \
4068 COMPARE(Smax(v3.M, v4.M, v5.M), "smax v3." S ", v4." S ", v5." S);
4069 NEON_FORMAT_LIST_BHS(DISASM_INST)
4070 #undef DISASM_INST
4071
4072 #define DISASM_INST(M, S) \
4073 COMPARE(Smin(v3.M, v4.M, v5.M), "smin v3." S ", v4." S ", v5." S);
4074 NEON_FORMAT_LIST_BHS(DISASM_INST)
4075 #undef DISASM_INST
4076
4077 #define DISASM_INST(M, S) \
4078 COMPARE(Umax(v3.M, v4.M, v5.M), "umax v3." S ", v4." S ", v5." S);
4079 NEON_FORMAT_LIST_BHS(DISASM_INST)
4080 #undef DISASM_INST
4081
4082 #define DISASM_INST(M, S) \
4083 COMPARE(Umin(v3.M, v4.M, v5.M), "umin v3." S ", v4." S ", v5." S);
4084 NEON_FORMAT_LIST_BHS(DISASM_INST)
4085 #undef DISASM_INST
4086
4087 #define DISASM_INST(M, S) \
4088 COMPARE(Smaxp(v3.M, v4.M, v5.M), "smaxp v3." S ", v4." S ", v5." S);
4089 NEON_FORMAT_LIST_BHS(DISASM_INST)
4090 #undef DISASM_INST
4091
4092 #define DISASM_INST(M, S) \
4093 COMPARE(Sminp(v3.M, v4.M, v5.M), "sminp v3." S ", v4." S ", v5." S);
4094 NEON_FORMAT_LIST_BHS(DISASM_INST)
4095 #undef DISASM_INST
4096
4097 #define DISASM_INST(M, S) \
4098 COMPARE(Umaxp(v3.M, v4.M, v5.M), "umaxp v3." S ", v4." S ", v5." S);
4099 NEON_FORMAT_LIST_BHS(DISASM_INST)
4100 #undef DISASM_INST
4101
4102 #define DISASM_INST(M, S) \
4103 COMPARE(Uminp(v3.M, v4.M, v5.M), "uminp v3." S ", v4." S ", v5." S);
4104 NEON_FORMAT_LIST_BHS(DISASM_INST)
4105 #undef DISASM_INST
4106
4107 #define DISASM_INST(M, S) \
4108 COMPARE(Uqadd(v6.M, v7.M, v8.M), "uqadd v6." S ", v7." S ", v8." S);
4109 NEON_FORMAT_LIST(DISASM_INST)
4110 #undef DISASM_INST
4111
4112 #define DISASM_INST(M, S) \
4113 COMPARE(Sqadd(v9.M, v10.M, v11.M), "sqadd v9." S ", v10." S ", v11." S);
4114 NEON_FORMAT_LIST(DISASM_INST)
4115 #undef DISASM_INST
4116
4117 #define DISASM_INST(M, S) \
4118 COMPARE(Uqsub(v6.M, v7.M, v8.M), "uqsub v6." S ", v7." S ", v8." S);
4119 NEON_FORMAT_LIST(DISASM_INST)
4120 #undef DISASM_INST
4121
4122 #define DISASM_INST(M, S) \
4123 COMPARE(Sqsub(v9.M, v10.M, v11.M), "sqsub v9." S ", v10." S ", v11." S);
4124 NEON_FORMAT_LIST(DISASM_INST)
4125 #undef DISASM_INST
4126
4127 #define DISASM_INST(M, S) \
4128 COMPARE(Sshl(v12.M, v13.M, v14.M), "sshl v12." S ", v13." S ", v14." S);
4129 NEON_FORMAT_LIST(DISASM_INST)
4130 #undef DISASM_INST
4131
4132 #define DISASM_INST(M, S) \
4133 COMPARE(Ushl(v15.M, v16.M, v17.M), "ushl v15." S ", v16." S ", v17." S);
4134 NEON_FORMAT_LIST(DISASM_INST)
4135 #undef DISASM_INST
4136
4137 #define DISASM_INST(M, S) \
4138 COMPARE(Sqshl(v18.M, v19.M, v20.M), "sqshl v18." S ", v19." S ", v20." S);
4139 NEON_FORMAT_LIST(DISASM_INST)
4140 #undef DISASM_INST
4141
4142 #define DISASM_INST(M, S) \
4143 COMPARE(Uqshl(v21.M, v22.M, v23.M), "uqshl v21." S ", v22." S ", v23." S);
4144 NEON_FORMAT_LIST(DISASM_INST)
4145 #undef DISASM_INST
4146
4147 #define DISASM_INST(M, S) \
4148 COMPARE(Srshl(v24.M, v25.M, v26.M), "srshl v24." S ", v25." S ", v26." S);
4149 NEON_FORMAT_LIST(DISASM_INST)
4150 #undef DISASM_INST
4151
4152 #define DISASM_INST(M, S) \
4153 COMPARE(Urshl(v27.M, v28.M, v29.M), "urshl v27." S ", v28." S ", v29." S);
4154 NEON_FORMAT_LIST(DISASM_INST)
4155 #undef DISASM_INST
4156
4157 #define DISASM_INST(M, S) \
4158 COMPARE(Sqrshl(v30.M, v31.M, v0.M), "sqrshl v30." S ", v31." S ", v0." S);
4159 NEON_FORMAT_LIST(DISASM_INST)
4160 #undef DISASM_INST
4161
4162 #define DISASM_INST(M, S) \
4163 COMPARE(Uqrshl(v1.M, v2.M, v3.M), "uqrshl v1." S ", v2." S ", v3." S);
4164 NEON_FORMAT_LIST(DISASM_INST)
4165 #undef DISASM_INST
4166
4167 #define DISASM_INST(M, S) \
4168 COMPARE(Shadd(v4.M, v5.M, v6.M), "shadd v4." S ", v5." S ", v6." S);
4169 NEON_FORMAT_LIST_BHS(DISASM_INST)
4170 #undef DISASM_INST
4171
4172 #define DISASM_INST(M, S) \
4173 COMPARE(Uhadd(v7.M, v8.M, v9.M), "uhadd v7." S ", v8." S ", v9." S);
4174 NEON_FORMAT_LIST_BHS(DISASM_INST)
4175 #undef DISASM_INST
4176
4177 #define DISASM_INST(M, S) \
4178 COMPARE(Srhadd(v10.M, v11.M, v12.M), "srhadd v10." S ", v11." S ", v12." S);
4179 NEON_FORMAT_LIST_BHS(DISASM_INST)
4180 #undef DISASM_INST
4181
4182 #define DISASM_INST(M, S) \
4183 COMPARE(Urhadd(v13.M, v14.M, v15.M), "urhadd v13." S ", v14." S ", v15." S);
4184 NEON_FORMAT_LIST_BHS(DISASM_INST)
4185 #undef DISASM_INST
4186
4187 #define DISASM_INST(M, S) \
4188 COMPARE(Shsub(v16.M, v17.M, v18.M), "shsub v16." S ", v17." S ", v18." S);
4189 NEON_FORMAT_LIST_BHS(DISASM_INST)
4190 #undef DISASM_INST
4191
4192 #define DISASM_INST(M, S) \
4193 COMPARE(Uhsub(v19.M, v20.M, v21.M), "uhsub v19." S ", v20." S ", v21." S);
4194 NEON_FORMAT_LIST_BHS(DISASM_INST)
4195 #undef DISASM_INST
4196
4197 #define DISASM_INST(M, S) \
4198 COMPARE(Addp(v19.M, v20.M, v21.M), "addp v19." S ", v20." S ", v21." S);
4199 NEON_FORMAT_LIST(DISASM_INST)
4200 #undef DISASM_INST
4201
4202 #define DISASM_INST(M, S) \
4203 COMPARE(Mla(v19.M, v20.M, v21.M), "mla v19." S ", v20." S ", v21." S);
4204 NEON_FORMAT_LIST_BHS(DISASM_INST)
4205 #undef DISASM_INST
4206
4207 #define DISASM_INST(M, S) \
4208 COMPARE(Mls(v19.M, v20.M, v21.M), "mls v19." S ", v20." S ", v21." S);
4209 NEON_FORMAT_LIST_BHS(DISASM_INST)
4210 #undef DISASM_INST
4211
4212 #define DISASM_INST(M, S) \
4213 COMPARE(Mul(v19.M, v20.M, v21.M), "mul v19." S ", v20." S ", v21." S);
4214 NEON_FORMAT_LIST_BHS(DISASM_INST)
4215 #undef DISASM_INST
4216
4217 #define DISASM_INST(M, S) \
4218 COMPARE(Sqdmulh(v1.M, v2.M, v3.M), "sqdmulh v1." S ", v2." S ", v3." S);
4219 NEON_FORMAT_LIST_HS(DISASM_INST)
4220 #undef DISASM_INST
4221
4222 #define DISASM_INST(M, S) \
4223 COMPARE(Sqrdmulh(v1.M, v2.M, v3.M), "sqrdmulh v1." S ", v2." S ", v3." S);
4224 NEON_FORMAT_LIST_HS(DISASM_INST)
4225 #undef DISASM_INST
4226
4227 COMPARE(And(v6.V8B(), v7.V8B(), v8.V8B()), "and v6.8b, v7.8b, v8.8b");
4228 COMPARE(And(v6.V16B(), v7.V16B(), v8.V16B()), "and v6.16b, v7.16b, v8.16b");
4229
4230 COMPARE(Bic(v6.V8B(), v7.V8B(), v8.V8B()), "bic v6.8b, v7.8b, v8.8b");
4231 COMPARE(Bic(v6.V16B(), v7.V16B(), v8.V16B()), "bic v6.16b, v7.16b, v8.16b");
4232
4233 COMPARE(Orr(v6.V8B(), v7.V8B(), v8.V8B()), "orr v6.8b, v7.8b, v8.8b");
4234 COMPARE(Orr(v6.V16B(), v7.V16B(), v8.V16B()), "orr v6.16b, v7.16b, v8.16b");
4235
4236 COMPARE(Orr(v6.V8B(), v7.V8B(), v7.V8B()), "mov v6.8b, v7.8b");
4237 COMPARE(Orr(v6.V16B(), v7.V16B(), v7.V16B()), "mov v6.16b, v7.16b");
4238
4239 COMPARE(Mov(v6.V8B(), v8.V8B()), "mov v6.8b, v8.8b");
4240 COMPARE(Mov(v6.V16B(), v8.V16B()), "mov v6.16b, v8.16b");
4241
4242 COMPARE(Orn(v6.V8B(), v7.V8B(), v8.V8B()), "orn v6.8b, v7.8b, v8.8b");
4243 COMPARE(Orn(v6.V16B(), v7.V16B(), v8.V16B()), "orn v6.16b, v7.16b, v8.16b");
4244
4245 COMPARE(Eor(v6.V8B(), v7.V8B(), v8.V8B()), "eor v6.8b, v7.8b, v8.8b");
4246 COMPARE(Eor(v6.V16B(), v7.V16B(), v8.V16B()), "eor v6.16b, v7.16b, v8.16b");
4247
4248 COMPARE(Bif(v6.V8B(), v7.V8B(), v8.V8B()), "bif v6.8b, v7.8b, v8.8b");
4249 COMPARE(Bif(v6.V16B(), v7.V16B(), v8.V16B()), "bif v6.16b, v7.16b, v8.16b");
4250
4251 COMPARE(Bit(v6.V8B(), v7.V8B(), v8.V8B()), "bit v6.8b, v7.8b, v8.8b");
4252 COMPARE(Bit(v6.V16B(), v7.V16B(), v8.V16B()), "bit v6.16b, v7.16b, v8.16b");
4253
4254 COMPARE(Bsl(v6.V8B(), v7.V8B(), v8.V8B()), "bsl v6.8b, v7.8b, v8.8b");
4255 COMPARE(Bsl(v6.V16B(), v7.V16B(), v8.V16B()), "bsl v6.16b, v7.16b, v8.16b");
4256
4257 COMPARE(Pmul(v6.V8B(), v7.V8B(), v8.V8B()), "pmul v6.8b, v7.8b, v8.8b");
4258 COMPARE(Pmul(v6.V16B(), v7.V16B(), v8.V16B()), "pmul v6.16b, v7.16b, v8.16b");
4259
4260 CLEANUP();
4261}
4262
4263
4264#define NEON_FORMAT_LIST_FP(V) \
4265 V(V2S(), "2s") \
4266 V(V4S(), "4s") \
4267 V(V2D(), "2d")
4268
4269TEST(neon_fp_3same) {
armvixl684cd2a2015-10-23 13:38:33 +01004270 SETUP_MACRO();
armvixl5289c592015-03-02 13:52:04 +00004271
4272 #define DISASM_INST(M, S) \
4273 COMPARE(Fadd(v0.M, v1.M, v2.M), "fadd v0." S ", v1." S ", v2." S);
4274 NEON_FORMAT_LIST_FP(DISASM_INST)
4275 #undef DISASM_INST
4276
4277 #define DISASM_INST(M, S) \
4278 COMPARE(Fsub(v3.M, v4.M, v5.M), "fsub v3." S ", v4." S ", v5." S);
4279 NEON_FORMAT_LIST_FP(DISASM_INST)
4280 #undef DISASM_INST
4281
4282 #define DISASM_INST(M, S) \
4283 COMPARE(Fmul(v6.M, v7.M, v8.M), "fmul v6." S ", v7." S ", v8." S);
4284 NEON_FORMAT_LIST_FP(DISASM_INST)
4285 #undef DISASM_INST
4286
4287 #define DISASM_INST(M, S) \
4288 COMPARE(Fdiv(v9.M, v10.M, v11.M), "fdiv v9." S ", v10." S ", v11." S);
4289 NEON_FORMAT_LIST_FP(DISASM_INST)
4290 #undef DISASM_INST
4291
4292 #define DISASM_INST(M, S) \
4293 COMPARE(Fmin(v12.M, v13.M, v14.M), "fmin v12." S ", v13." S ", v14." S);
4294 NEON_FORMAT_LIST_FP(DISASM_INST)
4295 #undef DISASM_INST
4296
4297 #define DISASM_INST(M, S) \
4298 COMPARE(Fminnm(v15.M, v16.M, v17.M), "fminnm v15." S ", v16." S ", v17." S);
4299 NEON_FORMAT_LIST_FP(DISASM_INST)
4300 #undef DISASM_INST
4301
4302 #define DISASM_INST(M, S) \
4303 COMPARE(Fmax(v18.M, v19.M, v20.M), "fmax v18." S ", v19." S ", v20." S);
4304 NEON_FORMAT_LIST_FP(DISASM_INST)
4305 #undef DISASM_INST
4306
4307 #define DISASM_INST(M, S) \
4308 COMPARE(Fmaxnm(v21.M, v22.M, v23.M), "fmaxnm v21." S ", v22." S ", v23." S);
4309 NEON_FORMAT_LIST_FP(DISASM_INST)
4310 #undef DISASM_INST
4311
4312 #define DISASM_INST(M, S) \
4313 COMPARE(Frecps(v24.M, v25.M, v26.M), "frecps v24." S ", v25." S ", v26." S);
4314 NEON_FORMAT_LIST_FP(DISASM_INST)
4315 #undef DISASM_INST
4316
4317 #define DISASM_INST(M, S) \
4318 COMPARE(Frsqrts(v27.M, v28.M, v29.M), "frsqrts v27." S ", v28." S ", v29." S);
4319 NEON_FORMAT_LIST_FP(DISASM_INST)
4320 #undef DISASM_INST
4321
4322 #define DISASM_INST(M, S) \
4323 COMPARE(Fmulx(v30.M, v31.M, v0.M), "fmulx v30." S ", v31." S ", v0." S);
4324 NEON_FORMAT_LIST_FP(DISASM_INST)
4325 #undef DISASM_INST
4326
4327 #define DISASM_INST(M, S) \
4328 COMPARE(Fmla(v1.M, v2.M, v3.M), "fmla v1." S ", v2." S ", v3." S);
4329 NEON_FORMAT_LIST_FP(DISASM_INST)
4330 #undef DISASM_INST
4331
4332 #define DISASM_INST(M, S) \
4333 COMPARE(Fmls(v4.M, v5.M, v6.M), "fmls v4." S ", v5." S ", v6." S);
4334 NEON_FORMAT_LIST_FP(DISASM_INST)
4335 #undef DISASM_INST
4336
4337 #define DISASM_INST(M, S) \
4338 COMPARE(Fabd(v7.M, v8.M, v9.M), "fabd v7." S ", v8." S ", v9." S);
4339 NEON_FORMAT_LIST_FP(DISASM_INST)
4340 #undef DISASM_INST
4341
4342 #define DISASM_INST(M, S) \
4343 COMPARE(Faddp(v10.M, v11.M, v12.M), "faddp v10." S ", v11." S ", v12." S);
4344 NEON_FORMAT_LIST_FP(DISASM_INST)
4345 #undef DISASM_INST
4346
4347 #define DISASM_INST(M, S) \
4348 COMPARE(Fmaxp(v13.M, v14.M, v15.M), "fmaxp v13." S ", v14." S ", v15." S);
4349 NEON_FORMAT_LIST_FP(DISASM_INST)
4350 #undef DISASM_INST
4351
4352 #define DISASM_INST(M, S) \
4353 COMPARE(Fminp(v16.M, v17.M, v18.M), "fminp v16." S ", v17." S ", v18." S);
4354 NEON_FORMAT_LIST_FP(DISASM_INST)
4355 #undef DISASM_INST
4356
4357 #define DISASM_INST(M, S) \
4358 COMPARE(Fmaxnmp(v19.M, v20.M, v21.M), "fmaxnmp v19." S ", v20." S ", v21." S);
4359 NEON_FORMAT_LIST_FP(DISASM_INST)
4360 #undef DISASM_INST
4361
4362 #define DISASM_INST(M, S) \
4363 COMPARE(Fminnmp(v22.M, v23.M, v24.M), "fminnmp v22." S ", v23." S ", v24." S);
4364 NEON_FORMAT_LIST_FP(DISASM_INST)
4365 #undef DISASM_INST
4366
4367 #define DISASM_INST(M, S) \
4368 COMPARE(Fcmeq(v25.M, v26.M, v27.M), "fcmeq v25." S ", v26." S ", v27." S);
4369 NEON_FORMAT_LIST_FP(DISASM_INST)
4370 #undef DISASM_INST
4371
4372 #define DISASM_INST(M, S) \
4373 COMPARE(Fcmge(v25.M, v26.M, v27.M), "fcmge v25." S ", v26." S ", v27." S);
4374 NEON_FORMAT_LIST_FP(DISASM_INST)
4375 #undef DISASM_INST
4376
4377 #define DISASM_INST(M, S) \
4378 COMPARE(Fcmgt(v25.M, v26.M, v27.M), "fcmgt v25." S ", v26." S ", v27." S);
4379 NEON_FORMAT_LIST_FP(DISASM_INST)
4380 #undef DISASM_INST
4381
4382 #define DISASM_INST(M, S) \
4383 COMPARE(Facge(v25.M, v26.M, v27.M), "facge v25." S ", v26." S ", v27." S);
4384 NEON_FORMAT_LIST_FP(DISASM_INST)
4385 #undef DISASM_INST
4386
4387 #define DISASM_INST(M, S) \
4388 COMPARE(Facgt(v25.M, v26.M, v27.M), "facgt v25." S ", v26." S ", v27." S);
4389 NEON_FORMAT_LIST_FP(DISASM_INST)
4390 #undef DISASM_INST
4391
4392 CLEANUP();
4393}
4394
4395
4396#define NEON_SCALAR_FORMAT_LIST(V) \
4397 V(B(), "b") \
4398 V(H(), "h") \
4399 V(S(), "s") \
4400 V(D(), "d")
4401
4402TEST(neon_scalar_3same) {
armvixl684cd2a2015-10-23 13:38:33 +01004403 SETUP_MACRO();
armvixl5289c592015-03-02 13:52:04 +00004404
4405 // Instructions that only support D-sized scalar operations.
4406 COMPARE(Add(v0.D(), v1.D(), v2.D()), "add d0, d1, d2");
4407 COMPARE(Sub(v3.D(), v4.D(), v5.D()), "sub d3, d4, d5");
4408 COMPARE(Cmeq(v0.D(), v1.D(), v2.D()), "cmeq d0, d1, d2");
4409 COMPARE(Cmge(v3.D(), v4.D(), v5.D()), "cmge d3, d4, d5");
4410 COMPARE(Cmgt(v6.D(), v7.D(), v8.D()), "cmgt d6, d7, d8");
4411 COMPARE(Cmhi(v0.D(), v1.D(), v2.D()), "cmhi d0, d1, d2");
4412 COMPARE(Cmhs(v3.D(), v4.D(), v5.D()), "cmhs d3, d4, d5");
4413 COMPARE(Cmtst(v6.D(), v7.D(), v8.D()), "cmtst d6, d7, d8");
4414 COMPARE(Ushl(v6.D(), v7.D(), v8.D()), "ushl d6, d7, d8");
4415 COMPARE(Sshl(v6.D(), v7.D(), v8.D()), "sshl d6, d7, d8");
4416 COMPARE(Urshl(v9.D(), v10.D(), v11.D()), "urshl d9, d10, d11");
4417 COMPARE(Srshl(v9.D(), v10.D(), v11.D()), "srshl d9, d10, d11");
4418
4419 // Instructions that support S and D-sized scalar operations.
4420 COMPARE(Frecps(v12.S(), v13.S(), v14.S()), "frecps s12, s13, s14");
4421 COMPARE(Frecps(v15.D(), v16.D(), v17.D()), "frecps d15, d16, d17");
4422 COMPARE(Frsqrts(v18.S(), v19.S(), v20.S()), "frsqrts s18, s19, s20");
4423 COMPARE(Frsqrts(v21.D(), v22.D(), v23.D()), "frsqrts d21, d22, d23");
4424 COMPARE(Fmulx(v12.S(), v13.S(), v14.S()), "fmulx s12, s13, s14");
4425 COMPARE(Fmulx(v15.D(), v16.D(), v17.D()), "fmulx d15, d16, d17");
4426 COMPARE(Fcmeq(v12.S(), v13.S(), v14.S()), "fcmeq s12, s13, s14");
4427 COMPARE(Fcmeq(v15.D(), v16.D(), v17.D()), "fcmeq d15, d16, d17");
4428 COMPARE(Fcmge(v12.S(), v13.S(), v14.S()), "fcmge s12, s13, s14");
4429 COMPARE(Fcmge(v15.D(), v16.D(), v17.D()), "fcmge d15, d16, d17");
4430 COMPARE(Fcmgt(v12.S(), v13.S(), v14.S()), "fcmgt s12, s13, s14");
4431 COMPARE(Fcmgt(v15.D(), v16.D(), v17.D()), "fcmgt d15, d16, d17");
4432 COMPARE(Fcmge(v12.S(), v13.S(), v14.S()), "fcmge s12, s13, s14");
4433 COMPARE(Fcmge(v15.D(), v16.D(), v17.D()), "fcmge d15, d16, d17");
4434 COMPARE(Facgt(v12.S(), v13.S(), v14.S()), "facgt s12, s13, s14");
4435 COMPARE(Facgt(v15.D(), v16.D(), v17.D()), "facgt d15, d16, d17");
4436
4437 // Instructions that support H and S-sized scalar operations.
4438 COMPARE(Sqdmulh(v12.S(), v13.S(), v14.S()), "sqdmulh s12, s13, s14");
4439 COMPARE(Sqdmulh(v15.H(), v16.H(), v17.H()), "sqdmulh h15, h16, h17");
4440 COMPARE(Sqrdmulh(v12.S(), v13.S(), v14.S()), "sqrdmulh s12, s13, s14");
4441 COMPARE(Sqrdmulh(v15.H(), v16.H(), v17.H()), "sqrdmulh h15, h16, h17");
4442
4443 #define DISASM_INST(M, R) \
4444 COMPARE(Uqadd(v6.M, v7.M, v8.M), "uqadd " R "6, " R "7, " R "8");
4445 NEON_SCALAR_FORMAT_LIST(DISASM_INST)
4446 #undef DISASM_INST
4447
4448 #define DISASM_INST(M, R) \
4449 COMPARE(Uqsub(v9.M, v10.M, v11.M), "uqsub " R "9, " R "10, " R "11");
4450 NEON_SCALAR_FORMAT_LIST(DISASM_INST)
4451 #undef DISASM_INST
4452
4453 #define DISASM_INST(M, R) \
4454 COMPARE(Sqadd(v12.M, v13.M, v14.M), "sqadd " R "12, " R "13, " R "14");
4455 NEON_SCALAR_FORMAT_LIST(DISASM_INST)
4456 #undef DISASM_INST
4457
4458 #define DISASM_INST(M, R) \
4459 COMPARE(Sqsub(v15.M, v16.M, v17.M), "sqsub " R "15, " R "16, " R "17");
4460 NEON_SCALAR_FORMAT_LIST(DISASM_INST)
4461 #undef DISASM_INST
4462
4463 #define DISASM_INST(M, R) \
4464 COMPARE(Uqshl(v18.M, v19.M, v20.M), "uqshl " R "18, " R "19, " R "20");
4465 NEON_SCALAR_FORMAT_LIST(DISASM_INST)
4466 #undef DISASM_INST
4467
4468 #define DISASM_INST(M, R) \
4469 COMPARE(Sqshl(v21.M, v22.M, v23.M), "sqshl " R "21, " R "22, " R "23");
4470 NEON_SCALAR_FORMAT_LIST(DISASM_INST)
4471 #undef DISASM_INST
4472
4473 #define DISASM_INST(M, R) \
4474 COMPARE(Uqrshl(v30.M, v31.M, v0.M), "uqrshl " R "30, " R "31, " R "0");
4475 NEON_SCALAR_FORMAT_LIST(DISASM_INST)
4476 #undef DISASM_INST
4477
4478 #define DISASM_INST(M, R) \
4479 COMPARE(Sqrshl(v1.M, v2.M, v3.M), "sqrshl " R "1, " R "2, " R "3");
4480 NEON_SCALAR_FORMAT_LIST(DISASM_INST)
4481 #undef DISASM_INST
4482
4483 CLEANUP();
4484}
4485
4486
4487TEST(neon_byelement) {
armvixl684cd2a2015-10-23 13:38:33 +01004488 SETUP_MACRO();
armvixl5289c592015-03-02 13:52:04 +00004489
4490 COMPARE(Mul(v0.V4H(), v1.V4H(), v2.H(), 0), "mul v0.4h, v1.4h, v2.h[0]");
4491 COMPARE(Mul(v2.V8H(), v3.V8H(), v15.H(), 7), "mul v2.8h, v3.8h, v15.h[7]");
4492 COMPARE(Mul(v0.V2S(), v1.V2S(), v2.S(), 0), "mul v0.2s, v1.2s, v2.s[0]");
4493 COMPARE(Mul(v2.V4S(), v3.V4S(), v15.S(), 3), "mul v2.4s, v3.4s, v15.s[3]");
4494
4495 COMPARE(Mla(v0.V4H(), v1.V4H(), v2.H(), 0), "mla v0.4h, v1.4h, v2.h[0]");
4496 COMPARE(Mla(v2.V8H(), v3.V8H(), v15.H(), 7), "mla v2.8h, v3.8h, v15.h[7]");
4497 COMPARE(Mla(v0.V2S(), v1.V2S(), v2.S(), 0), "mla v0.2s, v1.2s, v2.s[0]");
4498 COMPARE(Mla(v2.V4S(), v3.V4S(), v15.S(), 3), "mla v2.4s, v3.4s, v15.s[3]");
4499
4500 COMPARE(Mls(v0.V4H(), v1.V4H(), v2.H(), 0), "mls v0.4h, v1.4h, v2.h[0]");
4501 COMPARE(Mls(v2.V8H(), v3.V8H(), v15.H(), 7), "mls v2.8h, v3.8h, v15.h[7]");
4502 COMPARE(Mls(v0.V2S(), v1.V2S(), v2.S(), 0), "mls v0.2s, v1.2s, v2.s[0]");
4503 COMPARE(Mls(v2.V4S(), v3.V4S(), v15.S(), 3), "mls v2.4s, v3.4s, v15.s[3]");
4504
4505 COMPARE(Sqdmulh(v0.V4H(), v1.V4H(), v2.H(), 0),
4506 "sqdmulh v0.4h, v1.4h, v2.h[0]");
4507 COMPARE(Sqdmulh(v2.V8H(), v3.V8H(), v15.H(), 7),
4508 "sqdmulh v2.8h, v3.8h, v15.h[7]");
4509 COMPARE(Sqdmulh(v0.V2S(), v1.V2S(), v2.S(), 0),
4510 "sqdmulh v0.2s, v1.2s, v2.s[0]");
4511 COMPARE(Sqdmulh(v2.V4S(), v3.V4S(), v15.S(), 3),
4512 "sqdmulh v2.4s, v3.4s, v15.s[3]");
4513 COMPARE(Sqdmulh(h0, h1, v2.H(), 0), "sqdmulh h0, h1, v2.h[0]");
4514 COMPARE(Sqdmulh(s0, s1, v2.S(), 0), "sqdmulh s0, s1, v2.s[0]");
4515
4516 COMPARE(Sqrdmulh(v0.V4H(), v1.V4H(), v2.H(), 0),
4517 "sqrdmulh v0.4h, v1.4h, v2.h[0]");
4518 COMPARE(Sqrdmulh(v2.V8H(), v3.V8H(), v15.H(), 7),
4519 "sqrdmulh v2.8h, v3.8h, v15.h[7]");
4520 COMPARE(Sqrdmulh(v0.V2S(), v1.V2S(), v2.S(), 0),
4521 "sqrdmulh v0.2s, v1.2s, v2.s[0]");
4522 COMPARE(Sqrdmulh(v2.V4S(), v3.V4S(), v15.S(), 3),
4523 "sqrdmulh v2.4s, v3.4s, v15.s[3]");
4524 COMPARE(Sqrdmulh(h0, h1, v2.H(), 0), "sqrdmulh h0, h1, v2.h[0]");
4525 COMPARE(Sqrdmulh(s0, s1, v2.S(), 0), "sqrdmulh s0, s1, v2.s[0]");
4526
4527 COMPARE(Smull(v0.V4S(), v1.V4H(), v2.H(), 0), "smull v0.4s, v1.4h, v2.h[0]");
4528 COMPARE(Smull2(v2.V4S(), v3.V8H(), v4.H(), 7),
4529 "smull2 v2.4s, v3.8h, v4.h[7]");
4530 COMPARE(Smull(v0.V2D(), v1.V2S(), v2.S(), 0), "smull v0.2d, v1.2s, v2.s[0]");
4531 COMPARE(Smull2(v2.V2D(), v3.V4S(), v4.S(), 3),
4532 "smull2 v2.2d, v3.4s, v4.s[3]");
4533
4534 COMPARE(Umull(v0.V4S(), v1.V4H(), v2.H(), 0), "umull v0.4s, v1.4h, v2.h[0]");
4535 COMPARE(Umull2(v2.V4S(), v3.V8H(), v4.H(), 7),
4536 "umull2 v2.4s, v3.8h, v4.h[7]");
4537 COMPARE(Umull(v0.V2D(), v1.V2S(), v2.S(), 0), "umull v0.2d, v1.2s, v2.s[0]");
4538 COMPARE(Umull2(v2.V2D(), v3.V4S(), v4.S(), 3),
4539 "umull2 v2.2d, v3.4s, v4.s[3]");
4540
4541 COMPARE(Smlal(v0.V4S(), v1.V4H(), v2.H(), 0), "smlal v0.4s, v1.4h, v2.h[0]");
4542 COMPARE(Smlal2(v2.V4S(), v3.V8H(), v4.H(), 7),
4543 "smlal2 v2.4s, v3.8h, v4.h[7]");
4544 COMPARE(Smlal(v0.V2D(), v1.V2S(), v2.S(), 0), "smlal v0.2d, v1.2s, v2.s[0]");
4545 COMPARE(Smlal2(v2.V2D(), v3.V4S(), v4.S(), 3),
4546 "smlal2 v2.2d, v3.4s, v4.s[3]");
4547
4548 COMPARE(Umlal(v0.V4S(), v1.V4H(), v2.H(), 0), "umlal v0.4s, v1.4h, v2.h[0]");
4549 COMPARE(Umlal2(v2.V4S(), v3.V8H(), v4.H(), 7),
4550 "umlal2 v2.4s, v3.8h, v4.h[7]");
4551 COMPARE(Umlal(v0.V2D(), v1.V2S(), v2.S(), 0), "umlal v0.2d, v1.2s, v2.s[0]");
4552 COMPARE(Umlal2(v2.V2D(), v3.V4S(), v4.S(), 3),
4553 "umlal2 v2.2d, v3.4s, v4.s[3]");
4554
4555 COMPARE(Smlsl(v0.V4S(), v1.V4H(), v2.H(), 0), "smlsl v0.4s, v1.4h, v2.h[0]");
4556 COMPARE(Smlsl2(v2.V4S(), v3.V8H(), v4.H(), 7),
4557 "smlsl2 v2.4s, v3.8h, v4.h[7]");
4558 COMPARE(Smlsl(v0.V2D(), v1.V2S(), v2.S(), 0), "smlsl v0.2d, v1.2s, v2.s[0]");
4559 COMPARE(Smlsl2(v2.V2D(), v3.V4S(), v4.S(), 3),
4560 "smlsl2 v2.2d, v3.4s, v4.s[3]");
4561
4562 COMPARE(Umlsl(v0.V4S(), v1.V4H(), v2.H(), 0), "umlsl v0.4s, v1.4h, v2.h[0]");
4563 COMPARE(Umlsl2(v2.V4S(), v3.V8H(), v4.H(), 7),
4564 "umlsl2 v2.4s, v3.8h, v4.h[7]");
4565 COMPARE(Umlsl(v0.V2D(), v1.V2S(), v2.S(), 0), "umlsl v0.2d, v1.2s, v2.s[0]");
4566 COMPARE(Umlsl2(v2.V2D(), v3.V4S(), v4.S(), 3),
4567 "umlsl2 v2.2d, v3.4s, v4.s[3]");
4568
4569 COMPARE(Sqdmull(v0.V4S(), v1.V4H(), v2.H(), 0),
4570 "sqdmull v0.4s, v1.4h, v2.h[0]");
4571 COMPARE(Sqdmull2(v2.V4S(), v3.V8H(), v4.H(), 7),
4572 "sqdmull2 v2.4s, v3.8h, v4.h[7]");
4573 COMPARE(Sqdmull(v0.V2D(), v1.V2S(), v2.S(), 0),
4574 "sqdmull v0.2d, v1.2s, v2.s[0]");
4575 COMPARE(Sqdmull2(v2.V2D(), v3.V4S(), v4.S(), 3),
4576 "sqdmull2 v2.2d, v3.4s, v4.s[3]");
4577 COMPARE(Sqdmull(s0, h1, v2.H(), 0), "sqdmull s0, h1, v2.h[0]");
4578 COMPARE(Sqdmull(d0, s1, v2.S(), 0), "sqdmull d0, s1, v2.s[0]");
4579
4580 COMPARE(Sqdmlal(v0.V4S(), v1.V4H(), v2.H(), 0),
4581 "sqdmlal v0.4s, v1.4h, v2.h[0]");
4582 COMPARE(Sqdmlal2(v2.V4S(), v3.V8H(), v4.H(), 7),
4583 "sqdmlal2 v2.4s, v3.8h, v4.h[7]");
4584 COMPARE(Sqdmlal(v0.V2D(), v1.V2S(), v2.S(), 0),
4585 "sqdmlal v0.2d, v1.2s, v2.s[0]");
4586 COMPARE(Sqdmlal2(v2.V2D(), v3.V4S(), v4.S(), 3),
4587 "sqdmlal2 v2.2d, v3.4s, v4.s[3]");
4588 COMPARE(Sqdmlal(s0, h1, v2.H(), 0), "sqdmlal s0, h1, v2.h[0]");
4589 COMPARE(Sqdmlal(d0, s1, v2.S(), 0), "sqdmlal d0, s1, v2.s[0]");
4590
4591 COMPARE(Sqdmlsl(v0.V4S(), v1.V4H(), v2.H(), 0),
4592 "sqdmlsl v0.4s, v1.4h, v2.h[0]");
4593 COMPARE(Sqdmlsl2(v2.V4S(), v3.V8H(), v4.H(), 7),
4594 "sqdmlsl2 v2.4s, v3.8h, v4.h[7]");
4595 COMPARE(Sqdmlsl(v0.V2D(), v1.V2S(), v2.S(), 0),
4596 "sqdmlsl v0.2d, v1.2s, v2.s[0]");
4597 COMPARE(Sqdmlsl2(v2.V2D(), v3.V4S(), v4.S(), 3),
4598 "sqdmlsl2 v2.2d, v3.4s, v4.s[3]");
4599 COMPARE(Sqdmlsl(s0, h1, v2.H(), 0), "sqdmlsl s0, h1, v2.h[0]");
4600 COMPARE(Sqdmlsl(d0, s1, v2.S(), 0), "sqdmlsl d0, s1, v2.s[0]");
4601
4602 CLEANUP();
4603}
4604
4605
4606TEST(neon_fp_byelement) {
armvixl684cd2a2015-10-23 13:38:33 +01004607 SETUP_MACRO();
armvixl5289c592015-03-02 13:52:04 +00004608
4609 COMPARE(Fmul(v0.V2S(), v1.V2S(), v2.S(), 0), "fmul v0.2s, v1.2s, v2.s[0]");
4610 COMPARE(Fmul(v2.V4S(), v3.V4S(), v15.S(), 3), "fmul v2.4s, v3.4s, v15.s[3]");
4611 COMPARE(Fmul(v0.V2D(), v1.V2D(), v2.D(), 0), "fmul v0.2d, v1.2d, v2.d[0]");
4612 COMPARE(Fmul(d0, d1, v2.D(), 0), "fmul d0, d1, v2.d[0]");
4613 COMPARE(Fmul(s0, s1, v2.S(), 0), "fmul s0, s1, v2.s[0]");
4614
4615 COMPARE(Fmla(v0.V2S(), v1.V2S(), v2.S(), 0), "fmla v0.2s, v1.2s, v2.s[0]");
4616 COMPARE(Fmla(v2.V4S(), v3.V4S(), v15.S(), 3), "fmla v2.4s, v3.4s, v15.s[3]");
4617 COMPARE(Fmla(v0.V2D(), v1.V2D(), v2.D(), 0), "fmla v0.2d, v1.2d, v2.d[0]");
4618 COMPARE(Fmla(d0, d1, v2.D(), 0), "fmla d0, d1, v2.d[0]");
4619 COMPARE(Fmla(s0, s1, v2.S(), 0), "fmla s0, s1, v2.s[0]");
4620
4621 COMPARE(Fmls(v0.V2S(), v1.V2S(), v2.S(), 0), "fmls v0.2s, v1.2s, v2.s[0]");
4622 COMPARE(Fmls(v2.V4S(), v3.V4S(), v15.S(), 3), "fmls v2.4s, v3.4s, v15.s[3]");
4623 COMPARE(Fmls(v0.V2D(), v1.V2D(), v2.D(), 0), "fmls v0.2d, v1.2d, v2.d[0]");
4624 COMPARE(Fmls(d0, d1, v2.D(), 0), "fmls d0, d1, v2.d[0]");
4625 COMPARE(Fmls(s0, s1, v2.S(), 0), "fmls s0, s1, v2.s[0]");
4626
4627 COMPARE(Fmulx(v0.V2S(), v1.V2S(), v2.S(), 0), "fmulx v0.2s, v1.2s, v2.s[0]");
4628 COMPARE(Fmulx(v2.V4S(), v3.V4S(), v8.S(), 3), "fmulx v2.4s, v3.4s, v8.s[3]");
4629 COMPARE(Fmulx(v0.V2D(), v1.V2D(), v2.D(), 0), "fmulx v0.2d, v1.2d, v2.d[0]");
4630 COMPARE(Fmulx(d0, d1, v2.D(), 0), "fmulx d0, d1, v2.d[0]");
4631 COMPARE(Fmulx(s0, s1, v2.S(), 0), "fmulx s0, s1, v2.s[0]");
4632
4633 CLEANUP();
4634}
4635
4636
4637TEST(neon_3different) {
armvixl684cd2a2015-10-23 13:38:33 +01004638 SETUP_MACRO();
armvixl5289c592015-03-02 13:52:04 +00004639
4640 #define DISASM_INST(TA, TAS, TB, TBS) \
4641 COMPARE(Uaddl(v0.TA, v1.TB, v2.TB), "uaddl v0." TAS ", v1." TBS ", v2." TBS);
4642 NEON_FORMAT_LIST_LW(DISASM_INST)
4643 #undef DISASM_INST
4644
4645 #define DISASM_INST(TA, TAS, TB, TBS) \
4646 COMPARE(Uaddl2(v0.TA, v1.TB, v2.TB), \
4647 "uaddl2 v0." TAS ", v1." TBS ", v2." TBS);
4648 NEON_FORMAT_LIST_LW2(DISASM_INST)
4649 #undef DISASM_INST
4650
4651 #define DISASM_INST(TA, TAS, TB, TBS) \
4652 COMPARE(Uaddw(v0.TA, v1.TA, v2.TB), "uaddw v0." TAS ", v1." TAS ", v2." TBS);
4653 NEON_FORMAT_LIST_LW(DISASM_INST)
4654 #undef DISASM_INST
4655
4656 #define DISASM_INST(TA, TAS, TB, TBS) \
4657 COMPARE(Uaddw2(v0.TA, v1.TA, v2.TB), \
4658 "uaddw2 v0." TAS ", v1." TAS ", v2." TBS);
4659 NEON_FORMAT_LIST_LW2(DISASM_INST)
4660 #undef DISASM_INST
4661
4662 #define DISASM_INST(TA, TAS, TB, TBS) \
4663 COMPARE(Saddl(v0.TA, v1.TB, v2.TB), "saddl v0." TAS ", v1." TBS ", v2." TBS);
4664 NEON_FORMAT_LIST_LW(DISASM_INST)
4665 #undef DISASM_INST
4666
4667 #define DISASM_INST(TA, TAS, TB, TBS) \
4668 COMPARE(Saddl2(v0.TA, v1.TB, v2.TB), \
4669 "saddl2 v0." TAS ", v1." TBS ", v2." TBS);
4670 NEON_FORMAT_LIST_LW2(DISASM_INST)
4671 #undef DISASM_INST
4672
4673 #define DISASM_INST(TA, TAS, TB, TBS) \
4674 COMPARE(Saddw(v0.TA, v1.TA, v2.TB), "saddw v0." TAS ", v1." TAS ", v2." TBS);
4675 NEON_FORMAT_LIST_LW(DISASM_INST)
4676 #undef DISASM_INST
4677
4678 #define DISASM_INST(TA, TAS, TB, TBS) \
4679 COMPARE(Saddw2(v0.TA, v1.TA, v2.TB), \
4680 "saddw2 v0." TAS ", v1." TAS ", v2." TBS);
4681 NEON_FORMAT_LIST_LW2(DISASM_INST)
4682 #undef DISASM_INST
4683
4684 #define DISASM_INST(TA, TAS, TB, TBS) \
4685 COMPARE(Usubl(v0.TA, v1.TB, v2.TB), "usubl v0." TAS ", v1." TBS ", v2." TBS);
4686 NEON_FORMAT_LIST_LW(DISASM_INST)
4687 #undef DISASM_INST
4688
4689 #define DISASM_INST(TA, TAS, TB, TBS) \
4690 COMPARE(Usubl2(v0.TA, v1.TB, v2.TB), \
4691 "usubl2 v0." TAS ", v1." TBS ", v2." TBS);
4692 NEON_FORMAT_LIST_LW2(DISASM_INST)
4693 #undef DISASM_INST
4694
4695 #define DISASM_INST(TA, TAS, TB, TBS) \
4696 COMPARE(Usubw(v0.TA, v1.TA, v2.TB), "usubw v0." TAS ", v1." TAS ", v2." TBS);
4697 NEON_FORMAT_LIST_LW(DISASM_INST)
4698 #undef DISASM_INST
4699
4700 #define DISASM_INST(TA, TAS, TB, TBS) \
4701 COMPARE(Usubw2(v0.TA, v1.TA, v2.TB), \
4702 "usubw2 v0." TAS ", v1." TAS ", v2." TBS);
4703 NEON_FORMAT_LIST_LW2(DISASM_INST)
4704 #undef DISASM_INST
4705
4706 #define DISASM_INST(TA, TAS, TB, TBS) \
4707 COMPARE(Ssubl(v0.TA, v1.TB, v2.TB), "ssubl v0." TAS ", v1." TBS ", v2." TBS);
4708 NEON_FORMAT_LIST_LW(DISASM_INST)
4709 #undef DISASM_INST
4710
4711 #define DISASM_INST(TA, TAS, TB, TBS) \
4712 COMPARE(Ssubl2(v0.TA, v1.TB, v2.TB), \
4713 "ssubl2 v0." TAS ", v1." TBS ", v2." TBS);
4714 NEON_FORMAT_LIST_LW2(DISASM_INST)
4715 #undef DISASM_INST
4716
4717 #define DISASM_INST(TA, TAS, TB, TBS) \
4718 COMPARE(Ssubw(v0.TA, v1.TA, v2.TB), "ssubw v0." TAS ", v1." TAS ", v2." TBS);
4719 NEON_FORMAT_LIST_LW(DISASM_INST)
4720 #undef DISASM_INST
4721
4722 #define DISASM_INST(TA, TAS, TB, TBS) \
4723 COMPARE(Ssubw2(v0.TA, v1.TA, v2.TB), \
4724 "ssubw2 v0." TAS ", v1." TAS ", v2." TBS);
4725 NEON_FORMAT_LIST_LW2(DISASM_INST)
4726 #undef DISASM_INST
4727
4728 #define DISASM_INST(TA, TAS, TB, TBS) \
4729 COMPARE(Sabal(v0.TA, v1.TB, v2.TB), "sabal v0." TAS ", v1." TBS ", v2." TBS);
4730 NEON_FORMAT_LIST_LW(DISASM_INST)
4731 #undef DISASM_INST
4732
4733 #define DISASM_INST(TA, TAS, TB, TBS) \
4734 COMPARE(Sabal2(v0.TA, v1.TB, v2.TB), \
4735 "sabal2 v0." TAS ", v1." TBS ", v2." TBS);
4736 NEON_FORMAT_LIST_LW2(DISASM_INST)
4737 #undef DISASM_INST
4738
4739 #define DISASM_INST(TA, TAS, TB, TBS) \
4740 COMPARE(Uabal(v0.TA, v1.TB, v2.TB), "uabal v0." TAS ", v1." TBS ", v2." TBS);
4741 NEON_FORMAT_LIST_LW(DISASM_INST)
4742 #undef DISASM_INST
4743
4744 #define DISASM_INST(TA, TAS, TB, TBS) \
4745 COMPARE(Uabal2(v0.TA, v1.TB, v2.TB), \
4746 "uabal2 v0." TAS ", v1." TBS ", v2." TBS);
4747 NEON_FORMAT_LIST_LW2(DISASM_INST)
4748 #undef DISASM_INST
4749
4750 #define DISASM_INST(TA, TAS, TB, TBS) \
4751 COMPARE(Sabdl(v0.TA, v1.TB, v2.TB), "sabdl v0." TAS ", v1." TBS ", v2." TBS);
4752 NEON_FORMAT_LIST_LW(DISASM_INST)
4753 #undef DISASM_INST
4754
4755 #define DISASM_INST(TA, TAS, TB, TBS) \
4756 COMPARE(Sabdl2(v0.TA, v1.TB, v2.TB), \
4757 "sabdl2 v0." TAS ", v1." TBS ", v2." TBS);
4758 NEON_FORMAT_LIST_LW2(DISASM_INST)
4759 #undef DISASM_INST
4760
4761 #define DISASM_INST(TA, TAS, TB, TBS) \
4762 COMPARE(Uabdl(v0.TA, v1.TB, v2.TB), "uabdl v0." TAS ", v1." TBS ", v2." TBS);
4763 NEON_FORMAT_LIST_LW(DISASM_INST)
4764 #undef DISASM_INST
4765
4766 #define DISASM_INST(TA, TAS, TB, TBS) \
4767 COMPARE(Uabdl2(v0.TA, v1.TB, v2.TB), \
4768 "uabdl2 v0." TAS ", v1." TBS ", v2." TBS);
4769 NEON_FORMAT_LIST_LW2(DISASM_INST)
4770 #undef DISASM_INST
4771
4772 #define DISASM_INST(TA, TAS, TB, TBS) \
4773 COMPARE(Smlal(v0.TA, v1.TB, v2.TB), "smlal v0." TAS ", v1." TBS ", v2." TBS);
4774 NEON_FORMAT_LIST_LW(DISASM_INST)
4775 #undef DISASM_INST
4776
4777 #define DISASM_INST(TA, TAS, TB, TBS) \
4778 COMPARE(Smlal2(v0.TA, v1.TB, v2.TB), \
4779 "smlal2 v0." TAS ", v1." TBS ", v2." TBS);
4780 NEON_FORMAT_LIST_LW2(DISASM_INST)
4781 #undef DISASM_INST
4782
4783 #define DISASM_INST(TA, TAS, TB, TBS) \
4784 COMPARE(Umlsl(v0.TA, v1.TB, v2.TB), "umlsl v0." TAS ", v1." TBS ", v2." TBS);
4785 NEON_FORMAT_LIST_LW(DISASM_INST)
4786 #undef DISASM_INST
4787
4788 #define DISASM_INST(TA, TAS, TB, TBS) \
4789 COMPARE(Umlsl2(v0.TA, v1.TB, v2.TB), \
4790 "umlsl2 v0." TAS ", v1." TBS ", v2." TBS);
4791 NEON_FORMAT_LIST_LW2(DISASM_INST)
4792 #undef DISASM_INST
4793
4794 #define DISASM_INST(TA, TAS, TB, TBS) \
4795 COMPARE(Smlsl(v0.TA, v1.TB, v2.TB), "smlsl v0." TAS ", v1." TBS ", v2." TBS);
4796 NEON_FORMAT_LIST_LW(DISASM_INST)
4797 #undef DISASM_INST
4798
4799 #define DISASM_INST(TA, TAS, TB, TBS) \
4800 COMPARE(Smlsl2(v0.TA, v1.TB, v2.TB), \
4801 "smlsl2 v0." TAS ", v1." TBS ", v2." TBS);
4802 NEON_FORMAT_LIST_LW2(DISASM_INST)
4803 #undef DISASM_INST
4804
4805 #define DISASM_INST(TA, TAS, TB, TBS) \
4806 COMPARE(Umlsl(v0.TA, v1.TB, v2.TB), "umlsl v0." TAS ", v1." TBS ", v2." TBS);
4807 NEON_FORMAT_LIST_LW(DISASM_INST)
4808 #undef DISASM_INST
4809
4810 #define DISASM_INST(TA, TAS, TB, TBS) \
4811 COMPARE(Umlsl2(v0.TA, v1.TB, v2.TB), \
4812 "umlsl2 v0." TAS ", v1." TBS ", v2." TBS);
4813 NEON_FORMAT_LIST_LW2(DISASM_INST)
4814 #undef DISASM_INST
4815
4816 #define DISASM_INST(TA, TAS, TB, TBS) \
4817 COMPARE(Smull(v0.TA, v1.TB, v2.TB), "smull v0." TAS ", v1." TBS ", v2." TBS);
4818 NEON_FORMAT_LIST_LW(DISASM_INST)
4819 #undef DISASM_INST
4820
4821 #define DISASM_INST(TA, TAS, TB, TBS) \
4822 COMPARE(Smull2(v0.TA, v1.TB, v2.TB), \
4823 "smull2 v0." TAS ", v1." TBS ", v2." TBS);
4824 NEON_FORMAT_LIST_LW2(DISASM_INST)
4825 #undef DISASM_INST
4826
4827 #define DISASM_INST(TA, TAS, TB, TBS) \
4828 COMPARE(Umull(v0.TA, v1.TB, v2.TB), "umull v0." TAS ", v1." TBS ", v2." TBS);
4829 NEON_FORMAT_LIST_LW(DISASM_INST)
4830 #undef DISASM_INST
4831
4832 #define DISASM_INST(TA, TAS, TB, TBS) \
4833 COMPARE(Umull2(v0.TA, v1.TB, v2.TB), \
4834 "umull2 v0." TAS ", v1." TBS ", v2." TBS);
4835 NEON_FORMAT_LIST_LW2(DISASM_INST)
4836 #undef DISASM_INST
4837
4838 COMPARE(Sqdmull(v0.V4S(), v1.V4H(), v2.V4H()), "sqdmull v0.4s, v1.4h, v2.4h");
4839 COMPARE(Sqdmull(v1.V2D(), v2.V2S(), v3.V2S()), "sqdmull v1.2d, v2.2s, v3.2s");
4840 COMPARE(Sqdmull2(v2.V4S(), v3.V8H(), v4.V8H()),
4841 "sqdmull2 v2.4s, v3.8h, v4.8h");
4842 COMPARE(Sqdmull2(v3.V2D(), v4.V4S(), v5.V4S()),
4843 "sqdmull2 v3.2d, v4.4s, v5.4s");
4844 COMPARE(Sqdmull(s0, h1, h2), "sqdmull s0, h1, h2");
4845 COMPARE(Sqdmull(d1, s2, s3), "sqdmull d1, s2, s3");
4846
4847 COMPARE(Sqdmlal(v0.V4S(), v1.V4H(), v2.V4H()), "sqdmlal v0.4s, v1.4h, v2.4h");
4848 COMPARE(Sqdmlal(v1.V2D(), v2.V2S(), v3.V2S()), "sqdmlal v1.2d, v2.2s, v3.2s");
4849 COMPARE(Sqdmlal2(v2.V4S(), v3.V8H(), v4.V8H()),
4850 "sqdmlal2 v2.4s, v3.8h, v4.8h");
4851 COMPARE(Sqdmlal2(v3.V2D(), v4.V4S(), v5.V4S()),
4852 "sqdmlal2 v3.2d, v4.4s, v5.4s");
4853 COMPARE(Sqdmlal(s0, h1, h2), "sqdmlal s0, h1, h2");
4854 COMPARE(Sqdmlal(d1, s2, s3), "sqdmlal d1, s2, s3");
4855
4856 COMPARE(Sqdmlsl(v0.V4S(), v1.V4H(), v2.V4H()), "sqdmlsl v0.4s, v1.4h, v2.4h");
4857 COMPARE(Sqdmlsl(v1.V2D(), v2.V2S(), v3.V2S()), "sqdmlsl v1.2d, v2.2s, v3.2s");
4858 COMPARE(Sqdmlsl2(v2.V4S(), v3.V8H(), v4.V8H()),
4859 "sqdmlsl2 v2.4s, v3.8h, v4.8h");
4860 COMPARE(Sqdmlsl2(v3.V2D(), v4.V4S(), v5.V4S()),
4861 "sqdmlsl2 v3.2d, v4.4s, v5.4s");
4862 COMPARE(Sqdmlsl(s0, h1, h2), "sqdmlsl s0, h1, h2");
4863 COMPARE(Sqdmlsl(d1, s2, s3), "sqdmlsl d1, s2, s3");
4864
4865 COMPARE(Addhn(v0.V8B(), v1.V8H(), v2.V8H()), "addhn v0.8b, v1.8h, v2.8h");
4866 COMPARE(Addhn(v1.V4H(), v2.V4S(), v3.V4S()), "addhn v1.4h, v2.4s, v3.4s");
4867 COMPARE(Addhn(v2.V2S(), v3.V2D(), v4.V2D()), "addhn v2.2s, v3.2d, v4.2d");
4868 COMPARE(Addhn2(v0.V16B(), v1.V8H(), v5.V8H()), "addhn2 v0.16b, v1.8h, v5.8h");
4869 COMPARE(Addhn2(v1.V8H(), v2.V4S(), v6.V4S()), "addhn2 v1.8h, v2.4s, v6.4s");
4870 COMPARE(Addhn2(v2.V4S(), v3.V2D(), v7.V2D()), "addhn2 v2.4s, v3.2d, v7.2d");
4871
4872 COMPARE(Raddhn(v0.V8B(), v1.V8H(), v2.V8H()), "raddhn v0.8b, v1.8h, v2.8h");
4873 COMPARE(Raddhn(v1.V4H(), v2.V4S(), v3.V4S()), "raddhn v1.4h, v2.4s, v3.4s");
4874 COMPARE(Raddhn(v2.V2S(), v3.V2D(), v4.V2D()), "raddhn v2.2s, v3.2d, v4.2d");
4875 COMPARE(Raddhn2(v0.V16B(), v1.V8H(), v5.V8H()),
4876 "raddhn2 v0.16b, v1.8h, v5.8h");
4877 COMPARE(Raddhn2(v1.V8H(), v2.V4S(), v6.V4S()), "raddhn2 v1.8h, v2.4s, v6.4s");
4878 COMPARE(Raddhn2(v2.V4S(), v3.V2D(), v7.V2D()), "raddhn2 v2.4s, v3.2d, v7.2d");
4879
4880 COMPARE(Subhn(v1.V4H(), v2.V4S(), v3.V4S()), "subhn v1.4h, v2.4s, v3.4s");
4881 COMPARE(Subhn(v2.V2S(), v3.V2D(), v4.V2D()), "subhn v2.2s, v3.2d, v4.2d");
4882 COMPARE(Subhn2(v0.V16B(), v1.V8H(), v5.V8H()), "subhn2 v0.16b, v1.8h, v5.8h");
4883 COMPARE(Subhn2(v1.V8H(), v2.V4S(), v6.V4S()), "subhn2 v1.8h, v2.4s, v6.4s");
4884 COMPARE(Subhn2(v2.V4S(), v3.V2D(), v7.V2D()), "subhn2 v2.4s, v3.2d, v7.2d");
4885
4886 COMPARE(Rsubhn(v0.V8B(), v1.V8H(), v2.V8H()), "rsubhn v0.8b, v1.8h, v2.8h");
4887 COMPARE(Rsubhn(v1.V4H(), v2.V4S(), v3.V4S()), "rsubhn v1.4h, v2.4s, v3.4s");
4888 COMPARE(Rsubhn(v2.V2S(), v3.V2D(), v4.V2D()), "rsubhn v2.2s, v3.2d, v4.2d");
4889 COMPARE(Rsubhn2(v0.V16B(), v1.V8H(), v5.V8H()),
4890 "rsubhn2 v0.16b, v1.8h, v5.8h");
4891 COMPARE(Rsubhn2(v1.V8H(), v2.V4S(), v6.V4S()), "rsubhn2 v1.8h, v2.4s, v6.4s");
4892 COMPARE(Rsubhn2(v2.V4S(), v3.V2D(), v7.V2D()), "rsubhn2 v2.4s, v3.2d, v7.2d");
4893
4894 COMPARE(Pmull(v0.V8H(), v1.V8B(), v2.V8B()), "pmull v0.8h, v1.8b, v2.8b");
4895 COMPARE(Pmull2(v2.V8H(), v3.V16B(), v4.V16B()),
4896 "pmull2 v2.8h, v3.16b, v4.16b");
4897
4898 CLEANUP();
4899}
4900
4901
4902TEST(neon_perm) {
armvixl684cd2a2015-10-23 13:38:33 +01004903 SETUP_MACRO();
armvixl5289c592015-03-02 13:52:04 +00004904
4905 #define DISASM_INST(M, S) \
4906 COMPARE(Trn1(v0.M, v1.M, v2.M), "trn1 v0." S ", v1." S ", v2." S);
4907 NEON_FORMAT_LIST(DISASM_INST)
4908 #undef DISASM_INST
4909
4910 #define DISASM_INST(M, S) \
4911 COMPARE(Trn2(v0.M, v1.M, v2.M), "trn2 v0." S ", v1." S ", v2." S);
4912 NEON_FORMAT_LIST(DISASM_INST)
4913 #undef DISASM_INST
4914
4915 #define DISASM_INST(M, S) \
4916 COMPARE(Uzp1(v0.M, v1.M, v2.M), "uzp1 v0." S ", v1." S ", v2." S);
4917 NEON_FORMAT_LIST(DISASM_INST)
4918 #undef DISASM_INST
4919
4920 #define DISASM_INST(M, S) \
4921 COMPARE(Uzp2(v0.M, v1.M, v2.M), "uzp2 v0." S ", v1." S ", v2." S);
4922 NEON_FORMAT_LIST(DISASM_INST)
4923 #undef DISASM_INST
4924
4925 #define DISASM_INST(M, S) \
4926 COMPARE(Zip1(v0.M, v1.M, v2.M), "zip1 v0." S ", v1." S ", v2." S);
4927 NEON_FORMAT_LIST(DISASM_INST)
4928 #undef DISASM_INST
4929
4930 #define DISASM_INST(M, S) \
4931 COMPARE(Zip2(v0.M, v1.M, v2.M), "zip2 v0." S ", v1." S ", v2." S);
4932 NEON_FORMAT_LIST(DISASM_INST)
4933 #undef DISASM_INST
4934
4935 CLEANUP();
4936}
4937
4938
4939TEST(neon_copy) {
armvixl684cd2a2015-10-23 13:38:33 +01004940 SETUP_MACRO();
armvixl5289c592015-03-02 13:52:04 +00004941
4942 COMPARE(Ins(v1.V16B(), 4, v5.V16B(), 0), "mov v1.b[4], v5.b[0]");
4943 COMPARE(Ins(v2.V8B(), 5, v6.V8B(), 1), "mov v2.b[5], v6.b[1]");
4944 COMPARE(Ins(v3.B(), 6, v7.B(), 2), "mov v3.b[6], v7.b[2]");
4945 COMPARE(Ins(v4.V8H(), 7, v8.V8H(), 3), "mov v4.h[7], v8.h[3]");
4946 COMPARE(Ins(v5.V4H(), 3, v9.V4H(), 0), "mov v5.h[3], v9.h[0]");
4947 COMPARE(Ins(v6.H(), 6, v1.H(), 1), "mov v6.h[6], v1.h[1]");
4948 COMPARE(Ins(v7.V4S(), 2, v2.V4S(), 2), "mov v7.s[2], v2.s[2]");
4949 COMPARE(Ins(v8.V2S(), 1, v3.V2S(), 0), "mov v8.s[1], v3.s[0]");
4950 COMPARE(Ins(v9.S(), 0, v4.S(), 1), "mov v9.s[0], v4.s[1]");
4951 COMPARE(Ins(v1.V2D(), 1, v5.V2D(), 0), "mov v1.d[1], v5.d[0]");
4952 COMPARE(Ins(v2.D(), 0, v6.D(), 1), "mov v2.d[0], v6.d[1]");
4953
4954 COMPARE(Mov(v3.V16B(), 4, v7.V16B(), 0), "mov v3.b[4], v7.b[0]");
4955 COMPARE(Mov(v4.V8B(), 5, v8.V8B(), 1), "mov v4.b[5], v8.b[1]");
4956 COMPARE(Mov(v5.B(), 6, v9.B(), 2), "mov v5.b[6], v9.b[2]");
4957 COMPARE(Mov(v6.V8H(), 7, v1.V8H(), 3), "mov v6.h[7], v1.h[3]");
4958 COMPARE(Mov(v7.V4H(), 0, v2.V4H(), 0), "mov v7.h[0], v2.h[0]");
4959 COMPARE(Mov(v8.H(), 1, v3.H(), 1), "mov v8.h[1], v3.h[1]");
4960 COMPARE(Mov(v9.V4S(), 2, v4.V4S(), 2), "mov v9.s[2], v4.s[2]");
4961 COMPARE(Mov(v1.V2S(), 3, v5.V2S(), 0), "mov v1.s[3], v5.s[0]");
4962 COMPARE(Mov(v2.S(), 0, v6.S(), 1), "mov v2.s[0], v6.s[1]");
4963 COMPARE(Mov(v3.V2D(), 1, v7.V2D(), 0), "mov v3.d[1], v7.d[0]");
4964 COMPARE(Mov(v4.D(), 0, v8.D(), 1), "mov v4.d[0], v8.d[1]");
4965
4966 COMPARE(Ins(v1.V16B(), 4, w0), "mov v1.b[4], w0");
4967 COMPARE(Ins(v2.V8B(), 5, w1), "mov v2.b[5], w1");
4968 COMPARE(Ins(v3.B(), 6, w2), "mov v3.b[6], w2");
4969 COMPARE(Ins(v4.V8H(), 7, w3), "mov v4.h[7], w3");
4970 COMPARE(Ins(v5.V4H(), 3, w0), "mov v5.h[3], w0");
4971 COMPARE(Ins(v6.H(), 6, w1), "mov v6.h[6], w1");
4972 COMPARE(Ins(v7.V4S(), 2, w2), "mov v7.s[2], w2");
4973 COMPARE(Ins(v8.V2S(), 1, w0), "mov v8.s[1], w0");
4974 COMPARE(Ins(v9.S(), 0, w1), "mov v9.s[0], w1");
4975 COMPARE(Ins(v1.V2D(), 1, x0), "mov v1.d[1], x0");
4976 COMPARE(Ins(v2.D(), 0, x1), "mov v2.d[0], x1");
4977
4978 COMPARE(Mov(v1.V16B(), 4, w0), "mov v1.b[4], w0");
4979 COMPARE(Mov(v2.V8B(), 5, w1), "mov v2.b[5], w1");
4980 COMPARE(Mov(v3.B(), 6, w2), "mov v3.b[6], w2");
4981 COMPARE(Mov(v4.V8H(), 7, w3), "mov v4.h[7], w3");
4982 COMPARE(Mov(v5.V4H(), 3, w0), "mov v5.h[3], w0");
4983 COMPARE(Mov(v6.H(), 6, w1), "mov v6.h[6], w1");
4984 COMPARE(Mov(v7.V4S(), 2, w2), "mov v7.s[2], w2");
4985 COMPARE(Mov(v8.V2S(), 1, w0), "mov v8.s[1], w0");
4986 COMPARE(Mov(v9.S(), 0, w1), "mov v9.s[0], w1");
4987 COMPARE(Mov(v1.V2D(), 1, x0), "mov v1.d[1], x0");
4988 COMPARE(Mov(v2.D(), 0, x1), "mov v2.d[0], x1");
4989
4990 COMPARE(Dup(v5.V8B(), v9.V8B(), 6), "dup v5.8b, v9.b[6]");
4991 COMPARE(Dup(v6.V16B(), v1.V16B(), 5), "dup v6.16b, v1.b[5]");
4992 COMPARE(Dup(v7.V4H(), v2.V4H(), 4), "dup v7.4h, v2.h[4]");
4993 COMPARE(Dup(v8.V8H(), v3.V8H(), 3), "dup v8.8h, v3.h[3]");
4994 COMPARE(Dup(v9.V2S(), v4.V2S(), 2), "dup v9.2s, v4.s[2]");
4995 COMPARE(Dup(v1.V4S(), v5.V4S(), 1), "dup v1.4s, v5.s[1]");
4996 COMPARE(Dup(v2.V2D(), v6.V2D(), 0), "dup v2.2d, v6.d[0]");
4997
4998 COMPARE(Dup(v5.B(), v9.B(), 6), "mov b5, v9.b[6]");
4999 COMPARE(Dup(v7.H(), v2.H(), 4), "mov h7, v2.h[4]");
5000 COMPARE(Dup(v9.S(), v4.S(), 2), "mov s9, v4.s[2]");
5001 COMPARE(Dup(v2.D(), v6.D(), 0), "mov d2, v6.d[0]");
5002
5003 COMPARE(Mov(v5.B(), v9.B(), 6), "mov b5, v9.b[6]");
5004 COMPARE(Mov(v7.H(), v2.H(), 4), "mov h7, v2.h[4]");
5005 COMPARE(Mov(v9.S(), v4.S(), 2), "mov s9, v4.s[2]");
5006 COMPARE(Mov(v2.D(), v6.D(), 0), "mov d2, v6.d[0]");
5007
5008 COMPARE(Dup(v5.V8B(), w0), "dup v5.8b, w0");
5009 COMPARE(Dup(v6.V16B(), w1), "dup v6.16b, w1");
5010 COMPARE(Dup(v7.V4H(), w2), "dup v7.4h, w2");
5011 COMPARE(Dup(v8.V8H(), w3), "dup v8.8h, w3");
5012 COMPARE(Dup(v9.V2S(), w4), "dup v9.2s, w4");
5013 COMPARE(Dup(v1.V4S(), w5), "dup v1.4s, w5");
5014 COMPARE(Dup(v2.V2D(), x6), "dup v2.2d, x6");
5015
5016 COMPARE(Smov(w0, v1.V16B(), 4), "smov w0, v1.b[4]");
5017 COMPARE(Smov(w1, v2.V8B(), 5), "smov w1, v2.b[5]");
5018 COMPARE(Smov(w2, v3.B(), 6), "smov w2, v3.b[6]");
5019 COMPARE(Smov(w3, v4.V8H(), 7), "smov w3, v4.h[7]");
5020 COMPARE(Smov(w0, v5.V4H(), 3), "smov w0, v5.h[3]");
5021 COMPARE(Smov(w1, v6.H(), 6), "smov w1, v6.h[6]");
5022
5023 COMPARE(Smov(x0, v1.V16B(), 4), "smov x0, v1.b[4]");
5024 COMPARE(Smov(x1, v2.V8B(), 5), "smov x1, v2.b[5]");
5025 COMPARE(Smov(x2, v3.B(), 6), "smov x2, v3.b[6]");
5026 COMPARE(Smov(x3, v4.V8H(), 7), "smov x3, v4.h[7]");
5027 COMPARE(Smov(x0, v5.V4H(), 3), "smov x0, v5.h[3]");
5028 COMPARE(Smov(x1, v6.H(), 6), "smov x1, v6.h[6]");
5029 COMPARE(Smov(x2, v7.V4S(), 2), "smov x2, v7.s[2]");
5030 COMPARE(Smov(x0, v8.V2S(), 1), "smov x0, v8.s[1]");
5031 COMPARE(Smov(x1, v9.S(), 0), "smov x1, v9.s[0]");
5032
5033 COMPARE(Umov(w0, v1.V16B(), 4), "umov w0, v1.b[4]");
5034 COMPARE(Umov(w1, v2.V8B(), 5), "umov w1, v2.b[5]");
5035 COMPARE(Umov(w2, v3.B(), 6), "umov w2, v3.b[6]");
5036 COMPARE(Umov(w3, v4.V8H(), 7), "umov w3, v4.h[7]");
5037 COMPARE(Umov(w0, v5.V4H(), 3), "umov w0, v5.h[3]");
5038 COMPARE(Umov(w1, v6.H(), 6), "umov w1, v6.h[6]");
5039 COMPARE(Umov(w2, v7.V4S(), 2), "mov w2, v7.s[2]");
5040 COMPARE(Umov(w0, v8.V2S(), 1), "mov w0, v8.s[1]");
5041 COMPARE(Umov(w1, v9.S(), 0), "mov w1, v9.s[0]");
5042 COMPARE(Umov(x0, v1.V2D(), 1), "mov x0, v1.d[1]");
5043 COMPARE(Umov(x1, v2.D(), 0), "mov x1, v2.d[0]");
5044
5045 COMPARE(Mov(w2, v7.V4S(), 2), "mov w2, v7.s[2]");
5046 COMPARE(Mov(w0, v8.V2S(), 1), "mov w0, v8.s[1]");
5047 COMPARE(Mov(w1, v9.S(), 0), "mov w1, v9.s[0]");
5048 COMPARE(Mov(x0, v1.V2D(), 1), "mov x0, v1.d[1]");
5049 COMPARE(Mov(x1, v2.D(), 0), "mov x1, v2.d[0]");
5050
5051 CLEANUP();
5052}
5053
5054
5055TEST(neon_extract) {
armvixl684cd2a2015-10-23 13:38:33 +01005056 SETUP_MACRO();
armvixl5289c592015-03-02 13:52:04 +00005057
5058 COMPARE(Ext(v4.V8B(), v5.V8B(), v6.V8B(), 0), "ext v4.8b, v5.8b, v6.8b, #0");
5059 COMPARE(Ext(v1.V8B(), v2.V8B(), v3.V8B(), 7), "ext v1.8b, v2.8b, v3.8b, #7");
5060 COMPARE(Ext(v1.V16B(), v2.V16B(), v3.V16B(), 0),
5061 "ext v1.16b, v2.16b, v3.16b, #0");
5062 COMPARE(Ext(v1.V16B(), v2.V16B(), v3.V16B(), 15),
5063 "ext v1.16b, v2.16b, v3.16b, #15");
5064
5065 CLEANUP();
5066}
5067
5068
5069TEST(neon_modimm) {
armvixl684cd2a2015-10-23 13:38:33 +01005070 SETUP_MACRO();
armvixl5289c592015-03-02 13:52:04 +00005071
5072 COMPARE(Orr(v4.V4H(), 0xaa, 0), "orr v4.4h, #0xaa, lsl #0");
5073 COMPARE(Orr(v1.V8H(), 0xcc, 8), "orr v1.8h, #0xcc, lsl #8");
5074 COMPARE(Orr(v4.V2S(), 0xaa, 0), "orr v4.2s, #0xaa, lsl #0");
5075 COMPARE(Orr(v1.V2S(), 0xcc, 8), "orr v1.2s, #0xcc, lsl #8");
5076 COMPARE(Orr(v4.V4S(), 0xaa, 16), "orr v4.4s, #0xaa, lsl #16");
5077 COMPARE(Orr(v1.V4S(), 0xcc, 24), "orr v1.4s, #0xcc, lsl #24");
5078
5079 COMPARE(Bic(v4.V4H(), 0xaa, 0), "bic v4.4h, #0xaa, lsl #0");
5080 COMPARE(Bic(v1.V8H(), 0xcc, 8), "bic v1.8h, #0xcc, lsl #8");
5081 COMPARE(Bic(v4.V2S(), 0xaa, 0), "bic v4.2s, #0xaa, lsl #0");
5082 COMPARE(Bic(v1.V2S(), 0xcc, 8), "bic v1.2s, #0xcc, lsl #8");
5083 COMPARE(Bic(v4.V4S(), 0xaa, 16), "bic v4.4s, #0xaa, lsl #16");
5084 COMPARE(Bic(v1.V4S(), 0xcc, 24), "bic v1.4s, #0xcc, lsl #24");
5085
5086 COMPARE(Mvni(v4.V4H(), 0xaa, LSL, 0), "mvni v4.4h, #0xaa, lsl #0");
5087 COMPARE(Mvni(v1.V8H(), 0xcc, LSL, 8), "mvni v1.8h, #0xcc, lsl #8");
5088 COMPARE(Mvni(v4.V2S(), 0xaa, LSL, 0), "mvni v4.2s, #0xaa, lsl #0");
5089 COMPARE(Mvni(v1.V2S(), 0xcc, LSL, 8), "mvni v1.2s, #0xcc, lsl #8");
5090 COMPARE(Mvni(v4.V4S(), 0xaa, LSL, 16), "mvni v4.4s, #0xaa, lsl #16");
5091 COMPARE(Mvni(v1.V4S(), 0xcc, LSL, 24), "mvni v1.4s, #0xcc, lsl #24");
5092
5093 COMPARE(Mvni(v4.V2S(), 0xaa, MSL, 8), "mvni v4.2s, #0xaa, msl #8");
5094 COMPARE(Mvni(v1.V2S(), 0xcc, MSL, 16), "mvni v1.2s, #0xcc, msl #16");
5095 COMPARE(Mvni(v4.V4S(), 0xaa, MSL, 8), "mvni v4.4s, #0xaa, msl #8");
5096 COMPARE(Mvni(v1.V4S(), 0xcc, MSL, 16), "mvni v1.4s, #0xcc, msl #16");
5097
5098 COMPARE(Movi(v4.V8B(), 0xaa), "movi v4.8b, #0xaa");
5099 COMPARE(Movi(v1.V16B(), 0xcc), "movi v1.16b, #0xcc");
5100
5101 COMPARE(Movi(v4.V4H(), 0xaa, LSL, 0), "movi v4.4h, #0xaa, lsl #0");
5102 COMPARE(Movi(v1.V8H(), 0xcc, LSL, 8), "movi v1.8h, #0xcc, lsl #8");
5103
5104 COMPARE(Movi(v4.V2S(), 0xaa, LSL, 0), "movi v4.2s, #0xaa, lsl #0");
5105 COMPARE(Movi(v1.V2S(), 0xcc, LSL, 8), "movi v1.2s, #0xcc, lsl #8");
5106 COMPARE(Movi(v4.V4S(), 0xaa, LSL, 16), "movi v4.4s, #0xaa, lsl #16");
5107 COMPARE(Movi(v1.V4S(), 0xcc, LSL, 24), "movi v1.4s, #0xcc, lsl #24");
5108
5109 COMPARE(Movi(v4.V2S(), 0xaa, MSL, 8), "movi v4.2s, #0xaa, msl #8");
5110 COMPARE(Movi(v1.V2S(), 0xcc, MSL, 16), "movi v1.2s, #0xcc, msl #16");
5111 COMPARE(Movi(v4.V4S(), 0xaa, MSL, 8), "movi v4.4s, #0xaa, msl #8");
5112 COMPARE(Movi(v1.V4S(), 0xcc, MSL, 16), "movi v1.4s, #0xcc, msl #16");
5113
5114 COMPARE(Movi(d2, 0xffff0000ffffff), "movi d2, #0xffff0000ffffff");
5115 COMPARE(Movi(v1.V2D(), 0xffff0000ffffff), "movi v1.2d, #0xffff0000ffffff");
5116
5117 COMPARE(Fmov(v0.V2S(), 1.0f), "fmov v0.2s, #0x70 (1.0000)");
5118 COMPARE(Fmov(v31.V2S(), -13.0f), "fmov v31.2s, #0xaa (-13.0000)");
5119 COMPARE(Fmov(v0.V4S(), 1.0f), "fmov v0.4s, #0x70 (1.0000)");
5120 COMPARE(Fmov(v31.V4S(), -13.0f), "fmov v31.4s, #0xaa (-13.0000)");
5121 COMPARE(Fmov(v1.V2D(), 1.0), "fmov v1.2d, #0x70 (1.0000)");
5122 COMPARE(Fmov(v29.V2D(), -13.0), "fmov v29.2d, #0xaa (-13.0000)");
5123
armvixl0f35e362016-05-10 13:57:58 +01005124 // An unallocated form of fmov.
5125 COMPARE(dci(0x2f07ffff), "unallocated (NEONModifiedImmediate)");
5126
armvixl5289c592015-03-02 13:52:04 +00005127 CLEANUP();
5128}
5129
5130
5131TEST(neon_2regmisc) {
armvixl684cd2a2015-10-23 13:38:33 +01005132 SETUP_MACRO();
armvixl5289c592015-03-02 13:52:04 +00005133
5134 COMPARE(Shll(v1.V8H(), v8.V8B(), 8), "shll v1.8h, v8.8b, #8");
5135 COMPARE(Shll(v3.V4S(), v1.V4H(), 16), "shll v3.4s, v1.4h, #16");
5136 COMPARE(Shll(v5.V2D(), v3.V2S(), 32), "shll v5.2d, v3.2s, #32");
5137 COMPARE(Shll2(v2.V8H(), v9.V16B(), 8), "shll2 v2.8h, v9.16b, #8");
5138 COMPARE(Shll2(v4.V4S(), v2.V8H(), 16), "shll2 v4.4s, v2.8h, #16");
5139 COMPARE(Shll2(v6.V2D(), v4.V4S(), 32), "shll2 v6.2d, v4.4s, #32");
5140
armvixl0f35e362016-05-10 13:57:58 +01005141 // An unallocated form of shll.
5142 COMPARE(dci(0x2ee13bff), "unallocated (NEON2RegMisc)");
5143 // An unallocated form of shll2.
5144 COMPARE(dci(0x6ee13bff), "unallocated (NEON2RegMisc)");
5145
armvixl5289c592015-03-02 13:52:04 +00005146 #define DISASM_INST(M, S) \
5147 COMPARE(Cmeq(v0.M, v1.M, 0), "cmeq v0." S ", v1." S ", #0");
5148 NEON_FORMAT_LIST(DISASM_INST)
5149 #undef DISASM_INST
5150
5151 #define DISASM_INST(M, S) \
5152 COMPARE(Cmge(v0.M, v1.M, 0), "cmge v0." S ", v1." S ", #0");
5153 NEON_FORMAT_LIST(DISASM_INST)
5154 #undef DISASM_INST
5155
5156 #define DISASM_INST(M, S) \
5157 COMPARE(Cmgt(v0.M, v1.M, 0), "cmgt v0." S ", v1." S ", #0");
5158 NEON_FORMAT_LIST(DISASM_INST)
5159 #undef DISASM_INST
5160
5161 #define DISASM_INST(M, S) \
5162 COMPARE(Cmle(v0.M, v1.M, 0), "cmle v0." S ", v1." S ", #0");
5163 NEON_FORMAT_LIST(DISASM_INST)
5164 #undef DISASM_INST
5165
5166 #define DISASM_INST(M, S) \
5167 COMPARE(Cmlt(v0.M, v1.M, 0), "cmlt v0." S ", v1." S ", #0");
5168 NEON_FORMAT_LIST(DISASM_INST)
5169 #undef DISASM_INST
5170
5171 COMPARE(Cmeq(v0.D(), v1.D(), 0), "cmeq d0, d1, #0");
5172 COMPARE(Cmge(v3.D(), v4.D(), 0), "cmge d3, d4, #0");
5173 COMPARE(Cmgt(v6.D(), v7.D(), 0), "cmgt d6, d7, #0");
5174 COMPARE(Cmle(v0.D(), v1.D(), 0), "cmle d0, d1, #0");
5175 COMPARE(Cmlt(v3.D(), v4.D(), 0), "cmlt d3, d4, #0");
5176
5177 #define DISASM_INST(M, S) \
5178 COMPARE(Fcmeq(v0.M, v1.M, 0), "fcmeq v0." S ", v1." S ", #0.0");
5179 NEON_FORMAT_LIST_FP(DISASM_INST)
5180 #undef DISASM_INST
5181
5182 COMPARE(Fcmeq(v0.S(), v1.S(), 0), "fcmeq s0, s1, #0.0");
5183 COMPARE(Fcmeq(v0.D(), v1.D(), 0), "fcmeq d0, d1, #0.0");
5184
5185 #define DISASM_INST(M, S) \
5186 COMPARE(Fcmge(v0.M, v1.M, 0), "fcmge v0." S ", v1." S ", #0.0");
5187 NEON_FORMAT_LIST_FP(DISASM_INST)
5188 #undef DISASM_INST
5189
5190 COMPARE(Fcmge(v0.S(), v1.S(), 0), "fcmge s0, s1, #0.0");
5191 COMPARE(Fcmge(v0.D(), v1.D(), 0), "fcmge d0, d1, #0.0");
5192
5193 #define DISASM_INST(M, S) \
5194 COMPARE(Fcmgt(v0.M, v1.M, 0), "fcmgt v0." S ", v1." S ", #0.0");
5195 NEON_FORMAT_LIST_FP(DISASM_INST)
5196 #undef DISASM_INST
5197
5198 COMPARE(Fcmgt(v0.S(), v1.S(), 0), "fcmgt s0, s1, #0.0");
5199 COMPARE(Fcmgt(v0.D(), v1.D(), 0), "fcmgt d0, d1, #0.0");
5200
5201 #define DISASM_INST(M, S) \
5202 COMPARE(Fcmle(v0.M, v1.M, 0), "fcmle v0." S ", v1." S ", #0.0");
5203 NEON_FORMAT_LIST_FP(DISASM_INST)
5204 #undef DISASM_INST
5205
5206 COMPARE(Fcmle(v0.S(), v1.S(), 0), "fcmle s0, s1, #0.0");
5207 COMPARE(Fcmle(v0.D(), v1.D(), 0), "fcmle d0, d1, #0.0");
5208
5209 #define DISASM_INST(M, S) \
5210 COMPARE(Fcmlt(v0.M, v1.M, 0), "fcmlt v0." S ", v1." S ", #0.0");
5211 NEON_FORMAT_LIST_FP(DISASM_INST)
5212 #undef DISASM_INST
5213
5214 COMPARE(Fcmlt(v0.S(), v1.S(), 0), "fcmlt s0, s1, #0.0");
5215 COMPARE(Fcmlt(v0.D(), v1.D(), 0), "fcmlt d0, d1, #0.0");
5216
5217 #define DISASM_INST(M, S) \
5218 COMPARE(Neg(v0.M, v1.M), "neg v0." S ", v1." S);
5219 NEON_FORMAT_LIST(DISASM_INST)
5220 #undef DISASM_INST
5221
5222 COMPARE(Neg(v0.D(), v1.D()), "neg d0, d1");
5223
5224 #define DISASM_INST(M, S) \
5225 COMPARE(Sqneg(v0.M, v1.M), "sqneg v0." S ", v1." S);
5226 NEON_FORMAT_LIST(DISASM_INST)
5227 #undef DISASM_INST
5228
5229 COMPARE(Sqneg(b0, b1), "sqneg b0, b1");
5230 COMPARE(Sqneg(h1, h2), "sqneg h1, h2");
5231 COMPARE(Sqneg(s2, s3), "sqneg s2, s3");
5232 COMPARE(Sqneg(d3, d4), "sqneg d3, d4");
5233
5234 #define DISASM_INST(M, S) \
5235 COMPARE(Abs(v0.M, v1.M), "abs v0." S ", v1." S);
5236 NEON_FORMAT_LIST(DISASM_INST)
5237 #undef DISASM_INST
5238
5239 COMPARE(Abs(v0.D(), v1.D()), "abs d0, d1");
5240
5241 #define DISASM_INST(M, S) \
5242 COMPARE(Sqabs(v0.M, v1.M), "sqabs v0." S ", v1." S);
5243 NEON_FORMAT_LIST(DISASM_INST)
5244 #undef DISASM_INST
5245
5246 COMPARE(Sqabs(b0, b1), "sqabs b0, b1");
5247 COMPARE(Sqabs(h1, h2), "sqabs h1, h2");
5248 COMPARE(Sqabs(s2, s3), "sqabs s2, s3");
5249 COMPARE(Sqabs(d3, d4), "sqabs d3, d4");
5250
5251 #define DISASM_INST(M, S) \
5252 COMPARE(Suqadd(v0.M, v1.M), "suqadd v0." S ", v1." S);
5253 NEON_FORMAT_LIST(DISASM_INST)
5254 #undef DISASM_INST
5255
5256 COMPARE(Suqadd(b0, b1), "suqadd b0, b1");
5257 COMPARE(Suqadd(h1, h2), "suqadd h1, h2");
5258 COMPARE(Suqadd(s2, s3), "suqadd s2, s3");
5259 COMPARE(Suqadd(d3, d4), "suqadd d3, d4");
5260
5261 #define DISASM_INST(M, S) \
5262 COMPARE(Usqadd(v0.M, v1.M), "usqadd v0." S ", v1." S);
5263 NEON_FORMAT_LIST(DISASM_INST)
5264 #undef DISASM_INST
5265
5266 COMPARE(Usqadd(b0, b1), "usqadd b0, b1");
5267 COMPARE(Usqadd(h1, h2), "usqadd h1, h2");
5268 COMPARE(Usqadd(s2, s3), "usqadd s2, s3");
5269 COMPARE(Usqadd(d3, d4), "usqadd d3, d4");
5270
5271 COMPARE(Xtn(v0.V8B(), v1.V8H()), "xtn v0.8b, v1.8h");
5272 COMPARE(Xtn(v1.V4H(), v2.V4S()), "xtn v1.4h, v2.4s");
5273 COMPARE(Xtn(v2.V2S(), v3.V2D()), "xtn v2.2s, v3.2d");
5274 COMPARE(Xtn2(v0.V16B(), v1.V8H()), "xtn2 v0.16b, v1.8h");
5275 COMPARE(Xtn2(v1.V8H(), v2.V4S()), "xtn2 v1.8h, v2.4s");
5276 COMPARE(Xtn2(v2.V4S(), v3.V2D()), "xtn2 v2.4s, v3.2d");
5277
5278 COMPARE(Sqxtn(v0.V8B(), v1.V8H()), "sqxtn v0.8b, v1.8h");
5279 COMPARE(Sqxtn(v1.V4H(), v2.V4S()), "sqxtn v1.4h, v2.4s");
5280 COMPARE(Sqxtn(v2.V2S(), v3.V2D()), "sqxtn v2.2s, v3.2d");
5281 COMPARE(Sqxtn2(v0.V16B(), v1.V8H()), "sqxtn2 v0.16b, v1.8h");
5282 COMPARE(Sqxtn2(v1.V8H(), v2.V4S()), "sqxtn2 v1.8h, v2.4s");
5283 COMPARE(Sqxtn2(v2.V4S(), v3.V2D()), "sqxtn2 v2.4s, v3.2d");
5284 COMPARE(Sqxtn(b19, h0), "sqxtn b19, h0");
5285 COMPARE(Sqxtn(h20, s0), "sqxtn h20, s0") ;
5286 COMPARE(Sqxtn(s21, d0), "sqxtn s21, d0");
5287
5288 COMPARE(Uqxtn(v0.V8B(), v1.V8H()), "uqxtn v0.8b, v1.8h");
5289 COMPARE(Uqxtn(v1.V4H(), v2.V4S()), "uqxtn v1.4h, v2.4s");
5290 COMPARE(Uqxtn(v2.V2S(), v3.V2D()), "uqxtn v2.2s, v3.2d");
5291 COMPARE(Uqxtn2(v0.V16B(), v1.V8H()), "uqxtn2 v0.16b, v1.8h");
5292 COMPARE(Uqxtn2(v1.V8H(), v2.V4S()), "uqxtn2 v1.8h, v2.4s");
5293 COMPARE(Uqxtn2(v2.V4S(), v3.V2D()), "uqxtn2 v2.4s, v3.2d");
5294 COMPARE(Uqxtn(b19, h0), "uqxtn b19, h0");
5295 COMPARE(Uqxtn(h20, s0), "uqxtn h20, s0") ;
5296 COMPARE(Uqxtn(s21, d0), "uqxtn s21, d0");
5297
5298 COMPARE(Sqxtun(v0.V8B(), v1.V8H()), "sqxtun v0.8b, v1.8h");
5299 COMPARE(Sqxtun(v1.V4H(), v2.V4S()), "sqxtun v1.4h, v2.4s");
5300 COMPARE(Sqxtun(v2.V2S(), v3.V2D()), "sqxtun v2.2s, v3.2d");
5301 COMPARE(Sqxtun2(v0.V16B(), v1.V8H()), "sqxtun2 v0.16b, v1.8h");
5302 COMPARE(Sqxtun2(v1.V8H(), v2.V4S()), "sqxtun2 v1.8h, v2.4s");
5303 COMPARE(Sqxtun2(v2.V4S(), v3.V2D()), "sqxtun2 v2.4s, v3.2d");
5304 COMPARE(Sqxtun(b19, h0), "sqxtun b19, h0");
5305 COMPARE(Sqxtun(h20, s0), "sqxtun h20, s0") ;
5306 COMPARE(Sqxtun(s21, d0), "sqxtun s21, d0");
5307
5308 COMPARE(Cls(v1.V8B(), v8.V8B()), "cls v1.8b, v8.8b");
5309 COMPARE(Cls(v2.V16B(), v9.V16B()), "cls v2.16b, v9.16b");
5310 COMPARE(Cls(v3.V4H(), v1.V4H()), "cls v3.4h, v1.4h");
5311 COMPARE(Cls(v4.V8H(), v2.V8H()), "cls v4.8h, v2.8h");
5312 COMPARE(Cls(v5.V2S(), v3.V2S()), "cls v5.2s, v3.2s");
5313 COMPARE(Cls(v6.V4S(), v4.V4S()), "cls v6.4s, v4.4s");
5314
5315 COMPARE(Clz(v1.V8B(), v8.V8B()), "clz v1.8b, v8.8b");
5316 COMPARE(Clz(v2.V16B(), v9.V16B()), "clz v2.16b, v9.16b");
5317 COMPARE(Clz(v3.V4H(), v1.V4H()), "clz v3.4h, v1.4h");
5318 COMPARE(Clz(v4.V8H(), v2.V8H()), "clz v4.8h, v2.8h");
5319 COMPARE(Clz(v5.V2S(), v3.V2S()), "clz v5.2s, v3.2s");
5320 COMPARE(Clz(v6.V4S(), v4.V4S()), "clz v6.4s, v4.4s");
5321
5322 COMPARE(Cnt(v1.V8B(), v8.V8B()), "cnt v1.8b, v8.8b");
5323 COMPARE(Cnt(v2.V16B(), v9.V16B()), "cnt v2.16b, v9.16b");
5324
5325 COMPARE(Mvn(v4.V8B(), v5.V8B()), "mvn v4.8b, v5.8b");
5326 COMPARE(Mvn(v4.V16B(), v5.V16B()), "mvn v4.16b, v5.16b");
5327
5328 COMPARE(Not(v4.V8B(), v5.V8B()), "mvn v4.8b, v5.8b");
5329 COMPARE(Not(v4.V16B(), v5.V16B()), "mvn v4.16b, v5.16b");
5330
5331 COMPARE(Rev64(v1.V8B(), v8.V8B()), "rev64 v1.8b, v8.8b");
5332 COMPARE(Rev64(v2.V16B(), v9.V16B()), "rev64 v2.16b, v9.16b");
5333 COMPARE(Rev64(v3.V4H(), v1.V4H()), "rev64 v3.4h, v1.4h");
5334 COMPARE(Rev64(v4.V8H(), v2.V8H()), "rev64 v4.8h, v2.8h");
5335 COMPARE(Rev64(v5.V2S(), v3.V2S()), "rev64 v5.2s, v3.2s");
5336 COMPARE(Rev64(v6.V4S(), v4.V4S()), "rev64 v6.4s, v4.4s");
5337
5338 COMPARE(Rev32(v1.V8B(), v8.V8B()), "rev32 v1.8b, v8.8b");
5339 COMPARE(Rev32(v2.V16B(), v9.V16B()), "rev32 v2.16b, v9.16b");
5340 COMPARE(Rev32(v3.V4H(), v1.V4H()), "rev32 v3.4h, v1.4h");
5341 COMPARE(Rev32(v4.V8H(), v2.V8H()), "rev32 v4.8h, v2.8h");
5342
5343 COMPARE(Rev16(v1.V8B(), v8.V8B()), "rev16 v1.8b, v8.8b");
5344 COMPARE(Rev16(v2.V16B(), v9.V16B()), "rev16 v2.16b, v9.16b");
5345
5346 COMPARE(Rbit(v1.V8B(), v8.V8B()), "rbit v1.8b, v8.8b");
5347 COMPARE(Rbit(v2.V16B(), v9.V16B()), "rbit v2.16b, v9.16b");
5348
5349 COMPARE(Ursqrte(v2.V2S(), v9.V2S()), "ursqrte v2.2s, v9.2s");
5350 COMPARE(Ursqrte(v16.V4S(), v23.V4S()), "ursqrte v16.4s, v23.4s");
5351
5352 COMPARE(Urecpe(v2.V2S(), v9.V2S()), "urecpe v2.2s, v9.2s");
5353 COMPARE(Urecpe(v16.V4S(), v23.V4S()), "urecpe v16.4s, v23.4s");
5354
5355 COMPARE(Frsqrte(v2.V2S(), v9.V2S()), "frsqrte v2.2s, v9.2s");
5356 COMPARE(Frsqrte(v16.V4S(), v23.V4S()), "frsqrte v16.4s, v23.4s");
5357 COMPARE(Frsqrte(v2.V2D(), v9.V2D()), "frsqrte v2.2d, v9.2d");
5358 COMPARE(Frsqrte(v0.S(), v1.S()), "frsqrte s0, s1");
5359 COMPARE(Frsqrte(v0.D(), v1.D()), "frsqrte d0, d1");
5360
5361 COMPARE(Frecpe(v2.V2S(), v9.V2S()), "frecpe v2.2s, v9.2s");
5362 COMPARE(Frecpe(v16.V4S(), v23.V4S()), "frecpe v16.4s, v23.4s");
5363 COMPARE(Frecpe(v2.V2D(), v9.V2D()), "frecpe v2.2d, v9.2d");
5364 COMPARE(Frecpe(v0.S(), v1.S()), "frecpe s0, s1");
5365 COMPARE(Frecpe(v0.D(), v1.D()), "frecpe d0, d1");
5366
5367 COMPARE(Fabs(v2.V2S(), v9.V2S()), "fabs v2.2s, v9.2s");
5368 COMPARE(Fabs(v16.V4S(), v23.V4S()), "fabs v16.4s, v23.4s");
5369 COMPARE(Fabs(v31.V2D(), v30.V2D()), "fabs v31.2d, v30.2d");
5370
5371 COMPARE(Fneg(v2.V2S(), v9.V2S()), "fneg v2.2s, v9.2s");
5372 COMPARE(Fneg(v16.V4S(), v23.V4S()), "fneg v16.4s, v23.4s");
5373 COMPARE(Fneg(v31.V2D(), v30.V2D()), "fneg v31.2d, v30.2d");
5374
5375 COMPARE(Frintn(v2.V2S(), v9.V2S()), "frintn v2.2s, v9.2s");
5376 COMPARE(Frintn(v16.V4S(), v23.V4S()), "frintn v16.4s, v23.4s");
5377 COMPARE(Frintn(v31.V2D(), v30.V2D()), "frintn v31.2d, v30.2d");
5378
5379 COMPARE(Frinta(v2.V2S(), v9.V2S()), "frinta v2.2s, v9.2s");
5380 COMPARE(Frinta(v16.V4S(), v23.V4S()), "frinta v16.4s, v23.4s");
5381 COMPARE(Frinta(v31.V2D(), v30.V2D()), "frinta v31.2d, v30.2d");
5382
5383 COMPARE(Frintp(v2.V2S(), v9.V2S()), "frintp v2.2s, v9.2s");
5384 COMPARE(Frintp(v16.V4S(), v23.V4S()), "frintp v16.4s, v23.4s");
5385 COMPARE(Frintp(v31.V2D(), v30.V2D()), "frintp v31.2d, v30.2d");
5386
5387 COMPARE(Frintm(v2.V2S(), v9.V2S()), "frintm v2.2s, v9.2s");
5388 COMPARE(Frintm(v16.V4S(), v23.V4S()), "frintm v16.4s, v23.4s");
5389 COMPARE(Frintm(v31.V2D(), v30.V2D()), "frintm v31.2d, v30.2d");
5390
5391 COMPARE(Frintx(v2.V2S(), v9.V2S()), "frintx v2.2s, v9.2s");
5392 COMPARE(Frintx(v16.V4S(), v23.V4S()), "frintx v16.4s, v23.4s");
5393 COMPARE(Frintx(v31.V2D(), v30.V2D()), "frintx v31.2d, v30.2d");
5394
5395 COMPARE(Frintz(v2.V2S(), v9.V2S()), "frintz v2.2s, v9.2s");
5396 COMPARE(Frintz(v16.V4S(), v23.V4S()), "frintz v16.4s, v23.4s");
5397 COMPARE(Frintz(v31.V2D(), v30.V2D()), "frintz v31.2d, v30.2d");
5398
5399 COMPARE(Frinti(v2.V2S(), v9.V2S()), "frinti v2.2s, v9.2s");
5400 COMPARE(Frinti(v16.V4S(), v23.V4S()), "frinti v16.4s, v23.4s");
5401 COMPARE(Frinti(v31.V2D(), v30.V2D()), "frinti v31.2d, v30.2d");
5402
5403 COMPARE(Fsqrt(v3.V2S(), v10.V2S()), "fsqrt v3.2s, v10.2s");
5404 COMPARE(Fsqrt(v22.V4S(), v11.V4S()), "fsqrt v22.4s, v11.4s");
5405 COMPARE(Fsqrt(v31.V2D(), v0.V2D()), "fsqrt v31.2d, v0.2d");
5406
5407 COMPARE(Fcvtns(v4.V2S(), v11.V2S()), "fcvtns v4.2s, v11.2s");
5408 COMPARE(Fcvtns(v23.V4S(), v12.V4S()), "fcvtns v23.4s, v12.4s");
5409 COMPARE(Fcvtns(v30.V2D(), v1.V2D()), "fcvtns v30.2d, v1.2d");
5410 COMPARE(Fcvtnu(v4.V2S(), v11.V2S()), "fcvtnu v4.2s, v11.2s");
5411 COMPARE(Fcvtnu(v23.V4S(), v12.V4S()), "fcvtnu v23.4s, v12.4s");
5412 COMPARE(Fcvtnu(v30.V2D(), v1.V2D()), "fcvtnu v30.2d, v1.2d");
5413
5414 COMPARE(Fcvtps(v4.V2S(), v11.V2S()), "fcvtps v4.2s, v11.2s");
5415 COMPARE(Fcvtps(v23.V4S(), v12.V4S()), "fcvtps v23.4s, v12.4s");
5416 COMPARE(Fcvtps(v30.V2D(), v1.V2D()), "fcvtps v30.2d, v1.2d");
5417 COMPARE(Fcvtpu(v4.V2S(), v11.V2S()), "fcvtpu v4.2s, v11.2s");
5418 COMPARE(Fcvtpu(v23.V4S(), v12.V4S()), "fcvtpu v23.4s, v12.4s");
5419 COMPARE(Fcvtpu(v30.V2D(), v1.V2D()), "fcvtpu v30.2d, v1.2d");
5420
5421 COMPARE(Fcvtms(v4.V2S(), v11.V2S()), "fcvtms v4.2s, v11.2s");
5422 COMPARE(Fcvtms(v23.V4S(), v12.V4S()), "fcvtms v23.4s, v12.4s");
5423 COMPARE(Fcvtms(v30.V2D(), v1.V2D()), "fcvtms v30.2d, v1.2d");
5424 COMPARE(Fcvtmu(v4.V2S(), v11.V2S()), "fcvtmu v4.2s, v11.2s");
5425 COMPARE(Fcvtmu(v23.V4S(), v12.V4S()), "fcvtmu v23.4s, v12.4s");
5426 COMPARE(Fcvtmu(v30.V2D(), v1.V2D()), "fcvtmu v30.2d, v1.2d");
5427
5428 COMPARE(Fcvtzs(v4.V2S(), v11.V2S()), "fcvtzs v4.2s, v11.2s");
5429 COMPARE(Fcvtzs(v23.V4S(), v12.V4S()), "fcvtzs v23.4s, v12.4s");
5430 COMPARE(Fcvtzs(v30.V2D(), v1.V2D()), "fcvtzs v30.2d, v1.2d");
5431 COMPARE(Fcvtzu(v4.V2S(), v11.V2S()), "fcvtzu v4.2s, v11.2s");
5432 COMPARE(Fcvtzu(v23.V4S(), v12.V4S()), "fcvtzu v23.4s, v12.4s");
5433 COMPARE(Fcvtzu(v30.V2D(), v1.V2D()), "fcvtzu v30.2d, v1.2d");
5434
5435 COMPARE(Fcvtas(v4.V2S(), v11.V2S()), "fcvtas v4.2s, v11.2s");
5436 COMPARE(Fcvtas(v23.V4S(), v12.V4S()), "fcvtas v23.4s, v12.4s");
5437 COMPARE(Fcvtas(v30.V2D(), v1.V2D()), "fcvtas v30.2d, v1.2d");
5438 COMPARE(Fcvtau(v4.V2S(), v11.V2S()), "fcvtau v4.2s, v11.2s");
5439 COMPARE(Fcvtau(v23.V4S(), v12.V4S()), "fcvtau v23.4s, v12.4s");
5440 COMPARE(Fcvtau(v30.V2D(), v1.V2D()), "fcvtau v30.2d, v1.2d");
5441
5442 COMPARE(Fcvtns(s0, s1), "fcvtns s0, s1");
5443 COMPARE(Fcvtns(d2, d3), "fcvtns d2, d3");
5444 COMPARE(Fcvtnu(s4, s5), "fcvtnu s4, s5");
5445 COMPARE(Fcvtnu(d6, d7), "fcvtnu d6, d7");
5446 COMPARE(Fcvtps(s8, s9), "fcvtps s8, s9");
5447 COMPARE(Fcvtps(d10, d11), "fcvtps d10, d11");
5448 COMPARE(Fcvtpu(s12, s13), "fcvtpu s12, s13");
5449 COMPARE(Fcvtpu(d14, d15), "fcvtpu d14, d15");
5450 COMPARE(Fcvtms(s16, s17), "fcvtms s16, s17");
5451 COMPARE(Fcvtms(d18, d19), "fcvtms d18, d19");
5452 COMPARE(Fcvtmu(s20, s21), "fcvtmu s20, s21");
5453 COMPARE(Fcvtmu(d22, d23), "fcvtmu d22, d23");
5454 COMPARE(Fcvtzs(s24, s25), "fcvtzs s24, s25");
5455 COMPARE(Fcvtzs(d26, d27), "fcvtzs d26, d27");
5456 COMPARE(Fcvtzu(s28, s29), "fcvtzu s28, s29");
5457 COMPARE(Fcvtzu(d30, d31), "fcvtzu d30, d31");
5458 COMPARE(Fcvtas(s0, s1), "fcvtas s0, s1");
5459 COMPARE(Fcvtas(d2, d3), "fcvtas d2, d3");
5460 COMPARE(Fcvtau(s4, s5), "fcvtau s4, s5");
5461 COMPARE(Fcvtau(d6, d7), "fcvtau d6, d7");
5462
5463 COMPARE(Fcvtl(v3.V4S(), v5.V4H()), "fcvtl v3.4s, v5.4h");
5464 COMPARE(Fcvtl(v7.V2D(), v11.V2S()), "fcvtl v7.2d, v11.2s");
5465 COMPARE(Fcvtl2(v13.V4S(), v17.V8H()), "fcvtl2 v13.4s, v17.8h");
5466 COMPARE(Fcvtl2(v23.V2D(), v29.V4S()), "fcvtl2 v23.2d, v29.4s");
5467
5468 COMPARE(Fcvtn(v3.V4H(), v5.V4S()), "fcvtn v3.4h, v5.4s");
5469 COMPARE(Fcvtn(v7.V2S(), v11.V2D()), "fcvtn v7.2s, v11.2d");
5470 COMPARE(Fcvtn2(v13.V8H(), v17.V4S()), "fcvtn2 v13.8h, v17.4s");
5471 COMPARE(Fcvtn2(v23.V4S(), v29.V2D()), "fcvtn2 v23.4s, v29.2d");
5472
5473 COMPARE(Fcvtxn(v5.V2S(), v7.V2D()), "fcvtxn v5.2s, v7.2d");
5474 COMPARE(Fcvtxn2(v8.V4S(), v13.V2D()), "fcvtxn2 v8.4s, v13.2d");
5475 COMPARE(Fcvtxn(s17, d31), "fcvtxn s17, d31");
5476
5477 COMPARE(Frecpx(s0, s1), "frecpx s0, s1");
5478 COMPARE(Frecpx(s31, s30), "frecpx s31, s30");
5479 COMPARE(Frecpx(d2, d3), "frecpx d2, d3");
5480 COMPARE(Frecpx(d31, d30), "frecpx d31, d30");
5481
5482 COMPARE(Scvtf(v5.V2S(), v3.V2S()), "scvtf v5.2s, v3.2s");
5483 COMPARE(Scvtf(v6.V4S(), v4.V4S()), "scvtf v6.4s, v4.4s");
5484 COMPARE(Scvtf(v7.V2D(), v5.V2D()), "scvtf v7.2d, v5.2d");
5485 COMPARE(Scvtf(s8, s6), "scvtf s8, s6");
5486 COMPARE(Scvtf(d8, d6), "scvtf d8, d6");
5487
5488 COMPARE(Ucvtf(v5.V2S(), v3.V2S()), "ucvtf v5.2s, v3.2s");
5489 COMPARE(Ucvtf(v6.V4S(), v4.V4S()), "ucvtf v6.4s, v4.4s");
5490 COMPARE(Ucvtf(v7.V2D(), v5.V2D()), "ucvtf v7.2d, v5.2d");
5491 COMPARE(Ucvtf(s8, s6), "ucvtf s8, s6");
5492 COMPARE(Ucvtf(d8, d6), "ucvtf d8, d6");
5493
5494 #define DISASM_INST(TA, TAS, TB, TBS) \
5495 COMPARE(Saddlp(v0.TA, v1.TB), "saddlp v0." TAS ", v1." TBS);
5496 NEON_FORMAT_LIST_LP(DISASM_INST)
5497 #undef DISASM_INST
5498
5499 #define DISASM_INST(TA, TAS, TB, TBS) \
5500 COMPARE(Uaddlp(v0.TA, v1.TB), "uaddlp v0." TAS ", v1." TBS);
5501 NEON_FORMAT_LIST_LP(DISASM_INST)
5502 #undef DISASM_INST
5503
5504 #define DISASM_INST(TA, TAS, TB, TBS) \
5505 COMPARE(Sadalp(v0.TA, v1.TB), "sadalp v0." TAS ", v1." TBS);
5506 NEON_FORMAT_LIST_LP(DISASM_INST)
5507 #undef DISASM_INST
5508
5509 #define DISASM_INST(TA, TAS, TB, TBS) \
5510 COMPARE(Uadalp(v0.TA, v1.TB), "uadalp v0." TAS ", v1." TBS);
5511 NEON_FORMAT_LIST_LP(DISASM_INST)
5512 #undef DISASM_INST
5513
5514 CLEANUP();
5515}
5516
5517TEST(neon_acrosslanes) {
armvixl684cd2a2015-10-23 13:38:33 +01005518 SETUP_MACRO();
armvixl5289c592015-03-02 13:52:04 +00005519
5520 COMPARE(Smaxv(b4, v5.V8B()), "smaxv b4, v5.8b");
5521 COMPARE(Smaxv(b4, v5.V16B()), "smaxv b4, v5.16b");
5522 COMPARE(Smaxv(h4, v5.V4H()), "smaxv h4, v5.4h");
5523 COMPARE(Smaxv(h4, v5.V8H()), "smaxv h4, v5.8h");
5524 COMPARE(Smaxv(s4, v5.V4S()), "smaxv s4, v5.4s");
5525
5526 COMPARE(Sminv(b4, v5.V8B()), "sminv b4, v5.8b");
5527 COMPARE(Sminv(b4, v5.V16B()), "sminv b4, v5.16b");
5528 COMPARE(Sminv(h4, v5.V4H()), "sminv h4, v5.4h");
5529 COMPARE(Sminv(h4, v5.V8H()), "sminv h4, v5.8h");
5530 COMPARE(Sminv(s4, v5.V4S()), "sminv s4, v5.4s");
5531
5532 COMPARE(Umaxv(b4, v5.V8B()), "umaxv b4, v5.8b");
5533 COMPARE(Umaxv(b4, v5.V16B()), "umaxv b4, v5.16b");
5534 COMPARE(Umaxv(h4, v5.V4H()), "umaxv h4, v5.4h");
5535 COMPARE(Umaxv(h4, v5.V8H()), "umaxv h4, v5.8h");
5536 COMPARE(Umaxv(s4, v5.V4S()), "umaxv s4, v5.4s");
5537
5538 COMPARE(Uminv(b4, v5.V8B()), "uminv b4, v5.8b");
5539 COMPARE(Uminv(b4, v5.V16B()), "uminv b4, v5.16b");
5540 COMPARE(Uminv(h4, v5.V4H()), "uminv h4, v5.4h");
5541 COMPARE(Uminv(h4, v5.V8H()), "uminv h4, v5.8h");
5542 COMPARE(Uminv(s4, v5.V4S()), "uminv s4, v5.4s");
5543
5544 COMPARE(Addv(b4, v5.V8B()), "addv b4, v5.8b");
5545 COMPARE(Addv(b4, v5.V16B()), "addv b4, v5.16b");
5546 COMPARE(Addv(h4, v5.V4H()), "addv h4, v5.4h");
5547 COMPARE(Addv(h4, v5.V8H()), "addv h4, v5.8h");
5548 COMPARE(Addv(s4, v5.V4S()), "addv s4, v5.4s");
5549
5550 COMPARE(Saddlv(h4, v5.V8B()), "saddlv h4, v5.8b");
5551 COMPARE(Saddlv(h4, v5.V16B()), "saddlv h4, v5.16b");
5552 COMPARE(Saddlv(s4, v5.V4H()), "saddlv s4, v5.4h");
5553 COMPARE(Saddlv(s4, v5.V8H()), "saddlv s4, v5.8h");
5554 COMPARE(Saddlv(d4, v5.V4S()), "saddlv d4, v5.4s");
5555
5556 COMPARE(Uaddlv(h4, v5.V8B()), "uaddlv h4, v5.8b");
5557 COMPARE(Uaddlv(h4, v5.V16B()), "uaddlv h4, v5.16b");
5558 COMPARE(Uaddlv(s4, v5.V4H()), "uaddlv s4, v5.4h");
5559 COMPARE(Uaddlv(s4, v5.V8H()), "uaddlv s4, v5.8h");
5560 COMPARE(Uaddlv(d4, v5.V4S()), "uaddlv d4, v5.4s");
5561
5562 COMPARE(Fmaxv(s4, v5.V4S()), "fmaxv s4, v5.4s");
5563 COMPARE(Fminv(s4, v5.V4S()), "fminv s4, v5.4s");
5564 COMPARE(Fmaxnmv(s4, v5.V4S()), "fmaxnmv s4, v5.4s");
5565 COMPARE(Fminnmv(s4, v5.V4S()), "fminnmv s4, v5.4s");
5566
5567 CLEANUP();
5568}
5569
5570TEST(neon_scalar_pairwise) {
armvixl684cd2a2015-10-23 13:38:33 +01005571 SETUP_MACRO();
armvixl5289c592015-03-02 13:52:04 +00005572
5573 COMPARE(Addp(d0, v1.V2D()), "addp d0, v1.2d");
5574 COMPARE(Faddp(s0, v1.V2S()), "faddp s0, v1.2s");
5575 COMPARE(Faddp(d2, v3.V2D()), "faddp d2, v3.2d");
5576 COMPARE(Fmaxp(s4, v5.V2S()), "fmaxp s4, v5.2s");
5577 COMPARE(Fmaxp(d6, v7.V2D()), "fmaxp d6, v7.2d");
5578 COMPARE(Fmaxnmp(s8, v9.V2S()), "fmaxnmp s8, v9.2s");
5579 COMPARE(Fmaxnmp(d10, v11.V2D()), "fmaxnmp d10, v11.2d");
5580 COMPARE(Fminp(s12, v13.V2S()), "fminp s12, v13.2s");
5581 COMPARE(Fminp(d14, v15.V2D()), "fminp d14, v15.2d");
5582 COMPARE(Fminnmp(s16, v17.V2S()), "fminnmp s16, v17.2s");
5583 COMPARE(Fminnmp(d18, v19.V2D()), "fminnmp d18, v19.2d");
5584 CLEANUP();
5585}
5586
5587TEST(neon_shift_immediate) {
armvixl684cd2a2015-10-23 13:38:33 +01005588 SETUP_MACRO();
armvixl5289c592015-03-02 13:52:04 +00005589
5590 COMPARE(Sshr(v0.V8B(), v1.V8B(), 1), "sshr v0.8b, v1.8b, #1");
5591 COMPARE(Sshr(v2.V8B(), v3.V8B(), 8), "sshr v2.8b, v3.8b, #8");
5592 COMPARE(Sshr(v4.V16B(), v5.V16B(), 1), "sshr v4.16b, v5.16b, #1");
5593 COMPARE(Sshr(v6.V16B(), v7.V16B(), 8), "sshr v6.16b, v7.16b, #8");
5594 COMPARE(Sshr(v8.V4H(), v9.V4H(), 1), "sshr v8.4h, v9.4h, #1");
5595 COMPARE(Sshr(v10.V4H(), v11.V4H(), 16), "sshr v10.4h, v11.4h, #16");
5596 COMPARE(Sshr(v12.V8H(), v13.V8H(), 1), "sshr v12.8h, v13.8h, #1");
5597 COMPARE(Sshr(v14.V8H(), v15.V8H(), 16), "sshr v14.8h, v15.8h, #16");
5598 COMPARE(Sshr(v16.V2S(), v17.V2S(), 1), "sshr v16.2s, v17.2s, #1");
5599 COMPARE(Sshr(v18.V2S(), v19.V2S(), 32), "sshr v18.2s, v19.2s, #32");
5600 COMPARE(Sshr(v20.V4S(), v21.V4S(), 1), "sshr v20.4s, v21.4s, #1");
5601 COMPARE(Sshr(v22.V4S(), v23.V4S(), 32), "sshr v22.4s, v23.4s, #32");
5602 COMPARE(Sshr(v28.V2D(), v29.V2D(), 1), "sshr v28.2d, v29.2d, #1");
5603 COMPARE(Sshr(v30.V2D(), v31.V2D(), 64), "sshr v30.2d, v31.2d, #64");
5604 COMPARE(Sshr(d0, d1, 7), "sshr d0, d1, #7");
5605
5606 COMPARE(Ushr(v0.V8B(), v1.V8B(), 1), "ushr v0.8b, v1.8b, #1");
5607 COMPARE(Ushr(v2.V8B(), v3.V8B(), 8), "ushr v2.8b, v3.8b, #8");
5608 COMPARE(Ushr(v4.V16B(), v5.V16B(), 1), "ushr v4.16b, v5.16b, #1");
5609 COMPARE(Ushr(v6.V16B(), v7.V16B(), 8), "ushr v6.16b, v7.16b, #8");
5610 COMPARE(Ushr(v8.V4H(), v9.V4H(), 1), "ushr v8.4h, v9.4h, #1");
5611 COMPARE(Ushr(v10.V4H(), v11.V4H(), 16), "ushr v10.4h, v11.4h, #16");
5612 COMPARE(Ushr(v12.V8H(), v13.V8H(), 1), "ushr v12.8h, v13.8h, #1");
5613 COMPARE(Ushr(v14.V8H(), v15.V8H(), 16), "ushr v14.8h, v15.8h, #16");
5614 COMPARE(Ushr(v16.V2S(), v17.V2S(), 1), "ushr v16.2s, v17.2s, #1");
5615 COMPARE(Ushr(v18.V2S(), v19.V2S(), 32), "ushr v18.2s, v19.2s, #32");
5616 COMPARE(Ushr(v20.V4S(), v21.V4S(), 1), "ushr v20.4s, v21.4s, #1");
5617 COMPARE(Ushr(v22.V4S(), v23.V4S(), 32), "ushr v22.4s, v23.4s, #32");
5618 COMPARE(Ushr(v28.V2D(), v29.V2D(), 1), "ushr v28.2d, v29.2d, #1");
5619 COMPARE(Ushr(v30.V2D(), v31.V2D(), 64), "ushr v30.2d, v31.2d, #64");
5620 COMPARE(Ushr(d0, d1, 7), "ushr d0, d1, #7");
5621
5622 COMPARE(Srshr(v0.V8B(), v1.V8B(), 1), "srshr v0.8b, v1.8b, #1");
5623 COMPARE(Srshr(v2.V8B(), v3.V8B(), 8), "srshr v2.8b, v3.8b, #8");
5624 COMPARE(Srshr(v4.V16B(), v5.V16B(), 1), "srshr v4.16b, v5.16b, #1");
5625 COMPARE(Srshr(v6.V16B(), v7.V16B(), 8), "srshr v6.16b, v7.16b, #8");
5626 COMPARE(Srshr(v8.V4H(), v9.V4H(), 1), "srshr v8.4h, v9.4h, #1");
5627 COMPARE(Srshr(v10.V4H(), v11.V4H(), 16), "srshr v10.4h, v11.4h, #16");
5628 COMPARE(Srshr(v12.V8H(), v13.V8H(), 1), "srshr v12.8h, v13.8h, #1");
5629 COMPARE(Srshr(v14.V8H(), v15.V8H(), 16), "srshr v14.8h, v15.8h, #16");
5630 COMPARE(Srshr(v16.V2S(), v17.V2S(), 1), "srshr v16.2s, v17.2s, #1");
5631 COMPARE(Srshr(v18.V2S(), v19.V2S(), 32), "srshr v18.2s, v19.2s, #32");
5632 COMPARE(Srshr(v20.V4S(), v21.V4S(), 1), "srshr v20.4s, v21.4s, #1");
5633 COMPARE(Srshr(v22.V4S(), v23.V4S(), 32), "srshr v22.4s, v23.4s, #32");
5634 COMPARE(Srshr(v28.V2D(), v29.V2D(), 1), "srshr v28.2d, v29.2d, #1");
5635 COMPARE(Srshr(v30.V2D(), v31.V2D(), 64), "srshr v30.2d, v31.2d, #64");
5636 COMPARE(Srshr(d0, d1, 7), "srshr d0, d1, #7");
5637
5638 COMPARE(Urshr(v0.V8B(), v1.V8B(), 1), "urshr v0.8b, v1.8b, #1");
5639 COMPARE(Urshr(v2.V8B(), v3.V8B(), 8), "urshr v2.8b, v3.8b, #8");
5640 COMPARE(Urshr(v4.V16B(), v5.V16B(), 1), "urshr v4.16b, v5.16b, #1");
5641 COMPARE(Urshr(v6.V16B(), v7.V16B(), 8), "urshr v6.16b, v7.16b, #8");
5642 COMPARE(Urshr(v8.V4H(), v9.V4H(), 1), "urshr v8.4h, v9.4h, #1");
5643 COMPARE(Urshr(v10.V4H(), v11.V4H(), 16), "urshr v10.4h, v11.4h, #16");
5644 COMPARE(Urshr(v12.V8H(), v13.V8H(), 1), "urshr v12.8h, v13.8h, #1");
5645 COMPARE(Urshr(v14.V8H(), v15.V8H(), 16), "urshr v14.8h, v15.8h, #16");
5646 COMPARE(Urshr(v16.V2S(), v17.V2S(), 1), "urshr v16.2s, v17.2s, #1");
5647 COMPARE(Urshr(v18.V2S(), v19.V2S(), 32), "urshr v18.2s, v19.2s, #32");
5648 COMPARE(Urshr(v20.V4S(), v21.V4S(), 1), "urshr v20.4s, v21.4s, #1");
5649 COMPARE(Urshr(v22.V4S(), v23.V4S(), 32), "urshr v22.4s, v23.4s, #32");
5650 COMPARE(Urshr(v28.V2D(), v29.V2D(), 1), "urshr v28.2d, v29.2d, #1");
5651 COMPARE(Urshr(v30.V2D(), v31.V2D(), 64), "urshr v30.2d, v31.2d, #64");
5652 COMPARE(Urshr(d0, d1, 7), "urshr d0, d1, #7");
5653
5654 COMPARE(Srsra(v0.V8B(), v1.V8B(), 1), "srsra v0.8b, v1.8b, #1");
5655 COMPARE(Srsra(v2.V8B(), v3.V8B(), 8), "srsra v2.8b, v3.8b, #8");
5656 COMPARE(Srsra(v4.V16B(), v5.V16B(), 1), "srsra v4.16b, v5.16b, #1");
5657 COMPARE(Srsra(v6.V16B(), v7.V16B(), 8), "srsra v6.16b, v7.16b, #8");
5658 COMPARE(Srsra(v8.V4H(), v9.V4H(), 1), "srsra v8.4h, v9.4h, #1");
5659 COMPARE(Srsra(v10.V4H(), v11.V4H(), 16), "srsra v10.4h, v11.4h, #16");
5660 COMPARE(Srsra(v12.V8H(), v13.V8H(), 1), "srsra v12.8h, v13.8h, #1");
5661 COMPARE(Srsra(v14.V8H(), v15.V8H(), 16), "srsra v14.8h, v15.8h, #16");
5662 COMPARE(Srsra(v16.V2S(), v17.V2S(), 1), "srsra v16.2s, v17.2s, #1");
5663 COMPARE(Srsra(v18.V2S(), v19.V2S(), 32), "srsra v18.2s, v19.2s, #32");
5664 COMPARE(Srsra(v20.V4S(), v21.V4S(), 1), "srsra v20.4s, v21.4s, #1");
5665 COMPARE(Srsra(v22.V4S(), v23.V4S(), 32), "srsra v22.4s, v23.4s, #32");
5666 COMPARE(Srsra(v28.V2D(), v29.V2D(), 1), "srsra v28.2d, v29.2d, #1");
5667 COMPARE(Srsra(v30.V2D(), v31.V2D(), 64), "srsra v30.2d, v31.2d, #64");
5668 COMPARE(Srsra(d0, d1, 7), "srsra d0, d1, #7");
5669
5670 COMPARE(Ssra(v0.V8B(), v1.V8B(), 1), "ssra v0.8b, v1.8b, #1");
5671 COMPARE(Ssra(v2.V8B(), v3.V8B(), 8), "ssra v2.8b, v3.8b, #8");
5672 COMPARE(Ssra(v4.V16B(), v5.V16B(), 1), "ssra v4.16b, v5.16b, #1");
5673 COMPARE(Ssra(v6.V16B(), v7.V16B(), 8), "ssra v6.16b, v7.16b, #8");
5674 COMPARE(Ssra(v8.V4H(), v9.V4H(), 1), "ssra v8.4h, v9.4h, #1");
5675 COMPARE(Ssra(v10.V4H(), v11.V4H(), 16), "ssra v10.4h, v11.4h, #16");
5676 COMPARE(Ssra(v12.V8H(), v13.V8H(), 1), "ssra v12.8h, v13.8h, #1");
5677 COMPARE(Ssra(v14.V8H(), v15.V8H(), 16), "ssra v14.8h, v15.8h, #16");
5678 COMPARE(Ssra(v16.V2S(), v17.V2S(), 1), "ssra v16.2s, v17.2s, #1");
5679 COMPARE(Ssra(v18.V2S(), v19.V2S(), 32), "ssra v18.2s, v19.2s, #32");
5680 COMPARE(Ssra(v20.V4S(), v21.V4S(), 1), "ssra v20.4s, v21.4s, #1");
5681 COMPARE(Ssra(v22.V4S(), v23.V4S(), 32), "ssra v22.4s, v23.4s, #32");
5682 COMPARE(Ssra(v28.V2D(), v29.V2D(), 1), "ssra v28.2d, v29.2d, #1");
5683 COMPARE(Ssra(v30.V2D(), v31.V2D(), 64), "ssra v30.2d, v31.2d, #64");
5684 COMPARE(Ssra(d0, d1, 7), "ssra d0, d1, #7");
5685
5686 COMPARE(Ursra(v0.V8B(), v1.V8B(), 1), "ursra v0.8b, v1.8b, #1");
5687 COMPARE(Ursra(v2.V8B(), v3.V8B(), 8), "ursra v2.8b, v3.8b, #8");
5688 COMPARE(Ursra(v4.V16B(), v5.V16B(), 1), "ursra v4.16b, v5.16b, #1");
5689 COMPARE(Ursra(v6.V16B(), v7.V16B(), 8), "ursra v6.16b, v7.16b, #8");
5690 COMPARE(Ursra(v8.V4H(), v9.V4H(), 1), "ursra v8.4h, v9.4h, #1");
5691 COMPARE(Ursra(v10.V4H(), v11.V4H(), 16), "ursra v10.4h, v11.4h, #16");
5692 COMPARE(Ursra(v12.V8H(), v13.V8H(), 1), "ursra v12.8h, v13.8h, #1");
5693 COMPARE(Ursra(v14.V8H(), v15.V8H(), 16), "ursra v14.8h, v15.8h, #16");
5694 COMPARE(Ursra(v16.V2S(), v17.V2S(), 1), "ursra v16.2s, v17.2s, #1");
5695 COMPARE(Ursra(v18.V2S(), v19.V2S(), 32), "ursra v18.2s, v19.2s, #32");
5696 COMPARE(Ursra(v20.V4S(), v21.V4S(), 1), "ursra v20.4s, v21.4s, #1");
5697 COMPARE(Ursra(v22.V4S(), v23.V4S(), 32), "ursra v22.4s, v23.4s, #32");
5698 COMPARE(Ursra(v28.V2D(), v29.V2D(), 1), "ursra v28.2d, v29.2d, #1");
5699 COMPARE(Ursra(v30.V2D(), v31.V2D(), 64), "ursra v30.2d, v31.2d, #64");
5700 COMPARE(Ursra(d0, d1, 7), "ursra d0, d1, #7");
5701
5702 COMPARE(Usra(v0.V8B(), v1.V8B(), 1), "usra v0.8b, v1.8b, #1");
5703 COMPARE(Usra(v2.V8B(), v3.V8B(), 8), "usra v2.8b, v3.8b, #8");
5704 COMPARE(Usra(v4.V16B(), v5.V16B(), 1), "usra v4.16b, v5.16b, #1");
5705 COMPARE(Usra(v6.V16B(), v7.V16B(), 8), "usra v6.16b, v7.16b, #8");
5706 COMPARE(Usra(v8.V4H(), v9.V4H(), 1), "usra v8.4h, v9.4h, #1");
5707 COMPARE(Usra(v10.V4H(), v11.V4H(), 16), "usra v10.4h, v11.4h, #16");
5708 COMPARE(Usra(v12.V8H(), v13.V8H(), 1), "usra v12.8h, v13.8h, #1");
5709 COMPARE(Usra(v14.V8H(), v15.V8H(), 16), "usra v14.8h, v15.8h, #16");
5710 COMPARE(Usra(v16.V2S(), v17.V2S(), 1), "usra v16.2s, v17.2s, #1");
5711 COMPARE(Usra(v18.V2S(), v19.V2S(), 32), "usra v18.2s, v19.2s, #32");
5712 COMPARE(Usra(v20.V4S(), v21.V4S(), 1), "usra v20.4s, v21.4s, #1");
5713 COMPARE(Usra(v22.V4S(), v23.V4S(), 32), "usra v22.4s, v23.4s, #32");
5714 COMPARE(Usra(v28.V2D(), v29.V2D(), 1), "usra v28.2d, v29.2d, #1");
5715 COMPARE(Usra(v30.V2D(), v31.V2D(), 64), "usra v30.2d, v31.2d, #64");
5716 COMPARE(Usra(d0, d1, 7), "usra d0, d1, #7");
5717
5718 COMPARE(Sli(v1.V8B(), v8.V8B(), 1), "sli v1.8b, v8.8b, #1");
5719 COMPARE(Sli(v2.V16B(), v9.V16B(), 2), "sli v2.16b, v9.16b, #2");
5720 COMPARE(Sli(v3.V4H(), v1.V4H(), 3), "sli v3.4h, v1.4h, #3");
5721 COMPARE(Sli(v4.V8H(), v2.V8H(), 4), "sli v4.8h, v2.8h, #4");
5722 COMPARE(Sli(v5.V2S(), v3.V2S(), 5), "sli v5.2s, v3.2s, #5");
5723 COMPARE(Sli(v6.V4S(), v4.V4S(), 6), "sli v6.4s, v4.4s, #6");
5724 COMPARE(Sli(v7.V2D(), v5.V2D(), 7), "sli v7.2d, v5.2d, #7");
5725 COMPARE(Sli(d8, d6, 8), "sli d8, d6, #8");
5726
5727 COMPARE(Shl(v1.V8B(), v8.V8B(), 1), "shl v1.8b, v8.8b, #1");
5728 COMPARE(Shl(v2.V16B(), v9.V16B(), 2), "shl v2.16b, v9.16b, #2");
5729 COMPARE(Shl(v3.V4H(), v1.V4H(), 3), "shl v3.4h, v1.4h, #3");
5730 COMPARE(Shl(v4.V8H(), v2.V8H(), 4), "shl v4.8h, v2.8h, #4");
5731 COMPARE(Shl(v5.V2S(), v3.V2S(), 5), "shl v5.2s, v3.2s, #5");
5732 COMPARE(Shl(v6.V4S(), v4.V4S(), 6), "shl v6.4s, v4.4s, #6");
5733 COMPARE(Shl(v7.V2D(), v5.V2D(), 7), "shl v7.2d, v5.2d, #7");
5734 COMPARE(Shl(d8, d6, 8), "shl d8, d6, #8");
5735
5736 COMPARE(Sqshl(v1.V8B(), v8.V8B(), 1), "sqshl v1.8b, v8.8b, #1");
5737 COMPARE(Sqshl(v2.V16B(), v9.V16B(), 2), "sqshl v2.16b, v9.16b, #2");
5738 COMPARE(Sqshl(v3.V4H(), v1.V4H(), 3), "sqshl v3.4h, v1.4h, #3");
5739 COMPARE(Sqshl(v4.V8H(), v2.V8H(), 4), "sqshl v4.8h, v2.8h, #4");
5740 COMPARE(Sqshl(v5.V2S(), v3.V2S(), 5), "sqshl v5.2s, v3.2s, #5");
5741 COMPARE(Sqshl(v6.V4S(), v4.V4S(), 6), "sqshl v6.4s, v4.4s, #6");
5742 COMPARE(Sqshl(v7.V2D(), v5.V2D(), 7), "sqshl v7.2d, v5.2d, #7");
5743 COMPARE(Sqshl(b8, b7, 1), "sqshl b8, b7, #1");
5744 COMPARE(Sqshl(h9, h8, 2), "sqshl h9, h8, #2");
5745 COMPARE(Sqshl(s10, s9, 3), "sqshl s10, s9, #3");
5746 COMPARE(Sqshl(d11, d10, 4), "sqshl d11, d10, #4");
5747
5748 COMPARE(Sqshlu(v1.V8B(), v8.V8B(), 1), "sqshlu v1.8b, v8.8b, #1");
5749 COMPARE(Sqshlu(v2.V16B(), v9.V16B(), 2), "sqshlu v2.16b, v9.16b, #2");
5750 COMPARE(Sqshlu(v3.V4H(), v1.V4H(), 3), "sqshlu v3.4h, v1.4h, #3");
5751 COMPARE(Sqshlu(v4.V8H(), v2.V8H(), 4), "sqshlu v4.8h, v2.8h, #4");
5752 COMPARE(Sqshlu(v5.V2S(), v3.V2S(), 5), "sqshlu v5.2s, v3.2s, #5");
5753 COMPARE(Sqshlu(v6.V4S(), v4.V4S(), 6), "sqshlu v6.4s, v4.4s, #6");
5754 COMPARE(Sqshlu(v7.V2D(), v5.V2D(), 7), "sqshlu v7.2d, v5.2d, #7");
5755 COMPARE(Sqshlu(b8, b7, 1), "sqshlu b8, b7, #1");
5756 COMPARE(Sqshlu(h9, h8, 2), "sqshlu h9, h8, #2");
5757 COMPARE(Sqshlu(s10, s9, 3), "sqshlu s10, s9, #3");
5758 COMPARE(Sqshlu(d11, d10, 4), "sqshlu d11, d10, #4");
5759
5760 COMPARE(Uqshl(v1.V8B(), v8.V8B(), 1), "uqshl v1.8b, v8.8b, #1");
5761 COMPARE(Uqshl(v2.V16B(), v9.V16B(), 2), "uqshl v2.16b, v9.16b, #2");
5762 COMPARE(Uqshl(v3.V4H(), v1.V4H(), 3), "uqshl v3.4h, v1.4h, #3");
5763 COMPARE(Uqshl(v4.V8H(), v2.V8H(), 4), "uqshl v4.8h, v2.8h, #4");
5764 COMPARE(Uqshl(v5.V2S(), v3.V2S(), 5), "uqshl v5.2s, v3.2s, #5");
5765 COMPARE(Uqshl(v6.V4S(), v4.V4S(), 6), "uqshl v6.4s, v4.4s, #6");
5766 COMPARE(Uqshl(v7.V2D(), v5.V2D(), 7), "uqshl v7.2d, v5.2d, #7");
5767 COMPARE(Uqshl(b8, b7, 1), "uqshl b8, b7, #1");
5768 COMPARE(Uqshl(h9, h8, 2), "uqshl h9, h8, #2");
5769 COMPARE(Uqshl(s10, s9, 3), "uqshl s10, s9, #3");
5770 COMPARE(Uqshl(d11, d10, 4), "uqshl d11, d10, #4");
5771
5772 COMPARE(Sshll(v1.V8H(), v8.V8B(), 1), "sshll v1.8h, v8.8b, #1");
5773 COMPARE(Sshll(v3.V4S(), v1.V4H(), 3), "sshll v3.4s, v1.4h, #3");
5774 COMPARE(Sshll(v5.V2D(), v3.V2S(), 5), "sshll v5.2d, v3.2s, #5");
5775 COMPARE(Sshll2(v2.V8H(), v9.V16B(), 2), "sshll2 v2.8h, v9.16b, #2");
5776 COMPARE(Sshll2(v4.V4S(), v2.V8H(), 4), "sshll2 v4.4s, v2.8h, #4");
5777 COMPARE(Sshll2(v6.V2D(), v4.V4S(), 6), "sshll2 v6.2d, v4.4s, #6");
5778
5779 COMPARE(Sshll(v1.V8H(), v8.V8B(), 0), "sxtl v1.8h, v8.8b");
5780 COMPARE(Sshll(v3.V4S(), v1.V4H(), 0), "sxtl v3.4s, v1.4h");
5781 COMPARE(Sshll(v5.V2D(), v3.V2S(), 0), "sxtl v5.2d, v3.2s");
5782 COMPARE(Sshll2(v2.V8H(), v9.V16B(), 0), "sxtl2 v2.8h, v9.16b");
5783 COMPARE(Sshll2(v4.V4S(), v2.V8H(), 0), "sxtl2 v4.4s, v2.8h");
5784 COMPARE(Sshll2(v6.V2D(), v4.V4S(), 0), "sxtl2 v6.2d, v4.4s");
5785
5786 COMPARE(Sxtl(v1.V8H(), v8.V8B()), "sxtl v1.8h, v8.8b");
5787 COMPARE(Sxtl(v3.V4S(), v1.V4H()), "sxtl v3.4s, v1.4h");
5788 COMPARE(Sxtl(v5.V2D(), v3.V2S()), "sxtl v5.2d, v3.2s");
5789 COMPARE(Sxtl2(v2.V8H(), v9.V16B()), "sxtl2 v2.8h, v9.16b");
5790 COMPARE(Sxtl2(v4.V4S(), v2.V8H()), "sxtl2 v4.4s, v2.8h");
5791 COMPARE(Sxtl2(v6.V2D(), v4.V4S()), "sxtl2 v6.2d, v4.4s");
5792
5793 COMPARE(Ushll(v1.V8H(), v8.V8B(), 1), "ushll v1.8h, v8.8b, #1");
5794 COMPARE(Ushll(v3.V4S(), v1.V4H(), 3), "ushll v3.4s, v1.4h, #3");
5795 COMPARE(Ushll(v5.V2D(), v3.V2S(), 5), "ushll v5.2d, v3.2s, #5");
5796 COMPARE(Ushll2(v2.V8H(), v9.V16B(), 2), "ushll2 v2.8h, v9.16b, #2");
5797 COMPARE(Ushll2(v4.V4S(), v2.V8H(), 4), "ushll2 v4.4s, v2.8h, #4");
5798 COMPARE(Ushll2(v6.V2D(), v4.V4S(), 6), "ushll2 v6.2d, v4.4s, #6");
5799
5800 COMPARE(Ushll(v1.V8H(), v8.V8B(), 0), "uxtl v1.8h, v8.8b");
5801 COMPARE(Ushll(v3.V4S(), v1.V4H(), 0), "uxtl v3.4s, v1.4h");
5802 COMPARE(Ushll(v5.V2D(), v3.V2S(), 0), "uxtl v5.2d, v3.2s");
5803 COMPARE(Ushll2(v2.V8H(), v9.V16B(), 0), "uxtl2 v2.8h, v9.16b");
5804 COMPARE(Ushll2(v4.V4S(), v2.V8H(), 0), "uxtl2 v4.4s, v2.8h");
5805 COMPARE(Ushll2(v6.V2D(), v4.V4S(), 0), "uxtl2 v6.2d, v4.4s");
5806
5807 COMPARE(Uxtl(v1.V8H(), v8.V8B()), "uxtl v1.8h, v8.8b");
5808 COMPARE(Uxtl(v3.V4S(), v1.V4H()), "uxtl v3.4s, v1.4h");
5809 COMPARE(Uxtl(v5.V2D(), v3.V2S()), "uxtl v5.2d, v3.2s");
5810 COMPARE(Uxtl2(v2.V8H(), v9.V16B()), "uxtl2 v2.8h, v9.16b");
5811 COMPARE(Uxtl2(v4.V4S(), v2.V8H()), "uxtl2 v4.4s, v2.8h");
5812 COMPARE(Uxtl2(v6.V2D(), v4.V4S()), "uxtl2 v6.2d, v4.4s");
5813
5814 COMPARE(Sri(v1.V8B(), v8.V8B(), 1), "sri v1.8b, v8.8b, #1");
5815 COMPARE(Sri(v2.V16B(), v9.V16B(), 2), "sri v2.16b, v9.16b, #2");
5816 COMPARE(Sri(v3.V4H(), v1.V4H(), 3), "sri v3.4h, v1.4h, #3");
5817 COMPARE(Sri(v4.V8H(), v2.V8H(), 4), "sri v4.8h, v2.8h, #4");
5818 COMPARE(Sri(v5.V2S(), v3.V2S(), 5), "sri v5.2s, v3.2s, #5");
5819 COMPARE(Sri(v6.V4S(), v4.V4S(), 6), "sri v6.4s, v4.4s, #6");
5820 COMPARE(Sri(v7.V2D(), v5.V2D(), 7), "sri v7.2d, v5.2d, #7");
5821 COMPARE(Sri(d8, d6, 8), "sri d8, d6, #8");
5822
5823 COMPARE(Shrn(v0.V8B(), v1.V8H(), 1), "shrn v0.8b, v1.8h, #1");
5824 COMPARE(Shrn(v1.V4H(), v2.V4S(), 2), "shrn v1.4h, v2.4s, #2");
5825 COMPARE(Shrn(v2.V2S(), v3.V2D(), 3), "shrn v2.2s, v3.2d, #3");
5826 COMPARE(Shrn2(v0.V16B(), v1.V8H(), 4), "shrn2 v0.16b, v1.8h, #4");
5827 COMPARE(Shrn2(v1.V8H(), v2.V4S(), 5), "shrn2 v1.8h, v2.4s, #5");
5828 COMPARE(Shrn2(v2.V4S(), v3.V2D(), 6), "shrn2 v2.4s, v3.2d, #6");
5829
5830 COMPARE(Rshrn(v0.V8B(), v1.V8H(), 1), "rshrn v0.8b, v1.8h, #1");
5831 COMPARE(Rshrn(v1.V4H(), v2.V4S(), 2), "rshrn v1.4h, v2.4s, #2");
5832 COMPARE(Rshrn(v2.V2S(), v3.V2D(), 3), "rshrn v2.2s, v3.2d, #3");
5833 COMPARE(Rshrn2(v0.V16B(), v1.V8H(), 4), "rshrn2 v0.16b, v1.8h, #4");
5834 COMPARE(Rshrn2(v1.V8H(), v2.V4S(), 5), "rshrn2 v1.8h, v2.4s, #5");
5835 COMPARE(Rshrn2(v2.V4S(), v3.V2D(), 6), "rshrn2 v2.4s, v3.2d, #6");
5836
5837 COMPARE(Uqshrn(v0.V8B(), v1.V8H(), 1), "uqshrn v0.8b, v1.8h, #1");
5838 COMPARE(Uqshrn(v1.V4H(), v2.V4S(), 2), "uqshrn v1.4h, v2.4s, #2");
5839 COMPARE(Uqshrn(v2.V2S(), v3.V2D(), 3), "uqshrn v2.2s, v3.2d, #3");
5840 COMPARE(Uqshrn2(v0.V16B(), v1.V8H(), 4), "uqshrn2 v0.16b, v1.8h, #4");
5841 COMPARE(Uqshrn2(v1.V8H(), v2.V4S(), 5), "uqshrn2 v1.8h, v2.4s, #5");
5842 COMPARE(Uqshrn2(v2.V4S(), v3.V2D(), 6), "uqshrn2 v2.4s, v3.2d, #6");
5843 COMPARE(Uqshrn(b0, h1, 1), "uqshrn b0, h1, #1");
5844 COMPARE(Uqshrn(h1, s2, 2), "uqshrn h1, s2, #2");
5845 COMPARE(Uqshrn(s2, d3, 3), "uqshrn s2, d3, #3");
5846
5847 COMPARE(Uqrshrn(v0.V8B(), v1.V8H(), 1), "uqrshrn v0.8b, v1.8h, #1");
5848 COMPARE(Uqrshrn(v1.V4H(), v2.V4S(), 2), "uqrshrn v1.4h, v2.4s, #2");
5849 COMPARE(Uqrshrn(v2.V2S(), v3.V2D(), 3), "uqrshrn v2.2s, v3.2d, #3");
5850 COMPARE(Uqrshrn2(v0.V16B(), v1.V8H(), 4), "uqrshrn2 v0.16b, v1.8h, #4");
5851 COMPARE(Uqrshrn2(v1.V8H(), v2.V4S(), 5), "uqrshrn2 v1.8h, v2.4s, #5");
5852 COMPARE(Uqrshrn2(v2.V4S(), v3.V2D(), 6), "uqrshrn2 v2.4s, v3.2d, #6");
5853 COMPARE(Uqrshrn(b0, h1, 1), "uqrshrn b0, h1, #1");
5854 COMPARE(Uqrshrn(h1, s2, 2), "uqrshrn h1, s2, #2");
5855 COMPARE(Uqrshrn(s2, d3, 3), "uqrshrn s2, d3, #3");
5856
5857 COMPARE(Sqshrn(v0.V8B(), v1.V8H(), 1), "sqshrn v0.8b, v1.8h, #1");
5858 COMPARE(Sqshrn(v1.V4H(), v2.V4S(), 2), "sqshrn v1.4h, v2.4s, #2");
5859 COMPARE(Sqshrn(v2.V2S(), v3.V2D(), 3), "sqshrn v2.2s, v3.2d, #3");
5860 COMPARE(Sqshrn2(v0.V16B(), v1.V8H(), 4), "sqshrn2 v0.16b, v1.8h, #4");
5861 COMPARE(Sqshrn2(v1.V8H(), v2.V4S(), 5), "sqshrn2 v1.8h, v2.4s, #5");
5862 COMPARE(Sqshrn2(v2.V4S(), v3.V2D(), 6), "sqshrn2 v2.4s, v3.2d, #6");
5863 COMPARE(Sqshrn(b0, h1, 1), "sqshrn b0, h1, #1");
5864 COMPARE(Sqshrn(h1, s2, 2), "sqshrn h1, s2, #2");
5865 COMPARE(Sqshrn(s2, d3, 3), "sqshrn s2, d3, #3");
5866
5867 COMPARE(Sqrshrn(v0.V8B(), v1.V8H(), 1), "sqrshrn v0.8b, v1.8h, #1");
5868 COMPARE(Sqrshrn(v1.V4H(), v2.V4S(), 2), "sqrshrn v1.4h, v2.4s, #2");
5869 COMPARE(Sqrshrn(v2.V2S(), v3.V2D(), 3), "sqrshrn v2.2s, v3.2d, #3");
5870 COMPARE(Sqrshrn2(v0.V16B(), v1.V8H(), 4), "sqrshrn2 v0.16b, v1.8h, #4");
5871 COMPARE(Sqrshrn2(v1.V8H(), v2.V4S(), 5), "sqrshrn2 v1.8h, v2.4s, #5");
5872 COMPARE(Sqrshrn2(v2.V4S(), v3.V2D(), 6), "sqrshrn2 v2.4s, v3.2d, #6");
5873 COMPARE(Sqrshrn(b0, h1, 1), "sqrshrn b0, h1, #1");
5874 COMPARE(Sqrshrn(h1, s2, 2), "sqrshrn h1, s2, #2");
5875 COMPARE(Sqrshrn(s2, d3, 3), "sqrshrn s2, d3, #3");
5876
5877 COMPARE(Sqshrun(v0.V8B(), v1.V8H(), 1), "sqshrun v0.8b, v1.8h, #1");
5878 COMPARE(Sqshrun(v1.V4H(), v2.V4S(), 2), "sqshrun v1.4h, v2.4s, #2");
5879 COMPARE(Sqshrun(v2.V2S(), v3.V2D(), 3), "sqshrun v2.2s, v3.2d, #3");
5880 COMPARE(Sqshrun2(v0.V16B(), v1.V8H(), 4), "sqshrun2 v0.16b, v1.8h, #4");
5881 COMPARE(Sqshrun2(v1.V8H(), v2.V4S(), 5), "sqshrun2 v1.8h, v2.4s, #5");
5882 COMPARE(Sqshrun2(v2.V4S(), v3.V2D(), 6), "sqshrun2 v2.4s, v3.2d, #6");
5883 COMPARE(Sqshrun(b0, h1, 1), "sqshrun b0, h1, #1");
5884 COMPARE(Sqshrun(h1, s2, 2), "sqshrun h1, s2, #2");
5885 COMPARE(Sqshrun(s2, d3, 3), "sqshrun s2, d3, #3");
5886
5887 COMPARE(Sqrshrun(v0.V8B(), v1.V8H(), 1), "sqrshrun v0.8b, v1.8h, #1");
5888 COMPARE(Sqrshrun(v1.V4H(), v2.V4S(), 2), "sqrshrun v1.4h, v2.4s, #2");
5889 COMPARE(Sqrshrun(v2.V2S(), v3.V2D(), 3), "sqrshrun v2.2s, v3.2d, #3");
5890 COMPARE(Sqrshrun2(v0.V16B(), v1.V8H(), 4), "sqrshrun2 v0.16b, v1.8h, #4");
5891 COMPARE(Sqrshrun2(v1.V8H(), v2.V4S(), 5), "sqrshrun2 v1.8h, v2.4s, #5");
5892 COMPARE(Sqrshrun2(v2.V4S(), v3.V2D(), 6), "sqrshrun2 v2.4s, v3.2d, #6");
5893 COMPARE(Sqrshrun(b0, h1, 1), "sqrshrun b0, h1, #1");
5894 COMPARE(Sqrshrun(h1, s2, 2), "sqrshrun h1, s2, #2");
5895 COMPARE(Sqrshrun(s2, d3, 3), "sqrshrun s2, d3, #3");
5896
5897 COMPARE(Scvtf(v5.V2S(), v3.V2S(), 11), "scvtf v5.2s, v3.2s, #11");
5898 COMPARE(Scvtf(v6.V4S(), v4.V4S(), 12), "scvtf v6.4s, v4.4s, #12");
5899 COMPARE(Scvtf(v7.V2D(), v5.V2D(), 33), "scvtf v7.2d, v5.2d, #33");
5900 COMPARE(Scvtf(s8, s6, 13), "scvtf s8, s6, #13");
5901 COMPARE(Scvtf(d8, d6, 34), "scvtf d8, d6, #34");
5902
5903 COMPARE(Ucvtf(v5.V2S(), v3.V2S(), 11), "ucvtf v5.2s, v3.2s, #11");
5904 COMPARE(Ucvtf(v6.V4S(), v4.V4S(), 12), "ucvtf v6.4s, v4.4s, #12");
5905 COMPARE(Ucvtf(v7.V2D(), v5.V2D(), 33), "ucvtf v7.2d, v5.2d, #33");
5906 COMPARE(Ucvtf(s8, s6, 13), "ucvtf s8, s6, #13");
5907 COMPARE(Ucvtf(d8, d6, 34), "ucvtf d8, d6, #34");
5908
5909 COMPARE(Fcvtzs(v5.V2S(), v3.V2S(), 11), "fcvtzs v5.2s, v3.2s, #11");
5910 COMPARE(Fcvtzs(v6.V4S(), v4.V4S(), 12), "fcvtzs v6.4s, v4.4s, #12");
5911 COMPARE(Fcvtzs(v7.V2D(), v5.V2D(), 33), "fcvtzs v7.2d, v5.2d, #33");
5912 COMPARE(Fcvtzs(s8, s6, 13), "fcvtzs s8, s6, #13");
5913 COMPARE(Fcvtzs(d8, d6, 34), "fcvtzs d8, d6, #34");
5914
5915 COMPARE(Fcvtzu(v5.V2S(), v3.V2S(), 11), "fcvtzu v5.2s, v3.2s, #11");
5916 COMPARE(Fcvtzu(v6.V4S(), v4.V4S(), 12), "fcvtzu v6.4s, v4.4s, #12");
5917 COMPARE(Fcvtzu(v7.V2D(), v5.V2D(), 33), "fcvtzu v7.2d, v5.2d, #33");
5918 COMPARE(Fcvtzu(s8, s6, 13), "fcvtzu s8, s6, #13");
5919 COMPARE(Fcvtzu(d8, d6, 34), "fcvtzu d8, d6, #34");
5920
5921 CLEANUP();
5922}
5923
armvixl330dc712014-11-25 10:38:32 +00005924TEST(address_map) {
5925 // Check that we can disassemble from a fake base address.
5926 SETUP();
5927
5928 disasm->MapCodeAddress(0, reinterpret_cast<Instruction*>(buf));
5929 COMPARE(ldr(x0, 0), "ldr x0, pc+0 (addr 0x0)");
5930 COMPARE(ldr(x0, -1), "ldr x0, pc-4 (addr -0x4)");
5931 COMPARE(ldr(x0, 1), "ldr x0, pc+4 (addr 0x4)");
5932 COMPARE(prfm(PLIL1KEEP, 0), "prfm plil1keep, pc+0 (addr 0x0)");
5933 COMPARE(prfm(PLIL1KEEP, -1), "prfm plil1keep, pc-4 (addr -0x4)");
5934 COMPARE(prfm(PLIL1KEEP, 1), "prfm plil1keep, pc+4 (addr 0x4)");
5935 COMPARE(adr(x0, 0), "adr x0, #+0x0 (addr 0x0)");
5936 COMPARE(adr(x0, -1), "adr x0, #-0x1 (addr -0x1)");
5937 COMPARE(adr(x0, 1), "adr x0, #+0x1 (addr 0x1)");
5938 COMPARE(adrp(x0, 0), "adrp x0, #+0x0 (addr 0x0)");
5939 COMPARE(adrp(x0, -1), "adrp x0, #-0x1000 (addr -0x1000)");
5940 COMPARE(adrp(x0, 1), "adrp x0, #+0x1000 (addr 0x1000)");
5941 COMPARE(b(0), "b #+0x0 (addr 0x0)");
5942 COMPARE(b(-1), "b #-0x4 (addr -0x4)");
5943 COMPARE(b(1), "b #+0x4 (addr 0x4)");
5944
5945 disasm->MapCodeAddress(0x1234, reinterpret_cast<Instruction*>(buf));
5946 COMPARE(ldr(x0, 0), "ldr x0, pc+0 (addr 0x1234)");
5947 COMPARE(ldr(x0, -1), "ldr x0, pc-4 (addr 0x1230)");
5948 COMPARE(ldr(x0, 1), "ldr x0, pc+4 (addr 0x1238)");
5949 COMPARE(prfm(PLIL1KEEP, 0), "prfm plil1keep, pc+0 (addr 0x1234)");
5950 COMPARE(prfm(PLIL1KEEP, -1), "prfm plil1keep, pc-4 (addr 0x1230)");
5951 COMPARE(prfm(PLIL1KEEP, 1), "prfm plil1keep, pc+4 (addr 0x1238)");
5952 COMPARE(adr(x0, 0), "adr x0, #+0x0 (addr 0x1234)");
5953 COMPARE(adr(x0, -1), "adr x0, #-0x1 (addr 0x1233)");
5954 COMPARE(adr(x0, 1), "adr x0, #+0x1 (addr 0x1235)");
5955 COMPARE(adrp(x0, 0), "adrp x0, #+0x0 (addr 0x1000)");
5956 COMPARE(adrp(x0, -1), "adrp x0, #-0x1000 (addr 0x0)");
5957 COMPARE(adrp(x0, 1), "adrp x0, #+0x1000 (addr 0x2000)");
5958 COMPARE(b(0), "b #+0x0 (addr 0x1234)");
5959 COMPARE(b(-1), "b #-0x4 (addr 0x1230)");
5960 COMPARE(b(1), "b #+0x4 (addr 0x1238)");
5961
5962 // Check that 64-bit addresses work.
5963 disasm->MapCodeAddress(UINT64_C(0x100000000),
5964 reinterpret_cast<Instruction*>(buf));
5965 COMPARE(ldr(x0, 0), "ldr x0, pc+0 (addr 0x100000000)");
5966 COMPARE(ldr(x0, -1), "ldr x0, pc-4 (addr 0xfffffffc)");
5967 COMPARE(ldr(x0, 1), "ldr x0, pc+4 (addr 0x100000004)");
5968 COMPARE(prfm(PLIL1KEEP, 0), "prfm plil1keep, pc+0 (addr 0x100000000)");
5969 COMPARE(prfm(PLIL1KEEP, -1), "prfm plil1keep, pc-4 (addr 0xfffffffc)");
5970 COMPARE(prfm(PLIL1KEEP, 1), "prfm plil1keep, pc+4 (addr 0x100000004)");
5971 COMPARE(adr(x0, 0), "adr x0, #+0x0 (addr 0x100000000)");
5972 COMPARE(adr(x0, -1), "adr x0, #-0x1 (addr 0xffffffff)");
5973 COMPARE(adr(x0, 1), "adr x0, #+0x1 (addr 0x100000001)");
5974 COMPARE(adrp(x0, 0), "adrp x0, #+0x0 (addr 0x100000000)");
5975 COMPARE(adrp(x0, -1), "adrp x0, #-0x1000 (addr 0xfffff000)");
5976 COMPARE(adrp(x0, 1), "adrp x0, #+0x1000 (addr 0x100001000)");
5977 COMPARE(b(0), "b #+0x0 (addr 0x100000000)");
5978 COMPARE(b(-1), "b #-0x4 (addr 0xfffffffc)");
5979 COMPARE(b(1), "b #+0x4 (addr 0x100000004)");
5980
5981 disasm->MapCodeAddress(0xfffffffc, reinterpret_cast<Instruction*>(buf));
5982 COMPARE(ldr(x0, 1), "ldr x0, pc+4 (addr 0x100000000)");
5983 COMPARE(prfm(PLIL1KEEP, 1), "prfm plil1keep, pc+4 (addr 0x100000000)");
5984 COMPARE(b(1), "b #+0x4 (addr 0x100000000)");
5985 COMPARE(adr(x0, 4), "adr x0, #+0x4 (addr 0x100000000)");
5986 COMPARE(adrp(x0, 1), "adrp x0, #+0x1000 (addr 0x100000000)");
5987
5988 // Check that very large offsets are handled properly. This detects misuse of
5989 // the host's ptrdiff_t type when run on a 32-bit host. Only adrp is capable
5990 // of encoding such offsets.
5991 disasm->MapCodeAddress(0, reinterpret_cast<Instruction*>(buf));
5992 COMPARE(adrp(x0, 0x000fffff), "adrp x0, #+0xfffff000 (addr 0xfffff000)");
5993 COMPARE(adrp(x0, -0x00100000), "adrp x0, #-0x100000000 (addr -0x100000000)");
5994
5995 CLEANUP();
5996}
armvixl5289c592015-03-02 13:52:04 +00005997
armvixlad96eda2013-06-14 11:42:37 +01005998} // namespace vixl