blob: 9b8b368cc3f6873ae10622267bace18f7765dc88 [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>
Alexandre Ramesb68bacb2016-05-24 08:56:23 +010028
armvixlad96eda2013-06-14 11:42:37 +010029#include <cstring>
armvixl0f35e362016-05-10 13:57:58 +010030#include <string>
Alexandre Ramesb68bacb2016-05-24 08:56:23 +010031
armvixl330dc712014-11-25 10:38:32 +000032#include "test-runner.h"
armvixlad96eda2013-06-14 11:42:37 +010033
Alexandre Rames39c32a62016-05-23 15:47:22 +010034#include "a64/disasm-a64.h"
Alexandre Ramesb68bacb2016-05-24 08:56:23 +010035#include "a64/macro-assembler-a64.h"
armvixlad96eda2013-06-14 11:42:37 +010036
37#define TEST(name) TEST_(DISASM_##name)
38
39#define EXP_SIZE (256)
40#define INSTR_SIZE (1024)
41#define SETUP_CLASS(ASMCLASS) \
armvixlc68cb642014-09-25 18:49:30 +010042 byte* buf = new byte[INSTR_SIZE]; \
armvixlad96eda2013-06-14 11:42:37 +010043 uint32_t encoding = 0; \
44 ASMCLASS* masm = new ASMCLASS(buf, INSTR_SIZE); \
45 Decoder* decoder = new Decoder(); \
46 Disassembler* disasm = new Disassembler(); \
47 decoder->AppendVisitor(disasm)
48
49#define SETUP() SETUP_CLASS(Assembler)
50
armvixl684cd2a2015-10-23 13:38:33 +010051#ifdef VIXL_INCLUDE_SIMULATOR
52// Run tests with the simulator.
53#define SETUP_MACRO() \
54 SETUP_CLASS(MacroAssembler); \
55 masm->SetAllowSimulatorInstructions(true)
56
57#else // ifdef VIXL_INCLUDE_SIMULATOR.
58#define SETUP_MACRO() \
59 SETUP_CLASS(MacroAssembler); \
60 masm->SetAllowSimulatorInstructions(false)
61
62#endif // ifdef VIXL_INCLUDE_SIMULATOR.
armvixlc68cb642014-09-25 18:49:30 +010063
armvixlad96eda2013-06-14 11:42:37 +010064#define COMPARE(ASM, EXP) \
65 masm->Reset(); \
armvixlc68cb642014-09-25 18:49:30 +010066 { \
67 CodeBufferCheckScope blind(masm); \
68 masm->ASM; \
69 } \
armvixlad96eda2013-06-14 11:42:37 +010070 masm->FinalizeCode(); \
71 decoder->Decode(reinterpret_cast<Instruction*>(buf)); \
72 encoding = *reinterpret_cast<uint32_t*>(buf); \
73 if (strcmp(disasm->GetOutput(), EXP) != 0) { \
armvixl330dc712014-11-25 10:38:32 +000074 printf("\nEncoding: %08" PRIx32 "\nExpected: %s\nFound: %s\n", \
armvixlad96eda2013-06-14 11:42:37 +010075 encoding, EXP, disasm->GetOutput()); \
76 abort(); \
armvixl330dc712014-11-25 10:38:32 +000077 } \
78 if (Test::trace_sim()) { \
79 printf("%08" PRIx32 "\t%s\n", encoding, disasm->GetOutput()); \
armvixlad96eda2013-06-14 11:42:37 +010080 }
81
armvixl578645f2013-08-15 17:21:42 +010082#define COMPARE_PREFIX(ASM, EXP) \
83 masm->Reset(); \
armvixlc68cb642014-09-25 18:49:30 +010084 { \
85 CodeBufferCheckScope blind(masm); \
86 masm->ASM; \
87 } \
88 masm->FinalizeCode(); \
89 decoder->Decode(reinterpret_cast<Instruction*>(buf)); \
90 encoding = *reinterpret_cast<uint32_t*>(buf); \
91 if (strncmp(disasm->GetOutput(), EXP, strlen(EXP)) != 0) { \
armvixl330dc712014-11-25 10:38:32 +000092 printf("\nEncoding: %08" PRIx32 "\nExpected: %s\nFound: %s\n", \
armvixlc68cb642014-09-25 18:49:30 +010093 encoding, EXP, disasm->GetOutput()); \
94 abort(); \
armvixl330dc712014-11-25 10:38:32 +000095 } \
96 if (Test::trace_sim()) { \
97 printf("%08" PRIx32 "\t%s\n", encoding, disasm->GetOutput()); \
armvixlc68cb642014-09-25 18:49:30 +010098 }
99
armvixl0f35e362016-05-10 13:57:58 +0100100#define COMPARE_MACRO_BASE(ASM, EXP) \
armvixlc68cb642014-09-25 18:49:30 +0100101 masm->Reset(); \
armvixl578645f2013-08-15 17:21:42 +0100102 masm->ASM; \
103 masm->FinalizeCode(); \
armvixl0f35e362016-05-10 13:57:58 +0100104 std::string res; \
105 \
106 Instruction* instruction = masm->GetOffsetAddress<Instruction*>(0); \
107 Instruction* end = masm->GetOffsetAddress<Instruction*>( \
108 masm->SizeOfCodeGenerated()); \
109 while (instruction != end) { \
110 decoder->Decode(instruction); \
111 res.append(disasm->GetOutput()); \
112 if (Test::trace_sim()) { \
113 encoding = *reinterpret_cast<uint32_t*>(instruction); \
114 printf("%08" PRIx32 "\t%s\n", encoding, disasm->GetOutput()); \
115 } \
116 instruction += kInstructionSize; \
117 if (instruction != end) { \
118 res.append("\n"); \
119 } \
120 }
121
122#define COMPARE_MACRO(ASM, EXP) \
123 { \
124 COMPARE_MACRO_BASE(ASM, EXP) \
125 if (strcmp(res.c_str(), EXP) != 0) { \
126 printf("Expected: %s\nFound: %s\n", EXP, res.c_str()); \
127 abort(); \
128 } \
129 }
130
131#define COMPARE_MACRO_PREFIX(ASM, EXP) \
132 { \
133 COMPARE_MACRO_BASE(ASM, EXP) \
134 if (strncmp(res.c_str(), EXP, strlen(EXP)) != 0) { \
135 printf("Expected (prefix): %s\nFound: %s\n", EXP, res.c_str()); \
136 abort(); \
137 } \
armvixl578645f2013-08-15 17:21:42 +0100138 }
139
armvixlad96eda2013-06-14 11:42:37 +0100140#define CLEANUP() \
141 delete disasm; \
142 delete decoder; \
armvixlc68cb642014-09-25 18:49:30 +0100143 delete masm; \
armvixldb644342015-07-21 11:37:10 +0100144 delete[] buf
armvixlad96eda2013-06-14 11:42:37 +0100145
146namespace vixl {
147
148TEST(bootstrap) {
149 SETUP();
150
151 // Instructions generated by C compiler, disassembled by objdump, and
152 // reformatted to suit our disassembly style.
153 COMPARE(dci(0xa9ba7bfd), "stp x29, x30, [sp, #-96]!");
154 COMPARE(dci(0x910003fd), "mov x29, sp");
155 COMPARE(dci(0x9100e3a0), "add x0, x29, #0x38 (56)");
156 COMPARE(dci(0xb900001f), "str wzr, [x0]");
armvixl330dc712014-11-25 10:38:32 +0000157 COMPARE(dci(0x528000e1), "mov w1, #0x7");
armvixlad96eda2013-06-14 11:42:37 +0100158 COMPARE(dci(0xb9001c01), "str w1, [x0, #28]");
159 COMPARE(dci(0x390043a0), "strb w0, [x29, #16]");
160 COMPARE(dci(0x790027a0), "strh w0, [x29, #18]");
161 COMPARE(dci(0xb9400400), "ldr w0, [x0, #4]");
162 COMPARE(dci(0x0b000021), "add w1, w1, w0");
163 COMPARE(dci(0x531b6800), "lsl w0, w0, #5");
164 COMPARE(dci(0x521e0400), "eor w0, w0, #0xc");
165 COMPARE(dci(0x72af0f00), "movk w0, #0x7878, lsl #16");
166 COMPARE(dci(0xd360fc00), "lsr x0, x0, #32");
167 COMPARE(dci(0x13037c01), "asr w1, w0, #3");
168 COMPARE(dci(0x4b000021), "sub w1, w1, w0");
169 COMPARE(dci(0x2a0103e0), "mov w0, w1");
170 COMPARE(dci(0x93407c00), "sxtw x0, w0");
171 COMPARE(dci(0x2a000020), "orr w0, w1, w0");
172 COMPARE(dci(0xa8c67bfd), "ldp x29, x30, [sp], #96");
173
174 CLEANUP();
175}
176
armvixl4a102ba2014-07-14 09:02:40 +0100177
armvixlad96eda2013-06-14 11:42:37 +0100178TEST(mov_mvn) {
armvixl684cd2a2015-10-23 13:38:33 +0100179 SETUP_MACRO();
armvixlad96eda2013-06-14 11:42:37 +0100180
armvixl330dc712014-11-25 10:38:32 +0000181 COMPARE(Mov(w0, Operand(0x1234)), "mov w0, #0x1234");
182 COMPARE(Mov(x1, Operand(0x1234)), "mov x1, #0x1234");
armvixlad96eda2013-06-14 11:42:37 +0100183 COMPARE(Mov(w2, Operand(w3)), "mov w2, w3");
184 COMPARE(Mov(x4, Operand(x5)), "mov x4, x5");
185 COMPARE(Mov(w6, Operand(w7, LSL, 5)), "lsl w6, w7, #5");
186 COMPARE(Mov(x8, Operand(x9, ASR, 42)), "asr x8, x9, #42");
187 COMPARE(Mov(w10, Operand(w11, UXTB)), "uxtb w10, w11");
188 COMPARE(Mov(x12, Operand(x13, UXTB, 1)), "ubfiz x12, x13, #1, #8");
189 COMPARE(Mov(w14, Operand(w15, SXTH, 2)), "sbfiz w14, w15, #2, #16");
190 COMPARE(Mov(x16, Operand(x17, SXTW, 3)), "sbfiz x16, x17, #3, #32");
191
armvixl330dc712014-11-25 10:38:32 +0000192 COMPARE(Mvn(w0, Operand(0x101)), "mov w0, #0xfffffefe");
193 COMPARE(Mvn(x1, Operand(0xfff1)), "mov x1, #0xffffffffffff000e");
armvixlad96eda2013-06-14 11:42:37 +0100194 COMPARE(Mvn(w2, Operand(w3)), "mvn w2, w3");
195 COMPARE(Mvn(x4, Operand(x5)), "mvn x4, x5");
196 COMPARE(Mvn(w6, Operand(w7, LSL, 12)), "mvn w6, w7, lsl #12");
197 COMPARE(Mvn(x8, Operand(x9, ASR, 63)), "mvn x8, x9, asr #63");
198
199 CLEANUP();
200}
201
armvixl4a102ba2014-07-14 09:02:40 +0100202
armvixlad96eda2013-06-14 11:42:37 +0100203TEST(move_immediate) {
204 SETUP();
205
armvixl330dc712014-11-25 10:38:32 +0000206 COMPARE(movz(w0, 0x1234), "mov w0, #0x1234");
207 COMPARE(movz(x1, 0xabcd0000), "mov x1, #0xabcd0000");
208 COMPARE(movz(x2, 0x555500000000), "mov x2, #0x555500000000");
209 COMPARE(movz(x3, 0xaaaa000000000000), "mov x3, #0xaaaa000000000000");
210 COMPARE(movz(x4, 0xabcd, 16), "mov x4, #0xabcd0000");
211 COMPARE(movz(x5, 0x5555, 32), "mov x5, #0x555500000000");
212 COMPARE(movz(x6, 0xaaaa, 48), "mov x6, #0xaaaa000000000000");
armvixlad96eda2013-06-14 11:42:37 +0100213
214 COMPARE(movk(w7, 0x1234), "movk w7, #0x1234");
215 COMPARE(movk(x8, 0xabcd0000), "movk x8, #0xabcd, lsl #16");
216 COMPARE(movk(x9, 0x555500000000), "movk x9, #0x5555, lsl #32");
217 COMPARE(movk(x10, 0xaaaa000000000000), "movk x10, #0xaaaa, lsl #48");
218 COMPARE(movk(w11, 0xabcd, 16), "movk w11, #0xabcd, lsl #16");
219 COMPARE(movk(x12, 0x5555, 32), "movk x12, #0x5555, lsl #32");
220 COMPARE(movk(x13, 0xaaaa, 48), "movk x13, #0xaaaa, lsl #48");
221
armvixl330dc712014-11-25 10:38:32 +0000222 COMPARE(movn(w14, 0x1234), "mov w14, #0xffffedcb");
223 COMPARE(movn(x15, 0xabcd0000), "mov x15, #0xffffffff5432ffff");
224 COMPARE(movn(x16, 0x555500000000), "mov x16, #0xffffaaaaffffffff");
225 COMPARE(movn(x17, 0xaaaa000000000000), "mov x17, #0x5555ffffffffffff");
226 COMPARE(movn(w18, 0xabcd, 16), "mov w18, #0x5432ffff");
227 COMPARE(movn(x19, 0x5555, 32), "mov x19, #0xffffaaaaffffffff");
228 COMPARE(movn(x20, 0xaaaa, 48), "mov x20, #0x5555ffffffffffff");
armvixlad96eda2013-06-14 11:42:37 +0100229
230 COMPARE(movk(w21, 0), "movk w21, #0x0");
231 COMPARE(movk(x22, 0, 0), "movk x22, #0x0");
232 COMPARE(movk(w23, 0, 16), "movk w23, #0x0, lsl #16");
233 COMPARE(movk(x24, 0, 32), "movk x24, #0x0, lsl #32");
234 COMPARE(movk(x25, 0, 48), "movk x25, #0x0, lsl #48");
235
armvixl330dc712014-11-25 10:38:32 +0000236 COMPARE(movz(x26, 0, 48), "movz x26, #0x0");
237 COMPARE(movn(x27, 0, 48), "movn x27, #0x0");
238 COMPARE(movn(w28, 0xffff), "movn w28, #0xffff");
239
armvixlad96eda2013-06-14 11:42:37 +0100240 CLEANUP();
241}
242
armvixl4a102ba2014-07-14 09:02:40 +0100243
armvixlf37fdc02014-02-05 13:22:16 +0000244TEST(move_immediate_2) {
armvixl684cd2a2015-10-23 13:38:33 +0100245 SETUP_MACRO();
armvixlf37fdc02014-02-05 13:22:16 +0000246
247 // Move instructions expected for certain immediates. This is really a macro
248 // assembler test, to ensure it generates immediates efficiently.
armvixl330dc712014-11-25 10:38:32 +0000249 COMPARE(Mov(w0, 0), "mov w0, #0x0");
250 COMPARE(Mov(w0, 0x0000ffff), "mov w0, #0xffff");
251 COMPARE(Mov(w0, 0x00010000), "mov w0, #0x10000");
252 COMPARE(Mov(w0, 0xffff0000), "mov w0, #0xffff0000");
253 COMPARE(Mov(w0, 0x0001ffff), "mov w0, #0x1ffff");
254 COMPARE(Mov(w0, 0xffff8000), "mov w0, #0xffff8000");
255 COMPARE(Mov(w0, 0xfffffffe), "mov w0, #0xfffffffe");
256 COMPARE(Mov(w0, 0xffffffff), "mov w0, #0xffffffff");
armvixlf37fdc02014-02-05 13:22:16 +0000257 COMPARE(Mov(w0, 0x00ffff00), "mov w0, #0xffff00");
258 COMPARE(Mov(w0, 0xfffe7fff), "mov w0, #0xfffe7fff");
armvixl330dc712014-11-25 10:38:32 +0000259 COMPARE(Mov(w0, 0xfffeffff), "mov w0, #0xfffeffff");
260 COMPARE(Mov(w0, 0xffff7fff), "mov w0, #0xffff7fff");
armvixlf37fdc02014-02-05 13:22:16 +0000261
armvixl330dc712014-11-25 10:38:32 +0000262 COMPARE(Mov(x0, 0), "mov x0, #0x0");
263 COMPARE(Mov(x0, 0x0000ffff), "mov x0, #0xffff");
264 COMPARE(Mov(x0, 0x00010000), "mov x0, #0x10000");
265 COMPARE(Mov(x0, 0xffff0000), "mov x0, #0xffff0000");
armvixlf37fdc02014-02-05 13:22:16 +0000266 COMPARE(Mov(x0, 0x0001ffff), "mov x0, #0x1ffff");
267 COMPARE(Mov(x0, 0xffff8000), "mov x0, #0xffff8000");
268 COMPARE(Mov(x0, 0xfffffffe), "mov x0, #0xfffffffe");
269 COMPARE(Mov(x0, 0xffffffff), "mov x0, #0xffffffff");
270 COMPARE(Mov(x0, 0x00ffff00), "mov x0, #0xffff00");
armvixl330dc712014-11-25 10:38:32 +0000271 COMPARE(Mov(x0, 0xffff000000000000), "mov x0, #0xffff000000000000");
272 COMPARE(Mov(x0, 0x0000ffff00000000), "mov x0, #0xffff00000000");
273 COMPARE(Mov(x0, 0x00000000ffff0000), "mov x0, #0xffff0000");
274 COMPARE(Mov(x0, 0xffffffffffff0000), "mov x0, #0xffffffffffff0000");
275 COMPARE(Mov(x0, 0xffffffff0000ffff), "mov x0, #0xffffffff0000ffff");
276 COMPARE(Mov(x0, 0xffff0000ffffffff), "mov x0, #0xffff0000ffffffff");
277 COMPARE(Mov(x0, 0x0000ffffffffffff), "mov x0, #0xffffffffffff");
armvixlf37fdc02014-02-05 13:22:16 +0000278 COMPARE(Mov(x0, 0xfffe7fffffffffff), "mov x0, #0xfffe7fffffffffff");
armvixl330dc712014-11-25 10:38:32 +0000279 COMPARE(Mov(x0, 0xfffeffffffffffff), "mov x0, #0xfffeffffffffffff");
280 COMPARE(Mov(x0, 0xffff7fffffffffff), "mov x0, #0xffff7fffffffffff");
armvixlf37fdc02014-02-05 13:22:16 +0000281 COMPARE(Mov(x0, 0xfffffffe7fffffff), "mov x0, #0xfffffffe7fffffff");
armvixl330dc712014-11-25 10:38:32 +0000282 COMPARE(Mov(x0, 0xfffffffeffffffff), "mov x0, #0xfffffffeffffffff");
283 COMPARE(Mov(x0, 0xffffffff7fffffff), "mov x0, #0xffffffff7fffffff");
armvixlf37fdc02014-02-05 13:22:16 +0000284 COMPARE(Mov(x0, 0xfffffffffffe7fff), "mov x0, #0xfffffffffffe7fff");
armvixl330dc712014-11-25 10:38:32 +0000285 COMPARE(Mov(x0, 0xfffffffffffeffff), "mov x0, #0xfffffffffffeffff");
286 COMPARE(Mov(x0, 0xffffffffffff7fff), "mov x0, #0xffffffffffff7fff");
287 COMPARE(Mov(x0, 0xffffffffffffffff), "mov x0, #0xffffffffffffffff");
armvixlf37fdc02014-02-05 13:22:16 +0000288
289 COMPARE(Movk(w0, 0x1234, 0), "movk w0, #0x1234");
290 COMPARE(Movk(x1, 0x2345, 0), "movk x1, #0x2345");
291 COMPARE(Movk(w2, 0x3456, 16), "movk w2, #0x3456, lsl #16");
292 COMPARE(Movk(x3, 0x4567, 16), "movk x3, #0x4567, lsl #16");
293 COMPARE(Movk(x4, 0x5678, 32), "movk x4, #0x5678, lsl #32");
294 COMPARE(Movk(x5, 0x6789, 48), "movk x5, #0x6789, lsl #48");
295
296 CLEANUP();
297}
298
armvixl4a102ba2014-07-14 09:02:40 +0100299
armvixlad96eda2013-06-14 11:42:37 +0100300TEST(add_immediate) {
301 SETUP();
302
303 COMPARE(add(w0, w1, Operand(0xff)), "add w0, w1, #0xff (255)");
304 COMPARE(add(x2, x3, Operand(0x3ff)), "add x2, x3, #0x3ff (1023)");
305 COMPARE(add(w4, w5, Operand(0xfff)), "add w4, w5, #0xfff (4095)");
306 COMPARE(add(x6, x7, Operand(0x1000)), "add x6, x7, #0x1000 (4096)");
307 COMPARE(add(w8, w9, Operand(0xff000)), "add w8, w9, #0xff000 (1044480)");
308 COMPARE(add(x10, x11, Operand(0x3ff000)),
309 "add x10, x11, #0x3ff000 (4190208)");
310 COMPARE(add(w12, w13, Operand(0xfff000)),
311 "add w12, w13, #0xfff000 (16773120)");
armvixlf37fdc02014-02-05 13:22:16 +0000312 COMPARE(adds(w14, w15, Operand(0xff)), "adds w14, w15, #0xff (255)");
313 COMPARE(adds(x16, x17, Operand(0xaa000)), "adds x16, x17, #0xaa000 (696320)");
314
armvixlad96eda2013-06-14 11:42:37 +0100315 COMPARE(cmn(w18, Operand(0xff)), "cmn w18, #0xff (255)");
316 COMPARE(cmn(x19, Operand(0xff000)), "cmn x19, #0xff000 (1044480)");
317 COMPARE(add(w0, wsp, Operand(0)), "mov w0, wsp");
318 COMPARE(add(sp, x0, Operand(0)), "mov sp, x0");
319
320 COMPARE(add(w1, wsp, Operand(8)), "add w1, wsp, #0x8 (8)");
321 COMPARE(add(x2, sp, Operand(16)), "add x2, sp, #0x10 (16)");
322 COMPARE(add(wsp, wsp, Operand(42)), "add wsp, wsp, #0x2a (42)");
323 COMPARE(cmn(sp, Operand(24)), "cmn sp, #0x18 (24)");
armvixlf37fdc02014-02-05 13:22:16 +0000324 COMPARE(adds(wzr, wsp, Operand(9)), "cmn wsp, #0x9 (9)");
armvixlad96eda2013-06-14 11:42:37 +0100325
326 CLEANUP();
327}
328
armvixl4a102ba2014-07-14 09:02:40 +0100329
armvixlad96eda2013-06-14 11:42:37 +0100330TEST(sub_immediate) {
331 SETUP();
332
333 COMPARE(sub(w0, w1, Operand(0xff)), "sub w0, w1, #0xff (255)");
334 COMPARE(sub(x2, x3, Operand(0x3ff)), "sub x2, x3, #0x3ff (1023)");
335 COMPARE(sub(w4, w5, Operand(0xfff)), "sub w4, w5, #0xfff (4095)");
336 COMPARE(sub(x6, x7, Operand(0x1000)), "sub x6, x7, #0x1000 (4096)");
337 COMPARE(sub(w8, w9, Operand(0xff000)), "sub w8, w9, #0xff000 (1044480)");
338 COMPARE(sub(x10, x11, Operand(0x3ff000)),
339 "sub x10, x11, #0x3ff000 (4190208)");
340 COMPARE(sub(w12, w13, Operand(0xfff000)),
341 "sub w12, w13, #0xfff000 (16773120)");
armvixlf37fdc02014-02-05 13:22:16 +0000342 COMPARE(subs(w14, w15, Operand(0xff)), "subs w14, w15, #0xff (255)");
343 COMPARE(subs(x16, x17, Operand(0xaa000)), "subs x16, x17, #0xaa000 (696320)");
armvixlad96eda2013-06-14 11:42:37 +0100344 COMPARE(cmp(w18, Operand(0xff)), "cmp w18, #0xff (255)");
345 COMPARE(cmp(x19, Operand(0xff000)), "cmp x19, #0xff000 (1044480)");
346
347 COMPARE(sub(w1, wsp, Operand(8)), "sub w1, wsp, #0x8 (8)");
348 COMPARE(sub(x2, sp, Operand(16)), "sub x2, sp, #0x10 (16)");
349 COMPARE(sub(wsp, wsp, Operand(42)), "sub wsp, wsp, #0x2a (42)");
350 COMPARE(cmp(sp, Operand(24)), "cmp sp, #0x18 (24)");
armvixlf37fdc02014-02-05 13:22:16 +0000351 COMPARE(subs(wzr, wsp, Operand(9)), "cmp wsp, #0x9 (9)");
armvixlad96eda2013-06-14 11:42:37 +0100352
353 CLEANUP();
354}
355
356
357TEST(add_shifted) {
358 SETUP();
359
360 COMPARE(add(w0, w1, Operand(w2)), "add w0, w1, w2");
361 COMPARE(add(x3, x4, Operand(x5)), "add x3, x4, x5");
362 COMPARE(add(w6, w7, Operand(w8, LSL, 1)), "add w6, w7, w8, lsl #1");
363 COMPARE(add(x9, x10, Operand(x11, LSL, 2)), "add x9, x10, x11, lsl #2");
364 COMPARE(add(w12, w13, Operand(w14, LSR, 3)), "add w12, w13, w14, lsr #3");
365 COMPARE(add(x15, x16, Operand(x17, LSR, 4)), "add x15, x16, x17, lsr #4");
366 COMPARE(add(w18, w19, Operand(w20, ASR, 5)), "add w18, w19, w20, asr #5");
367 COMPARE(add(x21, x22, Operand(x23, ASR, 6)), "add x21, x22, x23, asr #6");
368 COMPARE(cmn(w24, Operand(w25)), "cmn w24, w25");
369 COMPARE(cmn(x26, Operand(x27, LSL, 63)), "cmn x26, x27, lsl #63");
370
371 COMPARE(add(x0, sp, Operand(x1)), "add x0, sp, x1");
372 COMPARE(add(w2, wsp, Operand(w3)), "add w2, wsp, w3");
373 COMPARE(add(x4, sp, Operand(x5, LSL, 1)), "add x4, sp, x5, lsl #1");
374 COMPARE(add(x4, xzr, Operand(x5, LSL, 1)), "add x4, xzr, x5, lsl #1");
375 COMPARE(add(w6, wsp, Operand(w7, LSL, 3)), "add w6, wsp, w7, lsl #3");
armvixlf37fdc02014-02-05 13:22:16 +0000376 COMPARE(adds(xzr, sp, Operand(x8, LSL, 4)), "cmn sp, x8, lsl #4");
377 COMPARE(adds(xzr, xzr, Operand(x8, LSL, 5)), "cmn xzr, x8, lsl #5");
armvixlad96eda2013-06-14 11:42:37 +0100378
379 CLEANUP();
380}
381
382
383TEST(sub_shifted) {
384 SETUP();
385
386 COMPARE(sub(w0, w1, Operand(w2)), "sub w0, w1, w2");
387 COMPARE(sub(x3, x4, Operand(x5)), "sub x3, x4, x5");
388 COMPARE(sub(w6, w7, Operand(w8, LSL, 1)), "sub w6, w7, w8, lsl #1");
389 COMPARE(sub(x9, x10, Operand(x11, LSL, 2)), "sub x9, x10, x11, lsl #2");
390 COMPARE(sub(w12, w13, Operand(w14, LSR, 3)), "sub w12, w13, w14, lsr #3");
391 COMPARE(sub(x15, x16, Operand(x17, LSR, 4)), "sub x15, x16, x17, lsr #4");
392 COMPARE(sub(w18, w19, Operand(w20, ASR, 5)), "sub w18, w19, w20, asr #5");
393 COMPARE(sub(x21, x22, Operand(x23, ASR, 6)), "sub x21, x22, x23, asr #6");
394 COMPARE(cmp(w24, Operand(w25)), "cmp w24, w25");
395 COMPARE(cmp(x26, Operand(x27, LSL, 63)), "cmp x26, x27, lsl #63");
396 COMPARE(neg(w28, Operand(w29)), "neg w28, w29");
397 COMPARE(neg(x30, Operand(x0, LSR, 62)), "neg x30, x0, lsr #62");
armvixlf37fdc02014-02-05 13:22:16 +0000398 COMPARE(negs(w1, Operand(w2)), "negs w1, w2");
399 COMPARE(negs(x3, Operand(x4, ASR, 61)), "negs x3, x4, asr #61");
armvixlad96eda2013-06-14 11:42:37 +0100400
401 COMPARE(sub(x0, sp, Operand(x1)), "sub x0, sp, x1");
402 COMPARE(sub(w2, wsp, Operand(w3)), "sub w2, wsp, w3");
403 COMPARE(sub(x4, sp, Operand(x5, LSL, 1)), "sub x4, sp, x5, lsl #1");
404 COMPARE(sub(x4, xzr, Operand(x5, LSL, 1)), "neg x4, x5, lsl #1");
405 COMPARE(sub(w6, wsp, Operand(w7, LSL, 3)), "sub w6, wsp, w7, lsl #3");
armvixlf37fdc02014-02-05 13:22:16 +0000406 COMPARE(subs(xzr, sp, Operand(x8, LSL, 4)), "cmp sp, x8, lsl #4");
407 COMPARE(subs(xzr, xzr, Operand(x8, LSL, 5)), "cmp xzr, x8, lsl #5");
armvixlad96eda2013-06-14 11:42:37 +0100408
409 CLEANUP();
410}
411
412
413TEST(add_extended) {
414 SETUP();
415
416 COMPARE(add(w0, w1, Operand(w2, UXTB)), "add w0, w1, w2, uxtb");
armvixlf37fdc02014-02-05 13:22:16 +0000417 COMPARE(adds(x3, x4, Operand(w5, UXTB, 1)), "adds x3, x4, w5, uxtb #1");
armvixlad96eda2013-06-14 11:42:37 +0100418 COMPARE(add(w6, w7, Operand(w8, UXTH, 2)), "add w6, w7, w8, uxth #2");
armvixlf37fdc02014-02-05 13:22:16 +0000419 COMPARE(adds(x9, x10, Operand(x11, UXTW, 3)), "adds x9, x10, w11, uxtw #3");
armvixlad96eda2013-06-14 11:42:37 +0100420 COMPARE(add(x12, x13, Operand(x14, UXTX, 4)), "add x12, x13, x14, uxtx #4");
armvixlf37fdc02014-02-05 13:22:16 +0000421 COMPARE(adds(w15, w16, Operand(w17, SXTB, 4)), "adds w15, w16, w17, sxtb #4");
armvixlad96eda2013-06-14 11:42:37 +0100422 COMPARE(add(x18, x19, Operand(x20, SXTB, 3)), "add x18, x19, w20, sxtb #3");
armvixlf37fdc02014-02-05 13:22:16 +0000423 COMPARE(adds(w21, w22, Operand(w23, SXTH, 2)), "adds w21, w22, w23, sxth #2");
armvixlad96eda2013-06-14 11:42:37 +0100424 COMPARE(add(x24, x25, Operand(x26, SXTW, 1)), "add x24, x25, w26, sxtw #1");
armvixlf37fdc02014-02-05 13:22:16 +0000425 COMPARE(adds(x27, x28, Operand(x29, SXTX)), "adds x27, x28, x29, sxtx");
armvixlad96eda2013-06-14 11:42:37 +0100426 COMPARE(cmn(w0, Operand(w1, UXTB, 2)), "cmn w0, w1, uxtb #2");
427 COMPARE(cmn(x2, Operand(x3, SXTH, 4)), "cmn x2, w3, sxth #4");
428
429 COMPARE(add(w0, wsp, Operand(w1, UXTB)), "add w0, wsp, w1, uxtb");
430 COMPARE(add(x2, sp, Operand(x3, UXTH, 1)), "add x2, sp, w3, uxth #1");
431 COMPARE(add(wsp, wsp, Operand(w4, UXTW, 2)), "add wsp, wsp, w4, lsl #2");
432 COMPARE(cmn(sp, Operand(xzr, UXTX, 3)), "cmn sp, xzr, lsl #3");
433 COMPARE(cmn(sp, Operand(xzr, LSL, 4)), "cmn sp, xzr, lsl #4");
434
435 CLEANUP();
436}
437
438
439TEST(sub_extended) {
440 SETUP();
441
442 COMPARE(sub(w0, w1, Operand(w2, UXTB)), "sub w0, w1, w2, uxtb");
armvixlf37fdc02014-02-05 13:22:16 +0000443 COMPARE(subs(x3, x4, Operand(w5, UXTB, 1)), "subs x3, x4, w5, uxtb #1");
armvixlad96eda2013-06-14 11:42:37 +0100444 COMPARE(sub(w6, w7, Operand(w8, UXTH, 2)), "sub w6, w7, w8, uxth #2");
armvixlf37fdc02014-02-05 13:22:16 +0000445 COMPARE(subs(x9, x10, Operand(x11, UXTW, 3)), "subs x9, x10, w11, uxtw #3");
armvixlad96eda2013-06-14 11:42:37 +0100446 COMPARE(sub(x12, x13, Operand(x14, UXTX, 4)), "sub x12, x13, x14, uxtx #4");
armvixlf37fdc02014-02-05 13:22:16 +0000447 COMPARE(subs(w15, w16, Operand(w17, SXTB, 4)), "subs w15, w16, w17, sxtb #4");
armvixlad96eda2013-06-14 11:42:37 +0100448 COMPARE(sub(x18, x19, Operand(x20, SXTB, 3)), "sub x18, x19, w20, sxtb #3");
armvixlf37fdc02014-02-05 13:22:16 +0000449 COMPARE(subs(w21, w22, Operand(w23, SXTH, 2)), "subs w21, w22, w23, sxth #2");
armvixlad96eda2013-06-14 11:42:37 +0100450 COMPARE(sub(x24, x25, Operand(x26, SXTW, 1)), "sub x24, x25, w26, sxtw #1");
armvixlf37fdc02014-02-05 13:22:16 +0000451 COMPARE(subs(x27, x28, Operand(x29, SXTX)), "subs x27, x28, x29, sxtx");
armvixlad96eda2013-06-14 11:42:37 +0100452 COMPARE(cmp(w0, Operand(w1, SXTB, 1)), "cmp w0, w1, sxtb #1");
453 COMPARE(cmp(x2, Operand(x3, UXTH, 3)), "cmp x2, w3, uxth #3");
454
455 COMPARE(sub(w0, wsp, Operand(w1, UXTB)), "sub w0, wsp, w1, uxtb");
456 COMPARE(sub(x2, sp, Operand(x3, UXTH, 1)), "sub x2, sp, w3, uxth #1");
457 COMPARE(sub(wsp, wsp, Operand(w4, UXTW, 2)), "sub wsp, wsp, w4, lsl #2");
458 COMPARE(cmp(sp, Operand(xzr, UXTX, 3)), "cmp sp, xzr, lsl #3");
459 COMPARE(cmp(sp, Operand(xzr, LSL, 4)), "cmp sp, xzr, lsl #4");
460
461 CLEANUP();
462}
463
464
465TEST(adc_subc_ngc) {
466 SETUP();
467
468 COMPARE(adc(w0, w1, Operand(w2)), "adc w0, w1, w2");
469 COMPARE(adc(x3, x4, Operand(x5)), "adc x3, x4, x5");
armvixlf37fdc02014-02-05 13:22:16 +0000470 COMPARE(adcs(w6, w7, Operand(w8)), "adcs w6, w7, w8");
471 COMPARE(adcs(x9, x10, Operand(x11)), "adcs x9, x10, x11");
armvixlad96eda2013-06-14 11:42:37 +0100472 COMPARE(sbc(w12, w13, Operand(w14)), "sbc w12, w13, w14");
473 COMPARE(sbc(x15, x16, Operand(x17)), "sbc x15, x16, x17");
armvixlf37fdc02014-02-05 13:22:16 +0000474 COMPARE(sbcs(w18, w19, Operand(w20)), "sbcs w18, w19, w20");
475 COMPARE(sbcs(x21, x22, Operand(x23)), "sbcs x21, x22, x23");
armvixlad96eda2013-06-14 11:42:37 +0100476 COMPARE(ngc(w24, Operand(w25)), "ngc w24, w25");
477 COMPARE(ngc(x26, Operand(x27)), "ngc x26, x27");
armvixlf37fdc02014-02-05 13:22:16 +0000478 COMPARE(ngcs(w28, Operand(w29)), "ngcs w28, w29");
479 COMPARE(ngcs(x30, Operand(x0)), "ngcs x30, x0");
armvixlad96eda2013-06-14 11:42:37 +0100480
481 CLEANUP();
482}
483
484
485TEST(mul_and_div) {
486 SETUP();
487
488 COMPARE(mul(w0, w1, w2), "mul w0, w1, w2");
489 COMPARE(mul(x3, x4, x5), "mul x3, x4, x5");
490 COMPARE(mul(w30, w0, w1), "mul w30, w0, w1");
491 COMPARE(mul(x30, x0, x1), "mul x30, x0, x1");
492 COMPARE(mneg(w0, w1, w2), "mneg w0, w1, w2");
493 COMPARE(mneg(x3, x4, x5), "mneg x3, x4, x5");
494 COMPARE(mneg(w30, w0, w1), "mneg w30, w0, w1");
495 COMPARE(mneg(x30, x0, x1), "mneg x30, x0, x1");
496 COMPARE(smull(x0, w0, w1), "smull x0, w0, w1");
497 COMPARE(smull(x30, w30, w0), "smull x30, w30, w0");
498 COMPARE(smulh(x0, x1, x2), "smulh x0, x1, x2");
armvixl6e2c8272015-03-31 11:04:14 +0100499 COMPARE(umulh(x0, x2, x1), "umulh x0, x2, x1");
armvixlad96eda2013-06-14 11:42:37 +0100500
501 COMPARE(sdiv(w0, w1, w2), "sdiv w0, w1, w2");
502 COMPARE(sdiv(x3, x4, x5), "sdiv x3, x4, x5");
503 COMPARE(udiv(w6, w7, w8), "udiv w6, w7, w8");
504 COMPARE(udiv(x9, x10, x11), "udiv x9, x10, x11");
505
506 CLEANUP();
507}
508
509
510TEST(madd) {
511 SETUP();
512
513 COMPARE(madd(w0, w1, w2, w3), "madd w0, w1, w2, w3");
514 COMPARE(madd(w30, w21, w22, w16), "madd w30, w21, w22, w16");
515 COMPARE(madd(x0, x1, x2, x3), "madd x0, x1, x2, x3");
516 COMPARE(madd(x30, x21, x22, x16), "madd x30, x21, x22, x16");
517
518 COMPARE(smaddl(x0, w1, w2, x3), "smaddl x0, w1, w2, x3");
519 COMPARE(smaddl(x30, w21, w22, x16), "smaddl x30, w21, w22, x16");
520 COMPARE(umaddl(x0, w1, w2, x3), "umaddl x0, w1, w2, x3");
521 COMPARE(umaddl(x30, w21, w22, x16), "umaddl x30, w21, w22, x16");
armvixl5289c592015-03-02 13:52:04 +0000522 COMPARE(umull(x0, w1, w2), "umull x0, w1, w2");
523 COMPARE(umull(x30, w21, w22), "umull x30, w21, w22");
armvixlad96eda2013-06-14 11:42:37 +0100524
525 CLEANUP();
526}
527
528
529TEST(msub) {
530 SETUP();
531
532 COMPARE(msub(w0, w1, w2, w3), "msub w0, w1, w2, w3");
533 COMPARE(msub(w30, w21, w22, w16), "msub w30, w21, w22, w16");
534 COMPARE(msub(x0, x1, x2, x3), "msub x0, x1, x2, x3");
535 COMPARE(msub(x30, x21, x22, x16), "msub x30, x21, x22, x16");
536
537 COMPARE(smsubl(x0, w1, w2, x3), "smsubl x0, w1, w2, x3");
538 COMPARE(smsubl(x30, w21, w22, x16), "smsubl x30, w21, w22, x16");
539 COMPARE(umsubl(x0, w1, w2, x3), "umsubl x0, w1, w2, x3");
540 COMPARE(umsubl(x30, w21, w22, x16), "umsubl x30, w21, w22, x16");
541
542 CLEANUP();
543}
544
545
546TEST(dp_1_source) {
547 SETUP();
548
549 COMPARE(rbit(w0, w1), "rbit w0, w1");
550 COMPARE(rbit(x2, x3), "rbit x2, x3");
551 COMPARE(rev16(w4, w5), "rev16 w4, w5");
552 COMPARE(rev16(x6, x7), "rev16 x6, x7");
553 COMPARE(rev32(x8, x9), "rev32 x8, x9");
554 COMPARE(rev(w10, w11), "rev w10, w11");
555 COMPARE(rev(x12, x13), "rev x12, x13");
556 COMPARE(clz(w14, w15), "clz w14, w15");
557 COMPARE(clz(x16, x17), "clz x16, x17");
558 COMPARE(cls(w18, w19), "cls w18, w19");
559 COMPARE(cls(x20, x21), "cls x20, x21");
560
561 CLEANUP();
562}
563
564
565TEST(bitfield) {
566 SETUP();
567
568 COMPARE(sxtb(w0, w1), "sxtb w0, w1");
569 COMPARE(sxtb(x2, x3), "sxtb x2, w3");
570 COMPARE(sxth(w4, w5), "sxth w4, w5");
571 COMPARE(sxth(x6, x7), "sxth x6, w7");
572 COMPARE(sxtw(x8, x9), "sxtw x8, w9");
armvixlf37fdc02014-02-05 13:22:16 +0000573 COMPARE(sxtb(x0, w1), "sxtb x0, w1");
574 COMPARE(sxth(x2, w3), "sxth x2, w3");
575 COMPARE(sxtw(x4, w5), "sxtw x4, w5");
576
armvixlad96eda2013-06-14 11:42:37 +0100577 COMPARE(uxtb(w10, w11), "uxtb w10, w11");
578 COMPARE(uxtb(x12, x13), "uxtb x12, w13");
579 COMPARE(uxth(w14, w15), "uxth w14, w15");
580 COMPARE(uxth(x16, x17), "uxth x16, w17");
581 COMPARE(uxtw(x18, x19), "ubfx x18, x19, #0, #32");
582
583 COMPARE(asr(w20, w21, 10), "asr w20, w21, #10");
584 COMPARE(asr(x22, x23, 20), "asr x22, x23, #20");
585 COMPARE(lsr(w24, w25, 10), "lsr w24, w25, #10");
586 COMPARE(lsr(x26, x27, 20), "lsr x26, x27, #20");
587 COMPARE(lsl(w28, w29, 10), "lsl w28, w29, #10");
588 COMPARE(lsl(x30, x0, 20), "lsl x30, x0, #20");
589
590 COMPARE(sbfiz(w1, w2, 1, 20), "sbfiz w1, w2, #1, #20");
591 COMPARE(sbfiz(x3, x4, 2, 19), "sbfiz x3, x4, #2, #19");
592 COMPARE(sbfx(w5, w6, 3, 18), "sbfx w5, w6, #3, #18");
593 COMPARE(sbfx(x7, x8, 4, 17), "sbfx x7, x8, #4, #17");
594 COMPARE(bfi(w9, w10, 5, 16), "bfi w9, w10, #5, #16");
595 COMPARE(bfi(x11, x12, 6, 15), "bfi x11, x12, #6, #15");
596 COMPARE(bfxil(w13, w14, 7, 14), "bfxil w13, w14, #7, #14");
597 COMPARE(bfxil(x15, x16, 8, 13), "bfxil x15, x16, #8, #13");
598 COMPARE(ubfiz(w17, w18, 9, 12), "ubfiz w17, w18, #9, #12");
599 COMPARE(ubfiz(x19, x20, 10, 11), "ubfiz x19, x20, #10, #11");
600 COMPARE(ubfx(w21, w22, 11, 10), "ubfx w21, w22, #11, #10");
601 COMPARE(ubfx(x23, x24, 12, 9), "ubfx x23, x24, #12, #9");
602
603 CLEANUP();
604}
605
606
armvixl5289c592015-03-02 13:52:04 +0000607TEST(crc32b) {
608 SETUP();
609
610 COMPARE(crc32b(w0, w1, w2), "crc32b w0, w1, w2");
611 COMPARE(crc32b(w0, w11, w22), "crc32b w0, w11, w22");
612 COMPARE(crc32b(w10, w20, w30), "crc32b w10, w20, w30");
613
614 CLEANUP();
615}
616
617
618TEST(crc32h) {
619 SETUP();
620
621 COMPARE(crc32h(w1, w2, w3), "crc32h w1, w2, w3");
622 COMPARE(crc32h(w2, w13, w23), "crc32h w2, w13, w23");
623 COMPARE(crc32h(w11, w12, w15), "crc32h w11, w12, w15");
624
625 CLEANUP();
626}
627
628
629TEST(crc32w) {
630 SETUP();
631
632 COMPARE(crc32w(w2, w3, w4), "crc32w w2, w3, w4");
633 COMPARE(crc32w(w3, w14, w24), "crc32w w3, w14, w24");
634 COMPARE(crc32w(w13, w13, w16), "crc32w w13, w13, w16");
635
636 CLEANUP();
637}
638
639
640TEST(crc32x) {
641 SETUP();
642
643 COMPARE(crc32x(w3, w4, x5), "crc32x w3, w4, x5");
644 COMPARE(crc32x(w4, w15, x25), "crc32x w4, w15, x25");
645 COMPARE(crc32x(w14, w14, x30), "crc32x w14, w14, x30");
646
647 CLEANUP();
648}
649
650
651TEST(crc32cb) {
652 SETUP();
653
654 COMPARE(crc32cb(w4, w5, w6), "crc32cb w4, w5, w6");
655 COMPARE(crc32cb(w5, w16, w26), "crc32cb w5, w16, w26");
656 COMPARE(crc32cb(w15, w15, w5), "crc32cb w15, w15, w5");
657
658 CLEANUP();
659}
660
661
662TEST(crc32ch) {
663 SETUP();
664
665 COMPARE(crc32ch(w5, w6, w7), "crc32ch w5, w6, w7");
666 COMPARE(crc32ch(w6, w17, w27), "crc32ch w6, w17, w27");
667 COMPARE(crc32ch(w16, w16, w2), "crc32ch w16, w16, w2");
668
669 CLEANUP();
670}
671
672
673TEST(crc32cw) {
674 SETUP();
675
676 COMPARE(crc32cw(w6, w7, w8), "crc32cw w6, w7, w8");
677 COMPARE(crc32cw(w7, w18, w28), "crc32cw w7, w18, w28");
678 COMPARE(crc32cw(w17, w17, w3), "crc32cw w17, w17, w3");
679
680 CLEANUP();
681}
682
683
684TEST(crc32cx) {
685 SETUP();
686
687 COMPARE(crc32cx(w7, w8, x9), "crc32cx w7, w8, x9");
688 COMPARE(crc32cx(w8, w19, x29), "crc32cx w8, w19, x29");
689 COMPARE(crc32cx(w18, w18, x4), "crc32cx w18, w18, x4");
690
691 CLEANUP();
692}
693
694
armvixlad96eda2013-06-14 11:42:37 +0100695TEST(extract) {
696 SETUP();
697
698 COMPARE(extr(w0, w1, w2, 0), "extr w0, w1, w2, #0");
699 COMPARE(extr(x3, x4, x5, 1), "extr x3, x4, x5, #1");
700 COMPARE(extr(w6, w7, w8, 31), "extr w6, w7, w8, #31");
701 COMPARE(extr(x9, x10, x11, 63), "extr x9, x10, x11, #63");
702 COMPARE(extr(w12, w13, w13, 10), "ror w12, w13, #10");
703 COMPARE(extr(x14, x15, x15, 42), "ror x14, x15, #42");
704
705 CLEANUP();
706}
707
708
709TEST(logical_immediate) {
710 SETUP();
711 #define RESULT_SIZE (256)
712
713 char result[RESULT_SIZE];
714
715 // Test immediate encoding - 64-bit destination.
716 // 64-bit patterns.
717 uint64_t value = 0x7fffffff;
718 for (int i = 0; i < 64; i++) {
719 snprintf(result, RESULT_SIZE, "and x0, x0, #0x%" PRIx64, value);
720 COMPARE(and_(x0, x0, Operand(value)), result);
721 value = ((value & 1) << 63) | (value >> 1); // Rotate right 1 bit.
722 }
723
724 // 32-bit patterns.
armvixlb0c8ae22014-03-21 14:03:59 +0000725 value = 0x00003fff00003fff;
armvixlad96eda2013-06-14 11:42:37 +0100726 for (int i = 0; i < 32; i++) {
727 snprintf(result, RESULT_SIZE, "and x0, x0, #0x%" PRIx64, value);
728 COMPARE(and_(x0, x0, Operand(value)), result);
729 value = ((value & 1) << 63) | (value >> 1); // Rotate right 1 bit.
730 }
731
732 // 16-bit patterns.
armvixlb0c8ae22014-03-21 14:03:59 +0000733 value = 0x001f001f001f001f;
armvixlad96eda2013-06-14 11:42:37 +0100734 for (int i = 0; i < 16; i++) {
735 snprintf(result, RESULT_SIZE, "and x0, x0, #0x%" PRIx64, value);
736 COMPARE(and_(x0, x0, Operand(value)), result);
737 value = ((value & 1) << 63) | (value >> 1); // Rotate right 1 bit.
738 }
739
740 // 8-bit patterns.
armvixlb0c8ae22014-03-21 14:03:59 +0000741 value = 0x0e0e0e0e0e0e0e0e;
armvixlad96eda2013-06-14 11:42:37 +0100742 for (int i = 0; i < 8; i++) {
743 snprintf(result, RESULT_SIZE, "and x0, x0, #0x%" PRIx64, value);
744 COMPARE(and_(x0, x0, Operand(value)), result);
745 value = ((value & 1) << 63) | (value >> 1); // Rotate right 1 bit.
746 }
747
748 // 4-bit patterns.
armvixlb0c8ae22014-03-21 14:03:59 +0000749 value = 0x6666666666666666;
armvixlad96eda2013-06-14 11:42:37 +0100750 for (int i = 0; i < 4; i++) {
751 snprintf(result, RESULT_SIZE, "and x0, x0, #0x%" PRIx64, value);
752 COMPARE(and_(x0, x0, Operand(value)), result);
753 value = ((value & 1) << 63) | (value >> 1); // Rotate right 1 bit.
754 }
755
756 // 2-bit patterns.
armvixlb0c8ae22014-03-21 14:03:59 +0000757 COMPARE(and_(x0, x0, Operand(0x5555555555555555)),
armvixlad96eda2013-06-14 11:42:37 +0100758 "and x0, x0, #0x5555555555555555");
armvixlb0c8ae22014-03-21 14:03:59 +0000759 COMPARE(and_(x0, x0, Operand(0xaaaaaaaaaaaaaaaa)),
armvixlad96eda2013-06-14 11:42:37 +0100760 "and x0, x0, #0xaaaaaaaaaaaaaaaa");
761
762 // Test immediate encoding - 32-bit destination.
763 COMPARE(and_(w0, w0, Operand(0xff8007ff)),
764 "and w0, w0, #0xff8007ff"); // 32-bit pattern.
765 COMPARE(and_(w0, w0, Operand(0xf87ff87f)),
766 "and w0, w0, #0xf87ff87f"); // 16-bit pattern.
767 COMPARE(and_(w0, w0, Operand(0x87878787)),
768 "and w0, w0, #0x87878787"); // 8-bit pattern.
769 COMPARE(and_(w0, w0, Operand(0x66666666)),
770 "and w0, w0, #0x66666666"); // 4-bit pattern.
771 COMPARE(and_(w0, w0, Operand(0x55555555)),
772 "and w0, w0, #0x55555555"); // 2-bit pattern.
773
774 // Test other instructions.
775 COMPARE(tst(w1, Operand(0x11111111)),
776 "tst w1, #0x11111111");
armvixlb0c8ae22014-03-21 14:03:59 +0000777 COMPARE(tst(x2, Operand(0x8888888888888888)),
armvixlad96eda2013-06-14 11:42:37 +0100778 "tst x2, #0x8888888888888888");
779 COMPARE(orr(w7, w8, Operand(0xaaaaaaaa)),
780 "orr w7, w8, #0xaaaaaaaa");
armvixlb0c8ae22014-03-21 14:03:59 +0000781 COMPARE(orr(x9, x10, Operand(0x5555555555555555)),
armvixlad96eda2013-06-14 11:42:37 +0100782 "orr x9, x10, #0x5555555555555555");
783 COMPARE(eor(w15, w16, Operand(0x00000001)),
784 "eor w15, w16, #0x1");
armvixlb0c8ae22014-03-21 14:03:59 +0000785 COMPARE(eor(x17, x18, Operand(0x0000000000000003)),
armvixlad96eda2013-06-14 11:42:37 +0100786 "eor x17, x18, #0x3");
armvixlf37fdc02014-02-05 13:22:16 +0000787 COMPARE(ands(w23, w24, Operand(0x0000000f)), "ands w23, w24, #0xf");
armvixlb0c8ae22014-03-21 14:03:59 +0000788 COMPARE(ands(x25, x26, Operand(0x800000000000000f)),
armvixlad96eda2013-06-14 11:42:37 +0100789 "ands x25, x26, #0x800000000000000f");
790
791 // Test inverse.
792 COMPARE(bic(w3, w4, Operand(0x20202020)),
793 "and w3, w4, #0xdfdfdfdf");
armvixlb0c8ae22014-03-21 14:03:59 +0000794 COMPARE(bic(x5, x6, Operand(0x4040404040404040)),
armvixlad96eda2013-06-14 11:42:37 +0100795 "and x5, x6, #0xbfbfbfbfbfbfbfbf");
796 COMPARE(orn(w11, w12, Operand(0x40004000)),
797 "orr w11, w12, #0xbfffbfff");
armvixlb0c8ae22014-03-21 14:03:59 +0000798 COMPARE(orn(x13, x14, Operand(0x8181818181818181)),
armvixlad96eda2013-06-14 11:42:37 +0100799 "orr x13, x14, #0x7e7e7e7e7e7e7e7e");
800 COMPARE(eon(w19, w20, Operand(0x80000001)),
801 "eor w19, w20, #0x7ffffffe");
armvixlb0c8ae22014-03-21 14:03:59 +0000802 COMPARE(eon(x21, x22, Operand(0xc000000000000003)),
armvixlad96eda2013-06-14 11:42:37 +0100803 "eor x21, x22, #0x3ffffffffffffffc");
armvixlf37fdc02014-02-05 13:22:16 +0000804 COMPARE(bics(w27, w28, Operand(0xfffffff7)), "ands w27, w28, #0x8");
armvixlb0c8ae22014-03-21 14:03:59 +0000805 COMPARE(bics(x29, x0, Operand(0xfffffffeffffffff)),
armvixlad96eda2013-06-14 11:42:37 +0100806 "ands x29, x0, #0x100000000");
807
808 // Test stack pointer.
809 COMPARE(and_(wsp, wzr, Operand(7)), "and wsp, wzr, #0x7");
armvixlf37fdc02014-02-05 13:22:16 +0000810 COMPARE(ands(xzr, xzr, Operand(7)), "tst xzr, #0x7");
armvixlad96eda2013-06-14 11:42:37 +0100811 COMPARE(orr(sp, xzr, Operand(15)), "orr sp, xzr, #0xf");
812 COMPARE(eor(wsp, w0, Operand(31)), "eor wsp, w0, #0x1f");
813
814 // Test move aliases.
815 COMPARE(orr(w0, wzr, Operand(0x00000780)), "orr w0, wzr, #0x780");
816 COMPARE(orr(w1, wzr, Operand(0x00007800)), "orr w1, wzr, #0x7800");
817 COMPARE(orr(w2, wzr, Operand(0x00078000)), "mov w2, #0x78000");
818 COMPARE(orr(w3, wzr, Operand(0x00780000)), "orr w3, wzr, #0x780000");
819 COMPARE(orr(w4, wzr, Operand(0x07800000)), "orr w4, wzr, #0x7800000");
armvixlb0c8ae22014-03-21 14:03:59 +0000820 COMPARE(orr(x5, xzr, Operand(0xffffffffffffc001)),
armvixlad96eda2013-06-14 11:42:37 +0100821 "orr x5, xzr, #0xffffffffffffc001");
armvixlb0c8ae22014-03-21 14:03:59 +0000822 COMPARE(orr(x6, xzr, Operand(0xfffffffffffc001f)),
armvixlad96eda2013-06-14 11:42:37 +0100823 "mov x6, #0xfffffffffffc001f");
armvixlb0c8ae22014-03-21 14:03:59 +0000824 COMPARE(orr(x7, xzr, Operand(0xffffffffffc001ff)),
armvixlad96eda2013-06-14 11:42:37 +0100825 "mov x7, #0xffffffffffc001ff");
armvixlb0c8ae22014-03-21 14:03:59 +0000826 COMPARE(orr(x8, xzr, Operand(0xfffffffffc001fff)),
armvixlad96eda2013-06-14 11:42:37 +0100827 "mov x8, #0xfffffffffc001fff");
armvixlb0c8ae22014-03-21 14:03:59 +0000828 COMPARE(orr(x9, xzr, Operand(0xffffffffc001ffff)),
armvixlad96eda2013-06-14 11:42:37 +0100829 "orr x9, xzr, #0xffffffffc001ffff");
830
831 CLEANUP();
832}
833
834
835TEST(logical_shifted) {
836 SETUP();
837
838 COMPARE(and_(w0, w1, Operand(w2)), "and w0, w1, w2");
839 COMPARE(and_(x3, x4, Operand(x5, LSL, 1)), "and x3, x4, x5, lsl #1");
840 COMPARE(and_(w6, w7, Operand(w8, LSR, 2)), "and w6, w7, w8, lsr #2");
841 COMPARE(and_(x9, x10, Operand(x11, ASR, 3)), "and x9, x10, x11, asr #3");
842 COMPARE(and_(w12, w13, Operand(w14, ROR, 4)), "and w12, w13, w14, ror #4");
843
844 COMPARE(bic(w15, w16, Operand(w17)), "bic w15, w16, w17");
845 COMPARE(bic(x18, x19, Operand(x20, LSL, 5)), "bic x18, x19, x20, lsl #5");
846 COMPARE(bic(w21, w22, Operand(w23, LSR, 6)), "bic w21, w22, w23, lsr #6");
847 COMPARE(bic(x24, x25, Operand(x26, ASR, 7)), "bic x24, x25, x26, asr #7");
848 COMPARE(bic(w27, w28, Operand(w29, ROR, 8)), "bic w27, w28, w29, ror #8");
849
850 COMPARE(orr(w0, w1, Operand(w2)), "orr w0, w1, w2");
851 COMPARE(orr(x3, x4, Operand(x5, LSL, 9)), "orr x3, x4, x5, lsl #9");
852 COMPARE(orr(w6, w7, Operand(w8, LSR, 10)), "orr w6, w7, w8, lsr #10");
853 COMPARE(orr(x9, x10, Operand(x11, ASR, 11)), "orr x9, x10, x11, asr #11");
854 COMPARE(orr(w12, w13, Operand(w14, ROR, 12)), "orr w12, w13, w14, ror #12");
855
856 COMPARE(orn(w15, w16, Operand(w17)), "orn w15, w16, w17");
857 COMPARE(orn(x18, x19, Operand(x20, LSL, 13)), "orn x18, x19, x20, lsl #13");
858 COMPARE(orn(w21, w22, Operand(w23, LSR, 14)), "orn w21, w22, w23, lsr #14");
859 COMPARE(orn(x24, x25, Operand(x26, ASR, 15)), "orn x24, x25, x26, asr #15");
860 COMPARE(orn(w27, w28, Operand(w29, ROR, 16)), "orn w27, w28, w29, ror #16");
861
862 COMPARE(eor(w0, w1, Operand(w2)), "eor w0, w1, w2");
863 COMPARE(eor(x3, x4, Operand(x5, LSL, 17)), "eor x3, x4, x5, lsl #17");
864 COMPARE(eor(w6, w7, Operand(w8, LSR, 18)), "eor w6, w7, w8, lsr #18");
865 COMPARE(eor(x9, x10, Operand(x11, ASR, 19)), "eor x9, x10, x11, asr #19");
866 COMPARE(eor(w12, w13, Operand(w14, ROR, 20)), "eor w12, w13, w14, ror #20");
867
868 COMPARE(eon(w15, w16, Operand(w17)), "eon w15, w16, w17");
869 COMPARE(eon(x18, x19, Operand(x20, LSL, 21)), "eon x18, x19, x20, lsl #21");
870 COMPARE(eon(w21, w22, Operand(w23, LSR, 22)), "eon w21, w22, w23, lsr #22");
871 COMPARE(eon(x24, x25, Operand(x26, ASR, 23)), "eon x24, x25, x26, asr #23");
872 COMPARE(eon(w27, w28, Operand(w29, ROR, 24)), "eon w27, w28, w29, ror #24");
873
armvixlf37fdc02014-02-05 13:22:16 +0000874 COMPARE(ands(w0, w1, Operand(w2)), "ands w0, w1, w2");
875 COMPARE(ands(x3, x4, Operand(x5, LSL, 1)), "ands x3, x4, x5, lsl #1");
876 COMPARE(ands(w6, w7, Operand(w8, LSR, 2)), "ands w6, w7, w8, lsr #2");
877 COMPARE(ands(x9, x10, Operand(x11, ASR, 3)), "ands x9, x10, x11, asr #3");
878 COMPARE(ands(w12, w13, Operand(w14, ROR, 4)), "ands w12, w13, w14, ror #4");
armvixlad96eda2013-06-14 11:42:37 +0100879
armvixlf37fdc02014-02-05 13:22:16 +0000880 COMPARE(bics(w15, w16, Operand(w17)), "bics w15, w16, w17");
881 COMPARE(bics(x18, x19, Operand(x20, LSL, 5)), "bics x18, x19, x20, lsl #5");
882 COMPARE(bics(w21, w22, Operand(w23, LSR, 6)), "bics w21, w22, w23, lsr #6");
883 COMPARE(bics(x24, x25, Operand(x26, ASR, 7)), "bics x24, x25, x26, asr #7");
884 COMPARE(bics(w27, w28, Operand(w29, ROR, 8)), "bics w27, w28, w29, ror #8");
armvixlad96eda2013-06-14 11:42:37 +0100885
886 COMPARE(tst(w0, Operand(w1)), "tst w0, w1");
887 COMPARE(tst(w2, Operand(w3, ROR, 10)), "tst w2, w3, ror #10");
888 COMPARE(tst(x0, Operand(x1)), "tst x0, x1");
889 COMPARE(tst(x2, Operand(x3, ROR, 42)), "tst x2, x3, ror #42");
890
891 COMPARE(orn(w0, wzr, Operand(w1)), "mvn w0, w1");
892 COMPARE(orn(w2, wzr, Operand(w3, ASR, 5)), "mvn w2, w3, asr #5");
893 COMPARE(orn(x0, xzr, Operand(x1)), "mvn x0, x1");
894 COMPARE(orn(x2, xzr, Operand(x3, ASR, 42)), "mvn x2, x3, asr #42");
895
896 COMPARE(orr(w0, wzr, Operand(w1)), "mov w0, w1");
897 COMPARE(orr(x0, xzr, Operand(x1)), "mov x0, x1");
898 COMPARE(orr(w16, wzr, Operand(w17, LSL, 1)), "orr w16, wzr, w17, lsl #1");
899 COMPARE(orr(x16, xzr, Operand(x17, ASR, 2)), "orr x16, xzr, x17, asr #2");
900
901 CLEANUP();
902}
903
904
905TEST(dp_2_source) {
906 SETUP();
907
908 COMPARE(lslv(w0, w1, w2), "lsl w0, w1, w2");
909 COMPARE(lslv(x3, x4, x5), "lsl x3, x4, x5");
910 COMPARE(lsrv(w6, w7, w8), "lsr w6, w7, w8");
911 COMPARE(lsrv(x9, x10, x11), "lsr x9, x10, x11");
912 COMPARE(asrv(w12, w13, w14), "asr w12, w13, w14");
913 COMPARE(asrv(x15, x16, x17), "asr x15, x16, x17");
914 COMPARE(rorv(w18, w19, w20), "ror w18, w19, w20");
915 COMPARE(rorv(x21, x22, x23), "ror x21, x22, x23");
916
917 CLEANUP();
918}
919
armvixl4a102ba2014-07-14 09:02:40 +0100920
armvixlad96eda2013-06-14 11:42:37 +0100921TEST(adr) {
922 SETUP();
923
armvixlb0c8ae22014-03-21 14:03:59 +0000924 COMPARE_PREFIX(adr(x0, 0), "adr x0, #+0x0");
925 COMPARE_PREFIX(adr(x1, 1), "adr x1, #+0x1");
926 COMPARE_PREFIX(adr(x2, -1), "adr x2, #-0x1");
927 COMPARE_PREFIX(adr(x3, 4), "adr x3, #+0x4");
928 COMPARE_PREFIX(adr(x4, -4), "adr x4, #-0x4");
929 COMPARE_PREFIX(adr(x5, 0x000fffff), "adr x5, #+0xfffff");
930 COMPARE_PREFIX(adr(x6, -0x00100000), "adr x6, #-0x100000");
931 COMPARE_PREFIX(adr(xzr, 0), "adr xzr, #+0x0");
armvixlad96eda2013-06-14 11:42:37 +0100932
933 CLEANUP();
934}
935
armvixl4a102ba2014-07-14 09:02:40 +0100936
937TEST(adrp) {
938 SETUP();
939
940 COMPARE_PREFIX(adrp(x0, 0), "adrp x0, #+0x0");
armvixl330dc712014-11-25 10:38:32 +0000941 COMPARE_PREFIX(adrp(x1, 1), "adrp x1, #+0x1000");
942 COMPARE_PREFIX(adrp(x2, -1), "adrp x2, #-0x1000");
943 COMPARE_PREFIX(adrp(x3, 4), "adrp x3, #+0x4000");
944 COMPARE_PREFIX(adrp(x4, -4), "adrp x4, #-0x4000");
945 COMPARE_PREFIX(adrp(x5, 0x000fffff), "adrp x5, #+0xfffff000");
946 COMPARE_PREFIX(adrp(x6, -0x00100000), "adrp x6, #-0x100000000");
armvixl4a102ba2014-07-14 09:02:40 +0100947 COMPARE_PREFIX(adrp(xzr, 0), "adrp xzr, #+0x0");
948
949 CLEANUP();
950}
951
952
armvixlad96eda2013-06-14 11:42:37 +0100953TEST(branch) {
954 SETUP();
955
956 #define INST_OFF(x) ((x) >> kInstructionSizeLog2)
armvixlb0c8ae22014-03-21 14:03:59 +0000957 COMPARE_PREFIX(b(INST_OFF(0x4)), "b #+0x4");
958 COMPARE_PREFIX(b(INST_OFF(-0x4)), "b #-0x4");
959 COMPARE_PREFIX(b(INST_OFF(0x7fffffc)), "b #+0x7fffffc");
960 COMPARE_PREFIX(b(INST_OFF(-0x8000000)), "b #-0x8000000");
961 COMPARE_PREFIX(b(INST_OFF(0xffffc), eq), "b.eq #+0xffffc");
962 COMPARE_PREFIX(b(INST_OFF(-0x100000), mi), "b.mi #-0x100000");
963 COMPARE_PREFIX(b(INST_OFF(0xffffc), al), "b.al #+0xffffc");
964 COMPARE_PREFIX(b(INST_OFF(-0x100000), nv), "b.nv #-0x100000");
965 COMPARE_PREFIX(bl(INST_OFF(0x4)), "bl #+0x4");
966 COMPARE_PREFIX(bl(INST_OFF(-0x4)), "bl #-0x4");
967 COMPARE_PREFIX(bl(INST_OFF(0xffffc)), "bl #+0xffffc");
968 COMPARE_PREFIX(bl(INST_OFF(-0x100000)), "bl #-0x100000");
969 COMPARE_PREFIX(cbz(w0, INST_OFF(0xffffc)), "cbz w0, #+0xffffc");
970 COMPARE_PREFIX(cbz(x1, INST_OFF(-0x100000)), "cbz x1, #-0x100000");
971 COMPARE_PREFIX(cbnz(w2, INST_OFF(0xffffc)), "cbnz w2, #+0xffffc");
972 COMPARE_PREFIX(cbnz(x3, INST_OFF(-0x100000)), "cbnz x3, #-0x100000");
973 COMPARE_PREFIX(tbz(w4, 0, INST_OFF(0x7ffc)), "tbz w4, #0, #+0x7ffc");
974 COMPARE_PREFIX(tbz(x5, 63, INST_OFF(-0x8000)), "tbz x5, #63, #-0x8000");
975 COMPARE_PREFIX(tbz(w6, 31, INST_OFF(0)), "tbz w6, #31, #+0x0");
976 COMPARE_PREFIX(tbz(x7, 31, INST_OFF(0x4)), "tbz w7, #31, #+0x4");
977 COMPARE_PREFIX(tbz(x8, 32, INST_OFF(0x8)), "tbz x8, #32, #+0x8");
978 COMPARE_PREFIX(tbnz(w8, 0, INST_OFF(0x7ffc)), "tbnz w8, #0, #+0x7ffc");
979 COMPARE_PREFIX(tbnz(x9, 63, INST_OFF(-0x8000)), "tbnz x9, #63, #-0x8000");
980 COMPARE_PREFIX(tbnz(w10, 31, INST_OFF(0)), "tbnz w10, #31, #+0x0");
981 COMPARE_PREFIX(tbnz(x11, 31, INST_OFF(0x4)), "tbnz w11, #31, #+0x4");
982 COMPARE_PREFIX(tbnz(x12, 32, INST_OFF(0x8)), "tbnz x12, #32, #+0x8");
armvixlad96eda2013-06-14 11:42:37 +0100983 COMPARE(br(x0), "br x0");
984 COMPARE(blr(x1), "blr x1");
985 COMPARE(ret(x2), "ret x2");
986 COMPARE(ret(lr), "ret")
987
988 CLEANUP();
989}
990
armvixl4a102ba2014-07-14 09:02:40 +0100991
armvixlad96eda2013-06-14 11:42:37 +0100992TEST(load_store) {
993 SETUP();
994
995 COMPARE(ldr(w0, MemOperand(x1)), "ldr w0, [x1]");
996 COMPARE(ldr(w2, MemOperand(x3, 4)), "ldr w2, [x3, #4]");
997 COMPARE(ldr(w4, MemOperand(x5, 16380)), "ldr w4, [x5, #16380]");
998 COMPARE(ldr(x6, MemOperand(x7)), "ldr x6, [x7]");
999 COMPARE(ldr(x8, MemOperand(x9, 8)), "ldr x8, [x9, #8]");
1000 COMPARE(ldr(x10, MemOperand(x11, 32760)), "ldr x10, [x11, #32760]");
1001 COMPARE(str(w12, MemOperand(x13)), "str w12, [x13]");
1002 COMPARE(str(w14, MemOperand(x15, 4)), "str w14, [x15, #4]");
1003 COMPARE(str(w16, MemOperand(x17, 16380)), "str w16, [x17, #16380]");
1004 COMPARE(str(x18, MemOperand(x19)), "str x18, [x19]");
1005 COMPARE(str(x20, MemOperand(x21, 8)), "str x20, [x21, #8]");
1006 COMPARE(str(x22, MemOperand(x23, 32760)), "str x22, [x23, #32760]");
1007
1008 COMPARE(ldr(w0, MemOperand(x1, 4, PreIndex)), "ldr w0, [x1, #4]!");
1009 COMPARE(ldr(w2, MemOperand(x3, 255, PreIndex)), "ldr w2, [x3, #255]!");
1010 COMPARE(ldr(w4, MemOperand(x5, -256, PreIndex)), "ldr w4, [x5, #-256]!");
1011 COMPARE(ldr(x6, MemOperand(x7, 8, PreIndex)), "ldr x6, [x7, #8]!");
1012 COMPARE(ldr(x8, MemOperand(x9, 255, PreIndex)), "ldr x8, [x9, #255]!");
1013 COMPARE(ldr(x10, MemOperand(x11, -256, PreIndex)), "ldr x10, [x11, #-256]!");
1014 COMPARE(str(w12, MemOperand(x13, 4, PreIndex)), "str w12, [x13, #4]!");
1015 COMPARE(str(w14, MemOperand(x15, 255, PreIndex)), "str w14, [x15, #255]!");
1016 COMPARE(str(w16, MemOperand(x17, -256, PreIndex)), "str w16, [x17, #-256]!");
1017 COMPARE(str(x18, MemOperand(x19, 8, PreIndex)), "str x18, [x19, #8]!");
1018 COMPARE(str(x20, MemOperand(x21, 255, PreIndex)), "str x20, [x21, #255]!");
1019 COMPARE(str(x22, MemOperand(x23, -256, PreIndex)), "str x22, [x23, #-256]!");
1020
1021 COMPARE(ldr(w0, MemOperand(x1, 4, PostIndex)), "ldr w0, [x1], #4");
1022 COMPARE(ldr(w2, MemOperand(x3, 255, PostIndex)), "ldr w2, [x3], #255");
1023 COMPARE(ldr(w4, MemOperand(x5, -256, PostIndex)), "ldr w4, [x5], #-256");
1024 COMPARE(ldr(x6, MemOperand(x7, 8, PostIndex)), "ldr x6, [x7], #8");
1025 COMPARE(ldr(x8, MemOperand(x9, 255, PostIndex)), "ldr x8, [x9], #255");
1026 COMPARE(ldr(x10, MemOperand(x11, -256, PostIndex)), "ldr x10, [x11], #-256");
1027 COMPARE(str(w12, MemOperand(x13, 4, PostIndex)), "str w12, [x13], #4");
1028 COMPARE(str(w14, MemOperand(x15, 255, PostIndex)), "str w14, [x15], #255");
1029 COMPARE(str(w16, MemOperand(x17, -256, PostIndex)), "str w16, [x17], #-256");
1030 COMPARE(str(x18, MemOperand(x19, 8, PostIndex)), "str x18, [x19], #8");
1031 COMPARE(str(x20, MemOperand(x21, 255, PostIndex)), "str x20, [x21], #255");
1032 COMPARE(str(x22, MemOperand(x23, -256, PostIndex)), "str x22, [x23], #-256");
1033
1034 COMPARE(ldr(w24, MemOperand(sp)), "ldr w24, [sp]");
1035 COMPARE(ldr(x25, MemOperand(sp, 8)), "ldr x25, [sp, #8]");
1036 COMPARE(str(w26, MemOperand(sp, 4, PreIndex)), "str w26, [sp, #4]!");
1037 COMPARE(str(x27, MemOperand(sp, -8, PostIndex)), "str x27, [sp], #-8");
1038
1039 COMPARE(ldrsw(x0, MemOperand(x1)), "ldrsw x0, [x1]");
1040 COMPARE(ldrsw(x2, MemOperand(x3, 8)), "ldrsw x2, [x3, #8]");
1041 COMPARE(ldrsw(x4, MemOperand(x5, 42, PreIndex)), "ldrsw x4, [x5, #42]!");
1042 COMPARE(ldrsw(x6, MemOperand(x7, -11, PostIndex)), "ldrsw x6, [x7], #-11");
1043
1044 CLEANUP();
1045}
1046
1047
1048TEST(load_store_regoffset) {
1049 SETUP();
1050
1051 COMPARE(ldr(w0, MemOperand(x1, w2, UXTW)), "ldr w0, [x1, w2, uxtw]");
1052 COMPARE(ldr(w3, MemOperand(x4, w5, UXTW, 2)), "ldr w3, [x4, w5, uxtw #2]");
1053 COMPARE(ldr(w6, MemOperand(x7, x8)), "ldr w6, [x7, x8]");
1054 COMPARE(ldr(w9, MemOperand(x10, x11, LSL, 2)), "ldr w9, [x10, x11, lsl #2]");
1055 COMPARE(ldr(w12, MemOperand(x13, w14, SXTW)), "ldr w12, [x13, w14, sxtw]");
1056 COMPARE(ldr(w15, MemOperand(x16, w17, SXTW, 2)),
1057 "ldr w15, [x16, w17, sxtw #2]");
1058 COMPARE(ldr(w18, MemOperand(x19, x20, SXTX)), "ldr w18, [x19, x20, sxtx]");
1059 COMPARE(ldr(w21, MemOperand(x22, x23, SXTX, 2)),
1060 "ldr w21, [x22, x23, sxtx #2]");
1061 COMPARE(ldr(x0, MemOperand(x1, w2, UXTW)), "ldr x0, [x1, w2, uxtw]");
1062 COMPARE(ldr(x3, MemOperand(x4, w5, UXTW, 3)), "ldr x3, [x4, w5, uxtw #3]");
1063 COMPARE(ldr(x6, MemOperand(x7, x8)), "ldr x6, [x7, x8]");
1064 COMPARE(ldr(x9, MemOperand(x10, x11, LSL, 3)), "ldr x9, [x10, x11, lsl #3]");
1065 COMPARE(ldr(x12, MemOperand(x13, w14, SXTW)), "ldr x12, [x13, w14, sxtw]");
1066 COMPARE(ldr(x15, MemOperand(x16, w17, SXTW, 3)),
1067 "ldr x15, [x16, w17, sxtw #3]");
1068 COMPARE(ldr(x18, MemOperand(x19, x20, SXTX)), "ldr x18, [x19, x20, sxtx]");
1069 COMPARE(ldr(x21, MemOperand(x22, x23, SXTX, 3)),
1070 "ldr x21, [x22, x23, sxtx #3]");
1071
1072 COMPARE(str(w0, MemOperand(x1, w2, UXTW)), "str w0, [x1, w2, uxtw]");
1073 COMPARE(str(w3, MemOperand(x4, w5, UXTW, 2)), "str w3, [x4, w5, uxtw #2]");
1074 COMPARE(str(w6, MemOperand(x7, x8)), "str w6, [x7, x8]");
1075 COMPARE(str(w9, MemOperand(x10, x11, LSL, 2)), "str w9, [x10, x11, lsl #2]");
1076 COMPARE(str(w12, MemOperand(x13, w14, SXTW)), "str w12, [x13, w14, sxtw]");
1077 COMPARE(str(w15, MemOperand(x16, w17, SXTW, 2)),
1078 "str w15, [x16, w17, sxtw #2]");
1079 COMPARE(str(w18, MemOperand(x19, x20, SXTX)), "str w18, [x19, x20, sxtx]");
1080 COMPARE(str(w21, MemOperand(x22, x23, SXTX, 2)),
1081 "str w21, [x22, x23, sxtx #2]");
1082 COMPARE(str(x0, MemOperand(x1, w2, UXTW)), "str x0, [x1, w2, uxtw]");
1083 COMPARE(str(x3, MemOperand(x4, w5, UXTW, 3)), "str x3, [x4, w5, uxtw #3]");
1084 COMPARE(str(x6, MemOperand(x7, x8)), "str x6, [x7, x8]");
1085 COMPARE(str(x9, MemOperand(x10, x11, LSL, 3)), "str x9, [x10, x11, lsl #3]");
1086 COMPARE(str(x12, MemOperand(x13, w14, SXTW)), "str x12, [x13, w14, sxtw]");
1087 COMPARE(str(x15, MemOperand(x16, w17, SXTW, 3)),
1088 "str x15, [x16, w17, sxtw #3]");
1089 COMPARE(str(x18, MemOperand(x19, x20, SXTX)), "str x18, [x19, x20, sxtx]");
1090 COMPARE(str(x21, MemOperand(x22, x23, SXTX, 3)),
1091 "str x21, [x22, x23, sxtx #3]");
1092
1093 COMPARE(ldrb(w0, MemOperand(x1, w2, UXTW)), "ldrb w0, [x1, w2, uxtw]");
1094 COMPARE(ldrb(w6, MemOperand(x7, x8)), "ldrb w6, [x7, x8]");
1095 COMPARE(ldrb(w12, MemOperand(x13, w14, SXTW)), "ldrb w12, [x13, w14, sxtw]");
1096 COMPARE(ldrb(w18, MemOperand(x19, x20, SXTX)), "ldrb w18, [x19, x20, sxtx]");
1097 COMPARE(strb(w0, MemOperand(x1, w2, UXTW)), "strb w0, [x1, w2, uxtw]");
1098 COMPARE(strb(w6, MemOperand(x7, x8)), "strb w6, [x7, x8]");
1099 COMPARE(strb(w12, MemOperand(x13, w14, SXTW)), "strb w12, [x13, w14, sxtw]");
1100 COMPARE(strb(w18, MemOperand(x19, x20, SXTX)), "strb w18, [x19, x20, sxtx]");
1101
1102 COMPARE(ldrh(w0, MemOperand(x1, w2, UXTW)), "ldrh w0, [x1, w2, uxtw]");
1103 COMPARE(ldrh(w3, MemOperand(x4, w5, UXTW, 1)), "ldrh w3, [x4, w5, uxtw #1]");
1104 COMPARE(ldrh(w6, MemOperand(x7, x8)), "ldrh w6, [x7, x8]");
1105 COMPARE(ldrh(w9, MemOperand(x10, x11, LSL, 1)),
1106 "ldrh w9, [x10, x11, lsl #1]");
1107 COMPARE(ldrh(w12, MemOperand(x13, w14, SXTW)), "ldrh w12, [x13, w14, sxtw]");
1108 COMPARE(ldrh(w15, MemOperand(x16, w17, SXTW, 1)),
1109 "ldrh w15, [x16, w17, sxtw #1]");
1110 COMPARE(ldrh(w18, MemOperand(x19, x20, SXTX)), "ldrh w18, [x19, x20, sxtx]");
1111 COMPARE(ldrh(w21, MemOperand(x22, x23, SXTX, 1)),
1112 "ldrh w21, [x22, x23, sxtx #1]");
1113 COMPARE(strh(w0, MemOperand(x1, w2, UXTW)), "strh w0, [x1, w2, uxtw]");
1114 COMPARE(strh(w3, MemOperand(x4, w5, UXTW, 1)), "strh w3, [x4, w5, uxtw #1]");
1115 COMPARE(strh(w6, MemOperand(x7, x8)), "strh w6, [x7, x8]");
1116 COMPARE(strh(w9, MemOperand(x10, x11, LSL, 1)),
1117 "strh w9, [x10, x11, lsl #1]");
1118 COMPARE(strh(w12, MemOperand(x13, w14, SXTW)), "strh w12, [x13, w14, sxtw]");
1119 COMPARE(strh(w15, MemOperand(x16, w17, SXTW, 1)),
1120 "strh w15, [x16, w17, sxtw #1]");
1121 COMPARE(strh(w18, MemOperand(x19, x20, SXTX)), "strh w18, [x19, x20, sxtx]");
1122 COMPARE(strh(w21, MemOperand(x22, x23, SXTX, 1)),
1123 "strh w21, [x22, x23, sxtx #1]");
1124
1125 COMPARE(ldr(x0, MemOperand(sp, wzr, SXTW)), "ldr x0, [sp, wzr, sxtw]");
1126 COMPARE(str(x1, MemOperand(sp, xzr)), "str x1, [sp, xzr]");
1127
1128 CLEANUP();
1129}
1130
1131
1132TEST(load_store_byte) {
1133 SETUP();
1134
1135 COMPARE(ldrb(w0, MemOperand(x1)), "ldrb w0, [x1]");
1136 COMPARE(ldrb(x2, MemOperand(x3)), "ldrb w2, [x3]");
1137 COMPARE(ldrb(w4, MemOperand(x5, 4095)), "ldrb w4, [x5, #4095]");
1138 COMPARE(ldrb(w6, MemOperand(x7, 255, PreIndex)), "ldrb w6, [x7, #255]!");
1139 COMPARE(ldrb(w8, MemOperand(x9, -256, PreIndex)), "ldrb w8, [x9, #-256]!");
1140 COMPARE(ldrb(w10, MemOperand(x11, 255, PostIndex)), "ldrb w10, [x11], #255");
1141 COMPARE(ldrb(w12, MemOperand(x13, -256, PostIndex)),
1142 "ldrb w12, [x13], #-256");
1143 COMPARE(strb(w14, MemOperand(x15)), "strb w14, [x15]");
1144 COMPARE(strb(x16, MemOperand(x17)), "strb w16, [x17]");
1145 COMPARE(strb(w18, MemOperand(x19, 4095)), "strb w18, [x19, #4095]");
1146 COMPARE(strb(w20, MemOperand(x21, 255, PreIndex)), "strb w20, [x21, #255]!");
1147 COMPARE(strb(w22, MemOperand(x23, -256, PreIndex)),
1148 "strb w22, [x23, #-256]!");
1149 COMPARE(strb(w24, MemOperand(x25, 255, PostIndex)), "strb w24, [x25], #255");
1150 COMPARE(strb(w26, MemOperand(x27, -256, PostIndex)),
1151 "strb w26, [x27], #-256");
1152 COMPARE(ldrb(w28, MemOperand(sp, 3, PostIndex)), "ldrb w28, [sp], #3");
1153 COMPARE(strb(x29, MemOperand(sp, -42, PreIndex)), "strb w29, [sp, #-42]!");
1154 COMPARE(ldrsb(w0, MemOperand(x1)), "ldrsb w0, [x1]");
1155 COMPARE(ldrsb(x2, MemOperand(x3, 8)), "ldrsb x2, [x3, #8]");
1156 COMPARE(ldrsb(w4, MemOperand(x5, 42, PreIndex)), "ldrsb w4, [x5, #42]!");
1157 COMPARE(ldrsb(x6, MemOperand(x7, -11, PostIndex)), "ldrsb x6, [x7], #-11");
1158
1159 CLEANUP();
1160}
1161
1162
1163TEST(load_store_half) {
1164 SETUP();
1165
1166 COMPARE(ldrh(w0, MemOperand(x1)), "ldrh w0, [x1]");
1167 COMPARE(ldrh(x2, MemOperand(x3)), "ldrh w2, [x3]");
1168 COMPARE(ldrh(w4, MemOperand(x5, 8190)), "ldrh w4, [x5, #8190]");
1169 COMPARE(ldrh(w6, MemOperand(x7, 255, PreIndex)), "ldrh w6, [x7, #255]!");
1170 COMPARE(ldrh(w8, MemOperand(x9, -256, PreIndex)), "ldrh w8, [x9, #-256]!");
1171 COMPARE(ldrh(w10, MemOperand(x11, 255, PostIndex)), "ldrh w10, [x11], #255");
1172 COMPARE(ldrh(w12, MemOperand(x13, -256, PostIndex)),
1173 "ldrh w12, [x13], #-256");
1174 COMPARE(strh(w14, MemOperand(x15)), "strh w14, [x15]");
1175 COMPARE(strh(x16, MemOperand(x17)), "strh w16, [x17]");
1176 COMPARE(strh(w18, MemOperand(x19, 8190)), "strh w18, [x19, #8190]");
1177 COMPARE(strh(w20, MemOperand(x21, 255, PreIndex)), "strh w20, [x21, #255]!");
1178 COMPARE(strh(w22, MemOperand(x23, -256, PreIndex)),
1179 "strh w22, [x23, #-256]!");
1180 COMPARE(strh(w24, MemOperand(x25, 255, PostIndex)), "strh w24, [x25], #255");
1181 COMPARE(strh(w26, MemOperand(x27, -256, PostIndex)),
1182 "strh w26, [x27], #-256");
1183 COMPARE(ldrh(w28, MemOperand(sp, 3, PostIndex)), "ldrh w28, [sp], #3");
1184 COMPARE(strh(x29, MemOperand(sp, -42, PreIndex)), "strh w29, [sp, #-42]!");
1185 COMPARE(ldrh(w30, MemOperand(x0, 255)), "ldurh w30, [x0, #255]");
1186 COMPARE(ldrh(x1, MemOperand(x2, -256)), "ldurh w1, [x2, #-256]");
1187 COMPARE(strh(w3, MemOperand(x4, 255)), "sturh w3, [x4, #255]");
1188 COMPARE(strh(x5, MemOperand(x6, -256)), "sturh w5, [x6, #-256]");
1189 COMPARE(ldrsh(w0, MemOperand(x1)), "ldrsh w0, [x1]");
1190 COMPARE(ldrsh(w2, MemOperand(x3, 8)), "ldrsh w2, [x3, #8]");
1191 COMPARE(ldrsh(w4, MemOperand(x5, 42, PreIndex)), "ldrsh w4, [x5, #42]!");
1192 COMPARE(ldrsh(x6, MemOperand(x7, -11, PostIndex)), "ldrsh x6, [x7], #-11");
1193
1194 CLEANUP();
1195}
1196
1197
armvixl5289c592015-03-02 13:52:04 +00001198TEST(load_store_v_offset) {
armvixlad96eda2013-06-14 11:42:37 +01001199 SETUP();
1200
1201 COMPARE(ldr(s0, MemOperand(x1)), "ldr s0, [x1]");
1202 COMPARE(ldr(s2, MemOperand(x3, 4)), "ldr s2, [x3, #4]");
1203 COMPARE(ldr(s4, MemOperand(x5, 16380)), "ldr s4, [x5, #16380]");
1204 COMPARE(ldr(d6, MemOperand(x7)), "ldr d6, [x7]");
1205 COMPARE(ldr(d8, MemOperand(x9, 8)), "ldr d8, [x9, #8]");
1206 COMPARE(ldr(d10, MemOperand(x11, 32760)), "ldr d10, [x11, #32760]");
1207 COMPARE(str(s12, MemOperand(x13)), "str s12, [x13]");
1208 COMPARE(str(s14, MemOperand(x15, 4)), "str s14, [x15, #4]");
1209 COMPARE(str(s16, MemOperand(x17, 16380)), "str s16, [x17, #16380]");
1210 COMPARE(str(d18, MemOperand(x19)), "str d18, [x19]");
1211 COMPARE(str(d20, MemOperand(x21, 8)), "str d20, [x21, #8]");
1212 COMPARE(str(d22, MemOperand(x23, 32760)), "str d22, [x23, #32760]");
1213
armvixl5289c592015-03-02 13:52:04 +00001214 COMPARE(ldr(b0, MemOperand(x1)), "ldr b0, [x1]");
1215 COMPARE(ldr(b2, MemOperand(x3, 1)), "ldr b2, [x3, #1]");
1216 COMPARE(ldr(b4, MemOperand(x5, 4095)), "ldr b4, [x5, #4095]");
1217 COMPARE(ldr(h6, MemOperand(x7)), "ldr h6, [x7]");
1218 COMPARE(ldr(h8, MemOperand(x9, 2)), "ldr h8, [x9, #2]");
1219 COMPARE(ldr(h10, MemOperand(x11, 8190)), "ldr h10, [x11, #8190]");
1220 COMPARE(ldr(q12, MemOperand(x13)), "ldr q12, [x13]");
1221 COMPARE(ldr(q14, MemOperand(x15, 16)), "ldr q14, [x15, #16]");
1222 COMPARE(ldr(q16, MemOperand(x17, 65520)), "ldr q16, [x17, #65520]");
1223 COMPARE(str(b18, MemOperand(x19)), "str b18, [x19]");
1224 COMPARE(str(b20, MemOperand(x21, 1)), "str b20, [x21, #1]");
1225 COMPARE(str(b22, MemOperand(x23, 4095)), "str b22, [x23, #4095]");
1226 COMPARE(str(h24, MemOperand(x25)), "str h24, [x25]");
1227 COMPARE(str(h26, MemOperand(x27, 2)), "str h26, [x27, #2]");
1228 COMPARE(str(h28, MemOperand(x29, 8190)), "str h28, [x29, #8190]");
1229 COMPARE(str(q30, MemOperand(x30)), "str q30, [x30]");
1230 COMPARE(str(q31, MemOperand(x1, 16)), "str q31, [x1, #16]");
1231 COMPARE(str(q0, MemOperand(x3, 65520)), "str q0, [x3, #65520]");
1232
1233 COMPARE(ldr(s24, MemOperand(sp)), "ldr s24, [sp]");
1234 COMPARE(ldr(d25, MemOperand(sp, 8)), "ldr d25, [sp, #8]");
1235 COMPARE(ldr(b26, MemOperand(sp, 1)), "ldr b26, [sp, #1]");
1236 COMPARE(ldr(h27, MemOperand(sp, 2)), "ldr h27, [sp, #2]");
1237 COMPARE(ldr(q28, MemOperand(sp, 16)), "ldr q28, [sp, #16]");
1238
1239 CLEANUP();
1240}
1241
1242
1243TEST(load_store_v_pre) {
1244 SETUP();
1245
armvixlad96eda2013-06-14 11:42:37 +01001246 COMPARE(ldr(s0, MemOperand(x1, 4, PreIndex)), "ldr s0, [x1, #4]!");
1247 COMPARE(ldr(s2, MemOperand(x3, 255, PreIndex)), "ldr s2, [x3, #255]!");
1248 COMPARE(ldr(s4, MemOperand(x5, -256, PreIndex)), "ldr s4, [x5, #-256]!");
1249 COMPARE(ldr(d6, MemOperand(x7, 8, PreIndex)), "ldr d6, [x7, #8]!");
1250 COMPARE(ldr(d8, MemOperand(x9, 255, PreIndex)), "ldr d8, [x9, #255]!");
1251 COMPARE(ldr(d10, MemOperand(x11, -256, PreIndex)), "ldr d10, [x11, #-256]!");
armvixl5289c592015-03-02 13:52:04 +00001252
armvixlad96eda2013-06-14 11:42:37 +01001253 COMPARE(str(s12, MemOperand(x13, 4, PreIndex)), "str s12, [x13, #4]!");
1254 COMPARE(str(s14, MemOperand(x15, 255, PreIndex)), "str s14, [x15, #255]!");
1255 COMPARE(str(s16, MemOperand(x17, -256, PreIndex)), "str s16, [x17, #-256]!");
1256 COMPARE(str(d18, MemOperand(x19, 8, PreIndex)), "str d18, [x19, #8]!");
1257 COMPARE(str(d20, MemOperand(x21, 255, PreIndex)), "str d20, [x21, #255]!");
1258 COMPARE(str(d22, MemOperand(x23, -256, PreIndex)), "str d22, [x23, #-256]!");
1259
armvixl5289c592015-03-02 13:52:04 +00001260 COMPARE(ldr(b0, MemOperand(x1, 1, PreIndex)), "ldr b0, [x1, #1]!");
1261 COMPARE(ldr(b2, MemOperand(x3, 255, PreIndex)), "ldr b2, [x3, #255]!");
1262 COMPARE(ldr(b4, MemOperand(x5, -256, PreIndex)), "ldr b4, [x5, #-256]!");
1263 COMPARE(ldr(h6, MemOperand(x7, 2, PreIndex)), "ldr h6, [x7, #2]!");
1264 COMPARE(ldr(h8, MemOperand(x9, 255, PreIndex)), "ldr h8, [x9, #255]!");
1265 COMPARE(ldr(h10, MemOperand(x11, -256, PreIndex)), "ldr h10, [x11, #-256]!");
1266 COMPARE(ldr(q12, MemOperand(x13, 16, PreIndex)), "ldr q12, [x13, #16]!");
1267 COMPARE(ldr(q14, MemOperand(x15, 255, PreIndex)), "ldr q14, [x15, #255]!");
1268 COMPARE(ldr(q16, MemOperand(x17, -256, PreIndex)), "ldr q16, [x17, #-256]!");
1269
1270 COMPARE(str(b18, MemOperand(x19, 1, PreIndex)), "str b18, [x19, #1]!");
1271 COMPARE(str(b20, MemOperand(x21, 255, PreIndex)), "str b20, [x21, #255]!");
1272 COMPARE(str(b22, MemOperand(x23, -256, PreIndex)), "str b22, [x23, #-256]!");
1273 COMPARE(str(h24, MemOperand(x25, 2, PreIndex)), "str h24, [x25, #2]!");
1274 COMPARE(str(h26, MemOperand(x27, 255, PreIndex)), "str h26, [x27, #255]!");
1275 COMPARE(str(h28, MemOperand(x29, -256, PreIndex)), "str h28, [x29, #-256]!");
1276 COMPARE(str(q30, MemOperand(x1, 16, PreIndex)), "str q30, [x1, #16]!");
1277 COMPARE(str(q31, MemOperand(x3, 255, PreIndex)), "str q31, [x3, #255]!");
1278 COMPARE(str(q0, MemOperand(x5, -256, PreIndex)), "str q0, [x5, #-256]!");
1279
1280 COMPARE(str(b24, MemOperand(sp, 1, PreIndex)), "str b24, [sp, #1]!");
1281 COMPARE(str(h25, MemOperand(sp, -2, PreIndex)), "str h25, [sp, #-2]!");
1282 COMPARE(str(s26, MemOperand(sp, 4, PreIndex)), "str s26, [sp, #4]!");
1283 COMPARE(str(d27, MemOperand(sp, -8, PreIndex)), "str d27, [sp, #-8]!");
1284 COMPARE(str(q28, MemOperand(sp, 16, PreIndex)), "str q28, [sp, #16]!");
1285
1286 CLEANUP();
1287}
1288
1289
1290TEST(load_store_v_post) {
1291 SETUP();
1292
armvixlad96eda2013-06-14 11:42:37 +01001293 COMPARE(ldr(s0, MemOperand(x1, 4, PostIndex)), "ldr s0, [x1], #4");
1294 COMPARE(ldr(s2, MemOperand(x3, 255, PostIndex)), "ldr s2, [x3], #255");
1295 COMPARE(ldr(s4, MemOperand(x5, -256, PostIndex)), "ldr s4, [x5], #-256");
1296 COMPARE(ldr(d6, MemOperand(x7, 8, PostIndex)), "ldr d6, [x7], #8");
1297 COMPARE(ldr(d8, MemOperand(x9, 255, PostIndex)), "ldr d8, [x9], #255");
1298 COMPARE(ldr(d10, MemOperand(x11, -256, PostIndex)), "ldr d10, [x11], #-256");
armvixl5289c592015-03-02 13:52:04 +00001299
armvixlad96eda2013-06-14 11:42:37 +01001300 COMPARE(str(s12, MemOperand(x13, 4, PostIndex)), "str s12, [x13], #4");
1301 COMPARE(str(s14, MemOperand(x15, 255, PostIndex)), "str s14, [x15], #255");
1302 COMPARE(str(s16, MemOperand(x17, -256, PostIndex)), "str s16, [x17], #-256");
1303 COMPARE(str(d18, MemOperand(x19, 8, PostIndex)), "str d18, [x19], #8");
1304 COMPARE(str(d20, MemOperand(x21, 255, PostIndex)), "str d20, [x21], #255");
1305 COMPARE(str(d22, MemOperand(x23, -256, PostIndex)), "str d22, [x23], #-256");
1306
armvixl5289c592015-03-02 13:52:04 +00001307 COMPARE(ldr(b0, MemOperand(x1, 4, PostIndex)), "ldr b0, [x1], #4");
1308 COMPARE(ldr(b2, MemOperand(x3, 255, PostIndex)), "ldr b2, [x3], #255");
1309 COMPARE(ldr(b4, MemOperand(x5, -256, PostIndex)), "ldr b4, [x5], #-256");
1310 COMPARE(ldr(h6, MemOperand(x7, 8, PostIndex)), "ldr h6, [x7], #8");
1311 COMPARE(ldr(h8, MemOperand(x9, 255, PostIndex)), "ldr h8, [x9], #255");
1312 COMPARE(ldr(h10, MemOperand(x11, -256, PostIndex)), "ldr h10, [x11], #-256");
1313 COMPARE(ldr(q12, MemOperand(x13, 8, PostIndex)), "ldr q12, [x13], #8");
1314 COMPARE(ldr(q14, MemOperand(x15, 255, PostIndex)), "ldr q14, [x15], #255");
1315 COMPARE(ldr(q16, MemOperand(x17, -256, PostIndex)), "ldr q16, [x17], #-256");
1316
1317 COMPARE(str(b18, MemOperand(x19, 4, PostIndex)), "str b18, [x19], #4");
1318 COMPARE(str(b20, MemOperand(x21, 255, PostIndex)), "str b20, [x21], #255");
1319 COMPARE(str(b22, MemOperand(x23, -256, PostIndex)), "str b22, [x23], #-256");
1320 COMPARE(str(h24, MemOperand(x25, 8, PostIndex)), "str h24, [x25], #8");
1321 COMPARE(str(h26, MemOperand(x27, 255, PostIndex)), "str h26, [x27], #255");
1322 COMPARE(str(h28, MemOperand(x29, -256, PostIndex)), "str h28, [x29], #-256");
1323 COMPARE(str(q30, MemOperand(x1, 8, PostIndex)), "str q30, [x1], #8");
1324 COMPARE(str(q31, MemOperand(x3, 255, PostIndex)), "str q31, [x3], #255");
1325 COMPARE(str(q0, MemOperand(x5, -256, PostIndex)), "str q0, [x5], #-256");
1326
1327 COMPARE(ldr(b24, MemOperand(sp, -1, PreIndex)), "ldr b24, [sp, #-1]!");
1328 COMPARE(ldr(h25, MemOperand(sp, 2, PreIndex)), "ldr h25, [sp, #2]!");
1329 COMPARE(ldr(s26, MemOperand(sp, -4, PreIndex)), "ldr s26, [sp, #-4]!");
1330 COMPARE(ldr(d27, MemOperand(sp, 8, PreIndex)), "ldr d27, [sp, #8]!");
1331 COMPARE(ldr(q28, MemOperand(sp, -16, PreIndex)), "ldr q28, [sp, #-16]!");
1332
1333 CLEANUP();
1334}
1335
1336
1337TEST(load_store_v_regoffset) {
1338 SETUP();
1339
1340 COMPARE(ldr(b0, MemOperand(x1, x2)), "ldr b0, [x1, x2]");
1341 COMPARE(ldr(b1, MemOperand(x2, w3, UXTW)), "ldr b1, [x2, w3, uxtw]");
1342 COMPARE(ldr(b2, MemOperand(x3, w4, SXTW)), "ldr b2, [x3, w4, sxtw]");
1343 // We can't assemble this instruction, but we check it disassembles correctly.
1344 COMPARE(dci(0x3c657883), "ldr b3, [x4, x5, lsl #0]");
1345 COMPARE(ldr(b30, MemOperand(sp, xzr)), "ldr b30, [sp, xzr]");
1346 COMPARE(ldr(b31, MemOperand(sp, wzr, UXTW)), "ldr b31, [sp, wzr, uxtw]");
1347
1348 COMPARE(ldr(h0, MemOperand(x1, x2)), "ldr h0, [x1, x2]");
1349 COMPARE(ldr(h1, MemOperand(x2, w3, UXTW)), "ldr h1, [x2, w3, uxtw]");
1350 COMPARE(ldr(h2, MemOperand(x3, w4, SXTW)), "ldr h2, [x3, w4, sxtw]");
1351 COMPARE(ldr(h3, MemOperand(x4, w5, UXTW, 1)), "ldr h3, [x4, w5, uxtw #1]");
1352 COMPARE(ldr(h4, MemOperand(x5, w5, SXTW, 1)), "ldr h4, [x5, w5, sxtw #1]");
1353 COMPARE(ldr(h30, MemOperand(sp, xzr)), "ldr h30, [sp, xzr]");
1354 COMPARE(ldr(h31, MemOperand(sp, wzr, SXTW, 1)),
1355 "ldr h31, [sp, wzr, sxtw #1]");
1356
1357 COMPARE(ldr(s0, MemOperand(x1, x2)), "ldr s0, [x1, x2]");
1358 COMPARE(ldr(s1, MemOperand(x2, w3, UXTW)), "ldr s1, [x2, w3, uxtw]");
1359 COMPARE(ldr(s2, MemOperand(x3, w4, SXTW)), "ldr s2, [x3, w4, sxtw]");
1360 COMPARE(ldr(s3, MemOperand(x4, w5, UXTW, 2)), "ldr s3, [x4, w5, uxtw #2]");
1361 COMPARE(ldr(s4, MemOperand(x5, w5, SXTW, 2)), "ldr s4, [x5, w5, sxtw #2]");
1362 COMPARE(ldr(s30, MemOperand(sp, xzr)), "ldr s30, [sp, xzr]");
1363 COMPARE(ldr(s31, MemOperand(sp, wzr, SXTW, 2)),
1364 "ldr s31, [sp, wzr, sxtw #2]");
1365
1366 COMPARE(ldr(d0, MemOperand(x1, x2)), "ldr d0, [x1, x2]");
1367 COMPARE(ldr(d1, MemOperand(x2, w3, UXTW)), "ldr d1, [x2, w3, uxtw]");
1368 COMPARE(ldr(d2, MemOperand(x3, w4, SXTW)), "ldr d2, [x3, w4, sxtw]");
1369 COMPARE(ldr(d3, MemOperand(x4, w5, UXTW, 3)), "ldr d3, [x4, w5, uxtw #3]");
1370 COMPARE(ldr(d4, MemOperand(x5, w5, SXTW, 3)), "ldr d4, [x5, w5, sxtw #3]");
1371 COMPARE(ldr(d30, MemOperand(sp, xzr)), "ldr d30, [sp, xzr]");
1372 COMPARE(ldr(d31, MemOperand(sp, wzr, SXTW, 3)),
1373 "ldr d31, [sp, wzr, sxtw #3]");
1374
1375 COMPARE(ldr(q0, MemOperand(x1, x2)), "ldr q0, [x1, x2]");
1376 COMPARE(ldr(q1, MemOperand(x2, w3, UXTW)), "ldr q1, [x2, w3, uxtw]");
1377 COMPARE(ldr(q2, MemOperand(x3, w4, SXTW)), "ldr q2, [x3, w4, sxtw]");
1378 COMPARE(ldr(q3, MemOperand(x4, w5, UXTW, 4)), "ldr q3, [x4, w5, uxtw #4]");
1379 COMPARE(ldr(q4, MemOperand(x5, w5, SXTW, 4)), "ldr q4, [x5, w5, sxtw #4]");
1380 COMPARE(ldr(q30, MemOperand(sp, xzr)), "ldr q30, [sp, xzr]");
1381 COMPARE(ldr(q31, MemOperand(sp, wzr, SXTW, 4)),
1382 "ldr q31, [sp, wzr, sxtw #4]");
1383
1384 COMPARE(str(b0, MemOperand(x1, x2)), "str b0, [x1, x2]");
1385 COMPARE(str(b1, MemOperand(x2, w3, UXTW)), "str b1, [x2, w3, uxtw]");
1386 COMPARE(str(b2, MemOperand(x3, w4, SXTW)), "str b2, [x3, w4, sxtw]");
1387 // We can't assemble this instruction, but we check it disassembles correctly.
1388 COMPARE(dci(0x3c257883), "str b3, [x4, x5, lsl #0]");
1389 COMPARE(str(b30, MemOperand(sp, xzr)), "str b30, [sp, xzr]");
1390 COMPARE(str(b31, MemOperand(sp, wzr, UXTW)), "str b31, [sp, wzr, uxtw]");
1391
1392 COMPARE(str(h0, MemOperand(x1, x2)), "str h0, [x1, x2]");
1393 COMPARE(str(h1, MemOperand(x2, w3, UXTW)), "str h1, [x2, w3, uxtw]");
1394 COMPARE(str(h2, MemOperand(x3, w4, SXTW)), "str h2, [x3, w4, sxtw]");
1395 COMPARE(str(h3, MemOperand(x4, w5, UXTW, 1)), "str h3, [x4, w5, uxtw #1]");
1396 COMPARE(str(h4, MemOperand(x5, w5, SXTW, 1)), "str h4, [x5, w5, sxtw #1]");
1397 COMPARE(str(h30, MemOperand(sp, xzr)), "str h30, [sp, xzr]");
1398 COMPARE(str(h31, MemOperand(sp, wzr, SXTW, 1)),
1399 "str h31, [sp, wzr, sxtw #1]");
1400
1401 COMPARE(str(s0, MemOperand(x1, x2)), "str s0, [x1, x2]");
1402 COMPARE(str(s1, MemOperand(x2, w3, UXTW)), "str s1, [x2, w3, uxtw]");
1403 COMPARE(str(s2, MemOperand(x3, w4, SXTW)), "str s2, [x3, w4, sxtw]");
1404 COMPARE(str(s3, MemOperand(x4, w5, UXTW, 2)), "str s3, [x4, w5, uxtw #2]");
1405 COMPARE(str(s4, MemOperand(x5, w5, SXTW, 2)), "str s4, [x5, w5, sxtw #2]");
1406 COMPARE(str(s30, MemOperand(sp, xzr)), "str s30, [sp, xzr]");
1407 COMPARE(str(s31, MemOperand(sp, wzr, SXTW, 2)),
1408 "str s31, [sp, wzr, sxtw #2]");
1409
1410 COMPARE(str(d0, MemOperand(x1, x2)), "str d0, [x1, x2]");
1411 COMPARE(str(d1, MemOperand(x2, w3, UXTW)), "str d1, [x2, w3, uxtw]");
1412 COMPARE(str(d2, MemOperand(x3, w4, SXTW)), "str d2, [x3, w4, sxtw]");
1413 COMPARE(str(d3, MemOperand(x4, w5, UXTW, 3)), "str d3, [x4, w5, uxtw #3]");
1414 COMPARE(str(d4, MemOperand(x5, w5, SXTW, 3)), "str d4, [x5, w5, sxtw #3]");
1415 COMPARE(str(d30, MemOperand(sp, xzr)), "str d30, [sp, xzr]");
1416 COMPARE(str(d31, MemOperand(sp, wzr, SXTW, 3)),
1417 "str d31, [sp, wzr, sxtw #3]");
1418
1419 COMPARE(str(q0, MemOperand(x1, x2)), "str q0, [x1, x2]");
1420 COMPARE(str(q1, MemOperand(x2, w3, UXTW)), "str q1, [x2, w3, uxtw]");
1421 COMPARE(str(q2, MemOperand(x3, w4, SXTW)), "str q2, [x3, w4, sxtw]");
1422 COMPARE(str(q3, MemOperand(x4, w5, UXTW, 4)), "str q3, [x4, w5, uxtw #4]");
1423 COMPARE(str(q4, MemOperand(x5, w5, SXTW, 4)), "str q4, [x5, w5, sxtw #4]");
1424 COMPARE(str(q30, MemOperand(sp, xzr)), "str q30, [sp, xzr]");
1425 COMPARE(str(q31, MemOperand(sp, wzr, SXTW, 4)),
1426 "str q31, [sp, wzr, sxtw #4]");
armvixlad96eda2013-06-14 11:42:37 +01001427
1428 CLEANUP();
1429}
1430
1431
1432TEST(load_store_unscaled) {
1433 SETUP();
1434
armvixl4a102ba2014-07-14 09:02:40 +01001435 // If an unscaled-offset instruction is requested, it is used, even if the
1436 // offset could be encoded in a scaled-offset instruction.
1437 COMPARE(ldurb(w0, MemOperand(x1)), "ldurb w0, [x1]");
1438 COMPARE(ldurb(x2, MemOperand(x3, 1)), "ldurb w2, [x3, #1]");
1439 COMPARE(ldurb(w4, MemOperand(x5, 255)), "ldurb w4, [x5, #255]");
1440 COMPARE(sturb(w14, MemOperand(x15)), "sturb w14, [x15]");
1441 COMPARE(sturb(x16, MemOperand(x17, 1)), "sturb w16, [x17, #1]");
1442 COMPARE(sturb(w18, MemOperand(x19, 255)), "sturb w18, [x19, #255]");
1443 COMPARE(ldursb(w0, MemOperand(x1)), "ldursb w0, [x1]");
1444 COMPARE(ldursb(w2, MemOperand(x3, 1)), "ldursb w2, [x3, #1]");
1445 COMPARE(ldursb(x2, MemOperand(x3, 255)), "ldursb x2, [x3, #255]");
1446
1447 COMPARE(ldurh(w0, MemOperand(x1)), "ldurh w0, [x1]");
1448 COMPARE(ldurh(x2, MemOperand(x3, 2)), "ldurh w2, [x3, #2]");
1449 COMPARE(ldurh(w4, MemOperand(x5, 254)), "ldurh w4, [x5, #254]");
1450 COMPARE(sturh(w14, MemOperand(x15)), "sturh w14, [x15]");
1451 COMPARE(sturh(x16, MemOperand(x17, 2)), "sturh w16, [x17, #2]");
1452 COMPARE(sturh(w18, MemOperand(x19, 254)), "sturh w18, [x19, #254]");
1453 COMPARE(ldursh(w0, MemOperand(x1)), "ldursh w0, [x1]");
1454 COMPARE(ldursh(w2, MemOperand(x3, 2)), "ldursh w2, [x3, #2]");
1455 COMPARE(ldursh(x4, MemOperand(x5, 254)), "ldursh x4, [x5, #254]");
1456
1457 COMPARE(ldur(w0, MemOperand(x1)), "ldur w0, [x1]");
1458 COMPARE(ldur(w2, MemOperand(x3, 4)), "ldur w2, [x3, #4]");
1459 COMPARE(ldur(w4, MemOperand(x5, 248)), "ldur w4, [x5, #248]");
1460 COMPARE(stur(w12, MemOperand(x13)), "stur w12, [x13]");
1461 COMPARE(stur(w14, MemOperand(x15, 4)), "stur w14, [x15, #4]");
1462 COMPARE(stur(w16, MemOperand(x17, 248)), "stur w16, [x17, #248]");
1463 COMPARE(ldursw(x0, MemOperand(x1)), "ldursw x0, [x1]");
1464 COMPARE(ldursw(x2, MemOperand(x3, 4)), "ldursw x2, [x3, #4]");
1465 COMPARE(ldursw(x4, MemOperand(x5, 248)), "ldursw x4, [x5, #248]");
1466
1467 COMPARE(ldur(x6, MemOperand(x7)), "ldur x6, [x7]");
1468 COMPARE(ldur(x8, MemOperand(x9, 8)), "ldur x8, [x9, #8]");
1469 COMPARE(ldur(x10, MemOperand(x11, 248)), "ldur x10, [x11, #248]");
1470 COMPARE(stur(x18, MemOperand(x19)), "stur x18, [x19]");
1471 COMPARE(stur(x20, MemOperand(x21, 8)), "stur x20, [x21, #8]");
1472 COMPARE(stur(x22, MemOperand(x23, 248)), "stur x22, [x23, #248]");
1473
armvixl5289c592015-03-02 13:52:04 +00001474 COMPARE(ldur(b0, MemOperand(x1)), "ldur b0, [x1]");
1475 COMPARE(ldur(h2, MemOperand(x3, -1)), "ldur h2, [x3, #-1]");
1476 COMPARE(ldur(s4, MemOperand(x5, 2)), "ldur s4, [x5, #2]");
1477 COMPARE(ldur(d6, MemOperand(x7, -3)), "ldur d6, [x7, #-3]");
1478 COMPARE(ldur(q8, MemOperand(x9, 4)), "ldur q8, [x9, #4]");
1479 COMPARE(stur(b10, MemOperand(x11)), "stur b10, [x11]");
1480 COMPARE(stur(h12, MemOperand(x13, -1)), "stur h12, [x13, #-1]");
1481 COMPARE(stur(s14, MemOperand(x15, 2)), "stur s14, [x15, #2]");
1482 COMPARE(stur(d16, MemOperand(x17, -3)), "stur d16, [x17, #-3]");
1483 COMPARE(stur(q18, MemOperand(x19, 4)), "stur q18, [x19, #4]");
1484
armvixl4a102ba2014-07-14 09:02:40 +01001485 // Normal loads and stores are converted to unscaled loads and stores if the
1486 // offset requires it.
armvixlad96eda2013-06-14 11:42:37 +01001487 COMPARE(ldr(w0, MemOperand(x1, 1)), "ldur w0, [x1, #1]");
1488 COMPARE(ldr(w2, MemOperand(x3, -1)), "ldur w2, [x3, #-1]");
1489 COMPARE(ldr(w4, MemOperand(x5, 255)), "ldur w4, [x5, #255]");
1490 COMPARE(ldr(w6, MemOperand(x7, -256)), "ldur w6, [x7, #-256]");
1491 COMPARE(ldr(x8, MemOperand(x9, 1)), "ldur x8, [x9, #1]");
1492 COMPARE(ldr(x10, MemOperand(x11, -1)), "ldur x10, [x11, #-1]");
1493 COMPARE(ldr(x12, MemOperand(x13, 255)), "ldur x12, [x13, #255]");
1494 COMPARE(ldr(x14, MemOperand(x15, -256)), "ldur x14, [x15, #-256]");
1495 COMPARE(str(w16, MemOperand(x17, 1)), "stur w16, [x17, #1]");
1496 COMPARE(str(w18, MemOperand(x19, -1)), "stur w18, [x19, #-1]");
1497 COMPARE(str(w20, MemOperand(x21, 255)), "stur w20, [x21, #255]");
1498 COMPARE(str(w22, MemOperand(x23, -256)), "stur w22, [x23, #-256]");
1499 COMPARE(str(x24, MemOperand(x25, 1)), "stur x24, [x25, #1]");
1500 COMPARE(str(x26, MemOperand(x27, -1)), "stur x26, [x27, #-1]");
1501 COMPARE(str(x28, MemOperand(x29, 255)), "stur x28, [x29, #255]");
1502 COMPARE(str(x30, MemOperand(x0, -256)), "stur x30, [x0, #-256]");
1503 COMPARE(ldr(w0, MemOperand(sp, 1)), "ldur w0, [sp, #1]");
1504 COMPARE(str(x1, MemOperand(sp, -1)), "stur x1, [sp, #-1]");
1505 COMPARE(ldrb(w2, MemOperand(x3, -2)), "ldurb w2, [x3, #-2]");
1506 COMPARE(ldrsb(w4, MemOperand(x5, -3)), "ldursb w4, [x5, #-3]");
1507 COMPARE(ldrsb(x6, MemOperand(x7, -4)), "ldursb x6, [x7, #-4]");
1508 COMPARE(ldrh(w8, MemOperand(x9, -5)), "ldurh w8, [x9, #-5]");
1509 COMPARE(ldrsh(w10, MemOperand(x11, -6)), "ldursh w10, [x11, #-6]");
1510 COMPARE(ldrsh(x12, MemOperand(x13, -7)), "ldursh x12, [x13, #-7]");
1511 COMPARE(ldrsw(x14, MemOperand(x15, -8)), "ldursw x14, [x15, #-8]");
1512
1513 CLEANUP();
1514}
1515
armvixl4a102ba2014-07-14 09:02:40 +01001516
1517TEST(load_store_unscaled_option) {
1518 SETUP();
1519
1520 // Just like load_store_unscaled, but specify the scaling option explicitly.
1521 LoadStoreScalingOption options[] = {
1522 PreferUnscaledOffset,
1523 RequireUnscaledOffset
1524 };
1525
1526 for (size_t i = 0; i < sizeof(options)/sizeof(options[0]); i++) {
1527 LoadStoreScalingOption option = options[i];
1528
1529 // If an unscaled-offset instruction is requested, it is used, even if the
1530 // offset could be encoded in a scaled-offset instruction.
1531 COMPARE(ldurb(w0, MemOperand(x1), option), "ldurb w0, [x1]");
1532 COMPARE(ldurb(x2, MemOperand(x3, 1), option), "ldurb w2, [x3, #1]");
1533 COMPARE(ldurb(w4, MemOperand(x5, 255), option), "ldurb w4, [x5, #255]");
1534 COMPARE(sturb(w14, MemOperand(x15), option), "sturb w14, [x15]");
1535 COMPARE(sturb(x16, MemOperand(x17, 1), option), "sturb w16, [x17, #1]");
1536 COMPARE(sturb(w18, MemOperand(x19, 255), option), "sturb w18, [x19, #255]");
1537 COMPARE(ldursb(w0, MemOperand(x1), option), "ldursb w0, [x1]");
1538 COMPARE(ldursb(w2, MemOperand(x3, 1), option), "ldursb w2, [x3, #1]");
1539 COMPARE(ldursb(x2, MemOperand(x3, 255), option), "ldursb x2, [x3, #255]");
1540
1541 COMPARE(ldurh(w0, MemOperand(x1), option), "ldurh w0, [x1]");
1542 COMPARE(ldurh(x2, MemOperand(x3, 2), option), "ldurh w2, [x3, #2]");
1543 COMPARE(ldurh(w4, MemOperand(x5, 254), option), "ldurh w4, [x5, #254]");
1544 COMPARE(sturh(w14, MemOperand(x15), option), "sturh w14, [x15]");
1545 COMPARE(sturh(x16, MemOperand(x17, 2), option), "sturh w16, [x17, #2]");
1546 COMPARE(sturh(w18, MemOperand(x19, 254), option), "sturh w18, [x19, #254]");
1547 COMPARE(ldursh(w0, MemOperand(x1), option), "ldursh w0, [x1]");
1548 COMPARE(ldursh(w2, MemOperand(x3, 2), option), "ldursh w2, [x3, #2]");
1549 COMPARE(ldursh(x4, MemOperand(x5, 254), option), "ldursh x4, [x5, #254]");
1550
1551 COMPARE(ldur(w0, MemOperand(x1), option), "ldur w0, [x1]");
1552 COMPARE(ldur(w2, MemOperand(x3, 4), option), "ldur w2, [x3, #4]");
1553 COMPARE(ldur(w4, MemOperand(x5, 248), option), "ldur w4, [x5, #248]");
1554 COMPARE(stur(w12, MemOperand(x13), option), "stur w12, [x13]");
1555 COMPARE(stur(w14, MemOperand(x15, 4), option), "stur w14, [x15, #4]");
1556 COMPARE(stur(w16, MemOperand(x17, 248), option), "stur w16, [x17, #248]");
1557 COMPARE(ldursw(x0, MemOperand(x1), option), "ldursw x0, [x1]");
1558 COMPARE(ldursw(x2, MemOperand(x3, 4), option), "ldursw x2, [x3, #4]");
1559 COMPARE(ldursw(x4, MemOperand(x5, 248), option), "ldursw x4, [x5, #248]");
1560
1561 COMPARE(ldur(x6, MemOperand(x7), option), "ldur x6, [x7]");
1562 COMPARE(ldur(x8, MemOperand(x9, 8), option), "ldur x8, [x9, #8]");
1563 COMPARE(ldur(x10, MemOperand(x11, 248), option), "ldur x10, [x11, #248]");
1564 COMPARE(stur(x18, MemOperand(x19), option), "stur x18, [x19]");
1565 COMPARE(stur(x20, MemOperand(x21, 8), option), "stur x20, [x21, #8]");
1566 COMPARE(stur(x22, MemOperand(x23, 248), option), "stur x22, [x23, #248]");
armvixl5289c592015-03-02 13:52:04 +00001567
1568 COMPARE(ldur(b0, MemOperand(x1), option), "ldur b0, [x1]");
1569 COMPARE(ldur(h2, MemOperand(x3, 2), option), "ldur h2, [x3, #2]");
1570 COMPARE(ldur(s4, MemOperand(x5, 4), option), "ldur s4, [x5, #4]");
1571 COMPARE(ldur(d6, MemOperand(x7, 8), option), "ldur d6, [x7, #8]");
1572 COMPARE(ldur(q8, MemOperand(x9, 16), option), "ldur q8, [x9, #16]");
1573 COMPARE(stur(b10, MemOperand(x11), option), "stur b10, [x11]");
1574 COMPARE(stur(h12, MemOperand(x13, 2), option), "stur h12, [x13, #2]");
1575 COMPARE(stur(s14, MemOperand(x15, 4), option), "stur s14, [x15, #4]");
1576 COMPARE(stur(d16, MemOperand(x17, 8), option), "stur d16, [x17, #8]");
1577 COMPARE(stur(q18, MemOperand(x19, 16), option), "stur q18, [x19, #16]");
armvixl4a102ba2014-07-14 09:02:40 +01001578 }
1579
1580 // Normal loads and stores are converted to unscaled loads and stores if the
1581 // offset requires it. PreferScaledOffset is the default for these cases, so
1582 // the behaviour here is the same when no option is specified.
1583 LoadStoreScalingOption option = PreferScaledOffset;
1584 COMPARE(ldr(w0, MemOperand(x1, 1), option), "ldur w0, [x1, #1]");
1585 COMPARE(ldr(w2, MemOperand(x3, -1), option), "ldur w2, [x3, #-1]");
1586 COMPARE(ldr(w4, MemOperand(x5, 255), option), "ldur w4, [x5, #255]");
1587 COMPARE(ldr(w6, MemOperand(x7, -256), option), "ldur w6, [x7, #-256]");
1588 COMPARE(ldr(x8, MemOperand(x9, 1), option), "ldur x8, [x9, #1]");
1589 COMPARE(ldr(x10, MemOperand(x11, -1), option), "ldur x10, [x11, #-1]");
1590 COMPARE(ldr(x12, MemOperand(x13, 255), option), "ldur x12, [x13, #255]");
1591 COMPARE(ldr(x14, MemOperand(x15, -256), option), "ldur x14, [x15, #-256]");
1592 COMPARE(str(w16, MemOperand(x17, 1), option), "stur w16, [x17, #1]");
1593 COMPARE(str(w18, MemOperand(x19, -1), option), "stur w18, [x19, #-1]");
1594 COMPARE(str(w20, MemOperand(x21, 255), option), "stur w20, [x21, #255]");
1595 COMPARE(str(w22, MemOperand(x23, -256), option), "stur w22, [x23, #-256]");
1596 COMPARE(str(x24, MemOperand(x25, 1), option), "stur x24, [x25, #1]");
1597 COMPARE(str(x26, MemOperand(x27, -1), option), "stur x26, [x27, #-1]");
1598 COMPARE(str(x28, MemOperand(x29, 255), option), "stur x28, [x29, #255]");
1599 COMPARE(str(x30, MemOperand(x0, -256), option), "stur x30, [x0, #-256]");
1600 COMPARE(ldr(w0, MemOperand(sp, 1), option), "ldur w0, [sp, #1]");
1601 COMPARE(str(x1, MemOperand(sp, -1), option), "stur x1, [sp, #-1]");
1602 COMPARE(ldrb(w2, MemOperand(x3, -2), option), "ldurb w2, [x3, #-2]");
1603 COMPARE(ldrsb(w4, MemOperand(x5, -3), option), "ldursb w4, [x5, #-3]");
1604 COMPARE(ldrsb(x6, MemOperand(x7, -4), option), "ldursb x6, [x7, #-4]");
1605 COMPARE(ldrh(w8, MemOperand(x9, -5), option), "ldurh w8, [x9, #-5]");
1606 COMPARE(ldrsh(w10, MemOperand(x11, -6), option), "ldursh w10, [x11, #-6]");
1607 COMPARE(ldrsh(x12, MemOperand(x13, -7), option), "ldursh x12, [x13, #-7]");
1608 COMPARE(ldrsw(x14, MemOperand(x15, -8), option), "ldursw x14, [x15, #-8]");
armvixl5289c592015-03-02 13:52:04 +00001609 COMPARE(ldr(b0, MemOperand(x1, 1), option), "ldr b0, [x1, #1]");
1610 COMPARE(ldr(h2, MemOperand(x3, 1), option), "ldur h2, [x3, #1]");
1611 COMPARE(ldr(s4, MemOperand(x5, 3), option), "ldur s4, [x5, #3]");
1612 COMPARE(ldr(d6, MemOperand(x7, 7), option), "ldur d6, [x7, #7]");
1613 COMPARE(ldr(q8, MemOperand(x9, 15), option), "ldur q8, [x9, #15]");
1614 COMPARE(str(b10, MemOperand(x11, 1), option), "str b10, [x11, #1]");
1615 COMPARE(str(h12, MemOperand(x13, 1), option), "stur h12, [x13, #1]");
1616 COMPARE(str(s14, MemOperand(x15, 3), option), "stur s14, [x15, #3]");
1617 COMPARE(str(d16, MemOperand(x17, 7), option), "stur d16, [x17, #7]");
1618 COMPARE(str(q18, MemOperand(x19, 15), option), "stur q18, [x19, #15]");
armvixl4a102ba2014-07-14 09:02:40 +01001619
1620 CLEANUP();
1621}
1622
1623
armvixlad96eda2013-06-14 11:42:37 +01001624TEST(load_store_pair) {
1625 SETUP();
1626
1627 COMPARE(ldp(w0, w1, MemOperand(x2)), "ldp w0, w1, [x2]");
1628 COMPARE(ldp(x3, x4, MemOperand(x5)), "ldp x3, x4, [x5]");
1629 COMPARE(ldp(w6, w7, MemOperand(x8, 4)), "ldp w6, w7, [x8, #4]");
1630 COMPARE(ldp(x9, x10, MemOperand(x11, 8)), "ldp x9, x10, [x11, #8]");
1631 COMPARE(ldp(w12, w13, MemOperand(x14, 252)), "ldp w12, w13, [x14, #252]");
1632 COMPARE(ldp(x15, x16, MemOperand(x17, 504)), "ldp x15, x16, [x17, #504]");
1633 COMPARE(ldp(w18, w19, MemOperand(x20, -256)), "ldp w18, w19, [x20, #-256]");
1634 COMPARE(ldp(x21, x22, MemOperand(x23, -512)), "ldp x21, x22, [x23, #-512]");
1635 COMPARE(ldp(w24, w25, MemOperand(x26, 252, PreIndex)),
1636 "ldp w24, w25, [x26, #252]!");
1637 COMPARE(ldp(x27, x28, MemOperand(x29, 504, PreIndex)),
1638 "ldp x27, x28, [x29, #504]!");
1639 COMPARE(ldp(w30, w0, MemOperand(x1, -256, PreIndex)),
1640 "ldp w30, w0, [x1, #-256]!");
1641 COMPARE(ldp(x2, x3, MemOperand(x4, -512, PreIndex)),
1642 "ldp x2, x3, [x4, #-512]!");
1643 COMPARE(ldp(w5, w6, MemOperand(x7, 252, PostIndex)),
1644 "ldp w5, w6, [x7], #252");
1645 COMPARE(ldp(x8, x9, MemOperand(x10, 504, PostIndex)),
1646 "ldp x8, x9, [x10], #504");
1647 COMPARE(ldp(w11, w12, MemOperand(x13, -256, PostIndex)),
1648 "ldp w11, w12, [x13], #-256");
1649 COMPARE(ldp(x14, x15, MemOperand(x16, -512, PostIndex)),
1650 "ldp x14, x15, [x16], #-512");
1651
1652 COMPARE(ldp(s17, s18, MemOperand(x19)), "ldp s17, s18, [x19]");
1653 COMPARE(ldp(s20, s21, MemOperand(x22, 252)), "ldp s20, s21, [x22, #252]");
1654 COMPARE(ldp(s23, s24, MemOperand(x25, -256)), "ldp s23, s24, [x25, #-256]");
1655 COMPARE(ldp(s26, s27, MemOperand(x28, 252, PreIndex)),
1656 "ldp s26, s27, [x28, #252]!");
1657 COMPARE(ldp(s29, s30, MemOperand(x29, -256, PreIndex)),
1658 "ldp s29, s30, [x29, #-256]!");
1659 COMPARE(ldp(s31, s0, MemOperand(x1, 252, PostIndex)),
1660 "ldp s31, s0, [x1], #252");
1661 COMPARE(ldp(s2, s3, MemOperand(x4, -256, PostIndex)),
1662 "ldp s2, s3, [x4], #-256");
1663 COMPARE(ldp(d17, d18, MemOperand(x19)), "ldp d17, d18, [x19]");
1664 COMPARE(ldp(d20, d21, MemOperand(x22, 504)), "ldp d20, d21, [x22, #504]");
1665 COMPARE(ldp(d23, d24, MemOperand(x25, -512)), "ldp d23, d24, [x25, #-512]");
1666 COMPARE(ldp(d26, d27, MemOperand(x28, 504, PreIndex)),
1667 "ldp d26, d27, [x28, #504]!");
1668 COMPARE(ldp(d29, d30, MemOperand(x29, -512, PreIndex)),
1669 "ldp d29, d30, [x29, #-512]!");
1670 COMPARE(ldp(d31, d0, MemOperand(x1, 504, PostIndex)),
1671 "ldp d31, d0, [x1], #504");
1672 COMPARE(ldp(d2, d3, MemOperand(x4, -512, PostIndex)),
1673 "ldp d2, d3, [x4], #-512");
1674
armvixl5289c592015-03-02 13:52:04 +00001675 COMPARE(ldp(q5, q6, MemOperand(x7)), "ldp q5, q6, [x7]");
1676 COMPARE(ldp(q8, q9, MemOperand(x10, 1008)), "ldp q8, q9, [x10, #1008]");
1677 COMPARE(ldp(q11, q12, MemOperand(x13, -1024)), "ldp q11, q12, [x13, #-1024]");
1678 COMPARE(ldp(q14, q15, MemOperand(x16, 1008, PreIndex)),
1679 "ldp q14, q15, [x16, #1008]!");
1680 COMPARE(ldp(q17, q18, MemOperand(x19, -1024, PreIndex)),
1681 "ldp q17, q18, [x19, #-1024]!");
1682 COMPARE(ldp(q20, q21, MemOperand(x22, 1008, PostIndex)),
1683 "ldp q20, q21, [x22], #1008");
1684 COMPARE(ldp(q23, q24, MemOperand(x25, -1024, PostIndex)),
1685 "ldp q23, q24, [x25], #-1024");
1686
armvixlad96eda2013-06-14 11:42:37 +01001687 COMPARE(stp(w0, w1, MemOperand(x2)), "stp w0, w1, [x2]");
1688 COMPARE(stp(x3, x4, MemOperand(x5)), "stp x3, x4, [x5]");
1689 COMPARE(stp(w6, w7, MemOperand(x8, 4)), "stp w6, w7, [x8, #4]");
1690 COMPARE(stp(x9, x10, MemOperand(x11, 8)), "stp x9, x10, [x11, #8]");
1691 COMPARE(stp(w12, w13, MemOperand(x14, 252)), "stp w12, w13, [x14, #252]");
1692 COMPARE(stp(x15, x16, MemOperand(x17, 504)), "stp x15, x16, [x17, #504]");
1693 COMPARE(stp(w18, w19, MemOperand(x20, -256)), "stp w18, w19, [x20, #-256]");
1694 COMPARE(stp(x21, x22, MemOperand(x23, -512)), "stp x21, x22, [x23, #-512]");
1695 COMPARE(stp(w24, w25, MemOperand(x26, 252, PreIndex)),
1696 "stp w24, w25, [x26, #252]!");
1697 COMPARE(stp(x27, x28, MemOperand(x29, 504, PreIndex)),
1698 "stp x27, x28, [x29, #504]!");
1699 COMPARE(stp(w30, w0, MemOperand(x1, -256, PreIndex)),
1700 "stp w30, w0, [x1, #-256]!");
1701 COMPARE(stp(x2, x3, MemOperand(x4, -512, PreIndex)),
1702 "stp x2, x3, [x4, #-512]!");
1703 COMPARE(stp(w5, w6, MemOperand(x7, 252, PostIndex)),
1704 "stp w5, w6, [x7], #252");
1705 COMPARE(stp(x8, x9, MemOperand(x10, 504, PostIndex)),
1706 "stp x8, x9, [x10], #504");
1707 COMPARE(stp(w11, w12, MemOperand(x13, -256, PostIndex)),
1708 "stp w11, w12, [x13], #-256");
1709 COMPARE(stp(x14, x15, MemOperand(x16, -512, PostIndex)),
1710 "stp x14, x15, [x16], #-512");
1711
1712 COMPARE(stp(s17, s18, MemOperand(x19)), "stp s17, s18, [x19]");
1713 COMPARE(stp(s20, s21, MemOperand(x22, 252)), "stp s20, s21, [x22, #252]");
1714 COMPARE(stp(s23, s24, MemOperand(x25, -256)), "stp s23, s24, [x25, #-256]");
1715 COMPARE(stp(s26, s27, MemOperand(x28, 252, PreIndex)),
1716 "stp s26, s27, [x28, #252]!");
1717 COMPARE(stp(s29, s30, MemOperand(x29, -256, PreIndex)),
1718 "stp s29, s30, [x29, #-256]!");
1719 COMPARE(stp(s31, s0, MemOperand(x1, 252, PostIndex)),
1720 "stp s31, s0, [x1], #252");
1721 COMPARE(stp(s2, s3, MemOperand(x4, -256, PostIndex)),
1722 "stp s2, s3, [x4], #-256");
1723 COMPARE(stp(d17, d18, MemOperand(x19)), "stp d17, d18, [x19]");
1724 COMPARE(stp(d20, d21, MemOperand(x22, 504)), "stp d20, d21, [x22, #504]");
1725 COMPARE(stp(d23, d24, MemOperand(x25, -512)), "stp d23, d24, [x25, #-512]");
1726 COMPARE(stp(d26, d27, MemOperand(x28, 504, PreIndex)),
1727 "stp d26, d27, [x28, #504]!");
1728 COMPARE(stp(d29, d30, MemOperand(x29, -512, PreIndex)),
1729 "stp d29, d30, [x29, #-512]!");
1730 COMPARE(stp(d31, d0, MemOperand(x1, 504, PostIndex)),
1731 "stp d31, d0, [x1], #504");
1732 COMPARE(stp(d2, d3, MemOperand(x4, -512, PostIndex)),
1733 "stp d2, d3, [x4], #-512");
1734
armvixl5289c592015-03-02 13:52:04 +00001735 COMPARE(stp(q5, q6, MemOperand(x7)), "stp q5, q6, [x7]");
1736 COMPARE(stp(q8, q9, MemOperand(x10, 1008)), "stp q8, q9, [x10, #1008]");
1737 COMPARE(stp(q11, q12, MemOperand(x13, -1024)), "stp q11, q12, [x13, #-1024]");
1738 COMPARE(stp(q14, q15, MemOperand(x16, 1008, PreIndex)),
1739 "stp q14, q15, [x16, #1008]!");
1740 COMPARE(stp(q17, q18, MemOperand(x19, -1024, PreIndex)),
1741 "stp q17, q18, [x19, #-1024]!");
1742 COMPARE(stp(q20, q21, MemOperand(x22, 1008, PostIndex)),
1743 "stp q20, q21, [x22], #1008");
1744 COMPARE(stp(q23, q24, MemOperand(x25, -1024, PostIndex)),
1745 "stp q23, q24, [x25], #-1024");
1746
armvixlad96eda2013-06-14 11:42:37 +01001747 COMPARE(ldp(w16, w17, MemOperand(sp, 4, PostIndex)),
1748 "ldp w16, w17, [sp], #4");
1749 COMPARE(stp(x18, x19, MemOperand(sp, -8, PreIndex)),
1750 "stp x18, x19, [sp, #-8]!");
1751 COMPARE(ldp(s30, s31, MemOperand(sp, 12, PostIndex)),
1752 "ldp s30, s31, [sp], #12");
1753 COMPARE(stp(d30, d31, MemOperand(sp, -16)),
1754 "stp d30, d31, [sp, #-16]");
armvixl5289c592015-03-02 13:52:04 +00001755 COMPARE(ldp(q30, q31, MemOperand(sp, 32, PostIndex)),
1756 "ldp q30, q31, [sp], #32");
armvixlad96eda2013-06-14 11:42:37 +01001757
1758 COMPARE(ldpsw(x0, x1, MemOperand(x2)), "ldpsw x0, x1, [x2]");
1759 COMPARE(ldpsw(x3, x4, MemOperand(x5, 16)), "ldpsw x3, x4, [x5, #16]");
1760 COMPARE(ldpsw(x6, x7, MemOperand(x8, -32, PreIndex)),
1761 "ldpsw x6, x7, [x8, #-32]!");
1762 COMPARE(ldpsw(x9, x10, MemOperand(x11, 128, PostIndex)),
1763 "ldpsw x9, x10, [x11], #128");
1764
1765 CLEANUP();
1766}
1767
armvixl4a102ba2014-07-14 09:02:40 +01001768
1769TEST(load_store_exclusive) {
1770 SETUP();
1771
1772 COMPARE(stxrb(w0, w1, MemOperand(x2)), "stxrb w0, w1, [x2]");
1773 COMPARE(stxrb(x3, w4, MemOperand(sp)), "stxrb w3, w4, [sp]");
1774 COMPARE(stxrb(w5, x6, MemOperand(x7)), "stxrb w5, w6, [x7]");
1775 COMPARE(stxrb(x8, x9, MemOperand(sp)), "stxrb w8, w9, [sp]");
1776 COMPARE(stxrh(w10, w11, MemOperand(x12)), "stxrh w10, w11, [x12]");
1777 COMPARE(stxrh(x13, w14, MemOperand(sp)), "stxrh w13, w14, [sp]");
1778 COMPARE(stxrh(w15, x16, MemOperand(x17)), "stxrh w15, w16, [x17]");
1779 COMPARE(stxrh(x18, x19, MemOperand(sp)), "stxrh w18, w19, [sp]");
1780 COMPARE(stxr(w20, w21, MemOperand(x22)), "stxr w20, w21, [x22]");
1781 COMPARE(stxr(x23, w24, MemOperand(sp)), "stxr w23, w24, [sp]");
1782 COMPARE(stxr(w25, x26, MemOperand(x27)), "stxr w25, x26, [x27]");
1783 COMPARE(stxr(x28, x29, MemOperand(sp)), "stxr w28, x29, [sp]");
1784 COMPARE(ldxrb(w30, MemOperand(x0)), "ldxrb w30, [x0]");
1785 COMPARE(ldxrb(w1, MemOperand(sp)), "ldxrb w1, [sp]");
1786 COMPARE(ldxrb(x2, MemOperand(x3)), "ldxrb w2, [x3]");
1787 COMPARE(ldxrb(x4, MemOperand(sp)), "ldxrb w4, [sp]");
1788 COMPARE(ldxrh(w5, MemOperand(x6)), "ldxrh w5, [x6]");
1789 COMPARE(ldxrh(w7, MemOperand(sp)), "ldxrh w7, [sp]");
1790 COMPARE(ldxrh(x8, MemOperand(x9)), "ldxrh w8, [x9]");
1791 COMPARE(ldxrh(x10, MemOperand(sp)), "ldxrh w10, [sp]");
1792 COMPARE(ldxr(w11, MemOperand(x12)), "ldxr w11, [x12]");
1793 COMPARE(ldxr(w13, MemOperand(sp)), "ldxr w13, [sp]");
1794 COMPARE(ldxr(x14, MemOperand(x15)), "ldxr x14, [x15]");
1795 COMPARE(ldxr(x16, MemOperand(sp)), "ldxr x16, [sp]");
1796 COMPARE(stxp(w17, w18, w19, MemOperand(x20)), "stxp w17, w18, w19, [x20]");
1797 COMPARE(stxp(x21, w22, w23, MemOperand(sp)), "stxp w21, w22, w23, [sp]");
1798 COMPARE(stxp(w24, x25, x26, MemOperand(x27)), "stxp w24, x25, x26, [x27]");
1799 COMPARE(stxp(x28, x29, x30, MemOperand(sp)), "stxp w28, x29, x30, [sp]");
1800 COMPARE(ldxp(w0, w1, MemOperand(x2)), "ldxp w0, w1, [x2]");
1801 COMPARE(ldxp(w3, w4, MemOperand(sp)), "ldxp w3, w4, [sp]");
1802 COMPARE(ldxp(x5, x6, MemOperand(x7)), "ldxp x5, x6, [x7]");
1803 COMPARE(ldxp(x8, x9, MemOperand(sp)), "ldxp x8, x9, [sp]");
1804 COMPARE(stlxrb(w10, w11, MemOperand(x12)), "stlxrb w10, w11, [x12]");
1805 COMPARE(stlxrb(x13, w14, MemOperand(sp)), "stlxrb w13, w14, [sp]");
1806 COMPARE(stlxrb(w15, x16, MemOperand(x17)), "stlxrb w15, w16, [x17]");
1807 COMPARE(stlxrb(x18, x19, MemOperand(sp)), "stlxrb w18, w19, [sp]");
1808 COMPARE(stlxrh(w20, w21, MemOperand(x22)), "stlxrh w20, w21, [x22]");
1809 COMPARE(stlxrh(x23, w24, MemOperand(sp)), "stlxrh w23, w24, [sp]");
1810 COMPARE(stlxrh(w25, x26, MemOperand(x27)), "stlxrh w25, w26, [x27]");
1811 COMPARE(stlxrh(x28, x29, MemOperand(sp)), "stlxrh w28, w29, [sp]");
1812 COMPARE(stlxr(w30, w0, MemOperand(x1)), "stlxr w30, w0, [x1]");
1813 COMPARE(stlxr(x2, w3, MemOperand(sp)), "stlxr w2, w3, [sp]");
1814 COMPARE(stlxr(w4, x5, MemOperand(x6)), "stlxr w4, x5, [x6]");
1815 COMPARE(stlxr(x7, x8, MemOperand(sp)), "stlxr w7, x8, [sp]");
1816 COMPARE(ldaxrb(w9, MemOperand(x10)), "ldaxrb w9, [x10]");
1817 COMPARE(ldaxrb(w11, MemOperand(sp)), "ldaxrb w11, [sp]");
1818 COMPARE(ldaxrb(x12, MemOperand(x13)), "ldaxrb w12, [x13]");
1819 COMPARE(ldaxrb(x14, MemOperand(sp)), "ldaxrb w14, [sp]");
1820 COMPARE(ldaxrh(w15, MemOperand(x16)), "ldaxrh w15, [x16]");
1821 COMPARE(ldaxrh(w17, MemOperand(sp)), "ldaxrh w17, [sp]");
1822 COMPARE(ldaxrh(x18, MemOperand(x19)), "ldaxrh w18, [x19]");
1823 COMPARE(ldaxrh(x20, MemOperand(sp)), "ldaxrh w20, [sp]");
1824 COMPARE(ldaxr(w21, MemOperand(x22)), "ldaxr w21, [x22]");
1825 COMPARE(ldaxr(w23, MemOperand(sp)), "ldaxr w23, [sp]");
1826 COMPARE(ldaxr(x24, MemOperand(x25)), "ldaxr x24, [x25]");
1827 COMPARE(ldaxr(x26, MemOperand(sp)), "ldaxr x26, [sp]");
1828 COMPARE(stlxp(w27, w28, w29, MemOperand(x30)), "stlxp w27, w28, w29, [x30]");
1829 COMPARE(stlxp(x0, w1, w2, MemOperand(sp)), "stlxp w0, w1, w2, [sp]");
1830 COMPARE(stlxp(w3, x4, x5, MemOperand(x6)), "stlxp w3, x4, x5, [x6]");
1831 COMPARE(stlxp(x7, x8, x9, MemOperand(sp)), "stlxp w7, x8, x9, [sp]");
1832 COMPARE(ldaxp(w10, w11, MemOperand(x12)), "ldaxp w10, w11, [x12]");
1833 COMPARE(ldaxp(w13, w14, MemOperand(sp)), "ldaxp w13, w14, [sp]");
1834 COMPARE(ldaxp(x15, x16, MemOperand(x17)), "ldaxp x15, x16, [x17]");
1835 COMPARE(ldaxp(x18, x19, MemOperand(sp)), "ldaxp x18, x19, [sp]");
1836 COMPARE(stlrb(w20, MemOperand(x21)), "stlrb w20, [x21]");
1837 COMPARE(stlrb(w22, MemOperand(sp)), "stlrb w22, [sp]");
1838 COMPARE(stlrb(x23, MemOperand(x24)), "stlrb w23, [x24]");
1839 COMPARE(stlrb(x25, MemOperand(sp)), "stlrb w25, [sp]");
1840 COMPARE(stlrh(w26, MemOperand(x27)), "stlrh w26, [x27]");
1841 COMPARE(stlrh(w28, MemOperand(sp)), "stlrh w28, [sp]");
1842 COMPARE(stlrh(x29, MemOperand(x30)), "stlrh w29, [x30]");
1843 COMPARE(stlrh(x0, MemOperand(sp)), "stlrh w0, [sp]");
1844 COMPARE(stlr(w1, MemOperand(x2)), "stlr w1, [x2]");
1845 COMPARE(stlr(w3, MemOperand(sp)), "stlr w3, [sp]");
1846 COMPARE(stlr(x4, MemOperand(x5)), "stlr x4, [x5]");
1847 COMPARE(stlr(x6, MemOperand(sp)), "stlr x6, [sp]");
1848 COMPARE(ldarb(w7, MemOperand(x8)), "ldarb w7, [x8]");
1849 COMPARE(ldarb(w9, MemOperand(sp)), "ldarb w9, [sp]");
1850 COMPARE(ldarb(x10, MemOperand(x11)), "ldarb w10, [x11]");
1851 COMPARE(ldarb(x12, MemOperand(sp)), "ldarb w12, [sp]");
1852 COMPARE(ldarh(w13, MemOperand(x14)), "ldarh w13, [x14]");
1853 COMPARE(ldarh(w15, MemOperand(sp)), "ldarh w15, [sp]");
1854 COMPARE(ldarh(x16, MemOperand(x17)), "ldarh w16, [x17]");
1855 COMPARE(ldarh(x18, MemOperand(sp)), "ldarh w18, [sp]");
1856 COMPARE(ldar(w19, MemOperand(x20)), "ldar w19, [x20]");
1857 COMPARE(ldar(w21, MemOperand(sp)), "ldar w21, [sp]");
1858 COMPARE(ldar(x22, MemOperand(x23)), "ldar x22, [x23]");
1859 COMPARE(ldar(x24, MemOperand(sp)), "ldar x24, [sp]");
1860
1861 CLEANUP();
1862}
1863
1864
armvixlad96eda2013-06-14 11:42:37 +01001865TEST(load_store_pair_nontemp) {
1866 SETUP();
1867
1868 COMPARE(ldnp(w0, w1, MemOperand(x2)), "ldnp w0, w1, [x2]");
1869 COMPARE(stnp(w3, w4, MemOperand(x5, 252)), "stnp w3, w4, [x5, #252]");
1870 COMPARE(ldnp(w6, w7, MemOperand(x8, -256)), "ldnp w6, w7, [x8, #-256]");
1871 COMPARE(stnp(x9, x10, MemOperand(x11)), "stnp x9, x10, [x11]");
1872 COMPARE(ldnp(x12, x13, MemOperand(x14, 504)), "ldnp x12, x13, [x14, #504]");
1873 COMPARE(stnp(x15, x16, MemOperand(x17, -512)), "stnp x15, x16, [x17, #-512]");
1874 COMPARE(ldnp(s18, s19, MemOperand(x20)), "ldnp s18, s19, [x20]");
1875 COMPARE(stnp(s21, s22, MemOperand(x23, 252)), "stnp s21, s22, [x23, #252]");
1876 COMPARE(ldnp(s24, s25, MemOperand(x26, -256)), "ldnp s24, s25, [x26, #-256]");
1877 COMPARE(stnp(d27, d28, MemOperand(x29)), "stnp d27, d28, [x29]");
1878 COMPARE(ldnp(d30, d31, MemOperand(x0, 504)), "ldnp d30, d31, [x0, #504]");
1879 COMPARE(stnp(d1, d2, MemOperand(x3, -512)), "stnp d1, d2, [x3, #-512]");
armvixl5289c592015-03-02 13:52:04 +00001880 COMPARE(ldnp(q4, q5, MemOperand(x6)), "ldnp q4, q5, [x6]");
1881 COMPARE(stnp(q7, q8, MemOperand(x9, 1008)), "stnp q7, q8, [x9, #1008]");
1882 COMPARE(ldnp(q10, q11, MemOperand(x12, -1024)),
1883 "ldnp q10, q11, [x12, #-1024]");
armvixlad96eda2013-06-14 11:42:37 +01001884
1885 CLEANUP();
1886}
1887
armvixl4a102ba2014-07-14 09:02:40 +01001888
armvixl330dc712014-11-25 10:38:32 +00001889TEST(load_literal_macro) {
armvixl684cd2a2015-10-23 13:38:33 +01001890 SETUP_MACRO();
armvixlad96eda2013-06-14 11:42:37 +01001891
armvixl330dc712014-11-25 10:38:32 +00001892 // In each case, the literal will be placed at PC+8:
1893 // ldr x10, pc+8 // Test instruction.
1894 // ldr xzr, pc+12 // Pool marker.
1895 // .word64 #0x1234567890abcdef // Test literal.
1896
1897 COMPARE_PREFIX(Ldr(x10, 0x1234567890abcdef), "ldr x10, pc+8");
1898 COMPARE_PREFIX(Ldr(w20, 0xfedcba09), "ldr w20, pc+8");
1899 COMPARE_PREFIX(Ldr(d11, 1.234), "ldr d11, pc+8");
1900 COMPARE_PREFIX(Ldr(s22, 2.5f), "ldr s22, pc+8");
1901 COMPARE_PREFIX(Ldrsw(x21, 0x80000000), "ldrsw x21, pc+8");
1902
1903 CLEANUP();
1904}
1905
1906
1907TEST(load_literal) {
1908 SETUP();
1909
1910 COMPARE_PREFIX(ldr(x20, 0), "ldr x20, pc+0");
1911 COMPARE_PREFIX(ldr(x20, 1), "ldr x20, pc+4");
1912 COMPARE_PREFIX(ldr(x20, -1), "ldr x20, pc-4");
1913 COMPARE_PREFIX(ldr(x20, 0x3ffff), "ldr x20, pc+1048572");
1914 COMPARE_PREFIX(ldr(x20, -0x40000), "ldr x20, pc-1048576");
1915 COMPARE_PREFIX(ldr(w21, 0), "ldr w21, pc+0");
1916 COMPARE_PREFIX(ldr(w21, 1), "ldr w21, pc+4");
1917 COMPARE_PREFIX(ldr(w21, -1), "ldr w21, pc-4");
1918 COMPARE_PREFIX(ldr(w21, 0x3ffff), "ldr w21, pc+1048572");
1919 COMPARE_PREFIX(ldr(w21, -0x40000), "ldr w21, pc-1048576");
1920 COMPARE_PREFIX(ldr(d22, 0), "ldr d22, pc+0");
1921 COMPARE_PREFIX(ldr(d22, 1), "ldr d22, pc+4");
1922 COMPARE_PREFIX(ldr(d22, -1), "ldr d22, pc-4");
1923 COMPARE_PREFIX(ldr(d22, 0x3ffff), "ldr d22, pc+1048572");
1924 COMPARE_PREFIX(ldr(d22, -0x40000), "ldr d22, pc-1048576");
1925 COMPARE_PREFIX(ldr(s23, 0), "ldr s23, pc+0");
1926 COMPARE_PREFIX(ldr(s23, 1), "ldr s23, pc+4");
1927 COMPARE_PREFIX(ldr(s23, -1), "ldr s23, pc-4");
1928 COMPARE_PREFIX(ldr(s23, 0x3ffff), "ldr s23, pc+1048572");
1929 COMPARE_PREFIX(ldr(s23, -0x40000), "ldr s23, pc-1048576");
1930 COMPARE_PREFIX(ldrsw(x24, 0), "ldrsw x24, pc+0");
1931 COMPARE_PREFIX(ldrsw(x24, 1), "ldrsw x24, pc+4");
1932 COMPARE_PREFIX(ldrsw(x24, -1), "ldrsw x24, pc-4");
1933 COMPARE_PREFIX(ldrsw(x24, 0x3ffff), "ldrsw x24, pc+1048572");
1934 COMPARE_PREFIX(ldrsw(x24, -0x40000), "ldrsw x24, pc-1048576");
1935
1936 CLEANUP();
1937}
1938
1939
1940TEST(prfm_operations) {
1941 SETUP();
1942
1943 // Test every encodable prefetch operation.
1944 const char* expected[] = {
1945 "prfm pldl1keep, ",
1946 "prfm pldl1strm, ",
1947 "prfm pldl2keep, ",
1948 "prfm pldl2strm, ",
1949 "prfm pldl3keep, ",
1950 "prfm pldl3strm, ",
1951 "prfm #0b00110, ",
1952 "prfm #0b00111, ",
1953 "prfm plil1keep, ",
1954 "prfm plil1strm, ",
1955 "prfm plil2keep, ",
1956 "prfm plil2strm, ",
1957 "prfm plil3keep, ",
1958 "prfm plil3strm, ",
1959 "prfm #0b01110, ",
1960 "prfm #0b01111, ",
1961 "prfm pstl1keep, ",
1962 "prfm pstl1strm, ",
1963 "prfm pstl2keep, ",
1964 "prfm pstl2strm, ",
1965 "prfm pstl3keep, ",
1966 "prfm pstl3strm, ",
1967 "prfm #0b10110, ",
1968 "prfm #0b10111, ",
1969 "prfm #0b11000, ",
1970 "prfm #0b11001, ",
1971 "prfm #0b11010, ",
1972 "prfm #0b11011, ",
1973 "prfm #0b11100, ",
1974 "prfm #0b11101, ",
1975 "prfm #0b11110, ",
1976 "prfm #0b11111, ",
1977 };
1978 const int expected_count = sizeof(expected) / sizeof(expected[0]);
1979 VIXL_STATIC_ASSERT((1 << ImmPrefetchOperation_width) == expected_count);
1980
1981 for (int i = 0; i < (1 << ImmPrefetchOperation_width); i++) {
1982 PrefetchOperation op = static_cast<PrefetchOperation>(i);
1983 COMPARE_PREFIX(prfm(op, 0), expected[i]);
1984 COMPARE_PREFIX(prfm(op, MemOperand(x0, 0)), expected[i]);
1985 COMPARE_PREFIX(prfm(op, MemOperand(x0, x1)), expected[i]);
1986 }
1987
1988 CLEANUP();
1989}
1990
1991
1992TEST(prfum_operations) {
1993 SETUP();
1994
1995 // Test every encodable prefetch operation.
1996 const char* expected[] = {
1997 "prfum pldl1keep, ",
1998 "prfum pldl1strm, ",
1999 "prfum pldl2keep, ",
2000 "prfum pldl2strm, ",
2001 "prfum pldl3keep, ",
2002 "prfum pldl3strm, ",
2003 "prfum #0b00110, ",
2004 "prfum #0b00111, ",
2005 "prfum plil1keep, ",
2006 "prfum plil1strm, ",
2007 "prfum plil2keep, ",
2008 "prfum plil2strm, ",
2009 "prfum plil3keep, ",
2010 "prfum plil3strm, ",
2011 "prfum #0b01110, ",
2012 "prfum #0b01111, ",
2013 "prfum pstl1keep, ",
2014 "prfum pstl1strm, ",
2015 "prfum pstl2keep, ",
2016 "prfum pstl2strm, ",
2017 "prfum pstl3keep, ",
2018 "prfum pstl3strm, ",
2019 "prfum #0b10110, ",
2020 "prfum #0b10111, ",
2021 "prfum #0b11000, ",
2022 "prfum #0b11001, ",
2023 "prfum #0b11010, ",
2024 "prfum #0b11011, ",
2025 "prfum #0b11100, ",
2026 "prfum #0b11101, ",
2027 "prfum #0b11110, ",
2028 "prfum #0b11111, ",
2029 };
2030 const int expected_count = sizeof(expected) / sizeof(expected[0]);
2031 VIXL_STATIC_ASSERT((1 << ImmPrefetchOperation_width) == expected_count);
2032
2033 for (int i = 0; i < (1 << ImmPrefetchOperation_width); i++) {
2034 PrefetchOperation op = static_cast<PrefetchOperation>(i);
2035 COMPARE_PREFIX(prfum(op, MemOperand(x0, 0)), expected[i]);
2036 }
2037
2038 CLEANUP();
2039}
2040
2041
2042TEST(prfm_offset) {
2043 SETUP();
2044
2045 COMPARE(prfm(PLDL1KEEP, MemOperand(x1)), "prfm pldl1keep, [x1]");
2046 COMPARE(prfm(PLDL1STRM, MemOperand(x3, 8)), "prfm pldl1strm, [x3, #8]");
2047 COMPARE(prfm(PLDL2KEEP, MemOperand(x5, 32760)),
2048 "prfm pldl2keep, [x5, #32760]");
2049
2050 COMPARE(prfm(PLDL2STRM, MemOperand(sp)), "prfm pldl2strm, [sp]");
2051 COMPARE(prfm(PLDL3KEEP, MemOperand(sp, 8)), "prfm pldl3keep, [sp, #8]");
2052 COMPARE(prfm(PLDL3STRM, MemOperand(sp, 32760)),
2053 "prfm pldl3strm, [sp, #32760]");
2054
2055 CLEANUP();
2056}
2057
2058
2059TEST(prfm_regoffset) {
2060 SETUP();
2061
2062 COMPARE(prfm(PLIL1KEEP, MemOperand(x1, x2)), "prfm plil1keep, [x1, x2]");
2063 COMPARE(prfm(PLIL1STRM, MemOperand(x3, w4, SXTW)),
2064 "prfm plil1strm, [x3, w4, sxtw]");
2065 COMPARE(prfm(PLIL2KEEP, MemOperand(x5, x6, LSL, 3)),
2066 "prfm plil2keep, [x5, x6, lsl #3]");
2067
2068 COMPARE(prfm(PLIL2STRM, MemOperand(sp, xzr)), "prfm plil2strm, [sp, xzr]");
2069 COMPARE(prfm(PLIL3KEEP, MemOperand(sp, wzr, SXTW)),
2070 "prfm plil3keep, [sp, wzr, sxtw]");
2071 COMPARE(prfm(PLIL3STRM, MemOperand(sp, xzr, LSL, 3)),
2072 "prfm plil3strm, [sp, xzr, lsl #3]");
2073
2074 CLEANUP();
2075}
2076
2077
2078TEST(prfm_literal) {
2079 SETUP();
2080
2081 COMPARE_PREFIX(prfm(PSTL1KEEP, 0), "prfm pstl1keep, pc+0");
2082 COMPARE_PREFIX(prfm(PSTL1STRM, 1), "prfm pstl1strm, pc+4");
2083 COMPARE_PREFIX(prfm(PSTL2KEEP, -1), "prfm pstl2keep, pc-4");
2084 COMPARE_PREFIX(prfm(PSTL2STRM, 0x3ffff), "prfm pstl2strm, pc+1048572");
2085 COMPARE_PREFIX(prfm(PSTL3KEEP, -0x3ffff), "prfm pstl3keep, pc-1048572");
2086 COMPARE_PREFIX(prfm(PSTL3STRM, -0x40000), "prfm pstl3strm, pc-1048576");
2087
2088 CLEANUP();
2089}
2090
2091
2092TEST(prfm_unscaled) {
2093 SETUP();
2094
2095 // If an unscaled-offset instruction is requested, it is used, even if the
2096 // offset could be encoded in a scaled-offset instruction.
2097 COMPARE(prfum(PLDL1KEEP, MemOperand(x1)), "prfum pldl1keep, [x1]");
2098 COMPARE(prfum(PLDL1STRM, MemOperand(x1, 8)), "prfum pldl1strm, [x1, #8]");
2099 COMPARE(prfum(PLDL2KEEP, MemOperand(x1, 248)), "prfum pldl2keep, [x1, #248]");
2100
2101 // Normal offsets are converted to unscaled offsets if necssary.
2102 COMPARE(prfm(PLDL2STRM, MemOperand(x1, 1)), "prfum pldl2strm, [x1, #1]");
2103 COMPARE(prfm(PLDL3KEEP, MemOperand(x1, -1)), "prfum pldl3keep, [x1, #-1]");
2104 COMPARE(prfm(PLDL3STRM, MemOperand(x1, 255)), "prfum pldl3strm, [x1, #255]");
2105 COMPARE(prfm(PLDL3STRM, MemOperand(x1, -256)),
2106 "prfum pldl3strm, [x1, #-256]");
2107
2108 CLEANUP();
2109}
2110
2111
2112TEST(prfm_unscaled_option) {
2113 SETUP();
2114
2115 // Just like prfm_unscaled, but specify the scaling option explicitly.
2116
2117 // Require unscaled-offset forms.
2118 LoadStoreScalingOption option = RequireUnscaledOffset;
2119
2120 COMPARE(prfum(PLDL1KEEP, MemOperand(x1), option), "prfum pldl1keep, [x1]");
2121 COMPARE(prfum(PLDL1STRM, MemOperand(x1, 8), option),
2122 "prfum pldl1strm, [x1, #8]");
2123 COMPARE(prfum(PLDL2KEEP, MemOperand(x1, 248), option),
2124 "prfum pldl2keep, [x1, #248]");
2125 COMPARE(prfum(PLDL2STRM, MemOperand(x1, 1), option),
2126 "prfum pldl2strm, [x1, #1]");
2127 COMPARE(prfum(PLDL3KEEP, MemOperand(x1, -1), option),
2128 "prfum pldl3keep, [x1, #-1]");
2129 COMPARE(prfum(PLDL3STRM, MemOperand(x1, 255), option),
2130 "prfum pldl3strm, [x1, #255]");
2131 COMPARE(prfum(PLIL1KEEP, MemOperand(x1, -256), option),
2132 "prfum plil1keep, [x1, #-256]");
2133
2134 // Require scaled-offset forms..
2135 option = RequireScaledOffset;
2136
2137 COMPARE(prfm(PLDL1KEEP, MemOperand(x1), option), "prfm pldl1keep, [x1]");
2138 COMPARE(prfm(PLDL1STRM, MemOperand(x1, 8), option),
2139 "prfm pldl1strm, [x1, #8]");
2140 COMPARE(prfm(PLDL2KEEP, MemOperand(x1, 248), option),
2141 "prfm pldl2keep, [x1, #248]");
2142 COMPARE(prfm(PLIL2STRM, MemOperand(x1, 256), option),
2143 "prfm plil2strm, [x1, #256]");
2144 COMPARE(prfm(PLIL3KEEP, MemOperand(x1, 32760), option),
2145 "prfm plil3keep, [x1, #32760]");
2146
2147 // Prefer unscaled-offset forms, but allow scaled-offset forms if necessary.
2148 option = PreferUnscaledOffset;
2149
2150 COMPARE(prfum(PLDL1KEEP, MemOperand(x1), option), "prfum pldl1keep, [x1]");
2151 COMPARE(prfum(PLDL1STRM, MemOperand(x1, 8), option),
2152 "prfum pldl1strm, [x1, #8]");
2153 COMPARE(prfum(PLDL2KEEP, MemOperand(x1, 248), option),
2154 "prfum pldl2keep, [x1, #248]");
2155 COMPARE(prfum(PLDL2STRM, MemOperand(x1, 1), option),
2156 "prfum pldl2strm, [x1, #1]");
2157 COMPARE(prfum(PLDL3KEEP, MemOperand(x1, -1), option),
2158 "prfum pldl3keep, [x1, #-1]");
2159 COMPARE(prfum(PLDL3STRM, MemOperand(x1, 255), option),
2160 "prfum pldl3strm, [x1, #255]");
2161 COMPARE(prfum(PLIL1KEEP, MemOperand(x1, -256), option),
2162 "prfum plil1keep, [x1, #-256]");
2163 COMPARE(prfum(PLIL1STRM, MemOperand(x1, 256), option),
2164 "prfm plil1strm, [x1, #256]");
2165 COMPARE(prfum(PLIL2KEEP, MemOperand(x1, 32760), option),
2166 "prfm plil2keep, [x1, #32760]");
2167
2168 // Prefer scaled-offset forms, but allow unscaled-offset forms if necessary.
2169 option = PreferScaledOffset;
2170
2171 COMPARE(prfm(PLDL1KEEP, MemOperand(x1), option), "prfm pldl1keep, [x1]");
2172 COMPARE(prfm(PLDL1STRM, MemOperand(x1, 8), option),
2173 "prfm pldl1strm, [x1, #8]");
2174 COMPARE(prfm(PLDL2KEEP, MemOperand(x1, 248), option),
2175 "prfm pldl2keep, [x1, #248]");
2176 COMPARE(prfm(PLDL2STRM, MemOperand(x1, 1), option),
2177 "prfum pldl2strm, [x1, #1]");
2178 COMPARE(prfm(PLDL3KEEP, MemOperand(x1, -1), option),
2179 "prfum pldl3keep, [x1, #-1]");
2180 COMPARE(prfm(PLDL3STRM, MemOperand(x1, 255), option),
2181 "prfum pldl3strm, [x1, #255]");
2182 COMPARE(prfm(PLIL1KEEP, MemOperand(x1, -256), option),
2183 "prfum plil1keep, [x1, #-256]");
2184 COMPARE(prfm(PLIL1STRM, MemOperand(x1, 256), option),
2185 "prfm plil1strm, [x1, #256]");
2186 COMPARE(prfm(PLIL2KEEP, MemOperand(x1, 32760), option),
2187 "prfm plil2keep, [x1, #32760]");
armvixlad96eda2013-06-14 11:42:37 +01002188
2189 CLEANUP();
2190}
2191
armvixl4a102ba2014-07-14 09:02:40 +01002192
armvixlad96eda2013-06-14 11:42:37 +01002193TEST(cond_select) {
2194 SETUP();
2195
2196 COMPARE(csel(w0, w1, w2, eq), "csel w0, w1, w2, eq");
2197 COMPARE(csel(x3, x4, x5, ne), "csel x3, x4, x5, ne");
2198 COMPARE(csinc(w6, w7, w8, hs), "csinc w6, w7, w8, hs");
2199 COMPARE(csinc(x9, x10, x11, lo), "csinc x9, x10, x11, lo");
2200 COMPARE(csinv(w12, w13, w14, mi), "csinv w12, w13, w14, mi");
2201 COMPARE(csinv(x15, x16, x17, pl), "csinv x15, x16, x17, pl");
2202 COMPARE(csneg(w18, w19, w20, vs), "csneg w18, w19, w20, vs");
2203 COMPARE(csneg(x21, x22, x23, vc), "csneg x21, x22, x23, vc");
2204 COMPARE(cset(w24, hi), "cset w24, hi");
2205 COMPARE(cset(x25, ls), "cset x25, ls");
2206 COMPARE(csetm(w26, ge), "csetm w26, ge");
2207 COMPARE(csetm(x27, lt), "csetm x27, lt");
2208 COMPARE(cinc(w28, w29, gt), "cinc w28, w29, gt");
2209 COMPARE(cinc(x30, x0, le), "cinc x30, x0, le");
2210 COMPARE(cinv(w1, w2, eq), "cinv w1, w2, eq");
2211 COMPARE(cinv(x3, x4, ne), "cinv x3, x4, ne");
2212 COMPARE(cneg(w5, w6, hs), "cneg w5, w6, hs");
2213 COMPARE(cneg(x7, x8, lo), "cneg x7, x8, lo");
2214
armvixl578645f2013-08-15 17:21:42 +01002215 COMPARE(csel(x0, x1, x2, al), "csel x0, x1, x2, al");
2216 COMPARE(csel(x1, x2, x3, nv), "csel x1, x2, x3, nv");
2217 COMPARE(csinc(x2, x3, x4, al), "csinc x2, x3, x4, al");
2218 COMPARE(csinc(x3, x4, x5, nv), "csinc x3, x4, x5, nv");
2219 COMPARE(csinv(x4, x5, x6, al), "csinv x4, x5, x6, al");
2220 COMPARE(csinv(x5, x6, x7, nv), "csinv x5, x6, x7, nv");
2221 COMPARE(csneg(x6, x7, x8, al), "csneg x6, x7, x8, al");
2222 COMPARE(csneg(x7, x8, x9, nv), "csneg x7, x8, x9, nv");
2223
armvixlad96eda2013-06-14 11:42:37 +01002224 CLEANUP();
2225}
2226
armvixl4a102ba2014-07-14 09:02:40 +01002227
armvixlf37fdc02014-02-05 13:22:16 +00002228TEST(cond_select_macro) {
armvixl684cd2a2015-10-23 13:38:33 +01002229 SETUP_MACRO();
armvixlf37fdc02014-02-05 13:22:16 +00002230
armvixl0f35e362016-05-10 13:57:58 +01002231 // In the tests below we also test the `GetCselSynthesisInformation()` helper.
2232 // These tests are here (rather than in test-assembler-a64.cc) because the
2233 // disassembly makes it easy to see whether or not the inputs are synthesised.
2234 bool synthesises_left = false;
2235 bool synthesises_right = false;
2236
armvixlf37fdc02014-02-05 13:22:16 +00002237 COMPARE(Csel(w0, w1, -1, eq), "csinv w0, w1, wzr, eq");
armvixl0f35e362016-05-10 13:57:58 +01002238 MacroAssembler::GetCselSynthesisInformation(w0, w1, -1,
2239 &synthesises_left,
2240 &synthesises_right);
2241 VIXL_CHECK(!synthesises_left && !synthesises_right);
2242
armvixlf37fdc02014-02-05 13:22:16 +00002243 COMPARE(Csel(w2, w3, 0, ne), "csel w2, w3, wzr, ne");
armvixl0f35e362016-05-10 13:57:58 +01002244 MacroAssembler::GetCselSynthesisInformation(w2, w3, wzr,
2245 &synthesises_left,
2246 &synthesises_right);
2247 VIXL_CHECK(!synthesises_left && !synthesises_right);
2248
armvixlf37fdc02014-02-05 13:22:16 +00002249 COMPARE(Csel(w4, w5, 1, hs), "csinc w4, w5, wzr, hs");
armvixl0f35e362016-05-10 13:57:58 +01002250 MacroAssembler::GetCselSynthesisInformation(w4, w5, 1,
2251 &synthesises_left,
2252 &synthesises_right);
2253 VIXL_CHECK(!synthesises_left && !synthesises_right);
2254
armvixlf37fdc02014-02-05 13:22:16 +00002255 COMPARE(Csel(x6, x7, -1, lo), "csinv x6, x7, xzr, lo");
armvixl0f35e362016-05-10 13:57:58 +01002256 MacroAssembler::GetCselSynthesisInformation(x6, x7, xzr,
2257 &synthesises_left,
2258 &synthesises_right);
2259 VIXL_CHECK(!synthesises_left && !synthesises_right);
2260
armvixlf37fdc02014-02-05 13:22:16 +00002261 COMPARE(Csel(x8, x9, 0, mi), "csel x8, x9, xzr, mi");
armvixl0f35e362016-05-10 13:57:58 +01002262 MacroAssembler::GetCselSynthesisInformation(x8, x9, xzr,
2263 &synthesises_left,
2264 &synthesises_right);
2265 VIXL_CHECK(!synthesises_left && !synthesises_right);
2266
armvixlf37fdc02014-02-05 13:22:16 +00002267 COMPARE(Csel(x10, x11, 1, pl), "csinc x10, x11, xzr, pl");
armvixl0f35e362016-05-10 13:57:58 +01002268 MacroAssembler::GetCselSynthesisInformation(x10, x11, xzr,
2269 &synthesises_left,
2270 &synthesises_right);
2271 VIXL_CHECK(!synthesises_left && !synthesises_right);
2272
2273 COMPARE_MACRO(Csel(x12, 0, 0, eq), "mov x12, #0x0");
2274 MacroAssembler::GetCselSynthesisInformation(x12, 0, 0,
2275 &synthesises_left,
2276 &synthesises_right);
2277 VIXL_CHECK(!synthesises_left && !synthesises_right);
2278
Alexandre Rames2fbea6c2016-06-07 09:21:11 +01002279 COMPARE_MACRO(Csel(w13, 0, 1, eq), "cset w13, ne");
armvixl0f35e362016-05-10 13:57:58 +01002280 MacroAssembler::GetCselSynthesisInformation(w13, 0, 1,
2281 &synthesises_left,
2282 &synthesises_right);
2283 VIXL_CHECK(!synthesises_left && !synthesises_right);
2284
Alexandre Rames2fbea6c2016-06-07 09:21:11 +01002285 COMPARE_MACRO(Csel(x14, 1, 0, eq), "cset x14, eq");
armvixl0f35e362016-05-10 13:57:58 +01002286 MacroAssembler::GetCselSynthesisInformation(x14, 1, 0,
2287 &synthesises_left,
2288 &synthesises_right);
2289 VIXL_CHECK(!synthesises_left && !synthesises_right);
2290
Alexandre Rames2fbea6c2016-06-07 09:21:11 +01002291 COMPARE_MACRO(Csel(w15, 0, -1, eq), "csetm w15, ne");
armvixl0f35e362016-05-10 13:57:58 +01002292 MacroAssembler::GetCselSynthesisInformation(w15, 0, -1,
2293 &synthesises_left,
2294 &synthesises_right);
2295 VIXL_CHECK(!synthesises_left && !synthesises_right);
2296
Alexandre Rames2fbea6c2016-06-07 09:21:11 +01002297 COMPARE_MACRO(Csel(x18, -1, 0, eq), "csetm x18, eq");
armvixl0f35e362016-05-10 13:57:58 +01002298 MacroAssembler::GetCselSynthesisInformation(x18, -1, 0,
2299 &synthesises_left,
2300 &synthesises_right);
2301 VIXL_CHECK(!synthesises_left && !synthesises_right);
2302
2303 COMPARE_MACRO(Csel(w19, -1, 1, eq), "mov w19, #0x1\n"
2304 "cneg w19, w19, eq");
2305 MacroAssembler::GetCselSynthesisInformation(w19, -1, 1,
2306 &synthesises_left,
2307 &synthesises_right);
2308 VIXL_CHECK(!synthesises_left && synthesises_right);
2309
2310 COMPARE_MACRO(Csel(x20, 1, -1, eq), "mov x20, #0xffffffffffffffff\n"
2311 "cneg x20, x20, eq");
2312 MacroAssembler::GetCselSynthesisInformation(x20, 1, -1,
2313 &synthesises_left,
2314 &synthesises_right);
2315 VIXL_CHECK(!synthesises_left && synthesises_right);
2316
2317 COMPARE_MACRO(Csel(w21, 0xaa, 0xbb, eq), "mov w16, #0xaa\n"
2318 "mov w17, #0xbb\n"
2319 "csel w21, w16, w17, eq");
2320 MacroAssembler::GetCselSynthesisInformation(w21, 0xaa, 0xbb,
2321 &synthesises_left,
2322 &synthesises_right);
2323 VIXL_CHECK(synthesises_left && synthesises_right);
2324
2325 COMPARE_MACRO(Csel(x22, 0xaa, -0xbb, eq), "mov x16, #0xaa\n"
2326 "mov x17, #0xffffffffffffff45\n"
2327 "csel x22, x16, x17, eq");
2328 MacroAssembler::GetCselSynthesisInformation(x22, 0xaa, -0xbb,
2329 &synthesises_left,
2330 &synthesises_right);
2331 VIXL_CHECK(synthesises_left && synthesises_right);
2332
2333 COMPARE_MACRO(Csel(w23, 0, 0xaa, eq), "mov w16, #0xaa\n"
2334 "csel w23, w16, wzr, ne");
2335 MacroAssembler::GetCselSynthesisInformation(w23, 0, 0xaa,
2336 &synthesises_left,
2337 &synthesises_right);
2338 VIXL_CHECK(!synthesises_left && synthesises_right);
2339
2340 COMPARE_MACRO(Csel(x24, -0xaa, 0, eq), "mov x16, #0xffffffffffffff56\n"
2341 "csel x24, x16, xzr, eq");
2342 MacroAssembler::GetCselSynthesisInformation(x24, -0xaa, 0,
2343 &synthesises_left,
2344 &synthesises_right);
2345 VIXL_CHECK(synthesises_left && !synthesises_right);
2346
2347 COMPARE_MACRO(Csel(w25, 0xcc, -0xcc, eq), "mov w25, #0xffffff34\n"
2348 "cneg w25, w25, eq");
2349 MacroAssembler::GetCselSynthesisInformation(w25, 0xcc, -0xcc,
2350 &synthesises_left,
2351 &synthesises_right);
2352 VIXL_CHECK(!synthesises_left && synthesises_right);
2353
2354 COMPARE_MACRO(Csel(x26, -0xcc, 0xcc, eq), "mov x26, #0xcc\n"
2355 "cneg x26, x26, eq");
2356 MacroAssembler::GetCselSynthesisInformation(w25, -0xcc, 0xcc,
2357 &synthesises_left,
2358 &synthesises_right);
2359 VIXL_CHECK(!synthesises_left && synthesises_right);
2360
2361 // Test with `Operand` inputs.
2362 COMPARE_MACRO(Csel(x0, x1, Operand(x2, LSL, 3), eq), "lsl x16, x2, #3\n"
Alexandre Rames2fbea6c2016-06-07 09:21:11 +01002363 "csel x0, x1, x16, eq");
armvixl0f35e362016-05-10 13:57:58 +01002364 MacroAssembler::GetCselSynthesisInformation(x0, x1, Operand(x2, LSL, 3),
2365 &synthesises_left,
2366 &synthesises_right);
2367 VIXL_CHECK(!synthesises_left && synthesises_right);
2368
2369 COMPARE_MACRO(Csel(x3, x4, Operand(x5, SXTH), eq), "sxth x16, w5\n"
2370 "csel x3, x4, x16, eq");
2371 MacroAssembler::GetCselSynthesisInformation(x3, x4, Operand(x5, SXTH),
2372 &synthesises_left,
2373 &synthesises_right);
2374 VIXL_CHECK(!synthesises_left && synthesises_right);
2375
2376 COMPARE_MACRO(Csel(x6, Operand(x7, LSL, 7), x8, eq), "lsl x16, x7, #7\n"
2377 "csel x6, x16, x8, eq");
2378 MacroAssembler::GetCselSynthesisInformation(x6, Operand(x7, LSL, 7), x8,
2379 &synthesises_left,
2380 &synthesises_right);
2381 VIXL_CHECK(synthesises_left && !synthesises_right);
2382
2383 COMPARE_MACRO(Csel(x9, Operand(x10, SXTH), x11, eq), "sxth x16, w10\n"
2384 "csel x9, x16, x11, eq");
2385 MacroAssembler::GetCselSynthesisInformation(x9, Operand(x10, SXTH), x11,
2386 &synthesises_left,
2387 &synthesises_right);
2388 VIXL_CHECK(synthesises_left && !synthesises_right);
2389
2390 COMPARE_MACRO(Csel(x12, Operand(x13, LSL, 13), Operand(x14, SXTB), eq),
2391 "lsl x16, x13, #13\n"
2392 "sxtb x17, w14\n"
2393 "csel x12, x16, x17, eq");
2394 MacroAssembler::GetCselSynthesisInformation(x12,
2395 Operand(x13, LSL, 13),
2396 Operand(x14, SXTB),
2397 &synthesises_left,
2398 &synthesises_right);
2399 VIXL_CHECK(synthesises_left && synthesises_right);
2400
2401 COMPARE_MACRO(Csel(x15, 0, Operand(x18, LSR, 18), eq),
2402 "lsr x16, x18, #18\n"
2403 "csel x15, x16, xzr, ne");
2404 MacroAssembler::GetCselSynthesisInformation(x15, 0, Operand(x18, LSR, 18),
2405 &synthesises_left,
2406 &synthesises_right);
2407 VIXL_CHECK(!synthesises_left && synthesises_right);
2408
2409 // Test with the zero register.
2410 COMPARE_MACRO(Csel(w19, wzr, wzr, eq), "mov w19, #0x0");
2411 MacroAssembler::GetCselSynthesisInformation(w19, wzr, wzr,
2412 &synthesises_left,
2413 &synthesises_right);
2414 VIXL_CHECK(!synthesises_left && !synthesises_right);
2415
2416 COMPARE_MACRO(Csel(x20, x21, xzr, eq), "csel x20, x21, xzr, eq");
2417 MacroAssembler::GetCselSynthesisInformation(x20, x21, xzr,
2418 &synthesises_left,
2419 &synthesises_right);
2420 VIXL_CHECK(!synthesises_left && !synthesises_right);
2421
2422 COMPARE_MACRO(Csel(w22, wzr, w23, eq), "csel w22, w23, wzr, ne");
2423 MacroAssembler::GetCselSynthesisInformation(w22, wzr, w23,
2424 &synthesises_left,
2425 &synthesises_right);
2426 VIXL_CHECK(!synthesises_left && !synthesises_right);
2427
2428 COMPARE_MACRO(Csel(x24, xzr, 0, eq), "mov x24, #0x0");
2429 MacroAssembler::GetCselSynthesisInformation(x24, xzr, 0,
2430 &synthesises_left,
2431 &synthesises_right);
2432 VIXL_CHECK(!synthesises_left && !synthesises_right);
2433
Alexandre Rames2fbea6c2016-06-07 09:21:11 +01002434 COMPARE_MACRO(Csel(w25, wzr, 1, eq), "cset w25, ne");
armvixl0f35e362016-05-10 13:57:58 +01002435 MacroAssembler::GetCselSynthesisInformation(w25, wzr, 1,
2436 &synthesises_left,
2437 &synthesises_right);
2438 VIXL_CHECK(!synthesises_left && !synthesises_right);
2439
armvixlf37fdc02014-02-05 13:22:16 +00002440
2441 CLEANUP();
2442}
2443
armvixl4a102ba2014-07-14 09:02:40 +01002444
armvixlad96eda2013-06-14 11:42:37 +01002445TEST(cond_cmp) {
2446 SETUP();
2447
armvixl578645f2013-08-15 17:21:42 +01002448 COMPARE(ccmn(w0, w1, NZCVFlag, eq), "ccmn w0, w1, #NZCV, eq");
2449 COMPARE(ccmn(x2, x3, NZCFlag, ne), "ccmn x2, x3, #NZCv, ne");
2450 COMPARE(ccmp(w4, w5, NZVFlag, hs), "ccmp w4, w5, #NZcV, hs");
2451 COMPARE(ccmp(x6, x7, NZFlag, lo), "ccmp x6, x7, #NZcv, lo");
2452 COMPARE(ccmn(w8, 31, NFlag, mi), "ccmn w8, #31, #Nzcv, mi");
2453 COMPARE(ccmn(x9, 30, NCFlag, pl), "ccmn x9, #30, #NzCv, pl");
2454 COMPARE(ccmp(w10, 29, NVFlag, vs), "ccmp w10, #29, #NzcV, vs");
2455 COMPARE(ccmp(x11, 28, NFlag, vc), "ccmp x11, #28, #Nzcv, vc");
2456 COMPARE(ccmn(w12, w13, NoFlag, al), "ccmn w12, w13, #nzcv, al");
2457 COMPARE(ccmp(x14, 27, ZVFlag, nv), "ccmp x14, #27, #nZcV, nv");
armvixlad96eda2013-06-14 11:42:37 +01002458
2459 CLEANUP();
2460}
2461
armvixl4a102ba2014-07-14 09:02:40 +01002462
armvixlf37fdc02014-02-05 13:22:16 +00002463TEST(cond_cmp_macro) {
armvixl684cd2a2015-10-23 13:38:33 +01002464 SETUP_MACRO();
armvixlf37fdc02014-02-05 13:22:16 +00002465
2466 COMPARE(Ccmp(w0, -1, VFlag, hi), "ccmn w0, #1, #nzcV, hi");
2467 COMPARE(Ccmp(x1, -31, CFlag, ge), "ccmn x1, #31, #nzCv, ge");
2468 COMPARE(Ccmn(w2, -1, CVFlag, gt), "ccmp w2, #1, #nzCV, gt");
2469 COMPARE(Ccmn(x3, -31, ZCVFlag, ls), "ccmp x3, #31, #nZCV, ls");
2470
2471 CLEANUP();
2472}
2473
armvixl4a102ba2014-07-14 09:02:40 +01002474
armvixlad96eda2013-06-14 11:42:37 +01002475TEST(fmov_imm) {
2476 SETUP();
2477
armvixlb0c8ae22014-03-21 14:03:59 +00002478 COMPARE(fmov(s0, 1.0f), "fmov s0, #0x70 (1.0000)");
2479 COMPARE(fmov(s31, -13.0f), "fmov s31, #0xaa (-13.0000)");
armvixlad96eda2013-06-14 11:42:37 +01002480 COMPARE(fmov(d1, 1.0), "fmov d1, #0x70 (1.0000)");
2481 COMPARE(fmov(d29, -13.0), "fmov d29, #0xaa (-13.0000)");
2482
2483 CLEANUP();
2484}
2485
armvixl4a102ba2014-07-14 09:02:40 +01002486
armvixlad96eda2013-06-14 11:42:37 +01002487TEST(fmov_reg) {
2488 SETUP();
2489
2490 COMPARE(fmov(w3, s13), "fmov w3, s13");
2491 COMPARE(fmov(x6, d26), "fmov x6, d26");
2492 COMPARE(fmov(s11, w30), "fmov s11, w30");
2493 COMPARE(fmov(d31, x2), "fmov d31, x2");
2494 COMPARE(fmov(s12, s13), "fmov s12, s13");
2495 COMPARE(fmov(d22, d23), "fmov d22, d23");
armvixl5289c592015-03-02 13:52:04 +00002496 COMPARE(fmov(v0.D(), 1, x13), "fmov v0.D[1], x13");
2497 COMPARE(fmov(x13, v0.D(), 1), "fmov x13, v0.D[1]");
armvixlad96eda2013-06-14 11:42:37 +01002498
2499 CLEANUP();
2500}
2501
2502
2503TEST(fp_dp1) {
2504 SETUP();
2505
2506 COMPARE(fabs(s0, s1), "fabs s0, s1");
2507 COMPARE(fabs(s31, s30), "fabs s31, s30");
2508 COMPARE(fabs(d2, d3), "fabs d2, d3");
2509 COMPARE(fabs(d31, d30), "fabs d31, d30");
2510 COMPARE(fneg(s4, s5), "fneg s4, s5");
2511 COMPARE(fneg(s31, s30), "fneg s31, s30");
2512 COMPARE(fneg(d6, d7), "fneg d6, d7");
2513 COMPARE(fneg(d31, d30), "fneg d31, d30");
2514 COMPARE(fsqrt(s8, s9), "fsqrt s8, s9");
2515 COMPARE(fsqrt(s31, s30), "fsqrt s31, s30");
2516 COMPARE(fsqrt(d10, d11), "fsqrt d10, d11");
2517 COMPARE(fsqrt(d31, d30), "fsqrt d31, d30");
armvixlf37fdc02014-02-05 13:22:16 +00002518 COMPARE(frinta(s10, s11), "frinta s10, s11");
2519 COMPARE(frinta(s31, s30), "frinta s31, s30");
2520 COMPARE(frinta(d12, d13), "frinta d12, d13");
2521 COMPARE(frinta(d31, d30), "frinta d31, d30");
armvixl330dc712014-11-25 10:38:32 +00002522 COMPARE(frinti(s10, s11), "frinti s10, s11");
2523 COMPARE(frinti(s31, s30), "frinti s31, s30");
2524 COMPARE(frinti(d12, d13), "frinti d12, d13");
2525 COMPARE(frinti(d31, d30), "frinti d31, d30");
2526 COMPARE(frintm(s10, s11), "frintm s10, s11");
2527 COMPARE(frintm(s31, s30), "frintm s31, s30");
2528 COMPARE(frintm(d12, d13), "frintm d12, d13");
2529 COMPARE(frintm(d31, d30), "frintm d31, d30");
armvixlad96eda2013-06-14 11:42:37 +01002530 COMPARE(frintn(s10, s11), "frintn s10, s11");
2531 COMPARE(frintn(s31, s30), "frintn s31, s30");
2532 COMPARE(frintn(d12, d13), "frintn d12, d13");
2533 COMPARE(frintn(d31, d30), "frintn d31, d30");
armvixl330dc712014-11-25 10:38:32 +00002534 COMPARE(frintx(s10, s11), "frintx s10, s11");
2535 COMPARE(frintx(s31, s30), "frintx s31, s30");
2536 COMPARE(frintx(d12, d13), "frintx d12, d13");
2537 COMPARE(frintx(d31, d30), "frintx d31, d30");
armvixlad96eda2013-06-14 11:42:37 +01002538 COMPARE(frintz(s10, s11), "frintz s10, s11");
2539 COMPARE(frintz(s31, s30), "frintz s31, s30");
2540 COMPARE(frintz(d12, d13), "frintz d12, d13");
2541 COMPARE(frintz(d31, d30), "frintz d31, d30");
2542 COMPARE(fcvt(d14, s15), "fcvt d14, s15");
2543 COMPARE(fcvt(d31, s31), "fcvt d31, s31");
armvixl5289c592015-03-02 13:52:04 +00002544 COMPARE(fcvt(s0, d1), "fcvt s0, d1");
2545 COMPARE(fcvt(s2, h3), "fcvt s2, h3");
2546 COMPARE(fcvt(d4, h5), "fcvt d4, h5");
2547 COMPARE(fcvt(h6, s7), "fcvt h6, s7");
2548 COMPARE(fcvt(h8, d9), "fcvt h8, d9");
armvixlad96eda2013-06-14 11:42:37 +01002549
2550 CLEANUP();
2551}
2552
2553
2554TEST(fp_dp2) {
2555 SETUP();
2556
2557 COMPARE(fadd(s0, s1, s2), "fadd s0, s1, s2");
2558 COMPARE(fadd(d3, d4, d5), "fadd d3, d4, d5");
2559 COMPARE(fsub(s31, s30, s29), "fsub s31, s30, s29");
2560 COMPARE(fsub(d31, d30, d29), "fsub d31, d30, d29");
2561 COMPARE(fmul(s7, s8, s9), "fmul s7, s8, s9");
2562 COMPARE(fmul(d10, d11, d12), "fmul d10, d11, d12");
armvixl5289c592015-03-02 13:52:04 +00002563 COMPARE(fnmul(s7, s8, s9), "fnmul s7, s8, s9");
2564 COMPARE(fnmul(d10, d11, d12), "fnmul d10, d11, d12");
armvixlad96eda2013-06-14 11:42:37 +01002565 COMPARE(fdiv(s13, s14, s15), "fdiv s13, s14, s15");
2566 COMPARE(fdiv(d16, d17, d18), "fdiv d16, d17, d18");
2567 COMPARE(fmax(s19, s20, s21), "fmax s19, s20, s21");
2568 COMPARE(fmax(d22, d23, d24), "fmax d22, d23, d24");
2569 COMPARE(fmin(s25, s26, s27), "fmin s25, s26, s27");
2570 COMPARE(fmin(d28, d29, d30), "fmin d28, d29, d30");
armvixlf37fdc02014-02-05 13:22:16 +00002571 COMPARE(fmaxnm(s31, s0, s1), "fmaxnm s31, s0, s1");
2572 COMPARE(fmaxnm(d2, d3, d4), "fmaxnm d2, d3, d4");
2573 COMPARE(fminnm(s5, s6, s7), "fminnm s5, s6, s7");
2574 COMPARE(fminnm(d8, d9, d10), "fminnm d8, d9, d10");
armvixlad96eda2013-06-14 11:42:37 +01002575
2576 CLEANUP();
2577}
2578
2579
2580TEST(fp_dp3) {
2581 SETUP();
2582
armvixlf37fdc02014-02-05 13:22:16 +00002583 COMPARE(fmadd(s7, s8, s9, s10), "fmadd s7, s8, s9, s10");
2584 COMPARE(fmadd(d10, d11, d12, d10), "fmadd d10, d11, d12, d10");
armvixlad96eda2013-06-14 11:42:37 +01002585 COMPARE(fmsub(s7, s8, s9, s10), "fmsub s7, s8, s9, s10");
2586 COMPARE(fmsub(d10, d11, d12, d10), "fmsub d10, d11, d12, d10");
2587
armvixlf37fdc02014-02-05 13:22:16 +00002588 COMPARE(fnmadd(s7, s8, s9, s10), "fnmadd s7, s8, s9, s10");
2589 COMPARE(fnmadd(d10, d11, d12, d10), "fnmadd d10, d11, d12, d10");
2590 COMPARE(fnmsub(s7, s8, s9, s10), "fnmsub s7, s8, s9, s10");
2591 COMPARE(fnmsub(d10, d11, d12, d10), "fnmsub d10, d11, d12, d10");
2592
armvixlad96eda2013-06-14 11:42:37 +01002593 CLEANUP();
2594}
2595
2596
2597TEST(fp_compare) {
2598 SETUP();
2599
2600 COMPARE(fcmp(s0, s1), "fcmp s0, s1");
2601 COMPARE(fcmp(s31, s30), "fcmp s31, s30");
2602 COMPARE(fcmp(d0, d1), "fcmp d0, d1");
2603 COMPARE(fcmp(d31, d30), "fcmp d31, d30");
2604 COMPARE(fcmp(s12, 0), "fcmp s12, #0.0");
2605 COMPARE(fcmp(d12, 0), "fcmp d12, #0.0");
2606
armvixl6e2c8272015-03-31 11:04:14 +01002607 COMPARE(fcmpe(s0, s1), "fcmpe s0, s1");
2608 COMPARE(fcmpe(s31, s30), "fcmpe s31, s30");
2609 COMPARE(fcmpe(d0, d1), "fcmpe d0, d1");
2610 COMPARE(fcmpe(d31, d30), "fcmpe d31, d30");
2611 COMPARE(fcmpe(s12, 0), "fcmpe s12, #0.0");
2612 COMPARE(fcmpe(d12, 0), "fcmpe d12, #0.0");
2613
armvixlad96eda2013-06-14 11:42:37 +01002614 CLEANUP();
2615}
2616
2617
2618TEST(fp_cond_compare) {
2619 SETUP();
2620
2621 COMPARE(fccmp(s0, s1, NoFlag, eq), "fccmp s0, s1, #nzcv, eq");
2622 COMPARE(fccmp(s2, s3, ZVFlag, ne), "fccmp s2, s3, #nZcV, ne");
2623 COMPARE(fccmp(s30, s16, NCFlag, pl), "fccmp s30, s16, #NzCv, pl");
2624 COMPARE(fccmp(s31, s31, NZCVFlag, le), "fccmp s31, s31, #NZCV, le");
2625 COMPARE(fccmp(d4, d5, VFlag, gt), "fccmp d4, d5, #nzcV, gt");
2626 COMPARE(fccmp(d6, d7, NFlag, vs), "fccmp d6, d7, #Nzcv, vs");
2627 COMPARE(fccmp(d30, d0, NZFlag, vc), "fccmp d30, d0, #NZcv, vc");
2628 COMPARE(fccmp(d31, d31, ZFlag, hs), "fccmp d31, d31, #nZcv, hs");
armvixl578645f2013-08-15 17:21:42 +01002629 COMPARE(fccmp(s14, s15, CVFlag, al), "fccmp s14, s15, #nzCV, al");
2630 COMPARE(fccmp(d16, d17, CFlag, nv), "fccmp d16, d17, #nzCv, nv");
armvixlad96eda2013-06-14 11:42:37 +01002631
armvixl6e2c8272015-03-31 11:04:14 +01002632 COMPARE(fccmpe(s0, s1, NoFlag, eq), "fccmpe s0, s1, #nzcv, eq");
2633 COMPARE(fccmpe(s2, s3, ZVFlag, ne), "fccmpe s2, s3, #nZcV, ne");
2634 COMPARE(fccmpe(s30, s16, NCFlag, pl), "fccmpe s30, s16, #NzCv, pl");
2635 COMPARE(fccmpe(s31, s31, NZCVFlag, le), "fccmpe s31, s31, #NZCV, le");
2636 COMPARE(fccmpe(d4, d5, VFlag, gt), "fccmpe d4, d5, #nzcV, gt");
2637 COMPARE(fccmpe(d6, d7, NFlag, vs), "fccmpe d6, d7, #Nzcv, vs");
2638 COMPARE(fccmpe(d30, d0, NZFlag, vc), "fccmpe d30, d0, #NZcv, vc");
2639 COMPARE(fccmpe(d31, d31, ZFlag, hs), "fccmpe d31, d31, #nZcv, hs");
2640 COMPARE(fccmpe(s14, s15, CVFlag, al), "fccmpe s14, s15, #nzCV, al");
2641 COMPARE(fccmpe(d16, d17, CFlag, nv), "fccmpe d16, d17, #nzCv, nv");
2642
armvixlad96eda2013-06-14 11:42:37 +01002643 CLEANUP();
2644}
2645
2646
2647TEST(fp_select) {
2648 SETUP();
2649
2650 COMPARE(fcsel(s0, s1, s2, eq), "fcsel s0, s1, s2, eq")
2651 COMPARE(fcsel(s31, s31, s30, ne), "fcsel s31, s31, s30, ne");
2652 COMPARE(fcsel(d0, d1, d2, mi), "fcsel d0, d1, d2, mi");
2653 COMPARE(fcsel(d31, d30, d31, pl), "fcsel d31, d30, d31, pl");
armvixl578645f2013-08-15 17:21:42 +01002654 COMPARE(fcsel(s14, s15, s16, al), "fcsel s14, s15, s16, al");
2655 COMPARE(fcsel(d17, d18, d19, nv), "fcsel d17, d18, d19, nv");
armvixlad96eda2013-06-14 11:42:37 +01002656
2657 CLEANUP();
2658}
2659
2660
2661TEST(fcvt_scvtf_ucvtf) {
2662 SETUP();
2663
armvixlf37fdc02014-02-05 13:22:16 +00002664 COMPARE(fcvtas(w0, s1), "fcvtas w0, s1");
2665 COMPARE(fcvtas(x2, s3), "fcvtas x2, s3");
2666 COMPARE(fcvtas(w4, d5), "fcvtas w4, d5");
2667 COMPARE(fcvtas(x6, d7), "fcvtas x6, d7");
2668 COMPARE(fcvtau(w8, s9), "fcvtau w8, s9");
2669 COMPARE(fcvtau(x10, s11), "fcvtau x10, s11");
2670 COMPARE(fcvtau(w12, d13), "fcvtau w12, d13");
2671 COMPARE(fcvtau(x14, d15), "fcvtau x14, d15");
armvixlad96eda2013-06-14 11:42:37 +01002672 COMPARE(fcvtns(w0, s1), "fcvtns w0, s1");
2673 COMPARE(fcvtns(x2, s3), "fcvtns x2, s3");
2674 COMPARE(fcvtns(w4, d5), "fcvtns w4, d5");
2675 COMPARE(fcvtns(x6, d7), "fcvtns x6, d7");
2676 COMPARE(fcvtnu(w8, s9), "fcvtnu w8, s9");
2677 COMPARE(fcvtnu(x10, s11), "fcvtnu x10, s11");
2678 COMPARE(fcvtnu(w12, d13), "fcvtnu w12, d13");
2679 COMPARE(fcvtnu(x14, d15), "fcvtnu x14, d15");
2680 COMPARE(fcvtzu(x16, d17), "fcvtzu x16, d17");
2681 COMPARE(fcvtzu(w18, d19), "fcvtzu w18, d19");
2682 COMPARE(fcvtzs(x20, d21), "fcvtzs x20, d21");
2683 COMPARE(fcvtzs(w22, d23), "fcvtzs w22, d23");
2684 COMPARE(fcvtzu(x16, s17), "fcvtzu x16, s17");
2685 COMPARE(fcvtzu(w18, s19), "fcvtzu w18, s19");
2686 COMPARE(fcvtzs(x20, s21), "fcvtzs x20, s21");
2687 COMPARE(fcvtzs(w22, s23), "fcvtzs w22, s23");
armvixl5289c592015-03-02 13:52:04 +00002688 COMPARE(fcvtzs(w2, d1, 1), "fcvtzs w2, d1, #1");
2689 COMPARE(fcvtzs(w2, s1, 1), "fcvtzs w2, s1, #1");
2690 COMPARE(fcvtzs(x4, d3, 15), "fcvtzs x4, d3, #15");
2691 COMPARE(fcvtzs(x4, s3, 15), "fcvtzs x4, s3, #15");
2692 COMPARE(fcvtzs(w6, d5, 32), "fcvtzs w6, d5, #32");
2693 COMPARE(fcvtzs(w6, s5, 32), "fcvtzs w6, s5, #32");
2694 COMPARE(fcvtzu(w2, d1, 1), "fcvtzu w2, d1, #1");
2695 COMPARE(fcvtzu(w2, s1, 1), "fcvtzu w2, s1, #1");
2696 COMPARE(fcvtzu(x4, d3, 15), "fcvtzu x4, d3, #15");
2697 COMPARE(fcvtzu(x4, s3, 15), "fcvtzu x4, s3, #15");
2698 COMPARE(fcvtzu(w6, d5, 32), "fcvtzu w6, d5, #32");
2699 COMPARE(fcvtzu(w6, s5, 32), "fcvtzu w6, s5, #32");
2700 COMPARE(fcvtpu(x24, d25), "fcvtpu x24, d25");
2701 COMPARE(fcvtpu(w26, d27), "fcvtpu w26, d27");
2702 COMPARE(fcvtps(x28, d29), "fcvtps x28, d29");
2703 COMPARE(fcvtps(w30, d31), "fcvtps w30, d31");
2704 COMPARE(fcvtpu(x0, s1), "fcvtpu x0, s1");
2705 COMPARE(fcvtpu(w2, s3), "fcvtpu w2, s3");
2706 COMPARE(fcvtps(x4, s5), "fcvtps x4, s5");
2707 COMPARE(fcvtps(w6, s7), "fcvtps w6, s7");
armvixlad96eda2013-06-14 11:42:37 +01002708 COMPARE(scvtf(d24, w25), "scvtf d24, w25");
armvixl578645f2013-08-15 17:21:42 +01002709 COMPARE(scvtf(s24, w25), "scvtf s24, w25");
2710 COMPARE(scvtf(d26, x0), "scvtf d26, x0");
2711 COMPARE(scvtf(s26, x0), "scvtf s26, x0");
armvixlad96eda2013-06-14 11:42:37 +01002712 COMPARE(ucvtf(d28, w29), "ucvtf d28, w29");
armvixl578645f2013-08-15 17:21:42 +01002713 COMPARE(ucvtf(s28, w29), "ucvtf s28, w29");
armvixlad96eda2013-06-14 11:42:37 +01002714 COMPARE(ucvtf(d0, x1), "ucvtf d0, x1");
armvixl578645f2013-08-15 17:21:42 +01002715 COMPARE(ucvtf(s0, x1), "ucvtf s0, x1");
2716 COMPARE(ucvtf(d0, x1, 0), "ucvtf d0, x1");
2717 COMPARE(ucvtf(s0, x1, 0), "ucvtf s0, x1");
armvixlad96eda2013-06-14 11:42:37 +01002718 COMPARE(scvtf(d1, x2, 1), "scvtf d1, x2, #1");
armvixl578645f2013-08-15 17:21:42 +01002719 COMPARE(scvtf(s1, x2, 1), "scvtf s1, x2, #1");
armvixlad96eda2013-06-14 11:42:37 +01002720 COMPARE(scvtf(d3, x4, 15), "scvtf d3, x4, #15");
armvixl578645f2013-08-15 17:21:42 +01002721 COMPARE(scvtf(s3, x4, 15), "scvtf s3, x4, #15");
armvixlad96eda2013-06-14 11:42:37 +01002722 COMPARE(scvtf(d5, x6, 32), "scvtf d5, x6, #32");
armvixl578645f2013-08-15 17:21:42 +01002723 COMPARE(scvtf(s5, x6, 32), "scvtf s5, x6, #32");
armvixlad96eda2013-06-14 11:42:37 +01002724 COMPARE(ucvtf(d7, x8, 2), "ucvtf d7, x8, #2");
armvixl578645f2013-08-15 17:21:42 +01002725 COMPARE(ucvtf(s7, x8, 2), "ucvtf s7, x8, #2");
armvixlad96eda2013-06-14 11:42:37 +01002726 COMPARE(ucvtf(d9, x10, 16), "ucvtf d9, x10, #16");
armvixl578645f2013-08-15 17:21:42 +01002727 COMPARE(ucvtf(s9, x10, 16), "ucvtf s9, x10, #16");
armvixlad96eda2013-06-14 11:42:37 +01002728 COMPARE(ucvtf(d11, x12, 33), "ucvtf d11, x12, #33");
armvixl578645f2013-08-15 17:21:42 +01002729 COMPARE(ucvtf(s11, x12, 33), "ucvtf s11, x12, #33");
armvixlad96eda2013-06-14 11:42:37 +01002730 COMPARE(fcvtms(w0, s1), "fcvtms w0, s1");
2731 COMPARE(fcvtms(x2, s3), "fcvtms x2, s3");
2732 COMPARE(fcvtms(w4, d5), "fcvtms w4, d5");
2733 COMPARE(fcvtms(x6, d7), "fcvtms x6, d7");
2734 COMPARE(fcvtmu(w8, s9), "fcvtmu w8, s9");
2735 COMPARE(fcvtmu(x10, s11), "fcvtmu x10, s11");
2736 COMPARE(fcvtmu(w12, d13), "fcvtmu w12, d13");
2737 COMPARE(fcvtmu(x14, d15), "fcvtmu x14, d15");
2738
2739 CLEANUP();
2740}
2741
2742
armvixl4a102ba2014-07-14 09:02:40 +01002743TEST(system_clrex) {
2744 SETUP();
2745
2746 COMPARE(clrex(0), "clrex #0x0");
2747 COMPARE(clrex(14), "clrex #0xe");
2748 COMPARE(clrex(15), "clrex");
2749 COMPARE(clrex(), "clrex");
2750
2751 CLEANUP();
2752}
2753
2754
armvixlad96eda2013-06-14 11:42:37 +01002755TEST(system_mrs) {
2756 SETUP();
2757
2758 COMPARE(mrs(x0, NZCV), "mrs x0, nzcv");
2759 COMPARE(mrs(x30, NZCV), "mrs x30, nzcv");
armvixl578645f2013-08-15 17:21:42 +01002760 COMPARE(mrs(x15, FPCR), "mrs x15, fpcr");
armvixlad96eda2013-06-14 11:42:37 +01002761
2762 CLEANUP();
2763}
2764
2765
2766TEST(system_msr) {
2767 SETUP();
2768
2769 COMPARE(msr(NZCV, x0), "msr nzcv, x0");
2770 COMPARE(msr(NZCV, x30), "msr nzcv, x30");
armvixl578645f2013-08-15 17:21:42 +01002771 COMPARE(msr(FPCR, x15), "msr fpcr, x15");
armvixlad96eda2013-06-14 11:42:37 +01002772
2773 CLEANUP();
2774}
2775
2776
armvixl5289c592015-03-02 13:52:04 +00002777TEST(system_sys) {
2778 SETUP();
2779
2780 COMPARE(sys(0x3, 0x7, 0x5, 0x1, x1), "ic ivau, x1");
2781 COMPARE(sys(0x3, 0x7, 0xa, 0x1, x2), "dc cvac, x2");
2782 COMPARE(sys(0x3, 0x7, 0xb, 0x1, x3), "dc cvau, x3");
2783 COMPARE(sys(0x3, 0x7, 0xe, 0x1, x4), "dc civac, x4");
2784 COMPARE(sys(0x3, 0x7, 0x4, 0x1, x0), "dc zva, x0");
2785 COMPARE(sys(0x0, 0x0, 0x0, 0x0, x0), "sys #0, C0, C0, #0, x0");
2786 COMPARE(sys(0x1, 0x2, 0x5, 0x2, x5), "sys #1, C2, C5, #2, x5");
2787 COMPARE(sys(0x2, 0x8, 0xa, 0x3, x6), "sys #2, C8, C10, #3, x6");
2788 COMPARE(sys(0x2, 0xf, 0xf, 0x1, xzr), "sys #2, C15, C15, #1");
2789 COMPARE(sys(0x2, 0xf, 0xf, 0x1), "sys #2, C15, C15, #1");
2790
2791 CLEANUP();
2792}
2793
2794
2795TEST(system_ic) {
2796 SETUP();
2797
2798 COMPARE(ic(IVAU, x0), "ic ivau, x0");
2799 COMPARE(ic(IVAU, x1), "ic ivau, x1");
2800 COMPARE(ic(IVAU, xzr), "ic ivau, xzr");
2801
2802 CLEANUP();
2803}
2804
2805
2806TEST(system_dc) {
2807 SETUP();
2808
2809 COMPARE(dc(CVAC, x2), "dc cvac, x2");
2810 COMPARE(dc(CVAU, x3), "dc cvau, x3");
2811 COMPARE(dc(CIVAC, x4), "dc civac, x4");
2812 COMPARE(dc(ZVA, x0), "dc zva, x0");
2813 COMPARE(dc(ZVA, xzr), "dc zva, xzr");
2814
2815 CLEANUP();
2816}
2817
2818
armvixlad96eda2013-06-14 11:42:37 +01002819TEST(system_nop) {
2820 SETUP();
2821
2822 COMPARE(nop(), "nop");
2823
2824 CLEANUP();
2825}
2826
2827
2828TEST(unreachable) {
armvixl684cd2a2015-10-23 13:38:33 +01002829 SETUP_MACRO();
armvixlad96eda2013-06-14 11:42:37 +01002830
armvixl684cd2a2015-10-23 13:38:33 +01002831#ifdef VIXL_INCLUDE_SIMULATOR
armvixlb0c8ae22014-03-21 14:03:59 +00002832 VIXL_ASSERT(kUnreachableOpcode == 0xdeb0);
armvixlad96eda2013-06-14 11:42:37 +01002833 COMPARE(Unreachable(), "hlt #0xdeb0");
2834#else
2835 COMPARE(Unreachable(), "blr xzr");
2836#endif
2837
2838 CLEANUP();
2839}
2840
2841
armvixl684cd2a2015-10-23 13:38:33 +01002842#ifdef VIXL_INCLUDE_SIMULATOR
armvixlad96eda2013-06-14 11:42:37 +01002843TEST(trace) {
armvixl684cd2a2015-10-23 13:38:33 +01002844 SETUP_MACRO();
armvixlad96eda2013-06-14 11:42:37 +01002845
armvixlb0c8ae22014-03-21 14:03:59 +00002846 VIXL_ASSERT(kTraceOpcode == 0xdeb2);
armvixlad96eda2013-06-14 11:42:37 +01002847
2848 // All Trace calls should produce the same instruction.
armvixl0f35e362016-05-10 13:57:58 +01002849 COMPARE_MACRO_PREFIX(Trace(LOG_ALL, TRACE_ENABLE), "hlt #0xdeb2");
2850 COMPARE_MACRO_PREFIX(Trace(LOG_REGS, TRACE_DISABLE), "hlt #0xdeb2");
armvixlad96eda2013-06-14 11:42:37 +01002851
2852 CLEANUP();
2853}
2854#endif
2855
2856
armvixl684cd2a2015-10-23 13:38:33 +01002857#ifdef VIXL_INCLUDE_SIMULATOR
armvixlad96eda2013-06-14 11:42:37 +01002858TEST(log) {
armvixl684cd2a2015-10-23 13:38:33 +01002859 SETUP_MACRO();
armvixlad96eda2013-06-14 11:42:37 +01002860
armvixlb0c8ae22014-03-21 14:03:59 +00002861 VIXL_ASSERT(kLogOpcode == 0xdeb3);
armvixlad96eda2013-06-14 11:42:37 +01002862
2863 // All Log calls should produce the same instruction.
armvixl0f35e362016-05-10 13:57:58 +01002864 COMPARE_MACRO_PREFIX(Log(LOG_ALL), "hlt #0xdeb3");
2865 COMPARE_MACRO_PREFIX(Log(LOG_SYSREGS), "hlt #0xdeb3");
armvixlad96eda2013-06-14 11:42:37 +01002866
2867 CLEANUP();
2868}
2869#endif
2870
2871
2872TEST(hlt) {
2873 SETUP();
2874
2875 COMPARE(hlt(0), "hlt #0x0");
2876 COMPARE(hlt(1), "hlt #0x1");
2877 COMPARE(hlt(65535), "hlt #0xffff");
2878
2879 CLEANUP();
2880}
2881
2882
2883TEST(brk) {
2884 SETUP();
2885
2886 COMPARE(brk(0), "brk #0x0");
2887 COMPARE(brk(1), "brk #0x1");
2888 COMPARE(brk(65535), "brk #0xffff");
2889
2890 CLEANUP();
2891}
2892
2893
armvixl5289c592015-03-02 13:52:04 +00002894TEST(svc) {
2895 SETUP();
2896
2897 COMPARE(svc(0), "svc #0x0");
2898 COMPARE(svc(1), "svc #0x1");
2899 COMPARE(svc(65535), "svc #0xffff");
2900
2901 CLEANUP();
2902}
2903
2904
armvixlad96eda2013-06-14 11:42:37 +01002905TEST(add_sub_negative) {
armvixl684cd2a2015-10-23 13:38:33 +01002906 SETUP_MACRO();
armvixlad96eda2013-06-14 11:42:37 +01002907
2908 COMPARE(Add(x10, x0, -42), "sub x10, x0, #0x2a (42)");
2909 COMPARE(Add(x11, x1, -687), "sub x11, x1, #0x2af (687)");
2910 COMPARE(Add(x12, x2, -0x88), "sub x12, x2, #0x88 (136)");
2911
2912 COMPARE(Sub(x13, x0, -600), "add x13, x0, #0x258 (600)");
2913 COMPARE(Sub(x14, x1, -313), "add x14, x1, #0x139 (313)");
2914 COMPARE(Sub(x15, x2, -0x555), "add x15, x2, #0x555 (1365)");
2915
2916 COMPARE(Add(w19, w3, -0x344), "sub w19, w3, #0x344 (836)");
2917 COMPARE(Add(w20, w4, -2000), "sub w20, w4, #0x7d0 (2000)");
2918
armvixl6e2c8272015-03-31 11:04:14 +01002919 COMPARE(Add(w0, w1, 5, LeaveFlags), "add w0, w1, #0x5 (5)");
2920 COMPARE(Add(w1, w2, 15, SetFlags), "adds w1, w2, #0xf (15)");
2921
2922 COMPARE(Sub(w0, w1, 5, LeaveFlags), "sub w0, w1, #0x5 (5)");
2923 COMPARE(Sub(w1, w2, 15, SetFlags), "subs w1, w2, #0xf (15)");
2924
armvixlad96eda2013-06-14 11:42:37 +01002925 COMPARE(Sub(w21, w3, -0xbc), "add w21, w3, #0xbc (188)");
2926 COMPARE(Sub(w22, w4, -2000), "add w22, w4, #0x7d0 (2000)");
2927
armvixlf37fdc02014-02-05 13:22:16 +00002928 COMPARE(Cmp(w0, -1), "cmn w0, #0x1 (1)");
2929 COMPARE(Cmp(x1, -1), "cmn x1, #0x1 (1)");
2930 COMPARE(Cmp(w2, -4095), "cmn w2, #0xfff (4095)");
2931 COMPARE(Cmp(x3, -4095), "cmn x3, #0xfff (4095)");
2932
2933 COMPARE(Cmn(w0, -1), "cmp w0, #0x1 (1)");
2934 COMPARE(Cmn(x1, -1), "cmp x1, #0x1 (1)");
2935 COMPARE(Cmn(w2, -4095), "cmp w2, #0xfff (4095)");
2936 COMPARE(Cmn(x3, -4095), "cmp x3, #0xfff (4095)");
2937
armvixlad96eda2013-06-14 11:42:37 +01002938 CLEANUP();
2939}
2940
2941
2942TEST(logical_immediate_move) {
armvixl684cd2a2015-10-23 13:38:33 +01002943 SETUP_MACRO();
armvixlad96eda2013-06-14 11:42:37 +01002944
armvixl330dc712014-11-25 10:38:32 +00002945 COMPARE(And(w0, w1, 0), "mov w0, #0x0");
2946 COMPARE(And(x0, x1, 0), "mov x0, #0x0");
armvixlad96eda2013-06-14 11:42:37 +01002947 COMPARE(Orr(w2, w3, 0), "mov w2, w3");
2948 COMPARE(Orr(x2, x3, 0), "mov x2, x3");
2949 COMPARE(Eor(w4, w5, 0), "mov w4, w5");
2950 COMPARE(Eor(x4, x5, 0), "mov x4, x5");
2951 COMPARE(Bic(w6, w7, 0), "mov w6, w7");
2952 COMPARE(Bic(x6, x7, 0), "mov x6, x7");
armvixl330dc712014-11-25 10:38:32 +00002953 COMPARE(Orn(w8, w9, 0), "mov w8, #0xffffffff");
2954 COMPARE(Orn(x8, x9, 0), "mov x8, #0xffffffffffffffff");
armvixlad96eda2013-06-14 11:42:37 +01002955 COMPARE(Eon(w10, w11, 0), "mvn w10, w11");
2956 COMPARE(Eon(x10, x11, 0), "mvn x10, x11");
2957
2958 COMPARE(And(w12, w13, 0xffffffff), "mov w12, w13");
2959 COMPARE(And(x12, x13, 0xffffffff), "and x12, x13, #0xffffffff");
2960 COMPARE(And(x12, x13, 0xffffffffffffffff), "mov x12, x13");
armvixl330dc712014-11-25 10:38:32 +00002961 COMPARE(Orr(w14, w15, 0xffffffff), "mov w14, #0xffffffff");
armvixlad96eda2013-06-14 11:42:37 +01002962 COMPARE(Orr(x14, x15, 0xffffffff), "orr x14, x15, #0xffffffff");
armvixl330dc712014-11-25 10:38:32 +00002963 COMPARE(Orr(x14, x15, 0xffffffffffffffff), "mov x14, #0xffffffffffffffff");
armvixlad96eda2013-06-14 11:42:37 +01002964 COMPARE(Eor(w16, w17, 0xffffffff), "mvn w16, w17");
2965 COMPARE(Eor(x16, x17, 0xffffffff), "eor x16, x17, #0xffffffff");
2966 COMPARE(Eor(x16, x17, 0xffffffffffffffff), "mvn x16, x17");
armvixl330dc712014-11-25 10:38:32 +00002967 COMPARE(Bic(w18, w19, 0xffffffff), "mov w18, #0x0");
armvixlad96eda2013-06-14 11:42:37 +01002968 COMPARE(Bic(x18, x19, 0xffffffff), "and x18, x19, #0xffffffff00000000");
armvixl330dc712014-11-25 10:38:32 +00002969 COMPARE(Bic(x18, x19, 0xffffffffffffffff), "mov x18, #0x0");
armvixlad96eda2013-06-14 11:42:37 +01002970 COMPARE(Orn(w20, w21, 0xffffffff), "mov w20, w21");
2971 COMPARE(Orn(x20, x21, 0xffffffff), "orr x20, x21, #0xffffffff00000000");
2972 COMPARE(Orn(x20, x21, 0xffffffffffffffff), "mov x20, x21");
2973 COMPARE(Eon(w22, w23, 0xffffffff), "mov w22, w23");
2974 COMPARE(Eon(x22, x23, 0xffffffff), "eor x22, x23, #0xffffffff00000000");
2975 COMPARE(Eon(x22, x23, 0xffffffffffffffff), "mov x22, x23");
2976
2977 CLEANUP();
2978}
armvixlf37fdc02014-02-05 13:22:16 +00002979
armvixl4a102ba2014-07-14 09:02:40 +01002980
armvixlf37fdc02014-02-05 13:22:16 +00002981TEST(barriers) {
armvixl684cd2a2015-10-23 13:38:33 +01002982 SETUP_MACRO();
armvixlf37fdc02014-02-05 13:22:16 +00002983
2984 // DMB
2985 COMPARE(Dmb(FullSystem, BarrierAll), "dmb sy");
2986 COMPARE(Dmb(FullSystem, BarrierReads), "dmb ld");
2987 COMPARE(Dmb(FullSystem, BarrierWrites), "dmb st");
2988
2989 COMPARE(Dmb(InnerShareable, BarrierAll), "dmb ish");
2990 COMPARE(Dmb(InnerShareable, BarrierReads), "dmb ishld");
2991 COMPARE(Dmb(InnerShareable, BarrierWrites), "dmb ishst");
2992
2993 COMPARE(Dmb(NonShareable, BarrierAll), "dmb nsh");
2994 COMPARE(Dmb(NonShareable, BarrierReads), "dmb nshld");
2995 COMPARE(Dmb(NonShareable, BarrierWrites), "dmb nshst");
2996
2997 COMPARE(Dmb(OuterShareable, BarrierAll), "dmb osh");
2998 COMPARE(Dmb(OuterShareable, BarrierReads), "dmb oshld");
2999 COMPARE(Dmb(OuterShareable, BarrierWrites), "dmb oshst");
3000
3001 COMPARE(Dmb(FullSystem, BarrierOther), "dmb sy (0b1100)");
3002 COMPARE(Dmb(InnerShareable, BarrierOther), "dmb sy (0b1000)");
3003 COMPARE(Dmb(NonShareable, BarrierOther), "dmb sy (0b0100)");
3004 COMPARE(Dmb(OuterShareable, BarrierOther), "dmb sy (0b0000)");
3005
3006 // DSB
3007 COMPARE(Dsb(FullSystem, BarrierAll), "dsb sy");
3008 COMPARE(Dsb(FullSystem, BarrierReads), "dsb ld");
3009 COMPARE(Dsb(FullSystem, BarrierWrites), "dsb st");
3010
3011 COMPARE(Dsb(InnerShareable, BarrierAll), "dsb ish");
3012 COMPARE(Dsb(InnerShareable, BarrierReads), "dsb ishld");
3013 COMPARE(Dsb(InnerShareable, BarrierWrites), "dsb ishst");
3014
3015 COMPARE(Dsb(NonShareable, BarrierAll), "dsb nsh");
3016 COMPARE(Dsb(NonShareable, BarrierReads), "dsb nshld");
3017 COMPARE(Dsb(NonShareable, BarrierWrites), "dsb nshst");
3018
3019 COMPARE(Dsb(OuterShareable, BarrierAll), "dsb osh");
3020 COMPARE(Dsb(OuterShareable, BarrierReads), "dsb oshld");
3021 COMPARE(Dsb(OuterShareable, BarrierWrites), "dsb oshst");
3022
3023 COMPARE(Dsb(FullSystem, BarrierOther), "dsb sy (0b1100)");
3024 COMPARE(Dsb(InnerShareable, BarrierOther), "dsb sy (0b1000)");
3025 COMPARE(Dsb(NonShareable, BarrierOther), "dsb sy (0b0100)");
3026 COMPARE(Dsb(OuterShareable, BarrierOther), "dsb sy (0b0000)");
3027
3028 // ISB
3029 COMPARE(Isb(), "isb");
3030
3031 CLEANUP();
3032}
armvixl330dc712014-11-25 10:38:32 +00003033
3034
armvixl5289c592015-03-02 13:52:04 +00003035#define VLIST2(v) v, VRegister((v.code()+1)%32, v.size(), v.lanes())
3036#define VLIST3(v) VLIST2(v), VRegister((v.code()+2)%32, v.size(), v.lanes())
3037#define VLIST4(v) VLIST3(v), VRegister((v.code()+3)%32, v.size(), v.lanes())
3038
3039
3040#define NEON_FORMAT_LIST(V) \
3041 V(V8B(), "8b") \
3042 V(V16B(), "16b") \
3043 V(V4H(), "4h") \
3044 V(V8H(), "8h") \
3045 V(V2S(), "2s") \
3046 V(V4S(), "4s") \
3047 V(V2D(), "2d")
3048
3049#define NEON_FORMAT_LIST_LP(V) \
3050 V(V4H(), "4h", V8B(), "8b") \
3051 V(V2S(), "2s", V4H(), "4h") \
3052 V(V1D(), "1d", V2S(), "2s") \
3053 V(V8H(), "8h", V16B(), "16b") \
3054 V(V4S(), "4s", V8H(), "8h") \
3055 V(V2D(), "2d", V4S(), "4s")
3056
3057#define NEON_FORMAT_LIST_LW(V) \
3058 V(V8H(), "8h", V8B(), "8b") \
3059 V(V4S(), "4s", V4H(), "4h") \
3060 V(V2D(), "2d", V2S(), "2s")
3061
3062#define NEON_FORMAT_LIST_LW2(V) \
3063 V(V8H(), "8h", V16B(), "16b") \
3064 V(V4S(), "4s", V8H(), "8h") \
3065 V(V2D(), "2d", V4S(), "4s")
3066
3067#define NEON_FORMAT_LIST_BHS(V) \
3068 V(V8B(), "8b") \
3069 V(V16B(), "16b") \
3070 V(V4H(), "4h") \
3071 V(V8H(), "8h") \
3072 V(V2S(), "2s") \
3073 V(V4S(), "4s")
3074
3075#define NEON_FORMAT_LIST_HS(V) \
3076 V(V4H(), "4h") \
3077 V(V8H(), "8h") \
3078 V(V2S(), "2s") \
3079 V(V4S(), "4s")
3080
3081TEST(neon_load_store_vector) {
armvixl684cd2a2015-10-23 13:38:33 +01003082 SETUP_MACRO();
armvixl5289c592015-03-02 13:52:04 +00003083
3084 #define DISASM_INST(M, S) \
3085 COMPARE(Ld1(v0.M, MemOperand(x15)), \
3086 "ld1 {v0." S "}, [x15]"); \
3087 COMPARE(Ld1(v1.M, v2.M, MemOperand(x16)), \
3088 "ld1 {v1." S ", v2." S "}, [x16]"); \
3089 COMPARE(Ld1(v3.M, v4.M, v5.M, MemOperand(x17)), \
3090 "ld1 {v3." S ", v4." S ", v5." S "}, [x17]"); \
3091 COMPARE(Ld1(v6.M, v7.M, v8.M, v9.M, MemOperand(x18)), \
3092 "ld1 {v6." S ", v7." S ", v8." S ", v9." S "}, [x18]") \
3093 COMPARE(Ld1(v30.M, v31.M, v0.M, v1.M, MemOperand(sp)), \
3094 "ld1 {v30." S ", v31." S ", v0." S ", v1." S "}, [sp]") \
3095 COMPARE(Ld2(v1.M, v2.M, MemOperand(x16)), \
3096 "ld2 {v1." S ", v2." S "}, [x16]"); \
3097 COMPARE(Ld3(v3.M, v4.M, v5.M, MemOperand(x17)), \
3098 "ld3 {v3." S ", v4." S ", v5." S "}, [x17]"); \
3099 COMPARE(Ld4(v6.M, v7.M, v8.M, v9.M, MemOperand(x18)), \
3100 "ld4 {v6." S ", v7." S ", v8." S ", v9." S "}, [x18]") \
3101 COMPARE(Ld4(v30.M, v31.M, v0.M, v1.M, MemOperand(sp)), \
3102 "ld4 {v30." S ", v31." S ", v0." S ", v1." S "}, [sp]") \
3103 NEON_FORMAT_LIST(DISASM_INST);
3104 #undef DISASM_INST
3105
3106 #define DISASM_INST(M, S) \
3107 COMPARE(Ld1(v0.M, MemOperand(x15, x20, PostIndex)), \
3108 "ld1 {v0." S "}, [x15], x20"); \
3109 COMPARE(Ld1(v1.M, v2.M, MemOperand(x16, x21, PostIndex)), \
3110 "ld1 {v1." S ", v2." S "}, [x16], x21"); \
3111 COMPARE(Ld1(v3.M, v4.M, v5.M, MemOperand(x17, x22, PostIndex)), \
3112 "ld1 {v3." S ", v4." S ", v5." S "}, [x17], x22"); \
3113 COMPARE(Ld1(v6.M, v7.M, v8.M, v9.M, MemOperand(x18, x23, PostIndex)), \
3114 "ld1 {v6." S ", v7." S ", v8." S ", v9." S "}, [x18], x23") \
3115 COMPARE(Ld1(v30.M, v31.M, v0.M, v1.M, MemOperand(sp, x24, PostIndex)), \
3116 "ld1 {v30." S ", v31." S ", v0." S ", v1." S "}, [sp], x24") \
3117 COMPARE(Ld2(v1.M, v2.M, MemOperand(x16, x21, PostIndex)), \
3118 "ld2 {v1." S ", v2." S "}, [x16], x21"); \
3119 COMPARE(Ld3(v3.M, v4.M, v5.M, MemOperand(x17, x22, PostIndex)), \
3120 "ld3 {v3." S ", v4." S ", v5." S "}, [x17], x22"); \
3121 COMPARE(Ld4(v6.M, v7.M, v8.M, v9.M, MemOperand(x18, x23, PostIndex)), \
3122 "ld4 {v6." S ", v7." S ", v8." S ", v9." S "}, [x18], x23") \
3123 COMPARE(Ld4(v30.M, v31.M, v0.M, v1.M, MemOperand(sp, x24, PostIndex)), \
3124 "ld4 {v30." S ", v31." S ", v0." S ", v1." S "}, [sp], x24") \
3125 NEON_FORMAT_LIST(DISASM_INST);
3126 #undef DISASM_INST
3127
3128 COMPARE(Ld1(v0.V8B(), MemOperand(x15, 8, PostIndex)),
3129 "ld1 {v0.8b}, [x15], #8");
3130 COMPARE(Ld1(v1.V16B(), MemOperand(x16, 16, PostIndex)),
3131 "ld1 {v1.16b}, [x16], #16");
3132 COMPARE(Ld1(v2.V4H(), v3.V4H(), MemOperand(x17, 16, PostIndex)),
3133 "ld1 {v2.4h, v3.4h}, [x17], #16");
3134 COMPARE(Ld1(v4.V8H(), v5.V8H(), MemOperand(x18, 32, PostIndex)),
3135 "ld1 {v4.8h, v5.8h}, [x18], #32");
3136 COMPARE(Ld1(v16.V2S(), v17.V2S(), v18.V2S(), MemOperand(x19, 24, PostIndex)),
3137 "ld1 {v16.2s, v17.2s, v18.2s}, [x19], #24");
3138 COMPARE(Ld1(v16.V4S(), v17.V4S(), v18.V4S(), MemOperand(x19, 48, PostIndex)),
3139 "ld1 {v16.4s, v17.4s, v18.4s}, [x19], #48");
3140 COMPARE(Ld1(v19.V2S(), v20.V2S(), v21.V2S(), v22.V2S(),
3141 MemOperand(x20, 32, PostIndex)),
3142 "ld1 {v19.2s, v20.2s, v21.2s, v22.2s}, [x20], #32");
3143 COMPARE(Ld1(v23.V2D(), v24.V2D(), v25.V2D(), v26.V2D(),
3144 MemOperand(x21, 64, PostIndex)),
3145 "ld1 {v23.2d, v24.2d, v25.2d, v26.2d}, [x21], #64");
3146
3147 COMPARE(Ld2(v2.V4H(), v3.V4H(), MemOperand(x17, 16, PostIndex)),
3148 "ld2 {v2.4h, v3.4h}, [x17], #16");
3149 COMPARE(Ld2(v4.V8H(), v5.V8H(), MemOperand(x18, 32, PostIndex)),
3150 "ld2 {v4.8h, v5.8h}, [x18], #32");
3151 COMPARE(Ld3(v16.V2S(), v17.V2S(), v18.V2S(), MemOperand(x19, 24, PostIndex)),
3152 "ld3 {v16.2s, v17.2s, v18.2s}, [x19], #24");
3153 COMPARE(Ld3(v16.V4S(), v17.V4S(), v18.V4S(), MemOperand(x19, 48, PostIndex)),
3154 "ld3 {v16.4s, v17.4s, v18.4s}, [x19], #48");
3155 COMPARE(Ld4(v19.V2S(), v20.V2S(), v21.V2S(), v22.V2S(),
3156 MemOperand(x20, 32, PostIndex)),
3157 "ld4 {v19.2s, v20.2s, v21.2s, v22.2s}, [x20], #32");
3158 COMPARE(Ld4(v23.V2D(), v24.V2D(), v25.V2D(), v26.V2D(),
3159 MemOperand(x21, 64, PostIndex)),
3160 "ld4 {v23.2d, v24.2d, v25.2d, v26.2d}, [x21], #64");
3161
3162 COMPARE(Ld1(v0.V1D(), MemOperand(x16)), "ld1 {v0.1d}, [x16]");
3163 COMPARE(Ld1(v1.V1D(), v2.V1D(), MemOperand(x17, 16, PostIndex)),
3164 "ld1 {v1.1d, v2.1d}, [x17], #16");
3165 COMPARE(Ld1(v3.V1D(), v4.V1D(), v5.V1D(), MemOperand(x18, x19, PostIndex)),
3166 "ld1 {v3.1d, v4.1d, v5.1d}, [x18], x19");
3167 COMPARE(Ld1(v30.V1D(), v31.V1D(), v0.V1D(), v1.V1D(),
3168 MemOperand(x20, 32, PostIndex)),
3169 "ld1 {v30.1d, v31.1d, v0.1d, v1.1d}, [x20], #32");
3170 COMPARE(Ld1(d30, d31, d0, d1, MemOperand(x21, x22, PostIndex)),
3171 "ld1 {v30.1d, v31.1d, v0.1d, v1.1d}, [x21], x22");
3172
3173 #define DISASM_INST(M, S) \
3174 COMPARE(St1(v20.M, MemOperand(x15)), \
3175 "st1 {v20." S "}, [x15]"); \
3176 COMPARE(St1(v21.M, v22.M, MemOperand(x16)), \
3177 "st1 {v21." S ", v22." S "}, [x16]"); \
3178 COMPARE(St1(v23.M, v24.M, v25.M, MemOperand(x17)), \
3179 "st1 {v23." S ", v24." S ", v25." S "}, [x17]"); \
3180 COMPARE(St1(v26.M, v27.M, v28.M, v29.M, MemOperand(x18)), \
3181 "st1 {v26." S ", v27." S ", v28." S ", v29." S "}, [x18]") \
3182 COMPARE(St1(v30.M, v31.M, v0.M, v1.M, MemOperand(sp)), \
3183 "st1 {v30." S ", v31." S ", v0." S ", v1." S "}, [sp]") \
3184 COMPARE(St2(VLIST2(v21.M), MemOperand(x16)), \
3185 "st2 {v21." S ", v22." S "}, [x16]"); \
3186 COMPARE(St3(v23.M, v24.M, v25.M, MemOperand(x17)), \
3187 "st3 {v23." S ", v24." S ", v25." S "}, [x17]"); \
3188 COMPARE(St4(v30.M, v31.M, v0.M, v1.M, MemOperand(sp)), \
3189 "st4 {v30." S ", v31." S ", v0." S ", v1." S "}, [sp]")
3190 NEON_FORMAT_LIST(DISASM_INST);
3191 #undef DISASM_INST
3192
3193 #define DISASM_INST(M, S) \
3194 COMPARE(St1(v0.M, MemOperand(x15, x20, PostIndex)), \
3195 "st1 {v0." S "}, [x15], x20"); \
3196 COMPARE(St1(v1.M, v2.M, MemOperand(x16, x21, PostIndex)), \
3197 "st1 {v1." S ", v2." S "}, [x16], x21"); \
3198 COMPARE(St1(v3.M, v4.M, v5.M, MemOperand(x17, x22, PostIndex)), \
3199 "st1 {v3." S ", v4." S ", v5." S "}, [x17], x22"); \
3200 COMPARE(St1(v6.M, v7.M, v8.M, v9.M, MemOperand(x18, x23, PostIndex)), \
3201 "st1 {v6." S ", v7." S ", v8." S ", v9." S "}, [x18], x23") \
3202 COMPARE(St1(v30.M, v31.M, v0.M, v1.M, MemOperand(sp, x24, PostIndex)), \
3203 "st1 {v30." S ", v31." S ", v0." S ", v1." S "}, [sp], x24") \
3204 COMPARE(St2(v1.M, v2.M, MemOperand(x16, x21, PostIndex)), \
3205 "st2 {v1." S ", v2." S "}, [x16], x21"); \
3206 COMPARE(St3(v3.M, v4.M, v5.M, MemOperand(x17, x22, PostIndex)), \
3207 "st3 {v3." S ", v4." S ", v5." S "}, [x17], x22"); \
3208 COMPARE(St4(v6.M, v7.M, v8.M, v9.M, MemOperand(x18, x23, PostIndex)), \
3209 "st4 {v6." S ", v7." S ", v8." S ", v9." S "}, [x18], x23") \
3210 COMPARE(St4(v30.M, v31.M, v0.M, v1.M, MemOperand(sp, x24, PostIndex)), \
3211 "st4 {v30." S ", v31." S ", v0." S ", v1." S "}, [sp], x24")
3212 NEON_FORMAT_LIST(DISASM_INST);
3213 #undef DISASM_INST
3214
3215 COMPARE(St1(v0.V8B(), MemOperand(x15, 8, PostIndex)),
3216 "st1 {v0.8b}, [x15], #8");
3217 COMPARE(St1(v1.V16B(), MemOperand(x16, 16, PostIndex)),
3218 "st1 {v1.16b}, [x16], #16");
3219 COMPARE(St1(v2.V4H(), v3.V4H(), MemOperand(x17, 16, PostIndex)),
3220 "st1 {v2.4h, v3.4h}, [x17], #16");
3221 COMPARE(St1(v4.V8H(), v5.V8H(), MemOperand(x18, 32, PostIndex)),
3222 "st1 {v4.8h, v5.8h}, [x18], #32");
3223 COMPARE(St1(v16.V2S(), v17.V2S(), v18.V2S(), MemOperand(x19, 24, PostIndex)),
3224 "st1 {v16.2s, v17.2s, v18.2s}, [x19], #24");
3225 COMPARE(St1(v16.V4S(), v17.V4S(), v18.V4S(), MemOperand(x19, 48, PostIndex)),
3226 "st1 {v16.4s, v17.4s, v18.4s}, [x19], #48");
3227 COMPARE(St1(v19.V2S(), v20.V2S(), v21.V2S(), v22.V2S(),
3228 MemOperand(x20, 32, PostIndex)),
3229 "st1 {v19.2s, v20.2s, v21.2s, v22.2s}, [x20], #32");
3230 COMPARE(St1(v23.V2D(), v24.V2D(), v25.V2D(), v26.V2D(),
3231 MemOperand(x21, 64, PostIndex)),
3232 "st1 {v23.2d, v24.2d, v25.2d, v26.2d}, [x21], #64");
3233 COMPARE(St2(v1.V16B(), v2.V16B(), MemOperand(x16, 32, PostIndex)),
3234 "st2 {v1.16b, v2.16b}, [x16], #32");
3235 COMPARE(St2(v2.V4H(), v3.V4H(), MemOperand(x17, 16, PostIndex)),
3236 "st2 {v2.4h, v3.4h}, [x17], #16");
3237 COMPARE(St2(v4.V8H(), v5.V8H(), MemOperand(x18, 32, PostIndex)),
3238 "st2 {v4.8h, v5.8h}, [x18], #32");
3239 COMPARE(St3(v16.V2S(), v17.V2S(), v18.V2S(),
3240 MemOperand(x19, 24, PostIndex)),
3241 "st3 {v16.2s, v17.2s, v18.2s}, [x19], #24");
3242 COMPARE(St3(v16.V4S(), v17.V4S(), v18.V4S(),
3243 MemOperand(x19, 48, PostIndex)),
3244 "st3 {v16.4s, v17.4s, v18.4s}, [x19], #48");
3245 COMPARE(St4(v19.V2S(), v20.V2S(), v21.V2S(), v22.V2S(),
3246 MemOperand(x20, 32, PostIndex)),
3247 "st4 {v19.2s, v20.2s, v21.2s, v22.2s}, [x20], #32");
3248 COMPARE(St4(v23.V2D(), v24.V2D(), v25.V2D(), v26.V2D(),
3249 MemOperand(x21, 64, PostIndex)),
3250 "st4 {v23.2d, v24.2d, v25.2d, v26.2d}, [x21], #64");
3251
3252 COMPARE(St1(v0.V1D(), MemOperand(x16)), "st1 {v0.1d}, [x16]");
3253 COMPARE(St1(v1.V1D(), v2.V1D(), MemOperand(x17, 16, PostIndex)),
3254 "st1 {v1.1d, v2.1d}, [x17], #16");
3255 COMPARE(St1(v3.V1D(), v4.V1D(), v5.V1D(), MemOperand(x18, x19, PostIndex)),
3256 "st1 {v3.1d, v4.1d, v5.1d}, [x18], x19");
3257 COMPARE(St1(v30.V1D(), v31.V1D(), v0.V1D(), v1.V1D(),
3258 MemOperand(x20, 32, PostIndex)),
3259 "st1 {v30.1d, v31.1d, v0.1d, v1.1d}, [x20], #32");
3260 COMPARE(St1(d30, d31, d0, d1, MemOperand(x21, x22, PostIndex)),
3261 "st1 {v30.1d, v31.1d, v0.1d, v1.1d}, [x21], x22");
3262
3263 CLEANUP();
3264}
3265
3266
armvixl0f35e362016-05-10 13:57:58 +01003267TEST(neon_load_store_vector_unallocated) {
3268 SETUP();
3269
3270 const char* expected = "unallocated (NEONLoadStoreMultiStruct)";
3271 // LD[1-4] (multiple structures) (no offset)
3272 COMPARE(dci(0x0c401000), expected); // opcode = 0b0001
3273 COMPARE(dci(0x0c403000), expected); // opcode = 0b0011
3274 COMPARE(dci(0x0c405000), expected); // opcode = 0b0101
3275 COMPARE(dci(0x0c409000), expected); // opcode = 0b1001
3276 COMPARE(dci(0x0c40b000), expected); // opcode = 0b1011
3277 COMPARE(dci(0x0c40c000), expected); // opcode = 0b1100
3278 COMPARE(dci(0x0c40d000), expected); // opcode = 0b1101
3279 COMPARE(dci(0x0c40e000), expected); // opcode = 0b1110
3280 COMPARE(dci(0x0c40f000), expected); // opcode = 0b1111
3281 COMPARE(dci(0x0c400c00), expected); // opcode = 0b0000, size:Q = 0b110
3282 COMPARE(dci(0x0c404c00), expected); // opcode = 0b0100, size:Q = 0b110
3283 COMPARE(dci(0x0c408c00), expected); // opcode = 0b1000, size:Q = 0b110
3284
3285 // ST[1-4] (multiple structures) (no offset)
3286 COMPARE(dci(0x0c001000), expected); // opcode = 0b0001
3287 COMPARE(dci(0x0c003000), expected); // opcode = 0b0011
3288 COMPARE(dci(0x0c005000), expected); // opcode = 0b0101
3289 COMPARE(dci(0x0c009000), expected); // opcode = 0b1001
3290 COMPARE(dci(0x0c00b000), expected); // opcode = 0b1011
3291 COMPARE(dci(0x0c00c000), expected); // opcode = 0b1100
3292 COMPARE(dci(0x0c00d000), expected); // opcode = 0b1101
3293 COMPARE(dci(0x0c00e000), expected); // opcode = 0b1110
3294 COMPARE(dci(0x0c00f000), expected); // opcode = 0b1111
3295 COMPARE(dci(0x0c000c00), expected); // opcode = 0b0000, size:Q = 0b110
3296 COMPARE(dci(0x0c004c00), expected); // opcode = 0b0100, size:Q = 0b110
3297 COMPARE(dci(0x0c008c00), expected); // opcode = 0b1000, size:Q = 0b110
3298
3299 expected = "unallocated (NEONLoadStoreMultiStructPostIndex)";
3300 // LD[1-4] (multiple structures) (post index)
3301 COMPARE(dci(0x0cc01000), expected); // opcode = 0b0001
3302 COMPARE(dci(0x0cc03000), expected); // opcode = 0b0011
3303 COMPARE(dci(0x0cc05000), expected); // opcode = 0b0101
3304 COMPARE(dci(0x0cc09000), expected); // opcode = 0b1001
3305 COMPARE(dci(0x0cc0b000), expected); // opcode = 0b1011
3306 COMPARE(dci(0x0cc0c000), expected); // opcode = 0b1100
3307 COMPARE(dci(0x0cc0d000), expected); // opcode = 0b1101
3308 COMPARE(dci(0x0cc0e000), expected); // opcode = 0b1110
3309 COMPARE(dci(0x0cc0f000), expected); // opcode = 0b1111
3310 COMPARE(dci(0x0cc00c00), expected); // opcode = 0b0000, size:Q = 0b110
3311 COMPARE(dci(0x0cc04c00), expected); // opcode = 0b0100, size:Q = 0b110
3312 COMPARE(dci(0x0cc08c00), expected); // opcode = 0b1000, size:Q = 0b110
3313
3314 // ST[1-4] (multiple structures) (post index)
3315 COMPARE(dci(0x0c801000), expected); // opcode = 0b0001
3316 COMPARE(dci(0x0c803000), expected); // opcode = 0b0011
3317 COMPARE(dci(0x0c805000), expected); // opcode = 0b0101
3318 COMPARE(dci(0x0c809000), expected); // opcode = 0b1001
3319 COMPARE(dci(0x0c80b000), expected); // opcode = 0b1011
3320 COMPARE(dci(0x0c80c000), expected); // opcode = 0b1100
3321 COMPARE(dci(0x0c80d000), expected); // opcode = 0b1101
3322 COMPARE(dci(0x0c80e000), expected); // opcode = 0b1110
3323 COMPARE(dci(0x0c80f000), expected); // opcode = 0b1111
3324 COMPARE(dci(0x0c800c00), expected); // opcode = 0b0000, size:Q = 0b110
3325 COMPARE(dci(0x0c804c00), expected); // opcode = 0b0100, size:Q = 0b110
3326 COMPARE(dci(0x0c808c00), expected); // opcode = 0b1000, size:Q = 0b110
3327
3328 CLEANUP();
3329}
3330
3331
armvixl5289c592015-03-02 13:52:04 +00003332TEST(neon_load_store_lane) {
armvixl684cd2a2015-10-23 13:38:33 +01003333 SETUP_MACRO();
armvixl5289c592015-03-02 13:52:04 +00003334
3335 COMPARE(Ld1(v0.V8B(), 0, MemOperand(x15)), "ld1 {v0.b}[0], [x15]");
3336 COMPARE(Ld1(v1.V16B(), 1, MemOperand(x16)), "ld1 {v1.b}[1], [x16]");
3337 COMPARE(Ld1(v2.V4H(), 2, MemOperand(x17)), "ld1 {v2.h}[2], [x17]");
3338 COMPARE(Ld1(v3.V8H(), 3, MemOperand(x18)), "ld1 {v3.h}[3], [x18]");
3339 COMPARE(Ld1(v4.V2S(), 0, MemOperand(x19)), "ld1 {v4.s}[0], [x19]");
3340 COMPARE(Ld1(v5.V4S(), 1, MemOperand(x20)), "ld1 {v5.s}[1], [x20]");
3341 COMPARE(Ld1(v6.V2D(), 0, MemOperand(x21)), "ld1 {v6.d}[0], [x21]");
3342 COMPARE(Ld1(v7.B(), 7, MemOperand(x22)), "ld1 {v7.b}[7], [x22]");
3343 COMPARE(Ld1(v8.B(), 15, MemOperand(x23)), "ld1 {v8.b}[15], [x23]");
3344 COMPARE(Ld1(v9.H(), 3, MemOperand(x24)), "ld1 {v9.h}[3], [x24]");
3345 COMPARE(Ld1(v10.H(), 7, MemOperand(x25)), "ld1 {v10.h}[7], [x25]");
3346 COMPARE(Ld1(v11.S(), 1, MemOperand(x26)), "ld1 {v11.s}[1], [x26]");
3347 COMPARE(Ld1(v12.S(), 3, MemOperand(x27)), "ld1 {v12.s}[3], [x27]");
3348 COMPARE(Ld1(v13.D(), 1, MemOperand(sp)), "ld1 {v13.d}[1], [sp]");
3349
3350 COMPARE(Ld1(v0.V8B(), 0, MemOperand(x15, x0, PostIndex)),
3351 "ld1 {v0.b}[0], [x15], x0");
3352 COMPARE(Ld1(v1.V16B(), 1, MemOperand(x16, 1, PostIndex)),
3353 "ld1 {v1.b}[1], [x16], #1");
3354 COMPARE(Ld1(v2.V4H(), 2, MemOperand(x17, 2, PostIndex)),
3355 "ld1 {v2.h}[2], [x17], #2");
3356 COMPARE(Ld1(v3.V8H(), 3, MemOperand(x18, x1, PostIndex)),
3357 "ld1 {v3.h}[3], [x18], x1");
3358 COMPARE(Ld1(v4.V2S(), 0, MemOperand(x19, x2, PostIndex)),
3359 "ld1 {v4.s}[0], [x19], x2");
3360 COMPARE(Ld1(v5.V4S(), 1, MemOperand(x20, 4, PostIndex)),
3361 "ld1 {v5.s}[1], [x20], #4");
3362 COMPARE(Ld1(v6.V2D(), 0, MemOperand(x21, 8, PostIndex)),
3363 "ld1 {v6.d}[0], [x21], #8");
3364 COMPARE(Ld1(v7.B(), 7, MemOperand(x22, 1, PostIndex)),
3365 "ld1 {v7.b}[7], [x22], #1");
3366 COMPARE(Ld1(v8.B(), 15, MemOperand(x23, x3, PostIndex)),
3367 "ld1 {v8.b}[15], [x23], x3");
3368 COMPARE(Ld1(v9.H(), 3, MemOperand(x24, x4, PostIndex)),
3369 "ld1 {v9.h}[3], [x24], x4");
3370 COMPARE(Ld1(v10.H(), 7, MemOperand(x25, 2, PostIndex)),
3371 "ld1 {v10.h}[7], [x25], #2");
3372 COMPARE(Ld1(v11.S(), 1, MemOperand(x26, 4, PostIndex)),
3373 "ld1 {v11.s}[1], [x26], #4");
3374 COMPARE(Ld1(v12.S(), 3, MemOperand(x27, x5, PostIndex)),
3375 "ld1 {v12.s}[3], [x27], x5");
armvixl0f35e362016-05-10 13:57:58 +01003376 COMPARE(Ld1(v12.S(), 3, MemOperand(x27, 4, PostIndex)),
3377 "ld1 {v12.s}[3], [x27], #4");
armvixl5289c592015-03-02 13:52:04 +00003378 COMPARE(Ld1(v13.D(), 1, MemOperand(sp, x6, PostIndex)),
3379 "ld1 {v13.d}[1], [sp], x6");
armvixl0f35e362016-05-10 13:57:58 +01003380 COMPARE(Ld1(v13.D(), 1, MemOperand(sp, 8, PostIndex)),
3381 "ld1 {v13.d}[1], [sp], #8");
armvixl5289c592015-03-02 13:52:04 +00003382
3383 COMPARE(Ld2(v0.V8B(), v1.V8B(), 0, MemOperand(x15)),
3384 "ld2 {v0.b, v1.b}[0], [x15]");
3385 COMPARE(Ld2(v1.V16B(), v2.V16B(), 1, MemOperand(x16)),
3386 "ld2 {v1.b, v2.b}[1], [x16]");
3387 COMPARE(Ld2(v2.V4H(), v3.V4H(), 2, MemOperand(x17)),
3388 "ld2 {v2.h, v3.h}[2], [x17]");
3389 COMPARE(Ld2(v3.V8H(), v4.V8H(), 3, MemOperand(x18)),
3390 "ld2 {v3.h, v4.h}[3], [x18]");
3391 COMPARE(Ld2(v4.V2S(), v5.V2S(), 0, MemOperand(x19)),
3392 "ld2 {v4.s, v5.s}[0], [x19]");
3393 COMPARE(Ld2(v5.V4S(), v6.V4S(), 1, MemOperand(x20)),
3394 "ld2 {v5.s, v6.s}[1], [x20]");
3395 COMPARE(Ld2(v6.V2D(), v7.V2D(), 0, MemOperand(x21)),
3396 "ld2 {v6.d, v7.d}[0], [x21]");
3397 COMPARE(Ld2(v7.B(), v8.B(), 7, MemOperand(x22)),
3398 "ld2 {v7.b, v8.b}[7], [x22]");
3399 COMPARE(Ld2(v8.B(), v9.B(), 15, MemOperand(x23)),
3400 "ld2 {v8.b, v9.b}[15], [x23]");
3401 COMPARE(Ld2(v9.H(), v10.H(), 3, MemOperand(x24)),
3402 "ld2 {v9.h, v10.h}[3], [x24]");
3403 COMPARE(Ld2(v10.H(), v11.H(), 7, MemOperand(x25)),
3404 "ld2 {v10.h, v11.h}[7], [x25]");
3405 COMPARE(Ld2(v11.S(), v12.S(), 1, MemOperand(x26)),
3406 "ld2 {v11.s, v12.s}[1], [x26]");
3407 COMPARE(Ld2(v12.S(), v13.S(), 3, MemOperand(x27)),
3408 "ld2 {v12.s, v13.s}[3], [x27]");
3409 COMPARE(Ld2(v13.D(), v14.D(), 1, MemOperand(sp)),
3410 "ld2 {v13.d, v14.d}[1], [sp]");
3411
3412 COMPARE(Ld2(v0.V8B(), v1.V8B(), 0, MemOperand(x15, x0, PostIndex)),
3413 "ld2 {v0.b, v1.b}[0], [x15], x0");
3414 COMPARE(Ld2(v1.V16B(), v2.V16B(), 1, MemOperand(x16, 2, PostIndex)),
3415 "ld2 {v1.b, v2.b}[1], [x16], #2");
3416 COMPARE(Ld2(v2.V4H(), v3.V4H(), 2, MemOperand(x17, 4, PostIndex)),
3417 "ld2 {v2.h, v3.h}[2], [x17], #4");
3418 COMPARE(Ld2(v3.V8H(), v4.V8H(), 3, MemOperand(x18, x1, PostIndex)),
3419 "ld2 {v3.h, v4.h}[3], [x18], x1");
3420 COMPARE(Ld2(v4.V2S(), v5.V2S(), 0, MemOperand(x19, x2, PostIndex)),
3421 "ld2 {v4.s, v5.s}[0], [x19], x2");
3422 COMPARE(Ld2(v5.V4S(), v6.V4S(), 1, MemOperand(x20, 8, PostIndex)),
3423 "ld2 {v5.s, v6.s}[1], [x20], #8");
3424 COMPARE(Ld2(v6.V2D(), v7.V2D(), 0, MemOperand(x21, 16, PostIndex)),
3425 "ld2 {v6.d, v7.d}[0], [x21], #16");
3426 COMPARE(Ld2(v7.B(), v8.B(), 7, MemOperand(x22, 2, PostIndex)),
3427 "ld2 {v7.b, v8.b}[7], [x22], #2");
3428 COMPARE(Ld2(v8.B(), v9.B(), 15, MemOperand(x23, x3, PostIndex)),
3429 "ld2 {v8.b, v9.b}[15], [x23], x3");
3430 COMPARE(Ld2(v9.H(), v10.H(), 3, MemOperand(x24, x4, PostIndex)),
3431 "ld2 {v9.h, v10.h}[3], [x24], x4");
3432 COMPARE(Ld2(v10.H(), v11.H(), 7, MemOperand(x25, 4, PostIndex)),
3433 "ld2 {v10.h, v11.h}[7], [x25], #4");
3434 COMPARE(Ld2(v11.S(), v12.S(), 1, MemOperand(x26, 8, PostIndex)),
3435 "ld2 {v11.s, v12.s}[1], [x26], #8");
3436 COMPARE(Ld2(v12.S(), v13.S(), 3, MemOperand(x27, x5, PostIndex)),
3437 "ld2 {v12.s, v13.s}[3], [x27], x5");
armvixl0f35e362016-05-10 13:57:58 +01003438 COMPARE(Ld2(v11.S(), v12.S(), 3, MemOperand(x26, 8, PostIndex)),
3439 "ld2 {v11.s, v12.s}[3], [x26], #8");
armvixl5289c592015-03-02 13:52:04 +00003440 COMPARE(Ld2(v13.D(), v14.D(), 1, MemOperand(sp, x6, PostIndex)),
3441 "ld2 {v13.d, v14.d}[1], [sp], x6");
armvixl0f35e362016-05-10 13:57:58 +01003442 COMPARE(Ld2(v13.D(), v14.D(), 1, MemOperand(sp, 16, PostIndex)),
3443 "ld2 {v13.d, v14.d}[1], [sp], #16");
armvixl5289c592015-03-02 13:52:04 +00003444
3445 COMPARE(Ld3(v0.V8B(), v1.V8B(), v2.V8B(), 0, MemOperand(x15)),
3446 "ld3 {v0.b, v1.b, v2.b}[0], [x15]");
3447 COMPARE(Ld3(v1.V16B(), v2.V16B(), v3.V16B(), 1, MemOperand(x16)),
3448 "ld3 {v1.b, v2.b, v3.b}[1], [x16]");
3449 COMPARE(Ld3(v2.V4H(), v3.V4H(), v4.V4H(), 2, MemOperand(x17)),
3450 "ld3 {v2.h, v3.h, v4.h}[2], [x17]");
3451 COMPARE(Ld3(v3.V8H(), v4.V8H(), v5.V8H(), 3, MemOperand(x18)),
3452 "ld3 {v3.h, v4.h, v5.h}[3], [x18]");
3453 COMPARE(Ld3(v4.V2S(), v5.V2S(), v6.V2S(), 0, MemOperand(x19)),
3454 "ld3 {v4.s, v5.s, v6.s}[0], [x19]");
3455 COMPARE(Ld3(v5.V4S(), v6.V4S(), v7.V4S(), 1, MemOperand(x20)),
3456 "ld3 {v5.s, v6.s, v7.s}[1], [x20]");
3457 COMPARE(Ld3(v6.V2D(), v7.V2D(), v8.V2D(), 0, MemOperand(x21)),
3458 "ld3 {v6.d, v7.d, v8.d}[0], [x21]");
3459 COMPARE(Ld3(v7.B(), v8.B(), v9.B(), 7, MemOperand(x22)),
3460 "ld3 {v7.b, v8.b, v9.b}[7], [x22]");
3461 COMPARE(Ld3(v8.B(), v9.B(), v10.B(), 15, MemOperand(x23)),
3462 "ld3 {v8.b, v9.b, v10.b}[15], [x23]");
3463 COMPARE(Ld3(v9.H(), v10.H(), v11.H(), 3, MemOperand(x24)),
3464 "ld3 {v9.h, v10.h, v11.h}[3], [x24]");
3465 COMPARE(Ld3(v10.H(), v11.H(), v12.H(), 7, MemOperand(x25)),
3466 "ld3 {v10.h, v11.h, v12.h}[7], [x25]");
3467 COMPARE(Ld3(v11.S(), v12.S(), v13.S(), 1, MemOperand(x26)),
3468 "ld3 {v11.s, v12.s, v13.s}[1], [x26]");
3469 COMPARE(Ld3(v12.S(), v13.S(), v14.S(), 3, MemOperand(x27)),
3470 "ld3 {v12.s, v13.s, v14.s}[3], [x27]");
3471 COMPARE(Ld3(v13.D(), v14.D(), v15.D(), 1, MemOperand(sp)),
3472 "ld3 {v13.d, v14.d, v15.d}[1], [sp]");
3473
3474 COMPARE(Ld3(v0.V8B(), v1.V8B(), v2.V8B(), 0,
3475 MemOperand(x15, x0, PostIndex)),
3476 "ld3 {v0.b, v1.b, v2.b}[0], [x15], x0");
3477 COMPARE(Ld3(v1.V16B(), v2.V16B(), v3.V16B(), 1,
3478 MemOperand(x16, 3, PostIndex)),
3479 "ld3 {v1.b, v2.b, v3.b}[1], [x16], #3");
3480 COMPARE(Ld3(v2.V4H(), v3.V4H(), v4.V4H(), 2,
3481 MemOperand(x17, 6, PostIndex)),
3482 "ld3 {v2.h, v3.h, v4.h}[2], [x17], #6");
3483 COMPARE(Ld3(v3.V8H(), v4.V8H(), v5.V8H(), 3,
3484 MemOperand(x18, x1, PostIndex)),
3485 "ld3 {v3.h, v4.h, v5.h}[3], [x18], x1");
3486 COMPARE(Ld3(v4.V2S(), v5.V2S(), v6.V2S(), 0,
3487 MemOperand(x19, x2, PostIndex)),
3488 "ld3 {v4.s, v5.s, v6.s}[0], [x19], x2");
3489 COMPARE(Ld3(v5.V4S(), v6.V4S(), v7.V4S(), 1,
3490 MemOperand(x20, 12, PostIndex)),
3491 "ld3 {v5.s, v6.s, v7.s}[1], [x20], #12");
3492 COMPARE(Ld3(v6.V2D(), v7.V2D(), v8.V2D(), 0,
3493 MemOperand(x21, 24, PostIndex)),
3494 "ld3 {v6.d, v7.d, v8.d}[0], [x21], #24");
3495 COMPARE(Ld3(v7.B(), v8.B(), v9.B(), 7,
3496 MemOperand(x22, 3, PostIndex)),
3497 "ld3 {v7.b, v8.b, v9.b}[7], [x22], #3");
3498 COMPARE(Ld3(v8.B(), v9.B(), v10.B(), 15,
3499 MemOperand(x23, x3, PostIndex)),
3500 "ld3 {v8.b, v9.b, v10.b}[15], [x23], x3");
3501 COMPARE(Ld3(v9.H(), v10.H(), v11.H(), 3,
3502 MemOperand(x24, x4, PostIndex)),
3503 "ld3 {v9.h, v10.h, v11.h}[3], [x24], x4");
3504 COMPARE(Ld3(v10.H(), v11.H(), v12.H(), 7,
3505 MemOperand(x25, 6, PostIndex)),
3506 "ld3 {v10.h, v11.h, v12.h}[7], [x25], #6");
3507 COMPARE(Ld3(v11.S(), v12.S(), v13.S(), 1,
3508 MemOperand(x26, 12, PostIndex)),
3509 "ld3 {v11.s, v12.s, v13.s}[1], [x26], #12");
3510 COMPARE(Ld3(v12.S(), v13.S(), v14.S(), 3,
3511 MemOperand(x27, x5, PostIndex)),
3512 "ld3 {v12.s, v13.s, v14.s}[3], [x27], x5");
armvixl0f35e362016-05-10 13:57:58 +01003513 COMPARE(Ld3(v12.S(), v13.S(), v14.S(), 3,
3514 MemOperand(x27, 12, PostIndex)),
3515 "ld3 {v12.s, v13.s, v14.s}[3], [x27], #12");
armvixl5289c592015-03-02 13:52:04 +00003516 COMPARE(Ld3(v13.D(), v14.D(), v15.D(), 1,
3517 MemOperand(sp, x6, PostIndex)),
3518 "ld3 {v13.d, v14.d, v15.d}[1], [sp], x6");
armvixl0f35e362016-05-10 13:57:58 +01003519 COMPARE(Ld3(v13.D(), v14.D(), v15.D(), 1,
3520 MemOperand(sp, 24, PostIndex)),
3521 "ld3 {v13.d, v14.d, v15.d}[1], [sp], #24");
armvixl5289c592015-03-02 13:52:04 +00003522
3523 COMPARE(Ld4(v0.V8B(), v1.V8B(), v2.V8B(), v3.V8B(), 0,
3524 MemOperand(x15)),
3525 "ld4 {v0.b, v1.b, v2.b, v3.b}[0], [x15]");
3526 COMPARE(Ld4(v1.V16B(), v2.V16B(), v3.V16B(), v4.V16B(), 1,
3527 MemOperand(x16)),
3528 "ld4 {v1.b, v2.b, v3.b, v4.b}[1], [x16]");
3529 COMPARE(Ld4(v2.V4H(), v3.V4H(), v4.V4H(), v5.V4H(), 2,
3530 MemOperand(x17)),
3531 "ld4 {v2.h, v3.h, v4.h, v5.h}[2], [x17]");
3532 COMPARE(Ld4(v3.V8H(), v4.V8H(), v5.V8H(), v6.V8H(), 3,
3533 MemOperand(x18)),
3534 "ld4 {v3.h, v4.h, v5.h, v6.h}[3], [x18]");
3535 COMPARE(Ld4(v4.V2S(), v5.V2S(), v6.V2S(), v7.V2S(), 0,
3536 MemOperand(x19)),
3537 "ld4 {v4.s, v5.s, v6.s, v7.s}[0], [x19]");
3538 COMPARE(Ld4(v5.V4S(), v6.V4S(), v7.V4S(), v8.V4S(), 1,
3539 MemOperand(x20)),
3540 "ld4 {v5.s, v6.s, v7.s, v8.s}[1], [x20]");
3541 COMPARE(Ld4(v6.V2D(), v7.V2D(), v8.V2D(), v9.V2D(), 0,
3542 MemOperand(x21)),
3543 "ld4 {v6.d, v7.d, v8.d, v9.d}[0], [x21]");
3544 COMPARE(Ld4(v7.B(), v8.B(), v9.B(), v10.B(), 7,
3545 MemOperand(x22)),
3546 "ld4 {v7.b, v8.b, v9.b, v10.b}[7], [x22]");
3547 COMPARE(Ld4(v8.B(), v9.B(), v10.B(), v11.B(), 15,
3548 MemOperand(x23)),
3549 "ld4 {v8.b, v9.b, v10.b, v11.b}[15], [x23]");
3550 COMPARE(Ld4(v9.H(), v10.H(), v11.H(), v12.H(), 3,
3551 MemOperand(x24)),
3552 "ld4 {v9.h, v10.h, v11.h, v12.h}[3], [x24]");
3553 COMPARE(Ld4(v10.H(), v11.H(), v12.H(), v13.H(), 7,
3554 MemOperand(x25)),
3555 "ld4 {v10.h, v11.h, v12.h, v13.h}[7], [x25]");
3556 COMPARE(Ld4(v11.S(), v12.S(), v13.S(), v14.S(), 1,
3557 MemOperand(x26)),
3558 "ld4 {v11.s, v12.s, v13.s, v14.s}[1], [x26]");
3559 COMPARE(Ld4(v12.S(), v13.S(), v14.S(), v15.S(), 3,
3560 MemOperand(x27)),
3561 "ld4 {v12.s, v13.s, v14.s, v15.s}[3], [x27]");
3562 COMPARE(Ld4(v13.D(), v14.D(), v15.D(), v16.D(), 1,
3563 MemOperand(sp)),
3564 "ld4 {v13.d, v14.d, v15.d, v16.d}[1], [sp]");
3565
3566 COMPARE(Ld4(v0.V8B(), v1.V8B(), v2.V8B(), v3.V8B(), 0,
3567 MemOperand(x15, x0, PostIndex)),
3568 "ld4 {v0.b, v1.b, v2.b, v3.b}[0], [x15], x0");
3569 COMPARE(Ld4(v1.V16B(), v2.V16B(), v3.V16B(), v4.V16B(), 1,
3570 MemOperand(x16, 4, PostIndex)),
3571 "ld4 {v1.b, v2.b, v3.b, v4.b}[1], [x16], #4");
3572 COMPARE(Ld4(v2.V4H(), v3.V4H(), v4.V4H(), v5.V4H(), 2,
3573 MemOperand(x17, 8, PostIndex)),
3574 "ld4 {v2.h, v3.h, v4.h, v5.h}[2], [x17], #8");
3575 COMPARE(Ld4(v3.V8H(), v4.V8H(), v5.V8H(), v6.V8H(), 3,
3576 MemOperand(x18, x1, PostIndex)),
3577 "ld4 {v3.h, v4.h, v5.h, v6.h}[3], [x18], x1");
3578 COMPARE(Ld4(v4.V2S(), v5.V2S(), v6.V2S(), v7.V2S(), 0,
3579 MemOperand(x19, x2, PostIndex)),
3580 "ld4 {v4.s, v5.s, v6.s, v7.s}[0], [x19], x2");
3581 COMPARE(Ld4(v5.V4S(), v6.V4S(), v7.V4S(), v8.V4S(), 1,
3582 MemOperand(x20, 16, PostIndex)),
3583 "ld4 {v5.s, v6.s, v7.s, v8.s}[1], [x20], #16");
3584 COMPARE(Ld4(v6.V2D(), v7.V2D(), v8.V2D(), v9.V2D(), 0,
3585 MemOperand(x21, 32, PostIndex)),
3586 "ld4 {v6.d, v7.d, v8.d, v9.d}[0], [x21], #32");
3587 COMPARE(Ld4(v7.B(), v8.B(), v9.B(), v10.B(), 7,
3588 MemOperand(x22, 4, PostIndex)),
3589 "ld4 {v7.b, v8.b, v9.b, v10.b}[7], [x22], #4");
3590 COMPARE(Ld4(v8.B(), v9.B(), v10.B(), v11.B(), 15,
3591 MemOperand(x23, x3, PostIndex)),
3592 "ld4 {v8.b, v9.b, v10.b, v11.b}[15], [x23], x3");
3593 COMPARE(Ld4(v9.H(), v10.H(), v11.H(), v12.H(), 3,
3594 MemOperand(x24, x4, PostIndex)),
3595 "ld4 {v9.h, v10.h, v11.h, v12.h}[3], [x24], x4");
3596 COMPARE(Ld4(v10.H(), v11.H(), v12.H(), v13.H(), 7,
3597 MemOperand(x25, 8, PostIndex)),
3598 "ld4 {v10.h, v11.h, v12.h, v13.h}[7], [x25], #8");
3599 COMPARE(Ld4(v11.S(), v12.S(), v13.S(), v14.S(), 1,
3600 MemOperand(x26, 16, PostIndex)),
3601 "ld4 {v11.s, v12.s, v13.s, v14.s}[1], [x26], #16");
3602 COMPARE(Ld4(v12.S(), v13.S(), v14.S(), v15.S(), 3,
3603 MemOperand(x27, x5, PostIndex)),
3604 "ld4 {v12.s, v13.s, v14.s, v15.s}[3], [x27], x5");
armvixl0f35e362016-05-10 13:57:58 +01003605 COMPARE(Ld4(v11.S(), v12.S(), v13.S(), v14.S(), 3,
3606 MemOperand(x26, 16, PostIndex)),
3607 "ld4 {v11.s, v12.s, v13.s, v14.s}[3], [x26], #16");
armvixl5289c592015-03-02 13:52:04 +00003608 COMPARE(Ld4(v13.D(), v14.D(), v15.D(), v16.D(), 1,
3609 MemOperand(sp, x6, PostIndex)),
3610 "ld4 {v13.d, v14.d, v15.d, v16.d}[1], [sp], x6");
armvixl0f35e362016-05-10 13:57:58 +01003611 COMPARE(Ld4(v13.D(), v14.D(), v15.D(), v16.D(), 1,
3612 MemOperand(sp, 32, PostIndex)),
3613 "ld4 {v13.d, v14.d, v15.d, v16.d}[1], [sp], #32");
armvixl5289c592015-03-02 13:52:04 +00003614
3615 COMPARE(St1(v0.V8B(), 0, MemOperand(x15)), "st1 {v0.b}[0], [x15]");
3616 COMPARE(St1(v1.V16B(), 1, MemOperand(x16)), "st1 {v1.b}[1], [x16]");
3617 COMPARE(St1(v2.V4H(), 2, MemOperand(x17)), "st1 {v2.h}[2], [x17]");
3618 COMPARE(St1(v3.V8H(), 3, MemOperand(x18)), "st1 {v3.h}[3], [x18]");
3619 COMPARE(St1(v4.V2S(), 0, MemOperand(x19)), "st1 {v4.s}[0], [x19]");
3620 COMPARE(St1(v5.V4S(), 1, MemOperand(x20)), "st1 {v5.s}[1], [x20]");
3621 COMPARE(St1(v6.V2D(), 0, MemOperand(x21)), "st1 {v6.d}[0], [x21]");
3622 COMPARE(St1(v7.B(), 7, MemOperand(x22)), "st1 {v7.b}[7], [x22]");
3623 COMPARE(St1(v8.B(), 15, MemOperand(x23)), "st1 {v8.b}[15], [x23]");
3624 COMPARE(St1(v9.H(), 3, MemOperand(x24)), "st1 {v9.h}[3], [x24]");
3625 COMPARE(St1(v10.H(), 7, MemOperand(x25)), "st1 {v10.h}[7], [x25]");
3626 COMPARE(St1(v11.S(), 1, MemOperand(x26)), "st1 {v11.s}[1], [x26]");
3627 COMPARE(St1(v12.S(), 3, MemOperand(x27)), "st1 {v12.s}[3], [x27]");
3628 COMPARE(St1(v13.D(), 1, MemOperand(sp)), "st1 {v13.d}[1], [sp]");
3629
3630 COMPARE(St1(v0.V8B(), 0, MemOperand(x15, x0, PostIndex)),
3631 "st1 {v0.b}[0], [x15], x0");
3632 COMPARE(St1(v1.V16B(), 1, MemOperand(x16, 1, PostIndex)),
3633 "st1 {v1.b}[1], [x16], #1");
3634 COMPARE(St1(v2.V4H(), 2, MemOperand(x17, 2, PostIndex)),
3635 "st1 {v2.h}[2], [x17], #2");
3636 COMPARE(St1(v3.V8H(), 3, MemOperand(x18, x1, PostIndex)),
3637 "st1 {v3.h}[3], [x18], x1");
3638 COMPARE(St1(v4.V2S(), 0, MemOperand(x19, x2, PostIndex)),
3639 "st1 {v4.s}[0], [x19], x2");
3640 COMPARE(St1(v5.V4S(), 1, MemOperand(x20, 4, PostIndex)),
3641 "st1 {v5.s}[1], [x20], #4");
3642 COMPARE(St1(v6.V2D(), 0, MemOperand(x21, 8, PostIndex)),
3643 "st1 {v6.d}[0], [x21], #8");
3644 COMPARE(St1(v7.B(), 7, MemOperand(x22, 1, PostIndex)),
3645 "st1 {v7.b}[7], [x22], #1");
3646 COMPARE(St1(v8.B(), 15, MemOperand(x23, x3, PostIndex)),
3647 "st1 {v8.b}[15], [x23], x3");
3648 COMPARE(St1(v9.H(), 3, MemOperand(x24, x4, PostIndex)),
3649 "st1 {v9.h}[3], [x24], x4");
3650 COMPARE(St1(v10.H(), 7, MemOperand(x25, 2, PostIndex)),
3651 "st1 {v10.h}[7], [x25], #2");
3652 COMPARE(St1(v11.S(), 1, MemOperand(x26, 4, PostIndex)),
3653 "st1 {v11.s}[1], [x26], #4");
3654 COMPARE(St1(v12.S(), 3, MemOperand(x27, x5, PostIndex)),
3655 "st1 {v12.s}[3], [x27], x5");
3656 COMPARE(St1(v13.D(), 1, MemOperand(sp, x6, PostIndex)),
3657 "st1 {v13.d}[1], [sp], x6");
3658 COMPARE(St2(v0.V8B(), v1.V8B(), 0, MemOperand(x15, x0, PostIndex)),
3659 "st2 {v0.b, v1.b}[0], [x15], x0");
3660 COMPARE(St2(v1.V16B(), v2.V16B(), 1, MemOperand(x16, 2, PostIndex)),
3661 "st2 {v1.b, v2.b}[1], [x16], #2");
3662 COMPARE(St2(v2.V4H(), v3.V4H(), 2, MemOperand(x17, 4, PostIndex)),
3663 "st2 {v2.h, v3.h}[2], [x17], #4");
3664 COMPARE(St2(v3.V8H(), v4.V8H(), 3, MemOperand(x18, x1, PostIndex)),
3665 "st2 {v3.h, v4.h}[3], [x18], x1");
3666 COMPARE(St2(v4.V2S(), v5.V2S(), 0, MemOperand(x19, x2, PostIndex)),
3667 "st2 {v4.s, v5.s}[0], [x19], x2");
3668 COMPARE(St2(v5.V4S(), v6.V4S(), 1, MemOperand(x20, 8, PostIndex)),
3669 "st2 {v5.s, v6.s}[1], [x20], #8");
3670 COMPARE(St2(v6.V2D(), v7.V2D(), 0, MemOperand(x21, 16, PostIndex)),
3671 "st2 {v6.d, v7.d}[0], [x21], #16");
3672 COMPARE(St2(v7.B(), v8.B(), 7, MemOperand(x22, 2, PostIndex)),
3673 "st2 {v7.b, v8.b}[7], [x22], #2");
3674 COMPARE(St2(v8.B(), v9.B(), 15, MemOperand(x23, x3, PostIndex)),
3675 "st2 {v8.b, v9.b}[15], [x23], x3");
3676 COMPARE(St2(v9.H(), v10.H(), 3, MemOperand(x24, x4, PostIndex)),
3677 "st2 {v9.h, v10.h}[3], [x24], x4");
3678 COMPARE(St2(v10.H(), v11.H(), 7, MemOperand(x25, 4, PostIndex)),
3679 "st2 {v10.h, v11.h}[7], [x25], #4");
3680 COMPARE(St2(v11.S(), v12.S(), 1, MemOperand(x26, 8, PostIndex)),
3681 "st2 {v11.s, v12.s}[1], [x26], #8");
3682 COMPARE(St2(v12.S(), v13.S(), 3, MemOperand(x27, x5, PostIndex)),
3683 "st2 {v12.s, v13.s}[3], [x27], x5");
3684 COMPARE(St2(v13.D(), v14.D(), 1, MemOperand(sp, x6, PostIndex)),
3685 "st2 {v13.d, v14.d}[1], [sp], x6");
3686 COMPARE(St3(VLIST3(v0.V8B()), 0, MemOperand(x15, x0, PostIndex)),
3687 "st3 {v0.b, v1.b, v2.b}[0], [x15], x0");
3688 COMPARE(St3(VLIST3(v1.V16B()), 1, MemOperand(x16, 3, PostIndex)),
3689 "st3 {v1.b, v2.b, v3.b}[1], [x16], #3");
3690 COMPARE(St3(VLIST3(v2.V4H()), 2, MemOperand(x17, 6, PostIndex)),
3691 "st3 {v2.h, v3.h, v4.h}[2], [x17], #6");
3692 COMPARE(St3(VLIST3(v3.V8H()), 3, MemOperand(x18, x1, PostIndex)),
3693 "st3 {v3.h, v4.h, v5.h}[3], [x18], x1");
3694 COMPARE(St3(VLIST3(v4.V2S()), 0, MemOperand(x19, x2, PostIndex)),
3695 "st3 {v4.s, v5.s, v6.s}[0], [x19], x2");
3696 COMPARE(St3(VLIST3(v5.V4S()), 1, MemOperand(x20, 12, PostIndex)),
3697 "st3 {v5.s, v6.s, v7.s}[1], [x20], #12");
3698 COMPARE(St3(VLIST3(v6.V2D()), 0, MemOperand(x21, 24, PostIndex)),
3699 "st3 {v6.d, v7.d, v8.d}[0], [x21], #24");
3700 COMPARE(St3(VLIST3(v7.B()), 7, MemOperand(x22, 3, PostIndex)),
3701 "st3 {v7.b, v8.b, v9.b}[7], [x22], #3");
3702 COMPARE(St3(VLIST3(v8.B()), 15, MemOperand(x23, x3, PostIndex)),
3703 "st3 {v8.b, v9.b, v10.b}[15], [x23], x3");
3704 COMPARE(St3(VLIST3(v9.H()), 3, MemOperand(x24, x4, PostIndex)),
3705 "st3 {v9.h, v10.h, v11.h}[3], [x24], x4");
3706 COMPARE(St3(VLIST3(v10.H()), 7, MemOperand(x25, 6, PostIndex)),
3707 "st3 {v10.h, v11.h, v12.h}[7], [x25], #6");
3708 COMPARE(St3(VLIST3(v11.S()), 1, MemOperand(x26, 12, PostIndex)),
3709 "st3 {v11.s, v12.s, v13.s}[1], [x26], #12");
3710 COMPARE(St3(VLIST3(v12.S()), 3, MemOperand(x27, x5, PostIndex)),
3711 "st3 {v12.s, v13.s, v14.s}[3], [x27], x5");
3712 COMPARE(St3(VLIST3(v13.D()), 1, MemOperand(sp, x6, PostIndex)),
3713 "st3 {v13.d, v14.d, v15.d}[1], [sp], x6");
3714
3715 COMPARE(St4(VLIST4(v0.V8B()), 0, MemOperand(x15, x0, PostIndex)),
3716 "st4 {v0.b, v1.b, v2.b, v3.b}[0], [x15], x0");
3717 COMPARE(St4(VLIST4(v1.V16B()), 1, MemOperand(x16, 4, PostIndex)),
3718 "st4 {v1.b, v2.b, v3.b, v4.b}[1], [x16], #4");
3719 COMPARE(St4(VLIST4(v2.V4H()), 2, MemOperand(x17, 8, PostIndex)),
3720 "st4 {v2.h, v3.h, v4.h, v5.h}[2], [x17], #8");
3721 COMPARE(St4(VLIST4(v3.V8H()), 3, MemOperand(x18, x1, PostIndex)),
3722 "st4 {v3.h, v4.h, v5.h, v6.h}[3], [x18], x1");
3723 COMPARE(St4(VLIST4(v4.V2S()), 0, MemOperand(x19, x2, PostIndex)),
3724 "st4 {v4.s, v5.s, v6.s, v7.s}[0], [x19], x2");
3725 COMPARE(St4(VLIST4(v5.V4S()), 1, MemOperand(x20, 16, PostIndex)),
3726 "st4 {v5.s, v6.s, v7.s, v8.s}[1], [x20], #16");
3727 COMPARE(St4(VLIST4(v6.V2D()), 0, MemOperand(x21, 32, PostIndex)),
3728 "st4 {v6.d, v7.d, v8.d, v9.d}[0], [x21], #32");
3729 COMPARE(St4(VLIST4(v7.B()), 7, MemOperand(x22, 4, PostIndex)),
3730 "st4 {v7.b, v8.b, v9.b, v10.b}[7], [x22], #4");
3731 COMPARE(St4(VLIST4(v8.B()), 15, MemOperand(x23, x3, PostIndex)),
3732 "st4 {v8.b, v9.b, v10.b, v11.b}[15], [x23], x3");
3733 COMPARE(St4(VLIST4(v9.H()), 3, MemOperand(x24, x4, PostIndex)),
3734 "st4 {v9.h, v10.h, v11.h, v12.h}[3], [x24], x4");
3735 COMPARE(St4(VLIST4(v10.H()), 7, MemOperand(x25, 8, PostIndex)),
3736 "st4 {v10.h, v11.h, v12.h, v13.h}[7], [x25], #8");
3737 COMPARE(St4(VLIST4(v11.S()), 1, MemOperand(x26, 16, PostIndex)),
3738 "st4 {v11.s, v12.s, v13.s, v14.s}[1], [x26], #16");
3739 COMPARE(St4(VLIST4(v12.S()), 3, MemOperand(x27, x5, PostIndex)),
3740 "st4 {v12.s, v13.s, v14.s, v15.s}[3], [x27], x5");
3741 COMPARE(St4(VLIST4(v13.D()), 1, MemOperand(sp, x6, PostIndex)),
3742 "st4 {v13.d, v14.d, v15.d, v16.d}[1], [sp], x6");
3743
3744 CLEANUP();
3745}
3746
3747
armvixl0f35e362016-05-10 13:57:58 +01003748TEST(neon_load_store_lane_unallocated) {
3749 SETUP();
3750
3751 const char* expected = "unallocated (NEONLoadStoreSingleStruct)";
3752 // LD1 (single structure) (no offset)
3753 COMPARE(dci(0x0d404400), expected); // .h, size<0> = 1
3754 COMPARE(dci(0x0d408800), expected); // .s, size<1> = 1
3755 COMPARE(dci(0x0d409400), expected); // .d, size<0> = 1, S = 1
3756 // LD2 (single structure) (no offset)
3757 COMPARE(dci(0x0d604400), expected); // .h, size<0> = 1
3758 COMPARE(dci(0x0d608800), expected); // .s, size<1> = 1
3759 COMPARE(dci(0x0d609400), expected); // .d, size<0> = 1, S = 1
3760 // LD3 (single structure) (no offset)
3761 COMPARE(dci(0x0d406400), expected); // .h, size<0> = 1
3762 COMPARE(dci(0x0d40a800), expected); // .s, size<1> = 1
3763 COMPARE(dci(0x0d40b400), expected); // .d, size<0> = 1, S = 1
3764 // LD4 (single structure) (no offset)
3765 COMPARE(dci(0x0d606400), expected); // .h, size<0> = 1
3766 COMPARE(dci(0x0d60a800), expected); // .s, size<1> = 1
3767 COMPARE(dci(0x0d60b400), expected); // .d, size<0> = 1, S = 1
3768 // ST1 (single structure) (no offset)
3769 COMPARE(dci(0x0d004400), expected); // .h, size<0> = 1
3770 COMPARE(dci(0x0d008800), expected); // .s, size<1> = 1
3771 COMPARE(dci(0x0d009400), expected); // .d, size<0> = 1, S = 1
3772 // ST2 (single structure) (no offset)
3773 COMPARE(dci(0x0d204400), expected); // .h, size<0> = 1
3774 COMPARE(dci(0x0d208800), expected); // .s, size<1> = 1
3775 COMPARE(dci(0x0d209400), expected); // .d, size<0> = 1, S = 1
3776 // ST3 (single structure) (no offset)
3777 COMPARE(dci(0x0d006400), expected); // .h, size<0> = 1
3778 COMPARE(dci(0x0d00a800), expected); // .s, size<1> = 1
3779 COMPARE(dci(0x0d00b400), expected); // .d, size<0> = 1, S = 1
3780 // ST4 (single structure) (no offset)
3781 COMPARE(dci(0x0d206400), expected); // .h, size<0> = 1
3782 COMPARE(dci(0x0d20a800), expected); // .s, size<1> = 1
3783 COMPARE(dci(0x0d20b400), expected); // .d, size<0> = 1, S = 1
3784
3785 expected = "unallocated (NEONLoadStoreSingleStructPostIndex)";
3786 // LD1 (single structure) (post index)
3787 COMPARE(dci(0x0dc04400), expected); // .h, size<0> = 1
3788 COMPARE(dci(0x0dc08800), expected); // .s, size<1> = 1
3789 COMPARE(dci(0x0dc09400), expected); // .d, size<0> = 1, S = 1
3790 // LD2 (single structure) (post index)
3791 COMPARE(dci(0x0de04400), expected); // .h, size<0> = 1
3792 COMPARE(dci(0x0de08800), expected); // .s, size<1> = 1
3793 COMPARE(dci(0x0de09400), expected); // .d, size<0> = 1, S = 1
3794 // LD3 (single structure) (post index)
3795 COMPARE(dci(0x0dc06400), expected); // .h, size<0> = 1
3796 COMPARE(dci(0x0dc0a800), expected); // .s, size<1> = 1
3797 COMPARE(dci(0x0dc0b400), expected); // .d, size<0> = 1, S = 1
3798 // LD4 (single structure) (post index)
3799 COMPARE(dci(0x0de06400), expected); // .h, size<0> = 1
3800 COMPARE(dci(0x0de0a800), expected); // .s, size<1> = 1
3801 COMPARE(dci(0x0de0b400), expected); // .d, size<0> = 1, S = 1
3802 // ST1 (single structure) (post index)
3803 COMPARE(dci(0x0d804400), expected); // .h, size<0> = 1
3804 COMPARE(dci(0x0d808800), expected); // .s, size<1> = 1
3805 COMPARE(dci(0x0d809400), expected); // .d, size<0> = 1, S = 1
3806 // ST2 (single structure) (post index)
3807 COMPARE(dci(0x0da04400), expected); // .h, size<0> = 1
3808 COMPARE(dci(0x0da08800), expected); // .s, size<1> = 1
3809 COMPARE(dci(0x0da09400), expected); // .d, size<0> = 1, S = 1
3810 // ST3 (single structure) (post index)
3811 COMPARE(dci(0x0d806400), expected); // .h, size<0> = 1
3812 COMPARE(dci(0x0d80a800), expected); // .s, size<1> = 1
3813 COMPARE(dci(0x0d80b400), expected); // .d, size<0> = 1, S = 1
3814 // ST4 (single structure) (post index)
3815 COMPARE(dci(0x0da06400), expected); // .h, size<0> = 1
3816 COMPARE(dci(0x0da0a800), expected); // .s, size<1> = 1
3817 COMPARE(dci(0x0da0b400), expected); // .d, size<0> = 1, S = 1
3818
3819 CLEANUP();
3820}
3821
3822
armvixl5289c592015-03-02 13:52:04 +00003823TEST(neon_load_all_lanes) {
armvixl684cd2a2015-10-23 13:38:33 +01003824 SETUP_MACRO();
armvixl5289c592015-03-02 13:52:04 +00003825
3826 COMPARE(Ld1r(v14.V8B(), MemOperand(x0)), "ld1r {v14.8b}, [x0]");
3827 COMPARE(Ld1r(v15.V16B(), MemOperand(x1)), "ld1r {v15.16b}, [x1]");
3828 COMPARE(Ld1r(v16.V4H(), MemOperand(x2)), "ld1r {v16.4h}, [x2]");
3829 COMPARE(Ld1r(v17.V8H(), MemOperand(x3)), "ld1r {v17.8h}, [x3]");
3830 COMPARE(Ld1r(v18.V2S(), MemOperand(x4)), "ld1r {v18.2s}, [x4]");
3831 COMPARE(Ld1r(v19.V4S(), MemOperand(x5)), "ld1r {v19.4s}, [x5]");
3832 COMPARE(Ld1r(v20.V2D(), MemOperand(sp)), "ld1r {v20.2d}, [sp]");
3833 COMPARE(Ld1r(v21.V1D(), MemOperand(x30)), "ld1r {v21.1d}, [x30]");
3834
3835 COMPARE(Ld1r(v22.V8B(), MemOperand(x6, 1, PostIndex)),
3836 "ld1r {v22.8b}, [x6], #1");
3837 COMPARE(Ld1r(v23.V16B(), MemOperand(x7, x16, PostIndex)),
3838 "ld1r {v23.16b}, [x7], x16");
3839 COMPARE(Ld1r(v24.V4H(), MemOperand(x8, x17, PostIndex)),
3840 "ld1r {v24.4h}, [x8], x17");
3841 COMPARE(Ld1r(v25.V8H(), MemOperand(x9, 2, PostIndex)),
3842 "ld1r {v25.8h}, [x9], #2");
3843 COMPARE(Ld1r(v26.V2S(), MemOperand(x10, 4, PostIndex)),
3844 "ld1r {v26.2s}, [x10], #4");
3845 COMPARE(Ld1r(v27.V4S(), MemOperand(x11, x18, PostIndex)),
3846 "ld1r {v27.4s}, [x11], x18");
3847 COMPARE(Ld1r(v28.V2D(), MemOperand(x12, 8, PostIndex)),
3848 "ld1r {v28.2d}, [x12], #8");
3849 COMPARE(Ld1r(v29.V1D(), MemOperand(x13, 8, PostIndex)),
3850 "ld1r {v29.1d}, [x13], #8");
3851
3852 COMPARE(Ld2r(v14.V8B(), v15.V8B(), MemOperand(x0)),
3853 "ld2r {v14.8b, v15.8b}, [x0]");
3854 COMPARE(Ld2r(v15.V16B(), v16.V16B(), MemOperand(x1)),
3855 "ld2r {v15.16b, v16.16b}, [x1]");
3856 COMPARE(Ld2r(v16.V4H(), v17.V4H(), MemOperand(x2)),
3857 "ld2r {v16.4h, v17.4h}, [x2]");
3858 COMPARE(Ld2r(v17.V8H(), v18.V8H(), MemOperand(x3)),
3859 "ld2r {v17.8h, v18.8h}, [x3]");
3860 COMPARE(Ld2r(v18.V2S(), v19.V2S(), MemOperand(x4)),
3861 "ld2r {v18.2s, v19.2s}, [x4]");
3862 COMPARE(Ld2r(v19.V4S(), v20.V4S(), MemOperand(x5)),
3863 "ld2r {v19.4s, v20.4s}, [x5]");
3864 COMPARE(Ld2r(v20.V2D(), v21.V2D(), MemOperand(sp)),
3865 "ld2r {v20.2d, v21.2d}, [sp]");
3866 COMPARE(Ld2r(v21.V8B(), v22.V8B(), MemOperand(x6, 2, PostIndex)),
3867 "ld2r {v21.8b, v22.8b}, [x6], #2");
3868 COMPARE(Ld2r(v22.V16B(), v23.V16B(), MemOperand(x7, x16, PostIndex)),
3869 "ld2r {v22.16b, v23.16b}, [x7], x16");
3870 COMPARE(Ld2r(v23.V4H(), v24.V4H(), MemOperand(x8, x17, PostIndex)),
3871 "ld2r {v23.4h, v24.4h}, [x8], x17");
3872 COMPARE(Ld2r(v24.V8H(), v25.V8H(), MemOperand(x9, 4, PostIndex)),
3873 "ld2r {v24.8h, v25.8h}, [x9], #4");
3874 COMPARE(Ld2r(v25.V2S(), v26.V2S(), MemOperand(x10, 8, PostIndex)),
3875 "ld2r {v25.2s, v26.2s}, [x10], #8");
3876 COMPARE(Ld2r(v26.V4S(), v27.V4S(), MemOperand(x11, x18, PostIndex)),
3877 "ld2r {v26.4s, v27.4s}, [x11], x18");
3878 COMPARE(Ld2r(v27.V2D(), v28.V2D(), MemOperand(x12, 16, PostIndex)),
3879 "ld2r {v27.2d, v28.2d}, [x12], #16");
3880
3881 COMPARE(Ld3r(v14.V8B(), v15.V8B(), v16.V8B(),
3882 MemOperand(x0)),
3883 "ld3r {v14.8b, v15.8b, v16.8b}, [x0]");
3884 COMPARE(Ld3r(v15.V16B(), v16.V16B(), v17.V16B(),
3885 MemOperand(x1)),
3886 "ld3r {v15.16b, v16.16b, v17.16b}, [x1]");
3887 COMPARE(Ld3r(v16.V4H(), v17.V4H(), v18.V4H(),
3888 MemOperand(x2)),
3889 "ld3r {v16.4h, v17.4h, v18.4h}, [x2]");
3890 COMPARE(Ld3r(v17.V8H(), v18.V8H(), v19.V8H(),
3891 MemOperand(x3)),
3892 "ld3r {v17.8h, v18.8h, v19.8h}, [x3]");
3893 COMPARE(Ld3r(v18.V2S(), v19.V2S(), v20.V2S(),
3894 MemOperand(x4)),
3895 "ld3r {v18.2s, v19.2s, v20.2s}, [x4]");
3896 COMPARE(Ld3r(v19.V4S(), v20.V4S(), v21.V4S(),
3897 MemOperand(x5)),
3898 "ld3r {v19.4s, v20.4s, v21.4s}, [x5]");
3899 COMPARE(Ld3r(v20.V2D(), v21.V2D(), v22.V2D(),
3900 MemOperand(sp)),
3901 "ld3r {v20.2d, v21.2d, v22.2d}, [sp]");
3902 COMPARE(Ld3r(v21.V8B(), v22.V8B(), v23.V8B(),
3903 MemOperand(x6, 3, PostIndex)),
3904 "ld3r {v21.8b, v22.8b, v23.8b}, [x6], #3");
3905 COMPARE(Ld3r(v22.V16B(), v23.V16B(), v24.V16B(),
3906 MemOperand(x7, x16, PostIndex)),
3907 "ld3r {v22.16b, v23.16b, v24.16b}, [x7], x16");
3908 COMPARE(Ld3r(v23.V4H(), v24.V4H(), v25.V4H(),
3909 MemOperand(x8, x17, PostIndex)),
3910 "ld3r {v23.4h, v24.4h, v25.4h}, [x8], x17");
3911 COMPARE(Ld3r(v24.V8H(), v25.V8H(), v26.V8H(),
3912 MemOperand(x9, 6, PostIndex)),
3913 "ld3r {v24.8h, v25.8h, v26.8h}, [x9], #6");
3914 COMPARE(Ld3r(v25.V2S(), v26.V2S(), v27.V2S(),
3915 MemOperand(x10, 12, PostIndex)),
3916 "ld3r {v25.2s, v26.2s, v27.2s}, [x10], #12");
3917 COMPARE(Ld3r(v26.V4S(), v27.V4S(), v28.V4S(),
3918 MemOperand(x11, x18, PostIndex)),
3919 "ld3r {v26.4s, v27.4s, v28.4s}, [x11], x18");
3920 COMPARE(Ld3r(v27.V2D(), v28.V2D(), v29.V2D(),
3921 MemOperand(x12, 24, PostIndex)),
3922 "ld3r {v27.2d, v28.2d, v29.2d}, [x12], #24");
3923
3924 COMPARE(Ld4r(v14.V8B(), v15.V8B(), v16.V8B(), v17.V8B(),
3925 MemOperand(x0)),
3926 "ld4r {v14.8b, v15.8b, v16.8b, v17.8b}, [x0]");
3927 COMPARE(Ld4r(v15.V16B(), v16.V16B(), v17.V16B(), v18.V16B(),
3928 MemOperand(x1)),
3929 "ld4r {v15.16b, v16.16b, v17.16b, v18.16b}, [x1]");
3930 COMPARE(Ld4r(v16.V4H(), v17.V4H(), v18.V4H(), v19.V4H(),
3931 MemOperand(x2)),
3932 "ld4r {v16.4h, v17.4h, v18.4h, v19.4h}, [x2]");
3933 COMPARE(Ld4r(v17.V8H(), v18.V8H(), v19.V8H(), v20.V8H(),
3934 MemOperand(x3)),
3935 "ld4r {v17.8h, v18.8h, v19.8h, v20.8h}, [x3]");
3936 COMPARE(Ld4r(v18.V2S(), v19.V2S(), v20.V2S(), v21.V2S(),
3937 MemOperand(x4)),
3938 "ld4r {v18.2s, v19.2s, v20.2s, v21.2s}, [x4]");
3939 COMPARE(Ld4r(v19.V4S(), v20.V4S(), v21.V4S(), v22.V4S(),
3940 MemOperand(x5)),
3941 "ld4r {v19.4s, v20.4s, v21.4s, v22.4s}, [x5]");
3942 COMPARE(Ld4r(v20.V2D(), v21.V2D(), v22.V2D(), v23.V2D(),
3943 MemOperand(sp)),
3944 "ld4r {v20.2d, v21.2d, v22.2d, v23.2d}, [sp]");
3945 COMPARE(Ld4r(v21.V8B(), v22.V8B(), v23.V8B(), v24.V8B(),
3946 MemOperand(x6, 4, PostIndex)),
3947 "ld4r {v21.8b, v22.8b, v23.8b, v24.8b}, [x6], #4");
3948 COMPARE(Ld4r(v22.V16B(), v23.V16B(), v24.V16B(), v25.V16B(),
3949 MemOperand(x7, x16, PostIndex)),
3950 "ld4r {v22.16b, v23.16b, v24.16b, v25.16b}, [x7], x16");
3951 COMPARE(Ld4r(v23.V4H(), v24.V4H(), v25.V4H(), v26.V4H(),
3952 MemOperand(x8, x17, PostIndex)),
3953 "ld4r {v23.4h, v24.4h, v25.4h, v26.4h}, [x8], x17");
3954 COMPARE(Ld4r(v24.V8H(), v25.V8H(), v26.V8H(), v27.V8H(),
3955 MemOperand(x9, 8, PostIndex)),
3956 "ld4r {v24.8h, v25.8h, v26.8h, v27.8h}, [x9], #8");
3957 COMPARE(Ld4r(v25.V2S(), v26.V2S(), v27.V2S(), v28.V2S(),
3958 MemOperand(x10, 16, PostIndex)),
3959 "ld4r {v25.2s, v26.2s, v27.2s, v28.2s}, [x10], #16");
3960 COMPARE(Ld4r(v26.V4S(), v27.V4S(), v28.V4S(), v29.V4S(),
3961 MemOperand(x11, x18, PostIndex)),
3962 "ld4r {v26.4s, v27.4s, v28.4s, v29.4s}, [x11], x18");
3963 COMPARE(Ld4r(v27.V2D(), v28.V2D(), v29.V2D(), v30.V2D(),
3964 MemOperand(x12, 32, PostIndex)),
3965 "ld4r {v27.2d, v28.2d, v29.2d, v30.2d}, [x12], #32");
3966
3967 CLEANUP();
3968}
3969
3970
armvixl0f35e362016-05-10 13:57:58 +01003971TEST(neon_load_all_lanes_unallocated) {
3972 SETUP();
3973
3974 const char* expected = "unallocated (NEONLoadStoreSingleStruct)";
3975 // LD1R (single structure) (no offset)
3976 COMPARE(dci(0x0d00c000), expected); // L = 0
3977 COMPARE(dci(0x0d40d000), expected); // S = 1
3978 // LD2R (single structure) (no offset)
3979 COMPARE(dci(0x0d20c000), expected); // L = 0
3980 COMPARE(dci(0x0d60d000), expected); // S = 1
3981 // LD3R (single structure) (no offset)
3982 COMPARE(dci(0x0d00e000), expected); // L = 0
3983 COMPARE(dci(0x0d40f000), expected); // S = 1
3984 // LD4R (single structure) (no offset)
3985 COMPARE(dci(0x0d20e000), expected); // L = 0
3986 COMPARE(dci(0x0d60f000), expected); // S = 1
3987
3988 expected = "unallocated (NEONLoadStoreSingleStructPostIndex)";
3989 // LD1R (single structure) (post index)
3990 COMPARE(dci(0x0d80c000), expected); // L = 0
3991 COMPARE(dci(0x0dc0d000), expected); // S = 1
3992 // LD2R (single structure) (post index)
3993 COMPARE(dci(0x0da0c000), expected); // L = 0
3994 COMPARE(dci(0x0de0d000), expected); // S = 1
3995 // LD3R (single structure) (post index)
3996 COMPARE(dci(0x0d80e000), expected); // L = 0
3997 COMPARE(dci(0x0dc0f000), expected); // S = 1
3998 // LD4R (single structure) (post index)
3999 COMPARE(dci(0x0da0e000), expected); // L = 0
4000 COMPARE(dci(0x0de0f000), expected); // S = 1
4001
4002 CLEANUP();
4003}
4004
4005
armvixl5289c592015-03-02 13:52:04 +00004006TEST(neon_3same) {
armvixl684cd2a2015-10-23 13:38:33 +01004007 SETUP_MACRO();
armvixl5289c592015-03-02 13:52:04 +00004008
4009 #define DISASM_INST(M, S) \
4010 COMPARE(Cmeq(v0.M, v1.M, v2.M), "cmeq v0." S ", v1." S ", v2." S);
4011 NEON_FORMAT_LIST(DISASM_INST)
4012 #undef DISASM_INST
4013
4014 #define DISASM_INST(M, S) \
4015 COMPARE(Cmge(v0.M, v1.M, v2.M), "cmge v0." S ", v1." S ", v2." S);
4016 NEON_FORMAT_LIST(DISASM_INST)
4017 #undef DISASM_INST
4018
4019 #define DISASM_INST(M, S) \
4020 COMPARE(Cmgt(v0.M, v1.M, v2.M), "cmgt v0." S ", v1." S ", v2." S);
4021 NEON_FORMAT_LIST(DISASM_INST)
4022 #undef DISASM_INST
4023
4024 #define DISASM_INST(M, S) \
4025 COMPARE(Cmhi(v0.M, v1.M, v2.M), "cmhi v0." S ", v1." S ", v2." S);
4026 NEON_FORMAT_LIST(DISASM_INST)
4027 #undef DISASM_INST
4028
4029 #define DISASM_INST(M, S) \
4030 COMPARE(Cmhs(v0.M, v1.M, v2.M), "cmhs v0." S ", v1." S ", v2." S);
4031 NEON_FORMAT_LIST(DISASM_INST)
4032 #undef DISASM_INST
4033
4034 #define DISASM_INST(M, S) \
4035 COMPARE(Cmtst(v0.M, v1.M, v2.M), "cmtst v0." S ", v1." S ", v2." S);
4036 NEON_FORMAT_LIST(DISASM_INST)
4037 #undef DISASM_INST
4038
4039 #define DISASM_INST(M, S) \
4040 COMPARE(Add(v0.M, v1.M, v2.M), "add v0." S ", v1." S ", v2." S);
4041 NEON_FORMAT_LIST(DISASM_INST)
4042 #undef DISASM_INST
4043
4044 #define DISASM_INST(M, S) \
4045 COMPARE(Sub(v3.M, v4.M, v5.M), "sub v3." S ", v4." S ", v5." S);
4046 NEON_FORMAT_LIST(DISASM_INST)
4047 #undef DISASM_INST
4048
4049 #define DISASM_INST(M, S) \
4050 COMPARE(Sabd(v3.M, v4.M, v5.M), "sabd v3." S ", v4." S ", v5." S);
4051 NEON_FORMAT_LIST_BHS(DISASM_INST)
4052 #undef DISASM_INST
4053
4054 #define DISASM_INST(M, S) \
4055 COMPARE(Uabd(v3.M, v4.M, v5.M), "uabd v3." S ", v4." S ", v5." S);
4056 NEON_FORMAT_LIST_BHS(DISASM_INST)
4057 #undef DISASM_INST
4058
4059 #define DISASM_INST(M, S) \
4060 COMPARE(Saba(v3.M, v4.M, v5.M), "saba v3." S ", v4." S ", v5." S);
4061 NEON_FORMAT_LIST_BHS(DISASM_INST)
4062 #undef DISASM_INST
4063
4064 #define DISASM_INST(M, S) \
4065 COMPARE(Uaba(v3.M, v4.M, v5.M), "uaba v3." S ", v4." S ", v5." S);
4066 NEON_FORMAT_LIST_BHS(DISASM_INST)
4067 #undef DISASM_INST
4068
4069 #define DISASM_INST(M, S) \
4070 COMPARE(Smax(v3.M, v4.M, v5.M), "smax v3." S ", v4." S ", v5." S);
4071 NEON_FORMAT_LIST_BHS(DISASM_INST)
4072 #undef DISASM_INST
4073
4074 #define DISASM_INST(M, S) \
4075 COMPARE(Smin(v3.M, v4.M, v5.M), "smin v3." S ", v4." S ", v5." S);
4076 NEON_FORMAT_LIST_BHS(DISASM_INST)
4077 #undef DISASM_INST
4078
4079 #define DISASM_INST(M, S) \
4080 COMPARE(Umax(v3.M, v4.M, v5.M), "umax v3." S ", v4." S ", v5." S);
4081 NEON_FORMAT_LIST_BHS(DISASM_INST)
4082 #undef DISASM_INST
4083
4084 #define DISASM_INST(M, S) \
4085 COMPARE(Umin(v3.M, v4.M, v5.M), "umin v3." S ", v4." S ", v5." S);
4086 NEON_FORMAT_LIST_BHS(DISASM_INST)
4087 #undef DISASM_INST
4088
4089 #define DISASM_INST(M, S) \
4090 COMPARE(Smaxp(v3.M, v4.M, v5.M), "smaxp v3." S ", v4." S ", v5." S);
4091 NEON_FORMAT_LIST_BHS(DISASM_INST)
4092 #undef DISASM_INST
4093
4094 #define DISASM_INST(M, S) \
4095 COMPARE(Sminp(v3.M, v4.M, v5.M), "sminp v3." S ", v4." S ", v5." S);
4096 NEON_FORMAT_LIST_BHS(DISASM_INST)
4097 #undef DISASM_INST
4098
4099 #define DISASM_INST(M, S) \
4100 COMPARE(Umaxp(v3.M, v4.M, v5.M), "umaxp v3." S ", v4." S ", v5." S);
4101 NEON_FORMAT_LIST_BHS(DISASM_INST)
4102 #undef DISASM_INST
4103
4104 #define DISASM_INST(M, S) \
4105 COMPARE(Uminp(v3.M, v4.M, v5.M), "uminp v3." S ", v4." S ", v5." S);
4106 NEON_FORMAT_LIST_BHS(DISASM_INST)
4107 #undef DISASM_INST
4108
4109 #define DISASM_INST(M, S) \
4110 COMPARE(Uqadd(v6.M, v7.M, v8.M), "uqadd v6." S ", v7." S ", v8." S);
4111 NEON_FORMAT_LIST(DISASM_INST)
4112 #undef DISASM_INST
4113
4114 #define DISASM_INST(M, S) \
4115 COMPARE(Sqadd(v9.M, v10.M, v11.M), "sqadd v9." S ", v10." S ", v11." S);
4116 NEON_FORMAT_LIST(DISASM_INST)
4117 #undef DISASM_INST
4118
4119 #define DISASM_INST(M, S) \
4120 COMPARE(Uqsub(v6.M, v7.M, v8.M), "uqsub v6." S ", v7." S ", v8." S);
4121 NEON_FORMAT_LIST(DISASM_INST)
4122 #undef DISASM_INST
4123
4124 #define DISASM_INST(M, S) \
4125 COMPARE(Sqsub(v9.M, v10.M, v11.M), "sqsub v9." S ", v10." S ", v11." S);
4126 NEON_FORMAT_LIST(DISASM_INST)
4127 #undef DISASM_INST
4128
4129 #define DISASM_INST(M, S) \
4130 COMPARE(Sshl(v12.M, v13.M, v14.M), "sshl v12." S ", v13." S ", v14." S);
4131 NEON_FORMAT_LIST(DISASM_INST)
4132 #undef DISASM_INST
4133
4134 #define DISASM_INST(M, S) \
4135 COMPARE(Ushl(v15.M, v16.M, v17.M), "ushl v15." S ", v16." S ", v17." S);
4136 NEON_FORMAT_LIST(DISASM_INST)
4137 #undef DISASM_INST
4138
4139 #define DISASM_INST(M, S) \
4140 COMPARE(Sqshl(v18.M, v19.M, v20.M), "sqshl v18." S ", v19." S ", v20." S);
4141 NEON_FORMAT_LIST(DISASM_INST)
4142 #undef DISASM_INST
4143
4144 #define DISASM_INST(M, S) \
4145 COMPARE(Uqshl(v21.M, v22.M, v23.M), "uqshl v21." S ", v22." S ", v23." S);
4146 NEON_FORMAT_LIST(DISASM_INST)
4147 #undef DISASM_INST
4148
4149 #define DISASM_INST(M, S) \
4150 COMPARE(Srshl(v24.M, v25.M, v26.M), "srshl v24." S ", v25." S ", v26." S);
4151 NEON_FORMAT_LIST(DISASM_INST)
4152 #undef DISASM_INST
4153
4154 #define DISASM_INST(M, S) \
4155 COMPARE(Urshl(v27.M, v28.M, v29.M), "urshl v27." S ", v28." S ", v29." S);
4156 NEON_FORMAT_LIST(DISASM_INST)
4157 #undef DISASM_INST
4158
4159 #define DISASM_INST(M, S) \
4160 COMPARE(Sqrshl(v30.M, v31.M, v0.M), "sqrshl v30." S ", v31." S ", v0." S);
4161 NEON_FORMAT_LIST(DISASM_INST)
4162 #undef DISASM_INST
4163
4164 #define DISASM_INST(M, S) \
4165 COMPARE(Uqrshl(v1.M, v2.M, v3.M), "uqrshl v1." S ", v2." S ", v3." S);
4166 NEON_FORMAT_LIST(DISASM_INST)
4167 #undef DISASM_INST
4168
4169 #define DISASM_INST(M, S) \
4170 COMPARE(Shadd(v4.M, v5.M, v6.M), "shadd v4." S ", v5." S ", v6." S);
4171 NEON_FORMAT_LIST_BHS(DISASM_INST)
4172 #undef DISASM_INST
4173
4174 #define DISASM_INST(M, S) \
4175 COMPARE(Uhadd(v7.M, v8.M, v9.M), "uhadd v7." S ", v8." S ", v9." S);
4176 NEON_FORMAT_LIST_BHS(DISASM_INST)
4177 #undef DISASM_INST
4178
4179 #define DISASM_INST(M, S) \
4180 COMPARE(Srhadd(v10.M, v11.M, v12.M), "srhadd v10." S ", v11." S ", v12." S);
4181 NEON_FORMAT_LIST_BHS(DISASM_INST)
4182 #undef DISASM_INST
4183
4184 #define DISASM_INST(M, S) \
4185 COMPARE(Urhadd(v13.M, v14.M, v15.M), "urhadd v13." S ", v14." S ", v15." S);
4186 NEON_FORMAT_LIST_BHS(DISASM_INST)
4187 #undef DISASM_INST
4188
4189 #define DISASM_INST(M, S) \
4190 COMPARE(Shsub(v16.M, v17.M, v18.M), "shsub v16." S ", v17." S ", v18." S);
4191 NEON_FORMAT_LIST_BHS(DISASM_INST)
4192 #undef DISASM_INST
4193
4194 #define DISASM_INST(M, S) \
4195 COMPARE(Uhsub(v19.M, v20.M, v21.M), "uhsub v19." S ", v20." S ", v21." S);
4196 NEON_FORMAT_LIST_BHS(DISASM_INST)
4197 #undef DISASM_INST
4198
4199 #define DISASM_INST(M, S) \
4200 COMPARE(Addp(v19.M, v20.M, v21.M), "addp v19." S ", v20." S ", v21." S);
4201 NEON_FORMAT_LIST(DISASM_INST)
4202 #undef DISASM_INST
4203
4204 #define DISASM_INST(M, S) \
4205 COMPARE(Mla(v19.M, v20.M, v21.M), "mla v19." S ", v20." S ", v21." S);
4206 NEON_FORMAT_LIST_BHS(DISASM_INST)
4207 #undef DISASM_INST
4208
4209 #define DISASM_INST(M, S) \
4210 COMPARE(Mls(v19.M, v20.M, v21.M), "mls v19." S ", v20." S ", v21." S);
4211 NEON_FORMAT_LIST_BHS(DISASM_INST)
4212 #undef DISASM_INST
4213
4214 #define DISASM_INST(M, S) \
4215 COMPARE(Mul(v19.M, v20.M, v21.M), "mul v19." S ", v20." S ", v21." S);
4216 NEON_FORMAT_LIST_BHS(DISASM_INST)
4217 #undef DISASM_INST
4218
4219 #define DISASM_INST(M, S) \
4220 COMPARE(Sqdmulh(v1.M, v2.M, v3.M), "sqdmulh v1." S ", v2." S ", v3." S);
4221 NEON_FORMAT_LIST_HS(DISASM_INST)
4222 #undef DISASM_INST
4223
4224 #define DISASM_INST(M, S) \
4225 COMPARE(Sqrdmulh(v1.M, v2.M, v3.M), "sqrdmulh v1." S ", v2." S ", v3." S);
4226 NEON_FORMAT_LIST_HS(DISASM_INST)
4227 #undef DISASM_INST
4228
4229 COMPARE(And(v6.V8B(), v7.V8B(), v8.V8B()), "and v6.8b, v7.8b, v8.8b");
4230 COMPARE(And(v6.V16B(), v7.V16B(), v8.V16B()), "and v6.16b, v7.16b, v8.16b");
4231
4232 COMPARE(Bic(v6.V8B(), v7.V8B(), v8.V8B()), "bic v6.8b, v7.8b, v8.8b");
4233 COMPARE(Bic(v6.V16B(), v7.V16B(), v8.V16B()), "bic v6.16b, v7.16b, v8.16b");
4234
4235 COMPARE(Orr(v6.V8B(), v7.V8B(), v8.V8B()), "orr v6.8b, v7.8b, v8.8b");
4236 COMPARE(Orr(v6.V16B(), v7.V16B(), v8.V16B()), "orr v6.16b, v7.16b, v8.16b");
4237
4238 COMPARE(Orr(v6.V8B(), v7.V8B(), v7.V8B()), "mov v6.8b, v7.8b");
4239 COMPARE(Orr(v6.V16B(), v7.V16B(), v7.V16B()), "mov v6.16b, v7.16b");
4240
4241 COMPARE(Mov(v6.V8B(), v8.V8B()), "mov v6.8b, v8.8b");
4242 COMPARE(Mov(v6.V16B(), v8.V16B()), "mov v6.16b, v8.16b");
4243
4244 COMPARE(Orn(v6.V8B(), v7.V8B(), v8.V8B()), "orn v6.8b, v7.8b, v8.8b");
4245 COMPARE(Orn(v6.V16B(), v7.V16B(), v8.V16B()), "orn v6.16b, v7.16b, v8.16b");
4246
4247 COMPARE(Eor(v6.V8B(), v7.V8B(), v8.V8B()), "eor v6.8b, v7.8b, v8.8b");
4248 COMPARE(Eor(v6.V16B(), v7.V16B(), v8.V16B()), "eor v6.16b, v7.16b, v8.16b");
4249
4250 COMPARE(Bif(v6.V8B(), v7.V8B(), v8.V8B()), "bif v6.8b, v7.8b, v8.8b");
4251 COMPARE(Bif(v6.V16B(), v7.V16B(), v8.V16B()), "bif v6.16b, v7.16b, v8.16b");
4252
4253 COMPARE(Bit(v6.V8B(), v7.V8B(), v8.V8B()), "bit v6.8b, v7.8b, v8.8b");
4254 COMPARE(Bit(v6.V16B(), v7.V16B(), v8.V16B()), "bit v6.16b, v7.16b, v8.16b");
4255
4256 COMPARE(Bsl(v6.V8B(), v7.V8B(), v8.V8B()), "bsl v6.8b, v7.8b, v8.8b");
4257 COMPARE(Bsl(v6.V16B(), v7.V16B(), v8.V16B()), "bsl v6.16b, v7.16b, v8.16b");
4258
4259 COMPARE(Pmul(v6.V8B(), v7.V8B(), v8.V8B()), "pmul v6.8b, v7.8b, v8.8b");
4260 COMPARE(Pmul(v6.V16B(), v7.V16B(), v8.V16B()), "pmul v6.16b, v7.16b, v8.16b");
4261
4262 CLEANUP();
4263}
4264
4265
4266#define NEON_FORMAT_LIST_FP(V) \
4267 V(V2S(), "2s") \
4268 V(V4S(), "4s") \
4269 V(V2D(), "2d")
4270
4271TEST(neon_fp_3same) {
armvixl684cd2a2015-10-23 13:38:33 +01004272 SETUP_MACRO();
armvixl5289c592015-03-02 13:52:04 +00004273
4274 #define DISASM_INST(M, S) \
4275 COMPARE(Fadd(v0.M, v1.M, v2.M), "fadd v0." S ", v1." S ", v2." S);
4276 NEON_FORMAT_LIST_FP(DISASM_INST)
4277 #undef DISASM_INST
4278
4279 #define DISASM_INST(M, S) \
4280 COMPARE(Fsub(v3.M, v4.M, v5.M), "fsub v3." S ", v4." S ", v5." S);
4281 NEON_FORMAT_LIST_FP(DISASM_INST)
4282 #undef DISASM_INST
4283
4284 #define DISASM_INST(M, S) \
4285 COMPARE(Fmul(v6.M, v7.M, v8.M), "fmul v6." S ", v7." S ", v8." S);
4286 NEON_FORMAT_LIST_FP(DISASM_INST)
4287 #undef DISASM_INST
4288
4289 #define DISASM_INST(M, S) \
4290 COMPARE(Fdiv(v9.M, v10.M, v11.M), "fdiv v9." S ", v10." S ", v11." S);
4291 NEON_FORMAT_LIST_FP(DISASM_INST)
4292 #undef DISASM_INST
4293
4294 #define DISASM_INST(M, S) \
4295 COMPARE(Fmin(v12.M, v13.M, v14.M), "fmin v12." S ", v13." S ", v14." S);
4296 NEON_FORMAT_LIST_FP(DISASM_INST)
4297 #undef DISASM_INST
4298
4299 #define DISASM_INST(M, S) \
4300 COMPARE(Fminnm(v15.M, v16.M, v17.M), "fminnm v15." S ", v16." S ", v17." S);
4301 NEON_FORMAT_LIST_FP(DISASM_INST)
4302 #undef DISASM_INST
4303
4304 #define DISASM_INST(M, S) \
4305 COMPARE(Fmax(v18.M, v19.M, v20.M), "fmax v18." S ", v19." S ", v20." S);
4306 NEON_FORMAT_LIST_FP(DISASM_INST)
4307 #undef DISASM_INST
4308
4309 #define DISASM_INST(M, S) \
4310 COMPARE(Fmaxnm(v21.M, v22.M, v23.M), "fmaxnm v21." S ", v22." S ", v23." S);
4311 NEON_FORMAT_LIST_FP(DISASM_INST)
4312 #undef DISASM_INST
4313
4314 #define DISASM_INST(M, S) \
4315 COMPARE(Frecps(v24.M, v25.M, v26.M), "frecps v24." S ", v25." S ", v26." S);
4316 NEON_FORMAT_LIST_FP(DISASM_INST)
4317 #undef DISASM_INST
4318
4319 #define DISASM_INST(M, S) \
4320 COMPARE(Frsqrts(v27.M, v28.M, v29.M), "frsqrts v27." S ", v28." S ", v29." S);
4321 NEON_FORMAT_LIST_FP(DISASM_INST)
4322 #undef DISASM_INST
4323
4324 #define DISASM_INST(M, S) \
4325 COMPARE(Fmulx(v30.M, v31.M, v0.M), "fmulx v30." S ", v31." S ", v0." S);
4326 NEON_FORMAT_LIST_FP(DISASM_INST)
4327 #undef DISASM_INST
4328
4329 #define DISASM_INST(M, S) \
4330 COMPARE(Fmla(v1.M, v2.M, v3.M), "fmla v1." S ", v2." S ", v3." S);
4331 NEON_FORMAT_LIST_FP(DISASM_INST)
4332 #undef DISASM_INST
4333
4334 #define DISASM_INST(M, S) \
4335 COMPARE(Fmls(v4.M, v5.M, v6.M), "fmls v4." S ", v5." S ", v6." S);
4336 NEON_FORMAT_LIST_FP(DISASM_INST)
4337 #undef DISASM_INST
4338
4339 #define DISASM_INST(M, S) \
4340 COMPARE(Fabd(v7.M, v8.M, v9.M), "fabd v7." S ", v8." S ", v9." S);
4341 NEON_FORMAT_LIST_FP(DISASM_INST)
4342 #undef DISASM_INST
4343
4344 #define DISASM_INST(M, S) \
4345 COMPARE(Faddp(v10.M, v11.M, v12.M), "faddp v10." S ", v11." S ", v12." S);
4346 NEON_FORMAT_LIST_FP(DISASM_INST)
4347 #undef DISASM_INST
4348
4349 #define DISASM_INST(M, S) \
4350 COMPARE(Fmaxp(v13.M, v14.M, v15.M), "fmaxp v13." S ", v14." S ", v15." S);
4351 NEON_FORMAT_LIST_FP(DISASM_INST)
4352 #undef DISASM_INST
4353
4354 #define DISASM_INST(M, S) \
4355 COMPARE(Fminp(v16.M, v17.M, v18.M), "fminp v16." S ", v17." S ", v18." S);
4356 NEON_FORMAT_LIST_FP(DISASM_INST)
4357 #undef DISASM_INST
4358
4359 #define DISASM_INST(M, S) \
4360 COMPARE(Fmaxnmp(v19.M, v20.M, v21.M), "fmaxnmp v19." S ", v20." S ", v21." S);
4361 NEON_FORMAT_LIST_FP(DISASM_INST)
4362 #undef DISASM_INST
4363
4364 #define DISASM_INST(M, S) \
4365 COMPARE(Fminnmp(v22.M, v23.M, v24.M), "fminnmp v22." S ", v23." S ", v24." S);
4366 NEON_FORMAT_LIST_FP(DISASM_INST)
4367 #undef DISASM_INST
4368
4369 #define DISASM_INST(M, S) \
4370 COMPARE(Fcmeq(v25.M, v26.M, v27.M), "fcmeq v25." S ", v26." S ", v27." S);
4371 NEON_FORMAT_LIST_FP(DISASM_INST)
4372 #undef DISASM_INST
4373
4374 #define DISASM_INST(M, S) \
4375 COMPARE(Fcmge(v25.M, v26.M, v27.M), "fcmge v25." S ", v26." S ", v27." S);
4376 NEON_FORMAT_LIST_FP(DISASM_INST)
4377 #undef DISASM_INST
4378
4379 #define DISASM_INST(M, S) \
4380 COMPARE(Fcmgt(v25.M, v26.M, v27.M), "fcmgt v25." S ", v26." S ", v27." S);
4381 NEON_FORMAT_LIST_FP(DISASM_INST)
4382 #undef DISASM_INST
4383
4384 #define DISASM_INST(M, S) \
4385 COMPARE(Facge(v25.M, v26.M, v27.M), "facge v25." S ", v26." S ", v27." S);
4386 NEON_FORMAT_LIST_FP(DISASM_INST)
4387 #undef DISASM_INST
4388
4389 #define DISASM_INST(M, S) \
4390 COMPARE(Facgt(v25.M, v26.M, v27.M), "facgt v25." S ", v26." S ", v27." S);
4391 NEON_FORMAT_LIST_FP(DISASM_INST)
4392 #undef DISASM_INST
4393
4394 CLEANUP();
4395}
4396
4397
4398#define NEON_SCALAR_FORMAT_LIST(V) \
4399 V(B(), "b") \
4400 V(H(), "h") \
4401 V(S(), "s") \
4402 V(D(), "d")
4403
4404TEST(neon_scalar_3same) {
armvixl684cd2a2015-10-23 13:38:33 +01004405 SETUP_MACRO();
armvixl5289c592015-03-02 13:52:04 +00004406
4407 // Instructions that only support D-sized scalar operations.
4408 COMPARE(Add(v0.D(), v1.D(), v2.D()), "add d0, d1, d2");
4409 COMPARE(Sub(v3.D(), v4.D(), v5.D()), "sub d3, d4, d5");
4410 COMPARE(Cmeq(v0.D(), v1.D(), v2.D()), "cmeq d0, d1, d2");
4411 COMPARE(Cmge(v3.D(), v4.D(), v5.D()), "cmge d3, d4, d5");
4412 COMPARE(Cmgt(v6.D(), v7.D(), v8.D()), "cmgt d6, d7, d8");
4413 COMPARE(Cmhi(v0.D(), v1.D(), v2.D()), "cmhi d0, d1, d2");
4414 COMPARE(Cmhs(v3.D(), v4.D(), v5.D()), "cmhs d3, d4, d5");
4415 COMPARE(Cmtst(v6.D(), v7.D(), v8.D()), "cmtst d6, d7, d8");
4416 COMPARE(Ushl(v6.D(), v7.D(), v8.D()), "ushl d6, d7, d8");
4417 COMPARE(Sshl(v6.D(), v7.D(), v8.D()), "sshl d6, d7, d8");
4418 COMPARE(Urshl(v9.D(), v10.D(), v11.D()), "urshl d9, d10, d11");
4419 COMPARE(Srshl(v9.D(), v10.D(), v11.D()), "srshl d9, d10, d11");
4420
4421 // Instructions that support S and D-sized scalar operations.
4422 COMPARE(Frecps(v12.S(), v13.S(), v14.S()), "frecps s12, s13, s14");
4423 COMPARE(Frecps(v15.D(), v16.D(), v17.D()), "frecps d15, d16, d17");
4424 COMPARE(Frsqrts(v18.S(), v19.S(), v20.S()), "frsqrts s18, s19, s20");
4425 COMPARE(Frsqrts(v21.D(), v22.D(), v23.D()), "frsqrts d21, d22, d23");
4426 COMPARE(Fmulx(v12.S(), v13.S(), v14.S()), "fmulx s12, s13, s14");
4427 COMPARE(Fmulx(v15.D(), v16.D(), v17.D()), "fmulx d15, d16, d17");
4428 COMPARE(Fcmeq(v12.S(), v13.S(), v14.S()), "fcmeq s12, s13, s14");
4429 COMPARE(Fcmeq(v15.D(), v16.D(), v17.D()), "fcmeq d15, d16, d17");
4430 COMPARE(Fcmge(v12.S(), v13.S(), v14.S()), "fcmge s12, s13, s14");
4431 COMPARE(Fcmge(v15.D(), v16.D(), v17.D()), "fcmge d15, d16, d17");
4432 COMPARE(Fcmgt(v12.S(), v13.S(), v14.S()), "fcmgt s12, s13, s14");
4433 COMPARE(Fcmgt(v15.D(), v16.D(), v17.D()), "fcmgt d15, d16, d17");
4434 COMPARE(Fcmge(v12.S(), v13.S(), v14.S()), "fcmge s12, s13, s14");
4435 COMPARE(Fcmge(v15.D(), v16.D(), v17.D()), "fcmge d15, d16, d17");
4436 COMPARE(Facgt(v12.S(), v13.S(), v14.S()), "facgt s12, s13, s14");
4437 COMPARE(Facgt(v15.D(), v16.D(), v17.D()), "facgt d15, d16, d17");
4438
4439 // Instructions that support H and S-sized scalar operations.
4440 COMPARE(Sqdmulh(v12.S(), v13.S(), v14.S()), "sqdmulh s12, s13, s14");
4441 COMPARE(Sqdmulh(v15.H(), v16.H(), v17.H()), "sqdmulh h15, h16, h17");
4442 COMPARE(Sqrdmulh(v12.S(), v13.S(), v14.S()), "sqrdmulh s12, s13, s14");
4443 COMPARE(Sqrdmulh(v15.H(), v16.H(), v17.H()), "sqrdmulh h15, h16, h17");
4444
4445 #define DISASM_INST(M, R) \
4446 COMPARE(Uqadd(v6.M, v7.M, v8.M), "uqadd " R "6, " R "7, " R "8");
4447 NEON_SCALAR_FORMAT_LIST(DISASM_INST)
4448 #undef DISASM_INST
4449
4450 #define DISASM_INST(M, R) \
4451 COMPARE(Uqsub(v9.M, v10.M, v11.M), "uqsub " R "9, " R "10, " R "11");
4452 NEON_SCALAR_FORMAT_LIST(DISASM_INST)
4453 #undef DISASM_INST
4454
4455 #define DISASM_INST(M, R) \
4456 COMPARE(Sqadd(v12.M, v13.M, v14.M), "sqadd " R "12, " R "13, " R "14");
4457 NEON_SCALAR_FORMAT_LIST(DISASM_INST)
4458 #undef DISASM_INST
4459
4460 #define DISASM_INST(M, R) \
4461 COMPARE(Sqsub(v15.M, v16.M, v17.M), "sqsub " R "15, " R "16, " R "17");
4462 NEON_SCALAR_FORMAT_LIST(DISASM_INST)
4463 #undef DISASM_INST
4464
4465 #define DISASM_INST(M, R) \
4466 COMPARE(Uqshl(v18.M, v19.M, v20.M), "uqshl " R "18, " R "19, " R "20");
4467 NEON_SCALAR_FORMAT_LIST(DISASM_INST)
4468 #undef DISASM_INST
4469
4470 #define DISASM_INST(M, R) \
4471 COMPARE(Sqshl(v21.M, v22.M, v23.M), "sqshl " R "21, " R "22, " R "23");
4472 NEON_SCALAR_FORMAT_LIST(DISASM_INST)
4473 #undef DISASM_INST
4474
4475 #define DISASM_INST(M, R) \
4476 COMPARE(Uqrshl(v30.M, v31.M, v0.M), "uqrshl " R "30, " R "31, " R "0");
4477 NEON_SCALAR_FORMAT_LIST(DISASM_INST)
4478 #undef DISASM_INST
4479
4480 #define DISASM_INST(M, R) \
4481 COMPARE(Sqrshl(v1.M, v2.M, v3.M), "sqrshl " R "1, " R "2, " R "3");
4482 NEON_SCALAR_FORMAT_LIST(DISASM_INST)
4483 #undef DISASM_INST
4484
4485 CLEANUP();
4486}
4487
4488
4489TEST(neon_byelement) {
armvixl684cd2a2015-10-23 13:38:33 +01004490 SETUP_MACRO();
armvixl5289c592015-03-02 13:52:04 +00004491
4492 COMPARE(Mul(v0.V4H(), v1.V4H(), v2.H(), 0), "mul v0.4h, v1.4h, v2.h[0]");
4493 COMPARE(Mul(v2.V8H(), v3.V8H(), v15.H(), 7), "mul v2.8h, v3.8h, v15.h[7]");
4494 COMPARE(Mul(v0.V2S(), v1.V2S(), v2.S(), 0), "mul v0.2s, v1.2s, v2.s[0]");
4495 COMPARE(Mul(v2.V4S(), v3.V4S(), v15.S(), 3), "mul v2.4s, v3.4s, v15.s[3]");
4496
4497 COMPARE(Mla(v0.V4H(), v1.V4H(), v2.H(), 0), "mla v0.4h, v1.4h, v2.h[0]");
4498 COMPARE(Mla(v2.V8H(), v3.V8H(), v15.H(), 7), "mla v2.8h, v3.8h, v15.h[7]");
4499 COMPARE(Mla(v0.V2S(), v1.V2S(), v2.S(), 0), "mla v0.2s, v1.2s, v2.s[0]");
4500 COMPARE(Mla(v2.V4S(), v3.V4S(), v15.S(), 3), "mla v2.4s, v3.4s, v15.s[3]");
4501
4502 COMPARE(Mls(v0.V4H(), v1.V4H(), v2.H(), 0), "mls v0.4h, v1.4h, v2.h[0]");
4503 COMPARE(Mls(v2.V8H(), v3.V8H(), v15.H(), 7), "mls v2.8h, v3.8h, v15.h[7]");
4504 COMPARE(Mls(v0.V2S(), v1.V2S(), v2.S(), 0), "mls v0.2s, v1.2s, v2.s[0]");
4505 COMPARE(Mls(v2.V4S(), v3.V4S(), v15.S(), 3), "mls v2.4s, v3.4s, v15.s[3]");
4506
4507 COMPARE(Sqdmulh(v0.V4H(), v1.V4H(), v2.H(), 0),
4508 "sqdmulh v0.4h, v1.4h, v2.h[0]");
4509 COMPARE(Sqdmulh(v2.V8H(), v3.V8H(), v15.H(), 7),
4510 "sqdmulh v2.8h, v3.8h, v15.h[7]");
4511 COMPARE(Sqdmulh(v0.V2S(), v1.V2S(), v2.S(), 0),
4512 "sqdmulh v0.2s, v1.2s, v2.s[0]");
4513 COMPARE(Sqdmulh(v2.V4S(), v3.V4S(), v15.S(), 3),
4514 "sqdmulh v2.4s, v3.4s, v15.s[3]");
4515 COMPARE(Sqdmulh(h0, h1, v2.H(), 0), "sqdmulh h0, h1, v2.h[0]");
4516 COMPARE(Sqdmulh(s0, s1, v2.S(), 0), "sqdmulh s0, s1, v2.s[0]");
4517
4518 COMPARE(Sqrdmulh(v0.V4H(), v1.V4H(), v2.H(), 0),
4519 "sqrdmulh v0.4h, v1.4h, v2.h[0]");
4520 COMPARE(Sqrdmulh(v2.V8H(), v3.V8H(), v15.H(), 7),
4521 "sqrdmulh v2.8h, v3.8h, v15.h[7]");
4522 COMPARE(Sqrdmulh(v0.V2S(), v1.V2S(), v2.S(), 0),
4523 "sqrdmulh v0.2s, v1.2s, v2.s[0]");
4524 COMPARE(Sqrdmulh(v2.V4S(), v3.V4S(), v15.S(), 3),
4525 "sqrdmulh v2.4s, v3.4s, v15.s[3]");
4526 COMPARE(Sqrdmulh(h0, h1, v2.H(), 0), "sqrdmulh h0, h1, v2.h[0]");
4527 COMPARE(Sqrdmulh(s0, s1, v2.S(), 0), "sqrdmulh s0, s1, v2.s[0]");
4528
4529 COMPARE(Smull(v0.V4S(), v1.V4H(), v2.H(), 0), "smull v0.4s, v1.4h, v2.h[0]");
4530 COMPARE(Smull2(v2.V4S(), v3.V8H(), v4.H(), 7),
4531 "smull2 v2.4s, v3.8h, v4.h[7]");
4532 COMPARE(Smull(v0.V2D(), v1.V2S(), v2.S(), 0), "smull v0.2d, v1.2s, v2.s[0]");
4533 COMPARE(Smull2(v2.V2D(), v3.V4S(), v4.S(), 3),
4534 "smull2 v2.2d, v3.4s, v4.s[3]");
4535
4536 COMPARE(Umull(v0.V4S(), v1.V4H(), v2.H(), 0), "umull v0.4s, v1.4h, v2.h[0]");
4537 COMPARE(Umull2(v2.V4S(), v3.V8H(), v4.H(), 7),
4538 "umull2 v2.4s, v3.8h, v4.h[7]");
4539 COMPARE(Umull(v0.V2D(), v1.V2S(), v2.S(), 0), "umull v0.2d, v1.2s, v2.s[0]");
4540 COMPARE(Umull2(v2.V2D(), v3.V4S(), v4.S(), 3),
4541 "umull2 v2.2d, v3.4s, v4.s[3]");
4542
4543 COMPARE(Smlal(v0.V4S(), v1.V4H(), v2.H(), 0), "smlal v0.4s, v1.4h, v2.h[0]");
4544 COMPARE(Smlal2(v2.V4S(), v3.V8H(), v4.H(), 7),
4545 "smlal2 v2.4s, v3.8h, v4.h[7]");
4546 COMPARE(Smlal(v0.V2D(), v1.V2S(), v2.S(), 0), "smlal v0.2d, v1.2s, v2.s[0]");
4547 COMPARE(Smlal2(v2.V2D(), v3.V4S(), v4.S(), 3),
4548 "smlal2 v2.2d, v3.4s, v4.s[3]");
4549
4550 COMPARE(Umlal(v0.V4S(), v1.V4H(), v2.H(), 0), "umlal v0.4s, v1.4h, v2.h[0]");
4551 COMPARE(Umlal2(v2.V4S(), v3.V8H(), v4.H(), 7),
4552 "umlal2 v2.4s, v3.8h, v4.h[7]");
4553 COMPARE(Umlal(v0.V2D(), v1.V2S(), v2.S(), 0), "umlal v0.2d, v1.2s, v2.s[0]");
4554 COMPARE(Umlal2(v2.V2D(), v3.V4S(), v4.S(), 3),
4555 "umlal2 v2.2d, v3.4s, v4.s[3]");
4556
4557 COMPARE(Smlsl(v0.V4S(), v1.V4H(), v2.H(), 0), "smlsl v0.4s, v1.4h, v2.h[0]");
4558 COMPARE(Smlsl2(v2.V4S(), v3.V8H(), v4.H(), 7),
4559 "smlsl2 v2.4s, v3.8h, v4.h[7]");
4560 COMPARE(Smlsl(v0.V2D(), v1.V2S(), v2.S(), 0), "smlsl v0.2d, v1.2s, v2.s[0]");
4561 COMPARE(Smlsl2(v2.V2D(), v3.V4S(), v4.S(), 3),
4562 "smlsl2 v2.2d, v3.4s, v4.s[3]");
4563
4564 COMPARE(Umlsl(v0.V4S(), v1.V4H(), v2.H(), 0), "umlsl v0.4s, v1.4h, v2.h[0]");
4565 COMPARE(Umlsl2(v2.V4S(), v3.V8H(), v4.H(), 7),
4566 "umlsl2 v2.4s, v3.8h, v4.h[7]");
4567 COMPARE(Umlsl(v0.V2D(), v1.V2S(), v2.S(), 0), "umlsl v0.2d, v1.2s, v2.s[0]");
4568 COMPARE(Umlsl2(v2.V2D(), v3.V4S(), v4.S(), 3),
4569 "umlsl2 v2.2d, v3.4s, v4.s[3]");
4570
4571 COMPARE(Sqdmull(v0.V4S(), v1.V4H(), v2.H(), 0),
4572 "sqdmull v0.4s, v1.4h, v2.h[0]");
4573 COMPARE(Sqdmull2(v2.V4S(), v3.V8H(), v4.H(), 7),
4574 "sqdmull2 v2.4s, v3.8h, v4.h[7]");
4575 COMPARE(Sqdmull(v0.V2D(), v1.V2S(), v2.S(), 0),
4576 "sqdmull v0.2d, v1.2s, v2.s[0]");
4577 COMPARE(Sqdmull2(v2.V2D(), v3.V4S(), v4.S(), 3),
4578 "sqdmull2 v2.2d, v3.4s, v4.s[3]");
4579 COMPARE(Sqdmull(s0, h1, v2.H(), 0), "sqdmull s0, h1, v2.h[0]");
4580 COMPARE(Sqdmull(d0, s1, v2.S(), 0), "sqdmull d0, s1, v2.s[0]");
4581
4582 COMPARE(Sqdmlal(v0.V4S(), v1.V4H(), v2.H(), 0),
4583 "sqdmlal v0.4s, v1.4h, v2.h[0]");
4584 COMPARE(Sqdmlal2(v2.V4S(), v3.V8H(), v4.H(), 7),
4585 "sqdmlal2 v2.4s, v3.8h, v4.h[7]");
4586 COMPARE(Sqdmlal(v0.V2D(), v1.V2S(), v2.S(), 0),
4587 "sqdmlal v0.2d, v1.2s, v2.s[0]");
4588 COMPARE(Sqdmlal2(v2.V2D(), v3.V4S(), v4.S(), 3),
4589 "sqdmlal2 v2.2d, v3.4s, v4.s[3]");
4590 COMPARE(Sqdmlal(s0, h1, v2.H(), 0), "sqdmlal s0, h1, v2.h[0]");
4591 COMPARE(Sqdmlal(d0, s1, v2.S(), 0), "sqdmlal d0, s1, v2.s[0]");
4592
4593 COMPARE(Sqdmlsl(v0.V4S(), v1.V4H(), v2.H(), 0),
4594 "sqdmlsl v0.4s, v1.4h, v2.h[0]");
4595 COMPARE(Sqdmlsl2(v2.V4S(), v3.V8H(), v4.H(), 7),
4596 "sqdmlsl2 v2.4s, v3.8h, v4.h[7]");
4597 COMPARE(Sqdmlsl(v0.V2D(), v1.V2S(), v2.S(), 0),
4598 "sqdmlsl v0.2d, v1.2s, v2.s[0]");
4599 COMPARE(Sqdmlsl2(v2.V2D(), v3.V4S(), v4.S(), 3),
4600 "sqdmlsl2 v2.2d, v3.4s, v4.s[3]");
4601 COMPARE(Sqdmlsl(s0, h1, v2.H(), 0), "sqdmlsl s0, h1, v2.h[0]");
4602 COMPARE(Sqdmlsl(d0, s1, v2.S(), 0), "sqdmlsl d0, s1, v2.s[0]");
4603
4604 CLEANUP();
4605}
4606
4607
4608TEST(neon_fp_byelement) {
armvixl684cd2a2015-10-23 13:38:33 +01004609 SETUP_MACRO();
armvixl5289c592015-03-02 13:52:04 +00004610
4611 COMPARE(Fmul(v0.V2S(), v1.V2S(), v2.S(), 0), "fmul v0.2s, v1.2s, v2.s[0]");
4612 COMPARE(Fmul(v2.V4S(), v3.V4S(), v15.S(), 3), "fmul v2.4s, v3.4s, v15.s[3]");
4613 COMPARE(Fmul(v0.V2D(), v1.V2D(), v2.D(), 0), "fmul v0.2d, v1.2d, v2.d[0]");
4614 COMPARE(Fmul(d0, d1, v2.D(), 0), "fmul d0, d1, v2.d[0]");
4615 COMPARE(Fmul(s0, s1, v2.S(), 0), "fmul s0, s1, v2.s[0]");
4616
4617 COMPARE(Fmla(v0.V2S(), v1.V2S(), v2.S(), 0), "fmla v0.2s, v1.2s, v2.s[0]");
4618 COMPARE(Fmla(v2.V4S(), v3.V4S(), v15.S(), 3), "fmla v2.4s, v3.4s, v15.s[3]");
4619 COMPARE(Fmla(v0.V2D(), v1.V2D(), v2.D(), 0), "fmla v0.2d, v1.2d, v2.d[0]");
4620 COMPARE(Fmla(d0, d1, v2.D(), 0), "fmla d0, d1, v2.d[0]");
4621 COMPARE(Fmla(s0, s1, v2.S(), 0), "fmla s0, s1, v2.s[0]");
4622
4623 COMPARE(Fmls(v0.V2S(), v1.V2S(), v2.S(), 0), "fmls v0.2s, v1.2s, v2.s[0]");
4624 COMPARE(Fmls(v2.V4S(), v3.V4S(), v15.S(), 3), "fmls v2.4s, v3.4s, v15.s[3]");
4625 COMPARE(Fmls(v0.V2D(), v1.V2D(), v2.D(), 0), "fmls v0.2d, v1.2d, v2.d[0]");
4626 COMPARE(Fmls(d0, d1, v2.D(), 0), "fmls d0, d1, v2.d[0]");
4627 COMPARE(Fmls(s0, s1, v2.S(), 0), "fmls s0, s1, v2.s[0]");
4628
4629 COMPARE(Fmulx(v0.V2S(), v1.V2S(), v2.S(), 0), "fmulx v0.2s, v1.2s, v2.s[0]");
4630 COMPARE(Fmulx(v2.V4S(), v3.V4S(), v8.S(), 3), "fmulx v2.4s, v3.4s, v8.s[3]");
4631 COMPARE(Fmulx(v0.V2D(), v1.V2D(), v2.D(), 0), "fmulx v0.2d, v1.2d, v2.d[0]");
4632 COMPARE(Fmulx(d0, d1, v2.D(), 0), "fmulx d0, d1, v2.d[0]");
4633 COMPARE(Fmulx(s0, s1, v2.S(), 0), "fmulx s0, s1, v2.s[0]");
4634
4635 CLEANUP();
4636}
4637
4638
4639TEST(neon_3different) {
armvixl684cd2a2015-10-23 13:38:33 +01004640 SETUP_MACRO();
armvixl5289c592015-03-02 13:52:04 +00004641
4642 #define DISASM_INST(TA, TAS, TB, TBS) \
4643 COMPARE(Uaddl(v0.TA, v1.TB, v2.TB), "uaddl v0." TAS ", v1." TBS ", v2." TBS);
4644 NEON_FORMAT_LIST_LW(DISASM_INST)
4645 #undef DISASM_INST
4646
4647 #define DISASM_INST(TA, TAS, TB, TBS) \
4648 COMPARE(Uaddl2(v0.TA, v1.TB, v2.TB), \
4649 "uaddl2 v0." TAS ", v1." TBS ", v2." TBS);
4650 NEON_FORMAT_LIST_LW2(DISASM_INST)
4651 #undef DISASM_INST
4652
4653 #define DISASM_INST(TA, TAS, TB, TBS) \
4654 COMPARE(Uaddw(v0.TA, v1.TA, v2.TB), "uaddw v0." TAS ", v1." TAS ", v2." TBS);
4655 NEON_FORMAT_LIST_LW(DISASM_INST)
4656 #undef DISASM_INST
4657
4658 #define DISASM_INST(TA, TAS, TB, TBS) \
4659 COMPARE(Uaddw2(v0.TA, v1.TA, v2.TB), \
4660 "uaddw2 v0." TAS ", v1." TAS ", v2." TBS);
4661 NEON_FORMAT_LIST_LW2(DISASM_INST)
4662 #undef DISASM_INST
4663
4664 #define DISASM_INST(TA, TAS, TB, TBS) \
4665 COMPARE(Saddl(v0.TA, v1.TB, v2.TB), "saddl v0." TAS ", v1." TBS ", v2." TBS);
4666 NEON_FORMAT_LIST_LW(DISASM_INST)
4667 #undef DISASM_INST
4668
4669 #define DISASM_INST(TA, TAS, TB, TBS) \
4670 COMPARE(Saddl2(v0.TA, v1.TB, v2.TB), \
4671 "saddl2 v0." TAS ", v1." TBS ", v2." TBS);
4672 NEON_FORMAT_LIST_LW2(DISASM_INST)
4673 #undef DISASM_INST
4674
4675 #define DISASM_INST(TA, TAS, TB, TBS) \
4676 COMPARE(Saddw(v0.TA, v1.TA, v2.TB), "saddw v0." TAS ", v1." TAS ", v2." TBS);
4677 NEON_FORMAT_LIST_LW(DISASM_INST)
4678 #undef DISASM_INST
4679
4680 #define DISASM_INST(TA, TAS, TB, TBS) \
4681 COMPARE(Saddw2(v0.TA, v1.TA, v2.TB), \
4682 "saddw2 v0." TAS ", v1." TAS ", v2." TBS);
4683 NEON_FORMAT_LIST_LW2(DISASM_INST)
4684 #undef DISASM_INST
4685
4686 #define DISASM_INST(TA, TAS, TB, TBS) \
4687 COMPARE(Usubl(v0.TA, v1.TB, v2.TB), "usubl v0." TAS ", v1." TBS ", v2." TBS);
4688 NEON_FORMAT_LIST_LW(DISASM_INST)
4689 #undef DISASM_INST
4690
4691 #define DISASM_INST(TA, TAS, TB, TBS) \
4692 COMPARE(Usubl2(v0.TA, v1.TB, v2.TB), \
4693 "usubl2 v0." TAS ", v1." TBS ", v2." TBS);
4694 NEON_FORMAT_LIST_LW2(DISASM_INST)
4695 #undef DISASM_INST
4696
4697 #define DISASM_INST(TA, TAS, TB, TBS) \
4698 COMPARE(Usubw(v0.TA, v1.TA, v2.TB), "usubw v0." TAS ", v1." TAS ", v2." TBS);
4699 NEON_FORMAT_LIST_LW(DISASM_INST)
4700 #undef DISASM_INST
4701
4702 #define DISASM_INST(TA, TAS, TB, TBS) \
4703 COMPARE(Usubw2(v0.TA, v1.TA, v2.TB), \
4704 "usubw2 v0." TAS ", v1." TAS ", v2." TBS);
4705 NEON_FORMAT_LIST_LW2(DISASM_INST)
4706 #undef DISASM_INST
4707
4708 #define DISASM_INST(TA, TAS, TB, TBS) \
4709 COMPARE(Ssubl(v0.TA, v1.TB, v2.TB), "ssubl v0." TAS ", v1." TBS ", v2." TBS);
4710 NEON_FORMAT_LIST_LW(DISASM_INST)
4711 #undef DISASM_INST
4712
4713 #define DISASM_INST(TA, TAS, TB, TBS) \
4714 COMPARE(Ssubl2(v0.TA, v1.TB, v2.TB), \
4715 "ssubl2 v0." TAS ", v1." TBS ", v2." TBS);
4716 NEON_FORMAT_LIST_LW2(DISASM_INST)
4717 #undef DISASM_INST
4718
4719 #define DISASM_INST(TA, TAS, TB, TBS) \
4720 COMPARE(Ssubw(v0.TA, v1.TA, v2.TB), "ssubw v0." TAS ", v1." TAS ", v2." TBS);
4721 NEON_FORMAT_LIST_LW(DISASM_INST)
4722 #undef DISASM_INST
4723
4724 #define DISASM_INST(TA, TAS, TB, TBS) \
4725 COMPARE(Ssubw2(v0.TA, v1.TA, v2.TB), \
4726 "ssubw2 v0." TAS ", v1." TAS ", v2." TBS);
4727 NEON_FORMAT_LIST_LW2(DISASM_INST)
4728 #undef DISASM_INST
4729
4730 #define DISASM_INST(TA, TAS, TB, TBS) \
4731 COMPARE(Sabal(v0.TA, v1.TB, v2.TB), "sabal v0." TAS ", v1." TBS ", v2." TBS);
4732 NEON_FORMAT_LIST_LW(DISASM_INST)
4733 #undef DISASM_INST
4734
4735 #define DISASM_INST(TA, TAS, TB, TBS) \
4736 COMPARE(Sabal2(v0.TA, v1.TB, v2.TB), \
4737 "sabal2 v0." TAS ", v1." TBS ", v2." TBS);
4738 NEON_FORMAT_LIST_LW2(DISASM_INST)
4739 #undef DISASM_INST
4740
4741 #define DISASM_INST(TA, TAS, TB, TBS) \
4742 COMPARE(Uabal(v0.TA, v1.TB, v2.TB), "uabal v0." TAS ", v1." TBS ", v2." TBS);
4743 NEON_FORMAT_LIST_LW(DISASM_INST)
4744 #undef DISASM_INST
4745
4746 #define DISASM_INST(TA, TAS, TB, TBS) \
4747 COMPARE(Uabal2(v0.TA, v1.TB, v2.TB), \
4748 "uabal2 v0." TAS ", v1." TBS ", v2." TBS);
4749 NEON_FORMAT_LIST_LW2(DISASM_INST)
4750 #undef DISASM_INST
4751
4752 #define DISASM_INST(TA, TAS, TB, TBS) \
4753 COMPARE(Sabdl(v0.TA, v1.TB, v2.TB), "sabdl v0." TAS ", v1." TBS ", v2." TBS);
4754 NEON_FORMAT_LIST_LW(DISASM_INST)
4755 #undef DISASM_INST
4756
4757 #define DISASM_INST(TA, TAS, TB, TBS) \
4758 COMPARE(Sabdl2(v0.TA, v1.TB, v2.TB), \
4759 "sabdl2 v0." TAS ", v1." TBS ", v2." TBS);
4760 NEON_FORMAT_LIST_LW2(DISASM_INST)
4761 #undef DISASM_INST
4762
4763 #define DISASM_INST(TA, TAS, TB, TBS) \
4764 COMPARE(Uabdl(v0.TA, v1.TB, v2.TB), "uabdl v0." TAS ", v1." TBS ", v2." TBS);
4765 NEON_FORMAT_LIST_LW(DISASM_INST)
4766 #undef DISASM_INST
4767
4768 #define DISASM_INST(TA, TAS, TB, TBS) \
4769 COMPARE(Uabdl2(v0.TA, v1.TB, v2.TB), \
4770 "uabdl2 v0." TAS ", v1." TBS ", v2." TBS);
4771 NEON_FORMAT_LIST_LW2(DISASM_INST)
4772 #undef DISASM_INST
4773
4774 #define DISASM_INST(TA, TAS, TB, TBS) \
4775 COMPARE(Smlal(v0.TA, v1.TB, v2.TB), "smlal v0." TAS ", v1." TBS ", v2." TBS);
4776 NEON_FORMAT_LIST_LW(DISASM_INST)
4777 #undef DISASM_INST
4778
4779 #define DISASM_INST(TA, TAS, TB, TBS) \
4780 COMPARE(Smlal2(v0.TA, v1.TB, v2.TB), \
4781 "smlal2 v0." TAS ", v1." TBS ", v2." TBS);
4782 NEON_FORMAT_LIST_LW2(DISASM_INST)
4783 #undef DISASM_INST
4784
4785 #define DISASM_INST(TA, TAS, TB, TBS) \
4786 COMPARE(Umlsl(v0.TA, v1.TB, v2.TB), "umlsl v0." TAS ", v1." TBS ", v2." TBS);
4787 NEON_FORMAT_LIST_LW(DISASM_INST)
4788 #undef DISASM_INST
4789
4790 #define DISASM_INST(TA, TAS, TB, TBS) \
4791 COMPARE(Umlsl2(v0.TA, v1.TB, v2.TB), \
4792 "umlsl2 v0." TAS ", v1." TBS ", v2." TBS);
4793 NEON_FORMAT_LIST_LW2(DISASM_INST)
4794 #undef DISASM_INST
4795
4796 #define DISASM_INST(TA, TAS, TB, TBS) \
4797 COMPARE(Smlsl(v0.TA, v1.TB, v2.TB), "smlsl v0." TAS ", v1." TBS ", v2." TBS);
4798 NEON_FORMAT_LIST_LW(DISASM_INST)
4799 #undef DISASM_INST
4800
4801 #define DISASM_INST(TA, TAS, TB, TBS) \
4802 COMPARE(Smlsl2(v0.TA, v1.TB, v2.TB), \
4803 "smlsl2 v0." TAS ", v1." TBS ", v2." TBS);
4804 NEON_FORMAT_LIST_LW2(DISASM_INST)
4805 #undef DISASM_INST
4806
4807 #define DISASM_INST(TA, TAS, TB, TBS) \
4808 COMPARE(Umlsl(v0.TA, v1.TB, v2.TB), "umlsl v0." TAS ", v1." TBS ", v2." TBS);
4809 NEON_FORMAT_LIST_LW(DISASM_INST)
4810 #undef DISASM_INST
4811
4812 #define DISASM_INST(TA, TAS, TB, TBS) \
4813 COMPARE(Umlsl2(v0.TA, v1.TB, v2.TB), \
4814 "umlsl2 v0." TAS ", v1." TBS ", v2." TBS);
4815 NEON_FORMAT_LIST_LW2(DISASM_INST)
4816 #undef DISASM_INST
4817
4818 #define DISASM_INST(TA, TAS, TB, TBS) \
4819 COMPARE(Smull(v0.TA, v1.TB, v2.TB), "smull v0." TAS ", v1." TBS ", v2." TBS);
4820 NEON_FORMAT_LIST_LW(DISASM_INST)
4821 #undef DISASM_INST
4822
4823 #define DISASM_INST(TA, TAS, TB, TBS) \
4824 COMPARE(Smull2(v0.TA, v1.TB, v2.TB), \
4825 "smull2 v0." TAS ", v1." TBS ", v2." TBS);
4826 NEON_FORMAT_LIST_LW2(DISASM_INST)
4827 #undef DISASM_INST
4828
4829 #define DISASM_INST(TA, TAS, TB, TBS) \
4830 COMPARE(Umull(v0.TA, v1.TB, v2.TB), "umull v0." TAS ", v1." TBS ", v2." TBS);
4831 NEON_FORMAT_LIST_LW(DISASM_INST)
4832 #undef DISASM_INST
4833
4834 #define DISASM_INST(TA, TAS, TB, TBS) \
4835 COMPARE(Umull2(v0.TA, v1.TB, v2.TB), \
4836 "umull2 v0." TAS ", v1." TBS ", v2." TBS);
4837 NEON_FORMAT_LIST_LW2(DISASM_INST)
4838 #undef DISASM_INST
4839
4840 COMPARE(Sqdmull(v0.V4S(), v1.V4H(), v2.V4H()), "sqdmull v0.4s, v1.4h, v2.4h");
4841 COMPARE(Sqdmull(v1.V2D(), v2.V2S(), v3.V2S()), "sqdmull v1.2d, v2.2s, v3.2s");
4842 COMPARE(Sqdmull2(v2.V4S(), v3.V8H(), v4.V8H()),
4843 "sqdmull2 v2.4s, v3.8h, v4.8h");
4844 COMPARE(Sqdmull2(v3.V2D(), v4.V4S(), v5.V4S()),
4845 "sqdmull2 v3.2d, v4.4s, v5.4s");
4846 COMPARE(Sqdmull(s0, h1, h2), "sqdmull s0, h1, h2");
4847 COMPARE(Sqdmull(d1, s2, s3), "sqdmull d1, s2, s3");
4848
4849 COMPARE(Sqdmlal(v0.V4S(), v1.V4H(), v2.V4H()), "sqdmlal v0.4s, v1.4h, v2.4h");
4850 COMPARE(Sqdmlal(v1.V2D(), v2.V2S(), v3.V2S()), "sqdmlal v1.2d, v2.2s, v3.2s");
4851 COMPARE(Sqdmlal2(v2.V4S(), v3.V8H(), v4.V8H()),
4852 "sqdmlal2 v2.4s, v3.8h, v4.8h");
4853 COMPARE(Sqdmlal2(v3.V2D(), v4.V4S(), v5.V4S()),
4854 "sqdmlal2 v3.2d, v4.4s, v5.4s");
4855 COMPARE(Sqdmlal(s0, h1, h2), "sqdmlal s0, h1, h2");
4856 COMPARE(Sqdmlal(d1, s2, s3), "sqdmlal d1, s2, s3");
4857
4858 COMPARE(Sqdmlsl(v0.V4S(), v1.V4H(), v2.V4H()), "sqdmlsl v0.4s, v1.4h, v2.4h");
4859 COMPARE(Sqdmlsl(v1.V2D(), v2.V2S(), v3.V2S()), "sqdmlsl v1.2d, v2.2s, v3.2s");
4860 COMPARE(Sqdmlsl2(v2.V4S(), v3.V8H(), v4.V8H()),
4861 "sqdmlsl2 v2.4s, v3.8h, v4.8h");
4862 COMPARE(Sqdmlsl2(v3.V2D(), v4.V4S(), v5.V4S()),
4863 "sqdmlsl2 v3.2d, v4.4s, v5.4s");
4864 COMPARE(Sqdmlsl(s0, h1, h2), "sqdmlsl s0, h1, h2");
4865 COMPARE(Sqdmlsl(d1, s2, s3), "sqdmlsl d1, s2, s3");
4866
4867 COMPARE(Addhn(v0.V8B(), v1.V8H(), v2.V8H()), "addhn v0.8b, v1.8h, v2.8h");
4868 COMPARE(Addhn(v1.V4H(), v2.V4S(), v3.V4S()), "addhn v1.4h, v2.4s, v3.4s");
4869 COMPARE(Addhn(v2.V2S(), v3.V2D(), v4.V2D()), "addhn v2.2s, v3.2d, v4.2d");
4870 COMPARE(Addhn2(v0.V16B(), v1.V8H(), v5.V8H()), "addhn2 v0.16b, v1.8h, v5.8h");
4871 COMPARE(Addhn2(v1.V8H(), v2.V4S(), v6.V4S()), "addhn2 v1.8h, v2.4s, v6.4s");
4872 COMPARE(Addhn2(v2.V4S(), v3.V2D(), v7.V2D()), "addhn2 v2.4s, v3.2d, v7.2d");
4873
4874 COMPARE(Raddhn(v0.V8B(), v1.V8H(), v2.V8H()), "raddhn v0.8b, v1.8h, v2.8h");
4875 COMPARE(Raddhn(v1.V4H(), v2.V4S(), v3.V4S()), "raddhn v1.4h, v2.4s, v3.4s");
4876 COMPARE(Raddhn(v2.V2S(), v3.V2D(), v4.V2D()), "raddhn v2.2s, v3.2d, v4.2d");
4877 COMPARE(Raddhn2(v0.V16B(), v1.V8H(), v5.V8H()),
4878 "raddhn2 v0.16b, v1.8h, v5.8h");
4879 COMPARE(Raddhn2(v1.V8H(), v2.V4S(), v6.V4S()), "raddhn2 v1.8h, v2.4s, v6.4s");
4880 COMPARE(Raddhn2(v2.V4S(), v3.V2D(), v7.V2D()), "raddhn2 v2.4s, v3.2d, v7.2d");
4881
4882 COMPARE(Subhn(v1.V4H(), v2.V4S(), v3.V4S()), "subhn v1.4h, v2.4s, v3.4s");
4883 COMPARE(Subhn(v2.V2S(), v3.V2D(), v4.V2D()), "subhn v2.2s, v3.2d, v4.2d");
4884 COMPARE(Subhn2(v0.V16B(), v1.V8H(), v5.V8H()), "subhn2 v0.16b, v1.8h, v5.8h");
4885 COMPARE(Subhn2(v1.V8H(), v2.V4S(), v6.V4S()), "subhn2 v1.8h, v2.4s, v6.4s");
4886 COMPARE(Subhn2(v2.V4S(), v3.V2D(), v7.V2D()), "subhn2 v2.4s, v3.2d, v7.2d");
4887
4888 COMPARE(Rsubhn(v0.V8B(), v1.V8H(), v2.V8H()), "rsubhn v0.8b, v1.8h, v2.8h");
4889 COMPARE(Rsubhn(v1.V4H(), v2.V4S(), v3.V4S()), "rsubhn v1.4h, v2.4s, v3.4s");
4890 COMPARE(Rsubhn(v2.V2S(), v3.V2D(), v4.V2D()), "rsubhn v2.2s, v3.2d, v4.2d");
4891 COMPARE(Rsubhn2(v0.V16B(), v1.V8H(), v5.V8H()),
4892 "rsubhn2 v0.16b, v1.8h, v5.8h");
4893 COMPARE(Rsubhn2(v1.V8H(), v2.V4S(), v6.V4S()), "rsubhn2 v1.8h, v2.4s, v6.4s");
4894 COMPARE(Rsubhn2(v2.V4S(), v3.V2D(), v7.V2D()), "rsubhn2 v2.4s, v3.2d, v7.2d");
4895
4896 COMPARE(Pmull(v0.V8H(), v1.V8B(), v2.V8B()), "pmull v0.8h, v1.8b, v2.8b");
4897 COMPARE(Pmull2(v2.V8H(), v3.V16B(), v4.V16B()),
4898 "pmull2 v2.8h, v3.16b, v4.16b");
4899
4900 CLEANUP();
4901}
4902
4903
4904TEST(neon_perm) {
armvixl684cd2a2015-10-23 13:38:33 +01004905 SETUP_MACRO();
armvixl5289c592015-03-02 13:52:04 +00004906
4907 #define DISASM_INST(M, S) \
4908 COMPARE(Trn1(v0.M, v1.M, v2.M), "trn1 v0." S ", v1." S ", v2." S);
4909 NEON_FORMAT_LIST(DISASM_INST)
4910 #undef DISASM_INST
4911
4912 #define DISASM_INST(M, S) \
4913 COMPARE(Trn2(v0.M, v1.M, v2.M), "trn2 v0." S ", v1." S ", v2." S);
4914 NEON_FORMAT_LIST(DISASM_INST)
4915 #undef DISASM_INST
4916
4917 #define DISASM_INST(M, S) \
4918 COMPARE(Uzp1(v0.M, v1.M, v2.M), "uzp1 v0." S ", v1." S ", v2." S);
4919 NEON_FORMAT_LIST(DISASM_INST)
4920 #undef DISASM_INST
4921
4922 #define DISASM_INST(M, S) \
4923 COMPARE(Uzp2(v0.M, v1.M, v2.M), "uzp2 v0." S ", v1." S ", v2." S);
4924 NEON_FORMAT_LIST(DISASM_INST)
4925 #undef DISASM_INST
4926
4927 #define DISASM_INST(M, S) \
4928 COMPARE(Zip1(v0.M, v1.M, v2.M), "zip1 v0." S ", v1." S ", v2." S);
4929 NEON_FORMAT_LIST(DISASM_INST)
4930 #undef DISASM_INST
4931
4932 #define DISASM_INST(M, S) \
4933 COMPARE(Zip2(v0.M, v1.M, v2.M), "zip2 v0." S ", v1." S ", v2." S);
4934 NEON_FORMAT_LIST(DISASM_INST)
4935 #undef DISASM_INST
4936
4937 CLEANUP();
4938}
4939
4940
4941TEST(neon_copy) {
armvixl684cd2a2015-10-23 13:38:33 +01004942 SETUP_MACRO();
armvixl5289c592015-03-02 13:52:04 +00004943
4944 COMPARE(Ins(v1.V16B(), 4, v5.V16B(), 0), "mov v1.b[4], v5.b[0]");
4945 COMPARE(Ins(v2.V8B(), 5, v6.V8B(), 1), "mov v2.b[5], v6.b[1]");
4946 COMPARE(Ins(v3.B(), 6, v7.B(), 2), "mov v3.b[6], v7.b[2]");
4947 COMPARE(Ins(v4.V8H(), 7, v8.V8H(), 3), "mov v4.h[7], v8.h[3]");
4948 COMPARE(Ins(v5.V4H(), 3, v9.V4H(), 0), "mov v5.h[3], v9.h[0]");
4949 COMPARE(Ins(v6.H(), 6, v1.H(), 1), "mov v6.h[6], v1.h[1]");
4950 COMPARE(Ins(v7.V4S(), 2, v2.V4S(), 2), "mov v7.s[2], v2.s[2]");
4951 COMPARE(Ins(v8.V2S(), 1, v3.V2S(), 0), "mov v8.s[1], v3.s[0]");
4952 COMPARE(Ins(v9.S(), 0, v4.S(), 1), "mov v9.s[0], v4.s[1]");
4953 COMPARE(Ins(v1.V2D(), 1, v5.V2D(), 0), "mov v1.d[1], v5.d[0]");
4954 COMPARE(Ins(v2.D(), 0, v6.D(), 1), "mov v2.d[0], v6.d[1]");
4955
4956 COMPARE(Mov(v3.V16B(), 4, v7.V16B(), 0), "mov v3.b[4], v7.b[0]");
4957 COMPARE(Mov(v4.V8B(), 5, v8.V8B(), 1), "mov v4.b[5], v8.b[1]");
4958 COMPARE(Mov(v5.B(), 6, v9.B(), 2), "mov v5.b[6], v9.b[2]");
4959 COMPARE(Mov(v6.V8H(), 7, v1.V8H(), 3), "mov v6.h[7], v1.h[3]");
4960 COMPARE(Mov(v7.V4H(), 0, v2.V4H(), 0), "mov v7.h[0], v2.h[0]");
4961 COMPARE(Mov(v8.H(), 1, v3.H(), 1), "mov v8.h[1], v3.h[1]");
4962 COMPARE(Mov(v9.V4S(), 2, v4.V4S(), 2), "mov v9.s[2], v4.s[2]");
4963 COMPARE(Mov(v1.V2S(), 3, v5.V2S(), 0), "mov v1.s[3], v5.s[0]");
4964 COMPARE(Mov(v2.S(), 0, v6.S(), 1), "mov v2.s[0], v6.s[1]");
4965 COMPARE(Mov(v3.V2D(), 1, v7.V2D(), 0), "mov v3.d[1], v7.d[0]");
4966 COMPARE(Mov(v4.D(), 0, v8.D(), 1), "mov v4.d[0], v8.d[1]");
4967
4968 COMPARE(Ins(v1.V16B(), 4, w0), "mov v1.b[4], w0");
4969 COMPARE(Ins(v2.V8B(), 5, w1), "mov v2.b[5], w1");
4970 COMPARE(Ins(v3.B(), 6, w2), "mov v3.b[6], w2");
4971 COMPARE(Ins(v4.V8H(), 7, w3), "mov v4.h[7], w3");
4972 COMPARE(Ins(v5.V4H(), 3, w0), "mov v5.h[3], w0");
4973 COMPARE(Ins(v6.H(), 6, w1), "mov v6.h[6], w1");
4974 COMPARE(Ins(v7.V4S(), 2, w2), "mov v7.s[2], w2");
4975 COMPARE(Ins(v8.V2S(), 1, w0), "mov v8.s[1], w0");
4976 COMPARE(Ins(v9.S(), 0, w1), "mov v9.s[0], w1");
4977 COMPARE(Ins(v1.V2D(), 1, x0), "mov v1.d[1], x0");
4978 COMPARE(Ins(v2.D(), 0, x1), "mov v2.d[0], x1");
4979
4980 COMPARE(Mov(v1.V16B(), 4, w0), "mov v1.b[4], w0");
4981 COMPARE(Mov(v2.V8B(), 5, w1), "mov v2.b[5], w1");
4982 COMPARE(Mov(v3.B(), 6, w2), "mov v3.b[6], w2");
4983 COMPARE(Mov(v4.V8H(), 7, w3), "mov v4.h[7], w3");
4984 COMPARE(Mov(v5.V4H(), 3, w0), "mov v5.h[3], w0");
4985 COMPARE(Mov(v6.H(), 6, w1), "mov v6.h[6], w1");
4986 COMPARE(Mov(v7.V4S(), 2, w2), "mov v7.s[2], w2");
4987 COMPARE(Mov(v8.V2S(), 1, w0), "mov v8.s[1], w0");
4988 COMPARE(Mov(v9.S(), 0, w1), "mov v9.s[0], w1");
4989 COMPARE(Mov(v1.V2D(), 1, x0), "mov v1.d[1], x0");
4990 COMPARE(Mov(v2.D(), 0, x1), "mov v2.d[0], x1");
4991
4992 COMPARE(Dup(v5.V8B(), v9.V8B(), 6), "dup v5.8b, v9.b[6]");
4993 COMPARE(Dup(v6.V16B(), v1.V16B(), 5), "dup v6.16b, v1.b[5]");
4994 COMPARE(Dup(v7.V4H(), v2.V4H(), 4), "dup v7.4h, v2.h[4]");
4995 COMPARE(Dup(v8.V8H(), v3.V8H(), 3), "dup v8.8h, v3.h[3]");
4996 COMPARE(Dup(v9.V2S(), v4.V2S(), 2), "dup v9.2s, v4.s[2]");
4997 COMPARE(Dup(v1.V4S(), v5.V4S(), 1), "dup v1.4s, v5.s[1]");
4998 COMPARE(Dup(v2.V2D(), v6.V2D(), 0), "dup v2.2d, v6.d[0]");
4999
5000 COMPARE(Dup(v5.B(), v9.B(), 6), "mov b5, v9.b[6]");
5001 COMPARE(Dup(v7.H(), v2.H(), 4), "mov h7, v2.h[4]");
5002 COMPARE(Dup(v9.S(), v4.S(), 2), "mov s9, v4.s[2]");
5003 COMPARE(Dup(v2.D(), v6.D(), 0), "mov d2, v6.d[0]");
5004
5005 COMPARE(Mov(v5.B(), v9.B(), 6), "mov b5, v9.b[6]");
5006 COMPARE(Mov(v7.H(), v2.H(), 4), "mov h7, v2.h[4]");
5007 COMPARE(Mov(v9.S(), v4.S(), 2), "mov s9, v4.s[2]");
5008 COMPARE(Mov(v2.D(), v6.D(), 0), "mov d2, v6.d[0]");
5009
5010 COMPARE(Dup(v5.V8B(), w0), "dup v5.8b, w0");
5011 COMPARE(Dup(v6.V16B(), w1), "dup v6.16b, w1");
5012 COMPARE(Dup(v7.V4H(), w2), "dup v7.4h, w2");
5013 COMPARE(Dup(v8.V8H(), w3), "dup v8.8h, w3");
5014 COMPARE(Dup(v9.V2S(), w4), "dup v9.2s, w4");
5015 COMPARE(Dup(v1.V4S(), w5), "dup v1.4s, w5");
5016 COMPARE(Dup(v2.V2D(), x6), "dup v2.2d, x6");
5017
5018 COMPARE(Smov(w0, v1.V16B(), 4), "smov w0, v1.b[4]");
5019 COMPARE(Smov(w1, v2.V8B(), 5), "smov w1, v2.b[5]");
5020 COMPARE(Smov(w2, v3.B(), 6), "smov w2, v3.b[6]");
5021 COMPARE(Smov(w3, v4.V8H(), 7), "smov w3, v4.h[7]");
5022 COMPARE(Smov(w0, v5.V4H(), 3), "smov w0, v5.h[3]");
5023 COMPARE(Smov(w1, v6.H(), 6), "smov w1, v6.h[6]");
5024
5025 COMPARE(Smov(x0, v1.V16B(), 4), "smov x0, v1.b[4]");
5026 COMPARE(Smov(x1, v2.V8B(), 5), "smov x1, v2.b[5]");
5027 COMPARE(Smov(x2, v3.B(), 6), "smov x2, v3.b[6]");
5028 COMPARE(Smov(x3, v4.V8H(), 7), "smov x3, v4.h[7]");
5029 COMPARE(Smov(x0, v5.V4H(), 3), "smov x0, v5.h[3]");
5030 COMPARE(Smov(x1, v6.H(), 6), "smov x1, v6.h[6]");
5031 COMPARE(Smov(x2, v7.V4S(), 2), "smov x2, v7.s[2]");
5032 COMPARE(Smov(x0, v8.V2S(), 1), "smov x0, v8.s[1]");
5033 COMPARE(Smov(x1, v9.S(), 0), "smov x1, v9.s[0]");
5034
5035 COMPARE(Umov(w0, v1.V16B(), 4), "umov w0, v1.b[4]");
5036 COMPARE(Umov(w1, v2.V8B(), 5), "umov w1, v2.b[5]");
5037 COMPARE(Umov(w2, v3.B(), 6), "umov w2, v3.b[6]");
5038 COMPARE(Umov(w3, v4.V8H(), 7), "umov w3, v4.h[7]");
5039 COMPARE(Umov(w0, v5.V4H(), 3), "umov w0, v5.h[3]");
5040 COMPARE(Umov(w1, v6.H(), 6), "umov w1, v6.h[6]");
5041 COMPARE(Umov(w2, v7.V4S(), 2), "mov w2, v7.s[2]");
5042 COMPARE(Umov(w0, v8.V2S(), 1), "mov w0, v8.s[1]");
5043 COMPARE(Umov(w1, v9.S(), 0), "mov w1, v9.s[0]");
5044 COMPARE(Umov(x0, v1.V2D(), 1), "mov x0, v1.d[1]");
5045 COMPARE(Umov(x1, v2.D(), 0), "mov x1, v2.d[0]");
5046
5047 COMPARE(Mov(w2, v7.V4S(), 2), "mov w2, v7.s[2]");
5048 COMPARE(Mov(w0, v8.V2S(), 1), "mov w0, v8.s[1]");
5049 COMPARE(Mov(w1, v9.S(), 0), "mov w1, v9.s[0]");
5050 COMPARE(Mov(x0, v1.V2D(), 1), "mov x0, v1.d[1]");
5051 COMPARE(Mov(x1, v2.D(), 0), "mov x1, v2.d[0]");
5052
5053 CLEANUP();
5054}
5055
5056
5057TEST(neon_extract) {
armvixl684cd2a2015-10-23 13:38:33 +01005058 SETUP_MACRO();
armvixl5289c592015-03-02 13:52:04 +00005059
5060 COMPARE(Ext(v4.V8B(), v5.V8B(), v6.V8B(), 0), "ext v4.8b, v5.8b, v6.8b, #0");
5061 COMPARE(Ext(v1.V8B(), v2.V8B(), v3.V8B(), 7), "ext v1.8b, v2.8b, v3.8b, #7");
5062 COMPARE(Ext(v1.V16B(), v2.V16B(), v3.V16B(), 0),
5063 "ext v1.16b, v2.16b, v3.16b, #0");
5064 COMPARE(Ext(v1.V16B(), v2.V16B(), v3.V16B(), 15),
5065 "ext v1.16b, v2.16b, v3.16b, #15");
5066
5067 CLEANUP();
5068}
5069
5070
5071TEST(neon_modimm) {
armvixl684cd2a2015-10-23 13:38:33 +01005072 SETUP_MACRO();
armvixl5289c592015-03-02 13:52:04 +00005073
5074 COMPARE(Orr(v4.V4H(), 0xaa, 0), "orr v4.4h, #0xaa, lsl #0");
5075 COMPARE(Orr(v1.V8H(), 0xcc, 8), "orr v1.8h, #0xcc, lsl #8");
5076 COMPARE(Orr(v4.V2S(), 0xaa, 0), "orr v4.2s, #0xaa, lsl #0");
5077 COMPARE(Orr(v1.V2S(), 0xcc, 8), "orr v1.2s, #0xcc, lsl #8");
5078 COMPARE(Orr(v4.V4S(), 0xaa, 16), "orr v4.4s, #0xaa, lsl #16");
5079 COMPARE(Orr(v1.V4S(), 0xcc, 24), "orr v1.4s, #0xcc, lsl #24");
5080
5081 COMPARE(Bic(v4.V4H(), 0xaa, 0), "bic v4.4h, #0xaa, lsl #0");
5082 COMPARE(Bic(v1.V8H(), 0xcc, 8), "bic v1.8h, #0xcc, lsl #8");
5083 COMPARE(Bic(v4.V2S(), 0xaa, 0), "bic v4.2s, #0xaa, lsl #0");
5084 COMPARE(Bic(v1.V2S(), 0xcc, 8), "bic v1.2s, #0xcc, lsl #8");
5085 COMPARE(Bic(v4.V4S(), 0xaa, 16), "bic v4.4s, #0xaa, lsl #16");
5086 COMPARE(Bic(v1.V4S(), 0xcc, 24), "bic v1.4s, #0xcc, lsl #24");
5087
5088 COMPARE(Mvni(v4.V4H(), 0xaa, LSL, 0), "mvni v4.4h, #0xaa, lsl #0");
5089 COMPARE(Mvni(v1.V8H(), 0xcc, LSL, 8), "mvni v1.8h, #0xcc, lsl #8");
5090 COMPARE(Mvni(v4.V2S(), 0xaa, LSL, 0), "mvni v4.2s, #0xaa, lsl #0");
5091 COMPARE(Mvni(v1.V2S(), 0xcc, LSL, 8), "mvni v1.2s, #0xcc, lsl #8");
5092 COMPARE(Mvni(v4.V4S(), 0xaa, LSL, 16), "mvni v4.4s, #0xaa, lsl #16");
5093 COMPARE(Mvni(v1.V4S(), 0xcc, LSL, 24), "mvni v1.4s, #0xcc, lsl #24");
5094
5095 COMPARE(Mvni(v4.V2S(), 0xaa, MSL, 8), "mvni v4.2s, #0xaa, msl #8");
5096 COMPARE(Mvni(v1.V2S(), 0xcc, MSL, 16), "mvni v1.2s, #0xcc, msl #16");
5097 COMPARE(Mvni(v4.V4S(), 0xaa, MSL, 8), "mvni v4.4s, #0xaa, msl #8");
5098 COMPARE(Mvni(v1.V4S(), 0xcc, MSL, 16), "mvni v1.4s, #0xcc, msl #16");
5099
5100 COMPARE(Movi(v4.V8B(), 0xaa), "movi v4.8b, #0xaa");
5101 COMPARE(Movi(v1.V16B(), 0xcc), "movi v1.16b, #0xcc");
5102
5103 COMPARE(Movi(v4.V4H(), 0xaa, LSL, 0), "movi v4.4h, #0xaa, lsl #0");
5104 COMPARE(Movi(v1.V8H(), 0xcc, LSL, 8), "movi v1.8h, #0xcc, lsl #8");
5105
5106 COMPARE(Movi(v4.V2S(), 0xaa, LSL, 0), "movi v4.2s, #0xaa, lsl #0");
5107 COMPARE(Movi(v1.V2S(), 0xcc, LSL, 8), "movi v1.2s, #0xcc, lsl #8");
5108 COMPARE(Movi(v4.V4S(), 0xaa, LSL, 16), "movi v4.4s, #0xaa, lsl #16");
5109 COMPARE(Movi(v1.V4S(), 0xcc, LSL, 24), "movi v1.4s, #0xcc, lsl #24");
5110
5111 COMPARE(Movi(v4.V2S(), 0xaa, MSL, 8), "movi v4.2s, #0xaa, msl #8");
5112 COMPARE(Movi(v1.V2S(), 0xcc, MSL, 16), "movi v1.2s, #0xcc, msl #16");
5113 COMPARE(Movi(v4.V4S(), 0xaa, MSL, 8), "movi v4.4s, #0xaa, msl #8");
5114 COMPARE(Movi(v1.V4S(), 0xcc, MSL, 16), "movi v1.4s, #0xcc, msl #16");
5115
5116 COMPARE(Movi(d2, 0xffff0000ffffff), "movi d2, #0xffff0000ffffff");
5117 COMPARE(Movi(v1.V2D(), 0xffff0000ffffff), "movi v1.2d, #0xffff0000ffffff");
5118
5119 COMPARE(Fmov(v0.V2S(), 1.0f), "fmov v0.2s, #0x70 (1.0000)");
5120 COMPARE(Fmov(v31.V2S(), -13.0f), "fmov v31.2s, #0xaa (-13.0000)");
5121 COMPARE(Fmov(v0.V4S(), 1.0f), "fmov v0.4s, #0x70 (1.0000)");
5122 COMPARE(Fmov(v31.V4S(), -13.0f), "fmov v31.4s, #0xaa (-13.0000)");
5123 COMPARE(Fmov(v1.V2D(), 1.0), "fmov v1.2d, #0x70 (1.0000)");
5124 COMPARE(Fmov(v29.V2D(), -13.0), "fmov v29.2d, #0xaa (-13.0000)");
5125
armvixl0f35e362016-05-10 13:57:58 +01005126 // An unallocated form of fmov.
5127 COMPARE(dci(0x2f07ffff), "unallocated (NEONModifiedImmediate)");
5128
armvixl5289c592015-03-02 13:52:04 +00005129 CLEANUP();
5130}
5131
5132
5133TEST(neon_2regmisc) {
armvixl684cd2a2015-10-23 13:38:33 +01005134 SETUP_MACRO();
armvixl5289c592015-03-02 13:52:04 +00005135
5136 COMPARE(Shll(v1.V8H(), v8.V8B(), 8), "shll v1.8h, v8.8b, #8");
5137 COMPARE(Shll(v3.V4S(), v1.V4H(), 16), "shll v3.4s, v1.4h, #16");
5138 COMPARE(Shll(v5.V2D(), v3.V2S(), 32), "shll v5.2d, v3.2s, #32");
5139 COMPARE(Shll2(v2.V8H(), v9.V16B(), 8), "shll2 v2.8h, v9.16b, #8");
5140 COMPARE(Shll2(v4.V4S(), v2.V8H(), 16), "shll2 v4.4s, v2.8h, #16");
5141 COMPARE(Shll2(v6.V2D(), v4.V4S(), 32), "shll2 v6.2d, v4.4s, #32");
5142
armvixl0f35e362016-05-10 13:57:58 +01005143 // An unallocated form of shll.
5144 COMPARE(dci(0x2ee13bff), "unallocated (NEON2RegMisc)");
5145 // An unallocated form of shll2.
5146 COMPARE(dci(0x6ee13bff), "unallocated (NEON2RegMisc)");
5147
armvixl5289c592015-03-02 13:52:04 +00005148 #define DISASM_INST(M, S) \
5149 COMPARE(Cmeq(v0.M, v1.M, 0), "cmeq v0." S ", v1." S ", #0");
5150 NEON_FORMAT_LIST(DISASM_INST)
5151 #undef DISASM_INST
5152
5153 #define DISASM_INST(M, S) \
5154 COMPARE(Cmge(v0.M, v1.M, 0), "cmge v0." S ", v1." S ", #0");
5155 NEON_FORMAT_LIST(DISASM_INST)
5156 #undef DISASM_INST
5157
5158 #define DISASM_INST(M, S) \
5159 COMPARE(Cmgt(v0.M, v1.M, 0), "cmgt v0." S ", v1." S ", #0");
5160 NEON_FORMAT_LIST(DISASM_INST)
5161 #undef DISASM_INST
5162
5163 #define DISASM_INST(M, S) \
5164 COMPARE(Cmle(v0.M, v1.M, 0), "cmle v0." S ", v1." S ", #0");
5165 NEON_FORMAT_LIST(DISASM_INST)
5166 #undef DISASM_INST
5167
5168 #define DISASM_INST(M, S) \
5169 COMPARE(Cmlt(v0.M, v1.M, 0), "cmlt v0." S ", v1." S ", #0");
5170 NEON_FORMAT_LIST(DISASM_INST)
5171 #undef DISASM_INST
5172
5173 COMPARE(Cmeq(v0.D(), v1.D(), 0), "cmeq d0, d1, #0");
5174 COMPARE(Cmge(v3.D(), v4.D(), 0), "cmge d3, d4, #0");
5175 COMPARE(Cmgt(v6.D(), v7.D(), 0), "cmgt d6, d7, #0");
5176 COMPARE(Cmle(v0.D(), v1.D(), 0), "cmle d0, d1, #0");
5177 COMPARE(Cmlt(v3.D(), v4.D(), 0), "cmlt d3, d4, #0");
5178
5179 #define DISASM_INST(M, S) \
5180 COMPARE(Fcmeq(v0.M, v1.M, 0), "fcmeq v0." S ", v1." S ", #0.0");
5181 NEON_FORMAT_LIST_FP(DISASM_INST)
5182 #undef DISASM_INST
5183
5184 COMPARE(Fcmeq(v0.S(), v1.S(), 0), "fcmeq s0, s1, #0.0");
5185 COMPARE(Fcmeq(v0.D(), v1.D(), 0), "fcmeq d0, d1, #0.0");
5186
5187 #define DISASM_INST(M, S) \
5188 COMPARE(Fcmge(v0.M, v1.M, 0), "fcmge v0." S ", v1." S ", #0.0");
5189 NEON_FORMAT_LIST_FP(DISASM_INST)
5190 #undef DISASM_INST
5191
5192 COMPARE(Fcmge(v0.S(), v1.S(), 0), "fcmge s0, s1, #0.0");
5193 COMPARE(Fcmge(v0.D(), v1.D(), 0), "fcmge d0, d1, #0.0");
5194
5195 #define DISASM_INST(M, S) \
5196 COMPARE(Fcmgt(v0.M, v1.M, 0), "fcmgt v0." S ", v1." S ", #0.0");
5197 NEON_FORMAT_LIST_FP(DISASM_INST)
5198 #undef DISASM_INST
5199
5200 COMPARE(Fcmgt(v0.S(), v1.S(), 0), "fcmgt s0, s1, #0.0");
5201 COMPARE(Fcmgt(v0.D(), v1.D(), 0), "fcmgt d0, d1, #0.0");
5202
5203 #define DISASM_INST(M, S) \
5204 COMPARE(Fcmle(v0.M, v1.M, 0), "fcmle v0." S ", v1." S ", #0.0");
5205 NEON_FORMAT_LIST_FP(DISASM_INST)
5206 #undef DISASM_INST
5207
5208 COMPARE(Fcmle(v0.S(), v1.S(), 0), "fcmle s0, s1, #0.0");
5209 COMPARE(Fcmle(v0.D(), v1.D(), 0), "fcmle d0, d1, #0.0");
5210
5211 #define DISASM_INST(M, S) \
5212 COMPARE(Fcmlt(v0.M, v1.M, 0), "fcmlt v0." S ", v1." S ", #0.0");
5213 NEON_FORMAT_LIST_FP(DISASM_INST)
5214 #undef DISASM_INST
5215
5216 COMPARE(Fcmlt(v0.S(), v1.S(), 0), "fcmlt s0, s1, #0.0");
5217 COMPARE(Fcmlt(v0.D(), v1.D(), 0), "fcmlt d0, d1, #0.0");
5218
5219 #define DISASM_INST(M, S) \
5220 COMPARE(Neg(v0.M, v1.M), "neg v0." S ", v1." S);
5221 NEON_FORMAT_LIST(DISASM_INST)
5222 #undef DISASM_INST
5223
5224 COMPARE(Neg(v0.D(), v1.D()), "neg d0, d1");
5225
5226 #define DISASM_INST(M, S) \
5227 COMPARE(Sqneg(v0.M, v1.M), "sqneg v0." S ", v1." S);
5228 NEON_FORMAT_LIST(DISASM_INST)
5229 #undef DISASM_INST
5230
5231 COMPARE(Sqneg(b0, b1), "sqneg b0, b1");
5232 COMPARE(Sqneg(h1, h2), "sqneg h1, h2");
5233 COMPARE(Sqneg(s2, s3), "sqneg s2, s3");
5234 COMPARE(Sqneg(d3, d4), "sqneg d3, d4");
5235
5236 #define DISASM_INST(M, S) \
5237 COMPARE(Abs(v0.M, v1.M), "abs v0." S ", v1." S);
5238 NEON_FORMAT_LIST(DISASM_INST)
5239 #undef DISASM_INST
5240
5241 COMPARE(Abs(v0.D(), v1.D()), "abs d0, d1");
5242
5243 #define DISASM_INST(M, S) \
5244 COMPARE(Sqabs(v0.M, v1.M), "sqabs v0." S ", v1." S);
5245 NEON_FORMAT_LIST(DISASM_INST)
5246 #undef DISASM_INST
5247
5248 COMPARE(Sqabs(b0, b1), "sqabs b0, b1");
5249 COMPARE(Sqabs(h1, h2), "sqabs h1, h2");
5250 COMPARE(Sqabs(s2, s3), "sqabs s2, s3");
5251 COMPARE(Sqabs(d3, d4), "sqabs d3, d4");
5252
5253 #define DISASM_INST(M, S) \
5254 COMPARE(Suqadd(v0.M, v1.M), "suqadd v0." S ", v1." S);
5255 NEON_FORMAT_LIST(DISASM_INST)
5256 #undef DISASM_INST
5257
5258 COMPARE(Suqadd(b0, b1), "suqadd b0, b1");
5259 COMPARE(Suqadd(h1, h2), "suqadd h1, h2");
5260 COMPARE(Suqadd(s2, s3), "suqadd s2, s3");
5261 COMPARE(Suqadd(d3, d4), "suqadd d3, d4");
5262
5263 #define DISASM_INST(M, S) \
5264 COMPARE(Usqadd(v0.M, v1.M), "usqadd v0." S ", v1." S);
5265 NEON_FORMAT_LIST(DISASM_INST)
5266 #undef DISASM_INST
5267
5268 COMPARE(Usqadd(b0, b1), "usqadd b0, b1");
5269 COMPARE(Usqadd(h1, h2), "usqadd h1, h2");
5270 COMPARE(Usqadd(s2, s3), "usqadd s2, s3");
5271 COMPARE(Usqadd(d3, d4), "usqadd d3, d4");
5272
5273 COMPARE(Xtn(v0.V8B(), v1.V8H()), "xtn v0.8b, v1.8h");
5274 COMPARE(Xtn(v1.V4H(), v2.V4S()), "xtn v1.4h, v2.4s");
5275 COMPARE(Xtn(v2.V2S(), v3.V2D()), "xtn v2.2s, v3.2d");
5276 COMPARE(Xtn2(v0.V16B(), v1.V8H()), "xtn2 v0.16b, v1.8h");
5277 COMPARE(Xtn2(v1.V8H(), v2.V4S()), "xtn2 v1.8h, v2.4s");
5278 COMPARE(Xtn2(v2.V4S(), v3.V2D()), "xtn2 v2.4s, v3.2d");
5279
5280 COMPARE(Sqxtn(v0.V8B(), v1.V8H()), "sqxtn v0.8b, v1.8h");
5281 COMPARE(Sqxtn(v1.V4H(), v2.V4S()), "sqxtn v1.4h, v2.4s");
5282 COMPARE(Sqxtn(v2.V2S(), v3.V2D()), "sqxtn v2.2s, v3.2d");
5283 COMPARE(Sqxtn2(v0.V16B(), v1.V8H()), "sqxtn2 v0.16b, v1.8h");
5284 COMPARE(Sqxtn2(v1.V8H(), v2.V4S()), "sqxtn2 v1.8h, v2.4s");
5285 COMPARE(Sqxtn2(v2.V4S(), v3.V2D()), "sqxtn2 v2.4s, v3.2d");
5286 COMPARE(Sqxtn(b19, h0), "sqxtn b19, h0");
5287 COMPARE(Sqxtn(h20, s0), "sqxtn h20, s0") ;
5288 COMPARE(Sqxtn(s21, d0), "sqxtn s21, d0");
5289
5290 COMPARE(Uqxtn(v0.V8B(), v1.V8H()), "uqxtn v0.8b, v1.8h");
5291 COMPARE(Uqxtn(v1.V4H(), v2.V4S()), "uqxtn v1.4h, v2.4s");
5292 COMPARE(Uqxtn(v2.V2S(), v3.V2D()), "uqxtn v2.2s, v3.2d");
5293 COMPARE(Uqxtn2(v0.V16B(), v1.V8H()), "uqxtn2 v0.16b, v1.8h");
5294 COMPARE(Uqxtn2(v1.V8H(), v2.V4S()), "uqxtn2 v1.8h, v2.4s");
5295 COMPARE(Uqxtn2(v2.V4S(), v3.V2D()), "uqxtn2 v2.4s, v3.2d");
5296 COMPARE(Uqxtn(b19, h0), "uqxtn b19, h0");
5297 COMPARE(Uqxtn(h20, s0), "uqxtn h20, s0") ;
5298 COMPARE(Uqxtn(s21, d0), "uqxtn s21, d0");
5299
5300 COMPARE(Sqxtun(v0.V8B(), v1.V8H()), "sqxtun v0.8b, v1.8h");
5301 COMPARE(Sqxtun(v1.V4H(), v2.V4S()), "sqxtun v1.4h, v2.4s");
5302 COMPARE(Sqxtun(v2.V2S(), v3.V2D()), "sqxtun v2.2s, v3.2d");
5303 COMPARE(Sqxtun2(v0.V16B(), v1.V8H()), "sqxtun2 v0.16b, v1.8h");
5304 COMPARE(Sqxtun2(v1.V8H(), v2.V4S()), "sqxtun2 v1.8h, v2.4s");
5305 COMPARE(Sqxtun2(v2.V4S(), v3.V2D()), "sqxtun2 v2.4s, v3.2d");
5306 COMPARE(Sqxtun(b19, h0), "sqxtun b19, h0");
5307 COMPARE(Sqxtun(h20, s0), "sqxtun h20, s0") ;
5308 COMPARE(Sqxtun(s21, d0), "sqxtun s21, d0");
5309
5310 COMPARE(Cls(v1.V8B(), v8.V8B()), "cls v1.8b, v8.8b");
5311 COMPARE(Cls(v2.V16B(), v9.V16B()), "cls v2.16b, v9.16b");
5312 COMPARE(Cls(v3.V4H(), v1.V4H()), "cls v3.4h, v1.4h");
5313 COMPARE(Cls(v4.V8H(), v2.V8H()), "cls v4.8h, v2.8h");
5314 COMPARE(Cls(v5.V2S(), v3.V2S()), "cls v5.2s, v3.2s");
5315 COMPARE(Cls(v6.V4S(), v4.V4S()), "cls v6.4s, v4.4s");
5316
5317 COMPARE(Clz(v1.V8B(), v8.V8B()), "clz v1.8b, v8.8b");
5318 COMPARE(Clz(v2.V16B(), v9.V16B()), "clz v2.16b, v9.16b");
5319 COMPARE(Clz(v3.V4H(), v1.V4H()), "clz v3.4h, v1.4h");
5320 COMPARE(Clz(v4.V8H(), v2.V8H()), "clz v4.8h, v2.8h");
5321 COMPARE(Clz(v5.V2S(), v3.V2S()), "clz v5.2s, v3.2s");
5322 COMPARE(Clz(v6.V4S(), v4.V4S()), "clz v6.4s, v4.4s");
5323
5324 COMPARE(Cnt(v1.V8B(), v8.V8B()), "cnt v1.8b, v8.8b");
5325 COMPARE(Cnt(v2.V16B(), v9.V16B()), "cnt v2.16b, v9.16b");
5326
5327 COMPARE(Mvn(v4.V8B(), v5.V8B()), "mvn v4.8b, v5.8b");
5328 COMPARE(Mvn(v4.V16B(), v5.V16B()), "mvn v4.16b, v5.16b");
5329
5330 COMPARE(Not(v4.V8B(), v5.V8B()), "mvn v4.8b, v5.8b");
5331 COMPARE(Not(v4.V16B(), v5.V16B()), "mvn v4.16b, v5.16b");
5332
5333 COMPARE(Rev64(v1.V8B(), v8.V8B()), "rev64 v1.8b, v8.8b");
5334 COMPARE(Rev64(v2.V16B(), v9.V16B()), "rev64 v2.16b, v9.16b");
5335 COMPARE(Rev64(v3.V4H(), v1.V4H()), "rev64 v3.4h, v1.4h");
5336 COMPARE(Rev64(v4.V8H(), v2.V8H()), "rev64 v4.8h, v2.8h");
5337 COMPARE(Rev64(v5.V2S(), v3.V2S()), "rev64 v5.2s, v3.2s");
5338 COMPARE(Rev64(v6.V4S(), v4.V4S()), "rev64 v6.4s, v4.4s");
5339
5340 COMPARE(Rev32(v1.V8B(), v8.V8B()), "rev32 v1.8b, v8.8b");
5341 COMPARE(Rev32(v2.V16B(), v9.V16B()), "rev32 v2.16b, v9.16b");
5342 COMPARE(Rev32(v3.V4H(), v1.V4H()), "rev32 v3.4h, v1.4h");
5343 COMPARE(Rev32(v4.V8H(), v2.V8H()), "rev32 v4.8h, v2.8h");
5344
5345 COMPARE(Rev16(v1.V8B(), v8.V8B()), "rev16 v1.8b, v8.8b");
5346 COMPARE(Rev16(v2.V16B(), v9.V16B()), "rev16 v2.16b, v9.16b");
5347
5348 COMPARE(Rbit(v1.V8B(), v8.V8B()), "rbit v1.8b, v8.8b");
5349 COMPARE(Rbit(v2.V16B(), v9.V16B()), "rbit v2.16b, v9.16b");
5350
5351 COMPARE(Ursqrte(v2.V2S(), v9.V2S()), "ursqrte v2.2s, v9.2s");
5352 COMPARE(Ursqrte(v16.V4S(), v23.V4S()), "ursqrte v16.4s, v23.4s");
5353
5354 COMPARE(Urecpe(v2.V2S(), v9.V2S()), "urecpe v2.2s, v9.2s");
5355 COMPARE(Urecpe(v16.V4S(), v23.V4S()), "urecpe v16.4s, v23.4s");
5356
5357 COMPARE(Frsqrte(v2.V2S(), v9.V2S()), "frsqrte v2.2s, v9.2s");
5358 COMPARE(Frsqrte(v16.V4S(), v23.V4S()), "frsqrte v16.4s, v23.4s");
5359 COMPARE(Frsqrte(v2.V2D(), v9.V2D()), "frsqrte v2.2d, v9.2d");
5360 COMPARE(Frsqrte(v0.S(), v1.S()), "frsqrte s0, s1");
5361 COMPARE(Frsqrte(v0.D(), v1.D()), "frsqrte d0, d1");
5362
5363 COMPARE(Frecpe(v2.V2S(), v9.V2S()), "frecpe v2.2s, v9.2s");
5364 COMPARE(Frecpe(v16.V4S(), v23.V4S()), "frecpe v16.4s, v23.4s");
5365 COMPARE(Frecpe(v2.V2D(), v9.V2D()), "frecpe v2.2d, v9.2d");
5366 COMPARE(Frecpe(v0.S(), v1.S()), "frecpe s0, s1");
5367 COMPARE(Frecpe(v0.D(), v1.D()), "frecpe d0, d1");
5368
5369 COMPARE(Fabs(v2.V2S(), v9.V2S()), "fabs v2.2s, v9.2s");
5370 COMPARE(Fabs(v16.V4S(), v23.V4S()), "fabs v16.4s, v23.4s");
5371 COMPARE(Fabs(v31.V2D(), v30.V2D()), "fabs v31.2d, v30.2d");
5372
5373 COMPARE(Fneg(v2.V2S(), v9.V2S()), "fneg v2.2s, v9.2s");
5374 COMPARE(Fneg(v16.V4S(), v23.V4S()), "fneg v16.4s, v23.4s");
5375 COMPARE(Fneg(v31.V2D(), v30.V2D()), "fneg v31.2d, v30.2d");
5376
5377 COMPARE(Frintn(v2.V2S(), v9.V2S()), "frintn v2.2s, v9.2s");
5378 COMPARE(Frintn(v16.V4S(), v23.V4S()), "frintn v16.4s, v23.4s");
5379 COMPARE(Frintn(v31.V2D(), v30.V2D()), "frintn v31.2d, v30.2d");
5380
5381 COMPARE(Frinta(v2.V2S(), v9.V2S()), "frinta v2.2s, v9.2s");
5382 COMPARE(Frinta(v16.V4S(), v23.V4S()), "frinta v16.4s, v23.4s");
5383 COMPARE(Frinta(v31.V2D(), v30.V2D()), "frinta v31.2d, v30.2d");
5384
5385 COMPARE(Frintp(v2.V2S(), v9.V2S()), "frintp v2.2s, v9.2s");
5386 COMPARE(Frintp(v16.V4S(), v23.V4S()), "frintp v16.4s, v23.4s");
5387 COMPARE(Frintp(v31.V2D(), v30.V2D()), "frintp v31.2d, v30.2d");
5388
5389 COMPARE(Frintm(v2.V2S(), v9.V2S()), "frintm v2.2s, v9.2s");
5390 COMPARE(Frintm(v16.V4S(), v23.V4S()), "frintm v16.4s, v23.4s");
5391 COMPARE(Frintm(v31.V2D(), v30.V2D()), "frintm v31.2d, v30.2d");
5392
5393 COMPARE(Frintx(v2.V2S(), v9.V2S()), "frintx v2.2s, v9.2s");
5394 COMPARE(Frintx(v16.V4S(), v23.V4S()), "frintx v16.4s, v23.4s");
5395 COMPARE(Frintx(v31.V2D(), v30.V2D()), "frintx v31.2d, v30.2d");
5396
5397 COMPARE(Frintz(v2.V2S(), v9.V2S()), "frintz v2.2s, v9.2s");
5398 COMPARE(Frintz(v16.V4S(), v23.V4S()), "frintz v16.4s, v23.4s");
5399 COMPARE(Frintz(v31.V2D(), v30.V2D()), "frintz v31.2d, v30.2d");
5400
5401 COMPARE(Frinti(v2.V2S(), v9.V2S()), "frinti v2.2s, v9.2s");
5402 COMPARE(Frinti(v16.V4S(), v23.V4S()), "frinti v16.4s, v23.4s");
5403 COMPARE(Frinti(v31.V2D(), v30.V2D()), "frinti v31.2d, v30.2d");
5404
5405 COMPARE(Fsqrt(v3.V2S(), v10.V2S()), "fsqrt v3.2s, v10.2s");
5406 COMPARE(Fsqrt(v22.V4S(), v11.V4S()), "fsqrt v22.4s, v11.4s");
5407 COMPARE(Fsqrt(v31.V2D(), v0.V2D()), "fsqrt v31.2d, v0.2d");
5408
5409 COMPARE(Fcvtns(v4.V2S(), v11.V2S()), "fcvtns v4.2s, v11.2s");
5410 COMPARE(Fcvtns(v23.V4S(), v12.V4S()), "fcvtns v23.4s, v12.4s");
5411 COMPARE(Fcvtns(v30.V2D(), v1.V2D()), "fcvtns v30.2d, v1.2d");
5412 COMPARE(Fcvtnu(v4.V2S(), v11.V2S()), "fcvtnu v4.2s, v11.2s");
5413 COMPARE(Fcvtnu(v23.V4S(), v12.V4S()), "fcvtnu v23.4s, v12.4s");
5414 COMPARE(Fcvtnu(v30.V2D(), v1.V2D()), "fcvtnu v30.2d, v1.2d");
5415
5416 COMPARE(Fcvtps(v4.V2S(), v11.V2S()), "fcvtps v4.2s, v11.2s");
5417 COMPARE(Fcvtps(v23.V4S(), v12.V4S()), "fcvtps v23.4s, v12.4s");
5418 COMPARE(Fcvtps(v30.V2D(), v1.V2D()), "fcvtps v30.2d, v1.2d");
5419 COMPARE(Fcvtpu(v4.V2S(), v11.V2S()), "fcvtpu v4.2s, v11.2s");
5420 COMPARE(Fcvtpu(v23.V4S(), v12.V4S()), "fcvtpu v23.4s, v12.4s");
5421 COMPARE(Fcvtpu(v30.V2D(), v1.V2D()), "fcvtpu v30.2d, v1.2d");
5422
5423 COMPARE(Fcvtms(v4.V2S(), v11.V2S()), "fcvtms v4.2s, v11.2s");
5424 COMPARE(Fcvtms(v23.V4S(), v12.V4S()), "fcvtms v23.4s, v12.4s");
5425 COMPARE(Fcvtms(v30.V2D(), v1.V2D()), "fcvtms v30.2d, v1.2d");
5426 COMPARE(Fcvtmu(v4.V2S(), v11.V2S()), "fcvtmu v4.2s, v11.2s");
5427 COMPARE(Fcvtmu(v23.V4S(), v12.V4S()), "fcvtmu v23.4s, v12.4s");
5428 COMPARE(Fcvtmu(v30.V2D(), v1.V2D()), "fcvtmu v30.2d, v1.2d");
5429
5430 COMPARE(Fcvtzs(v4.V2S(), v11.V2S()), "fcvtzs v4.2s, v11.2s");
5431 COMPARE(Fcvtzs(v23.V4S(), v12.V4S()), "fcvtzs v23.4s, v12.4s");
5432 COMPARE(Fcvtzs(v30.V2D(), v1.V2D()), "fcvtzs v30.2d, v1.2d");
5433 COMPARE(Fcvtzu(v4.V2S(), v11.V2S()), "fcvtzu v4.2s, v11.2s");
5434 COMPARE(Fcvtzu(v23.V4S(), v12.V4S()), "fcvtzu v23.4s, v12.4s");
5435 COMPARE(Fcvtzu(v30.V2D(), v1.V2D()), "fcvtzu v30.2d, v1.2d");
5436
5437 COMPARE(Fcvtas(v4.V2S(), v11.V2S()), "fcvtas v4.2s, v11.2s");
5438 COMPARE(Fcvtas(v23.V4S(), v12.V4S()), "fcvtas v23.4s, v12.4s");
5439 COMPARE(Fcvtas(v30.V2D(), v1.V2D()), "fcvtas v30.2d, v1.2d");
5440 COMPARE(Fcvtau(v4.V2S(), v11.V2S()), "fcvtau v4.2s, v11.2s");
5441 COMPARE(Fcvtau(v23.V4S(), v12.V4S()), "fcvtau v23.4s, v12.4s");
5442 COMPARE(Fcvtau(v30.V2D(), v1.V2D()), "fcvtau v30.2d, v1.2d");
5443
5444 COMPARE(Fcvtns(s0, s1), "fcvtns s0, s1");
5445 COMPARE(Fcvtns(d2, d3), "fcvtns d2, d3");
5446 COMPARE(Fcvtnu(s4, s5), "fcvtnu s4, s5");
5447 COMPARE(Fcvtnu(d6, d7), "fcvtnu d6, d7");
5448 COMPARE(Fcvtps(s8, s9), "fcvtps s8, s9");
5449 COMPARE(Fcvtps(d10, d11), "fcvtps d10, d11");
5450 COMPARE(Fcvtpu(s12, s13), "fcvtpu s12, s13");
5451 COMPARE(Fcvtpu(d14, d15), "fcvtpu d14, d15");
5452 COMPARE(Fcvtms(s16, s17), "fcvtms s16, s17");
5453 COMPARE(Fcvtms(d18, d19), "fcvtms d18, d19");
5454 COMPARE(Fcvtmu(s20, s21), "fcvtmu s20, s21");
5455 COMPARE(Fcvtmu(d22, d23), "fcvtmu d22, d23");
5456 COMPARE(Fcvtzs(s24, s25), "fcvtzs s24, s25");
5457 COMPARE(Fcvtzs(d26, d27), "fcvtzs d26, d27");
5458 COMPARE(Fcvtzu(s28, s29), "fcvtzu s28, s29");
5459 COMPARE(Fcvtzu(d30, d31), "fcvtzu d30, d31");
5460 COMPARE(Fcvtas(s0, s1), "fcvtas s0, s1");
5461 COMPARE(Fcvtas(d2, d3), "fcvtas d2, d3");
5462 COMPARE(Fcvtau(s4, s5), "fcvtau s4, s5");
5463 COMPARE(Fcvtau(d6, d7), "fcvtau d6, d7");
5464
5465 COMPARE(Fcvtl(v3.V4S(), v5.V4H()), "fcvtl v3.4s, v5.4h");
5466 COMPARE(Fcvtl(v7.V2D(), v11.V2S()), "fcvtl v7.2d, v11.2s");
5467 COMPARE(Fcvtl2(v13.V4S(), v17.V8H()), "fcvtl2 v13.4s, v17.8h");
5468 COMPARE(Fcvtl2(v23.V2D(), v29.V4S()), "fcvtl2 v23.2d, v29.4s");
5469
5470 COMPARE(Fcvtn(v3.V4H(), v5.V4S()), "fcvtn v3.4h, v5.4s");
5471 COMPARE(Fcvtn(v7.V2S(), v11.V2D()), "fcvtn v7.2s, v11.2d");
5472 COMPARE(Fcvtn2(v13.V8H(), v17.V4S()), "fcvtn2 v13.8h, v17.4s");
5473 COMPARE(Fcvtn2(v23.V4S(), v29.V2D()), "fcvtn2 v23.4s, v29.2d");
5474
5475 COMPARE(Fcvtxn(v5.V2S(), v7.V2D()), "fcvtxn v5.2s, v7.2d");
5476 COMPARE(Fcvtxn2(v8.V4S(), v13.V2D()), "fcvtxn2 v8.4s, v13.2d");
5477 COMPARE(Fcvtxn(s17, d31), "fcvtxn s17, d31");
5478
5479 COMPARE(Frecpx(s0, s1), "frecpx s0, s1");
5480 COMPARE(Frecpx(s31, s30), "frecpx s31, s30");
5481 COMPARE(Frecpx(d2, d3), "frecpx d2, d3");
5482 COMPARE(Frecpx(d31, d30), "frecpx d31, d30");
5483
5484 COMPARE(Scvtf(v5.V2S(), v3.V2S()), "scvtf v5.2s, v3.2s");
5485 COMPARE(Scvtf(v6.V4S(), v4.V4S()), "scvtf v6.4s, v4.4s");
5486 COMPARE(Scvtf(v7.V2D(), v5.V2D()), "scvtf v7.2d, v5.2d");
5487 COMPARE(Scvtf(s8, s6), "scvtf s8, s6");
5488 COMPARE(Scvtf(d8, d6), "scvtf d8, d6");
5489
5490 COMPARE(Ucvtf(v5.V2S(), v3.V2S()), "ucvtf v5.2s, v3.2s");
5491 COMPARE(Ucvtf(v6.V4S(), v4.V4S()), "ucvtf v6.4s, v4.4s");
5492 COMPARE(Ucvtf(v7.V2D(), v5.V2D()), "ucvtf v7.2d, v5.2d");
5493 COMPARE(Ucvtf(s8, s6), "ucvtf s8, s6");
5494 COMPARE(Ucvtf(d8, d6), "ucvtf d8, d6");
5495
5496 #define DISASM_INST(TA, TAS, TB, TBS) \
5497 COMPARE(Saddlp(v0.TA, v1.TB), "saddlp v0." TAS ", v1." TBS);
5498 NEON_FORMAT_LIST_LP(DISASM_INST)
5499 #undef DISASM_INST
5500
5501 #define DISASM_INST(TA, TAS, TB, TBS) \
5502 COMPARE(Uaddlp(v0.TA, v1.TB), "uaddlp v0." TAS ", v1." TBS);
5503 NEON_FORMAT_LIST_LP(DISASM_INST)
5504 #undef DISASM_INST
5505
5506 #define DISASM_INST(TA, TAS, TB, TBS) \
5507 COMPARE(Sadalp(v0.TA, v1.TB), "sadalp v0." TAS ", v1." TBS);
5508 NEON_FORMAT_LIST_LP(DISASM_INST)
5509 #undef DISASM_INST
5510
5511 #define DISASM_INST(TA, TAS, TB, TBS) \
5512 COMPARE(Uadalp(v0.TA, v1.TB), "uadalp v0." TAS ", v1." TBS);
5513 NEON_FORMAT_LIST_LP(DISASM_INST)
5514 #undef DISASM_INST
5515
5516 CLEANUP();
5517}
5518
5519TEST(neon_acrosslanes) {
armvixl684cd2a2015-10-23 13:38:33 +01005520 SETUP_MACRO();
armvixl5289c592015-03-02 13:52:04 +00005521
5522 COMPARE(Smaxv(b4, v5.V8B()), "smaxv b4, v5.8b");
5523 COMPARE(Smaxv(b4, v5.V16B()), "smaxv b4, v5.16b");
5524 COMPARE(Smaxv(h4, v5.V4H()), "smaxv h4, v5.4h");
5525 COMPARE(Smaxv(h4, v5.V8H()), "smaxv h4, v5.8h");
5526 COMPARE(Smaxv(s4, v5.V4S()), "smaxv s4, v5.4s");
5527
5528 COMPARE(Sminv(b4, v5.V8B()), "sminv b4, v5.8b");
5529 COMPARE(Sminv(b4, v5.V16B()), "sminv b4, v5.16b");
5530 COMPARE(Sminv(h4, v5.V4H()), "sminv h4, v5.4h");
5531 COMPARE(Sminv(h4, v5.V8H()), "sminv h4, v5.8h");
5532 COMPARE(Sminv(s4, v5.V4S()), "sminv s4, v5.4s");
5533
5534 COMPARE(Umaxv(b4, v5.V8B()), "umaxv b4, v5.8b");
5535 COMPARE(Umaxv(b4, v5.V16B()), "umaxv b4, v5.16b");
5536 COMPARE(Umaxv(h4, v5.V4H()), "umaxv h4, v5.4h");
5537 COMPARE(Umaxv(h4, v5.V8H()), "umaxv h4, v5.8h");
5538 COMPARE(Umaxv(s4, v5.V4S()), "umaxv s4, v5.4s");
5539
5540 COMPARE(Uminv(b4, v5.V8B()), "uminv b4, v5.8b");
5541 COMPARE(Uminv(b4, v5.V16B()), "uminv b4, v5.16b");
5542 COMPARE(Uminv(h4, v5.V4H()), "uminv h4, v5.4h");
5543 COMPARE(Uminv(h4, v5.V8H()), "uminv h4, v5.8h");
5544 COMPARE(Uminv(s4, v5.V4S()), "uminv s4, v5.4s");
5545
5546 COMPARE(Addv(b4, v5.V8B()), "addv b4, v5.8b");
5547 COMPARE(Addv(b4, v5.V16B()), "addv b4, v5.16b");
5548 COMPARE(Addv(h4, v5.V4H()), "addv h4, v5.4h");
5549 COMPARE(Addv(h4, v5.V8H()), "addv h4, v5.8h");
5550 COMPARE(Addv(s4, v5.V4S()), "addv s4, v5.4s");
5551
5552 COMPARE(Saddlv(h4, v5.V8B()), "saddlv h4, v5.8b");
5553 COMPARE(Saddlv(h4, v5.V16B()), "saddlv h4, v5.16b");
5554 COMPARE(Saddlv(s4, v5.V4H()), "saddlv s4, v5.4h");
5555 COMPARE(Saddlv(s4, v5.V8H()), "saddlv s4, v5.8h");
5556 COMPARE(Saddlv(d4, v5.V4S()), "saddlv d4, v5.4s");
5557
5558 COMPARE(Uaddlv(h4, v5.V8B()), "uaddlv h4, v5.8b");
5559 COMPARE(Uaddlv(h4, v5.V16B()), "uaddlv h4, v5.16b");
5560 COMPARE(Uaddlv(s4, v5.V4H()), "uaddlv s4, v5.4h");
5561 COMPARE(Uaddlv(s4, v5.V8H()), "uaddlv s4, v5.8h");
5562 COMPARE(Uaddlv(d4, v5.V4S()), "uaddlv d4, v5.4s");
5563
5564 COMPARE(Fmaxv(s4, v5.V4S()), "fmaxv s4, v5.4s");
5565 COMPARE(Fminv(s4, v5.V4S()), "fminv s4, v5.4s");
5566 COMPARE(Fmaxnmv(s4, v5.V4S()), "fmaxnmv s4, v5.4s");
5567 COMPARE(Fminnmv(s4, v5.V4S()), "fminnmv s4, v5.4s");
5568
5569 CLEANUP();
5570}
5571
5572TEST(neon_scalar_pairwise) {
armvixl684cd2a2015-10-23 13:38:33 +01005573 SETUP_MACRO();
armvixl5289c592015-03-02 13:52:04 +00005574
5575 COMPARE(Addp(d0, v1.V2D()), "addp d0, v1.2d");
5576 COMPARE(Faddp(s0, v1.V2S()), "faddp s0, v1.2s");
5577 COMPARE(Faddp(d2, v3.V2D()), "faddp d2, v3.2d");
5578 COMPARE(Fmaxp(s4, v5.V2S()), "fmaxp s4, v5.2s");
5579 COMPARE(Fmaxp(d6, v7.V2D()), "fmaxp d6, v7.2d");
5580 COMPARE(Fmaxnmp(s8, v9.V2S()), "fmaxnmp s8, v9.2s");
5581 COMPARE(Fmaxnmp(d10, v11.V2D()), "fmaxnmp d10, v11.2d");
5582 COMPARE(Fminp(s12, v13.V2S()), "fminp s12, v13.2s");
5583 COMPARE(Fminp(d14, v15.V2D()), "fminp d14, v15.2d");
5584 COMPARE(Fminnmp(s16, v17.V2S()), "fminnmp s16, v17.2s");
5585 COMPARE(Fminnmp(d18, v19.V2D()), "fminnmp d18, v19.2d");
5586 CLEANUP();
5587}
5588
5589TEST(neon_shift_immediate) {
armvixl684cd2a2015-10-23 13:38:33 +01005590 SETUP_MACRO();
armvixl5289c592015-03-02 13:52:04 +00005591
5592 COMPARE(Sshr(v0.V8B(), v1.V8B(), 1), "sshr v0.8b, v1.8b, #1");
5593 COMPARE(Sshr(v2.V8B(), v3.V8B(), 8), "sshr v2.8b, v3.8b, #8");
5594 COMPARE(Sshr(v4.V16B(), v5.V16B(), 1), "sshr v4.16b, v5.16b, #1");
5595 COMPARE(Sshr(v6.V16B(), v7.V16B(), 8), "sshr v6.16b, v7.16b, #8");
5596 COMPARE(Sshr(v8.V4H(), v9.V4H(), 1), "sshr v8.4h, v9.4h, #1");
5597 COMPARE(Sshr(v10.V4H(), v11.V4H(), 16), "sshr v10.4h, v11.4h, #16");
5598 COMPARE(Sshr(v12.V8H(), v13.V8H(), 1), "sshr v12.8h, v13.8h, #1");
5599 COMPARE(Sshr(v14.V8H(), v15.V8H(), 16), "sshr v14.8h, v15.8h, #16");
5600 COMPARE(Sshr(v16.V2S(), v17.V2S(), 1), "sshr v16.2s, v17.2s, #1");
5601 COMPARE(Sshr(v18.V2S(), v19.V2S(), 32), "sshr v18.2s, v19.2s, #32");
5602 COMPARE(Sshr(v20.V4S(), v21.V4S(), 1), "sshr v20.4s, v21.4s, #1");
5603 COMPARE(Sshr(v22.V4S(), v23.V4S(), 32), "sshr v22.4s, v23.4s, #32");
5604 COMPARE(Sshr(v28.V2D(), v29.V2D(), 1), "sshr v28.2d, v29.2d, #1");
5605 COMPARE(Sshr(v30.V2D(), v31.V2D(), 64), "sshr v30.2d, v31.2d, #64");
5606 COMPARE(Sshr(d0, d1, 7), "sshr d0, d1, #7");
5607
5608 COMPARE(Ushr(v0.V8B(), v1.V8B(), 1), "ushr v0.8b, v1.8b, #1");
5609 COMPARE(Ushr(v2.V8B(), v3.V8B(), 8), "ushr v2.8b, v3.8b, #8");
5610 COMPARE(Ushr(v4.V16B(), v5.V16B(), 1), "ushr v4.16b, v5.16b, #1");
5611 COMPARE(Ushr(v6.V16B(), v7.V16B(), 8), "ushr v6.16b, v7.16b, #8");
5612 COMPARE(Ushr(v8.V4H(), v9.V4H(), 1), "ushr v8.4h, v9.4h, #1");
5613 COMPARE(Ushr(v10.V4H(), v11.V4H(), 16), "ushr v10.4h, v11.4h, #16");
5614 COMPARE(Ushr(v12.V8H(), v13.V8H(), 1), "ushr v12.8h, v13.8h, #1");
5615 COMPARE(Ushr(v14.V8H(), v15.V8H(), 16), "ushr v14.8h, v15.8h, #16");
5616 COMPARE(Ushr(v16.V2S(), v17.V2S(), 1), "ushr v16.2s, v17.2s, #1");
5617 COMPARE(Ushr(v18.V2S(), v19.V2S(), 32), "ushr v18.2s, v19.2s, #32");
5618 COMPARE(Ushr(v20.V4S(), v21.V4S(), 1), "ushr v20.4s, v21.4s, #1");
5619 COMPARE(Ushr(v22.V4S(), v23.V4S(), 32), "ushr v22.4s, v23.4s, #32");
5620 COMPARE(Ushr(v28.V2D(), v29.V2D(), 1), "ushr v28.2d, v29.2d, #1");
5621 COMPARE(Ushr(v30.V2D(), v31.V2D(), 64), "ushr v30.2d, v31.2d, #64");
5622 COMPARE(Ushr(d0, d1, 7), "ushr d0, d1, #7");
5623
5624 COMPARE(Srshr(v0.V8B(), v1.V8B(), 1), "srshr v0.8b, v1.8b, #1");
5625 COMPARE(Srshr(v2.V8B(), v3.V8B(), 8), "srshr v2.8b, v3.8b, #8");
5626 COMPARE(Srshr(v4.V16B(), v5.V16B(), 1), "srshr v4.16b, v5.16b, #1");
5627 COMPARE(Srshr(v6.V16B(), v7.V16B(), 8), "srshr v6.16b, v7.16b, #8");
5628 COMPARE(Srshr(v8.V4H(), v9.V4H(), 1), "srshr v8.4h, v9.4h, #1");
5629 COMPARE(Srshr(v10.V4H(), v11.V4H(), 16), "srshr v10.4h, v11.4h, #16");
5630 COMPARE(Srshr(v12.V8H(), v13.V8H(), 1), "srshr v12.8h, v13.8h, #1");
5631 COMPARE(Srshr(v14.V8H(), v15.V8H(), 16), "srshr v14.8h, v15.8h, #16");
5632 COMPARE(Srshr(v16.V2S(), v17.V2S(), 1), "srshr v16.2s, v17.2s, #1");
5633 COMPARE(Srshr(v18.V2S(), v19.V2S(), 32), "srshr v18.2s, v19.2s, #32");
5634 COMPARE(Srshr(v20.V4S(), v21.V4S(), 1), "srshr v20.4s, v21.4s, #1");
5635 COMPARE(Srshr(v22.V4S(), v23.V4S(), 32), "srshr v22.4s, v23.4s, #32");
5636 COMPARE(Srshr(v28.V2D(), v29.V2D(), 1), "srshr v28.2d, v29.2d, #1");
5637 COMPARE(Srshr(v30.V2D(), v31.V2D(), 64), "srshr v30.2d, v31.2d, #64");
5638 COMPARE(Srshr(d0, d1, 7), "srshr d0, d1, #7");
5639
5640 COMPARE(Urshr(v0.V8B(), v1.V8B(), 1), "urshr v0.8b, v1.8b, #1");
5641 COMPARE(Urshr(v2.V8B(), v3.V8B(), 8), "urshr v2.8b, v3.8b, #8");
5642 COMPARE(Urshr(v4.V16B(), v5.V16B(), 1), "urshr v4.16b, v5.16b, #1");
5643 COMPARE(Urshr(v6.V16B(), v7.V16B(), 8), "urshr v6.16b, v7.16b, #8");
5644 COMPARE(Urshr(v8.V4H(), v9.V4H(), 1), "urshr v8.4h, v9.4h, #1");
5645 COMPARE(Urshr(v10.V4H(), v11.V4H(), 16), "urshr v10.4h, v11.4h, #16");
5646 COMPARE(Urshr(v12.V8H(), v13.V8H(), 1), "urshr v12.8h, v13.8h, #1");
5647 COMPARE(Urshr(v14.V8H(), v15.V8H(), 16), "urshr v14.8h, v15.8h, #16");
5648 COMPARE(Urshr(v16.V2S(), v17.V2S(), 1), "urshr v16.2s, v17.2s, #1");
5649 COMPARE(Urshr(v18.V2S(), v19.V2S(), 32), "urshr v18.2s, v19.2s, #32");
5650 COMPARE(Urshr(v20.V4S(), v21.V4S(), 1), "urshr v20.4s, v21.4s, #1");
5651 COMPARE(Urshr(v22.V4S(), v23.V4S(), 32), "urshr v22.4s, v23.4s, #32");
5652 COMPARE(Urshr(v28.V2D(), v29.V2D(), 1), "urshr v28.2d, v29.2d, #1");
5653 COMPARE(Urshr(v30.V2D(), v31.V2D(), 64), "urshr v30.2d, v31.2d, #64");
5654 COMPARE(Urshr(d0, d1, 7), "urshr d0, d1, #7");
5655
5656 COMPARE(Srsra(v0.V8B(), v1.V8B(), 1), "srsra v0.8b, v1.8b, #1");
5657 COMPARE(Srsra(v2.V8B(), v3.V8B(), 8), "srsra v2.8b, v3.8b, #8");
5658 COMPARE(Srsra(v4.V16B(), v5.V16B(), 1), "srsra v4.16b, v5.16b, #1");
5659 COMPARE(Srsra(v6.V16B(), v7.V16B(), 8), "srsra v6.16b, v7.16b, #8");
5660 COMPARE(Srsra(v8.V4H(), v9.V4H(), 1), "srsra v8.4h, v9.4h, #1");
5661 COMPARE(Srsra(v10.V4H(), v11.V4H(), 16), "srsra v10.4h, v11.4h, #16");
5662 COMPARE(Srsra(v12.V8H(), v13.V8H(), 1), "srsra v12.8h, v13.8h, #1");
5663 COMPARE(Srsra(v14.V8H(), v15.V8H(), 16), "srsra v14.8h, v15.8h, #16");
5664 COMPARE(Srsra(v16.V2S(), v17.V2S(), 1), "srsra v16.2s, v17.2s, #1");
5665 COMPARE(Srsra(v18.V2S(), v19.V2S(), 32), "srsra v18.2s, v19.2s, #32");
5666 COMPARE(Srsra(v20.V4S(), v21.V4S(), 1), "srsra v20.4s, v21.4s, #1");
5667 COMPARE(Srsra(v22.V4S(), v23.V4S(), 32), "srsra v22.4s, v23.4s, #32");
5668 COMPARE(Srsra(v28.V2D(), v29.V2D(), 1), "srsra v28.2d, v29.2d, #1");
5669 COMPARE(Srsra(v30.V2D(), v31.V2D(), 64), "srsra v30.2d, v31.2d, #64");
5670 COMPARE(Srsra(d0, d1, 7), "srsra d0, d1, #7");
5671
5672 COMPARE(Ssra(v0.V8B(), v1.V8B(), 1), "ssra v0.8b, v1.8b, #1");
5673 COMPARE(Ssra(v2.V8B(), v3.V8B(), 8), "ssra v2.8b, v3.8b, #8");
5674 COMPARE(Ssra(v4.V16B(), v5.V16B(), 1), "ssra v4.16b, v5.16b, #1");
5675 COMPARE(Ssra(v6.V16B(), v7.V16B(), 8), "ssra v6.16b, v7.16b, #8");
5676 COMPARE(Ssra(v8.V4H(), v9.V4H(), 1), "ssra v8.4h, v9.4h, #1");
5677 COMPARE(Ssra(v10.V4H(), v11.V4H(), 16), "ssra v10.4h, v11.4h, #16");
5678 COMPARE(Ssra(v12.V8H(), v13.V8H(), 1), "ssra v12.8h, v13.8h, #1");
5679 COMPARE(Ssra(v14.V8H(), v15.V8H(), 16), "ssra v14.8h, v15.8h, #16");
5680 COMPARE(Ssra(v16.V2S(), v17.V2S(), 1), "ssra v16.2s, v17.2s, #1");
5681 COMPARE(Ssra(v18.V2S(), v19.V2S(), 32), "ssra v18.2s, v19.2s, #32");
5682 COMPARE(Ssra(v20.V4S(), v21.V4S(), 1), "ssra v20.4s, v21.4s, #1");
5683 COMPARE(Ssra(v22.V4S(), v23.V4S(), 32), "ssra v22.4s, v23.4s, #32");
5684 COMPARE(Ssra(v28.V2D(), v29.V2D(), 1), "ssra v28.2d, v29.2d, #1");
5685 COMPARE(Ssra(v30.V2D(), v31.V2D(), 64), "ssra v30.2d, v31.2d, #64");
5686 COMPARE(Ssra(d0, d1, 7), "ssra d0, d1, #7");
5687
5688 COMPARE(Ursra(v0.V8B(), v1.V8B(), 1), "ursra v0.8b, v1.8b, #1");
5689 COMPARE(Ursra(v2.V8B(), v3.V8B(), 8), "ursra v2.8b, v3.8b, #8");
5690 COMPARE(Ursra(v4.V16B(), v5.V16B(), 1), "ursra v4.16b, v5.16b, #1");
5691 COMPARE(Ursra(v6.V16B(), v7.V16B(), 8), "ursra v6.16b, v7.16b, #8");
5692 COMPARE(Ursra(v8.V4H(), v9.V4H(), 1), "ursra v8.4h, v9.4h, #1");
5693 COMPARE(Ursra(v10.V4H(), v11.V4H(), 16), "ursra v10.4h, v11.4h, #16");
5694 COMPARE(Ursra(v12.V8H(), v13.V8H(), 1), "ursra v12.8h, v13.8h, #1");
5695 COMPARE(Ursra(v14.V8H(), v15.V8H(), 16), "ursra v14.8h, v15.8h, #16");
5696 COMPARE(Ursra(v16.V2S(), v17.V2S(), 1), "ursra v16.2s, v17.2s, #1");
5697 COMPARE(Ursra(v18.V2S(), v19.V2S(), 32), "ursra v18.2s, v19.2s, #32");
5698 COMPARE(Ursra(v20.V4S(), v21.V4S(), 1), "ursra v20.4s, v21.4s, #1");
5699 COMPARE(Ursra(v22.V4S(), v23.V4S(), 32), "ursra v22.4s, v23.4s, #32");
5700 COMPARE(Ursra(v28.V2D(), v29.V2D(), 1), "ursra v28.2d, v29.2d, #1");
5701 COMPARE(Ursra(v30.V2D(), v31.V2D(), 64), "ursra v30.2d, v31.2d, #64");
5702 COMPARE(Ursra(d0, d1, 7), "ursra d0, d1, #7");
5703
5704 COMPARE(Usra(v0.V8B(), v1.V8B(), 1), "usra v0.8b, v1.8b, #1");
5705 COMPARE(Usra(v2.V8B(), v3.V8B(), 8), "usra v2.8b, v3.8b, #8");
5706 COMPARE(Usra(v4.V16B(), v5.V16B(), 1), "usra v4.16b, v5.16b, #1");
5707 COMPARE(Usra(v6.V16B(), v7.V16B(), 8), "usra v6.16b, v7.16b, #8");
5708 COMPARE(Usra(v8.V4H(), v9.V4H(), 1), "usra v8.4h, v9.4h, #1");
5709 COMPARE(Usra(v10.V4H(), v11.V4H(), 16), "usra v10.4h, v11.4h, #16");
5710 COMPARE(Usra(v12.V8H(), v13.V8H(), 1), "usra v12.8h, v13.8h, #1");
5711 COMPARE(Usra(v14.V8H(), v15.V8H(), 16), "usra v14.8h, v15.8h, #16");
5712 COMPARE(Usra(v16.V2S(), v17.V2S(), 1), "usra v16.2s, v17.2s, #1");
5713 COMPARE(Usra(v18.V2S(), v19.V2S(), 32), "usra v18.2s, v19.2s, #32");
5714 COMPARE(Usra(v20.V4S(), v21.V4S(), 1), "usra v20.4s, v21.4s, #1");
5715 COMPARE(Usra(v22.V4S(), v23.V4S(), 32), "usra v22.4s, v23.4s, #32");
5716 COMPARE(Usra(v28.V2D(), v29.V2D(), 1), "usra v28.2d, v29.2d, #1");
5717 COMPARE(Usra(v30.V2D(), v31.V2D(), 64), "usra v30.2d, v31.2d, #64");
5718 COMPARE(Usra(d0, d1, 7), "usra d0, d1, #7");
5719
5720 COMPARE(Sli(v1.V8B(), v8.V8B(), 1), "sli v1.8b, v8.8b, #1");
5721 COMPARE(Sli(v2.V16B(), v9.V16B(), 2), "sli v2.16b, v9.16b, #2");
5722 COMPARE(Sli(v3.V4H(), v1.V4H(), 3), "sli v3.4h, v1.4h, #3");
5723 COMPARE(Sli(v4.V8H(), v2.V8H(), 4), "sli v4.8h, v2.8h, #4");
5724 COMPARE(Sli(v5.V2S(), v3.V2S(), 5), "sli v5.2s, v3.2s, #5");
5725 COMPARE(Sli(v6.V4S(), v4.V4S(), 6), "sli v6.4s, v4.4s, #6");
5726 COMPARE(Sli(v7.V2D(), v5.V2D(), 7), "sli v7.2d, v5.2d, #7");
5727 COMPARE(Sli(d8, d6, 8), "sli d8, d6, #8");
5728
5729 COMPARE(Shl(v1.V8B(), v8.V8B(), 1), "shl v1.8b, v8.8b, #1");
5730 COMPARE(Shl(v2.V16B(), v9.V16B(), 2), "shl v2.16b, v9.16b, #2");
5731 COMPARE(Shl(v3.V4H(), v1.V4H(), 3), "shl v3.4h, v1.4h, #3");
5732 COMPARE(Shl(v4.V8H(), v2.V8H(), 4), "shl v4.8h, v2.8h, #4");
5733 COMPARE(Shl(v5.V2S(), v3.V2S(), 5), "shl v5.2s, v3.2s, #5");
5734 COMPARE(Shl(v6.V4S(), v4.V4S(), 6), "shl v6.4s, v4.4s, #6");
5735 COMPARE(Shl(v7.V2D(), v5.V2D(), 7), "shl v7.2d, v5.2d, #7");
5736 COMPARE(Shl(d8, d6, 8), "shl d8, d6, #8");
5737
5738 COMPARE(Sqshl(v1.V8B(), v8.V8B(), 1), "sqshl v1.8b, v8.8b, #1");
5739 COMPARE(Sqshl(v2.V16B(), v9.V16B(), 2), "sqshl v2.16b, v9.16b, #2");
5740 COMPARE(Sqshl(v3.V4H(), v1.V4H(), 3), "sqshl v3.4h, v1.4h, #3");
5741 COMPARE(Sqshl(v4.V8H(), v2.V8H(), 4), "sqshl v4.8h, v2.8h, #4");
5742 COMPARE(Sqshl(v5.V2S(), v3.V2S(), 5), "sqshl v5.2s, v3.2s, #5");
5743 COMPARE(Sqshl(v6.V4S(), v4.V4S(), 6), "sqshl v6.4s, v4.4s, #6");
5744 COMPARE(Sqshl(v7.V2D(), v5.V2D(), 7), "sqshl v7.2d, v5.2d, #7");
5745 COMPARE(Sqshl(b8, b7, 1), "sqshl b8, b7, #1");
5746 COMPARE(Sqshl(h9, h8, 2), "sqshl h9, h8, #2");
5747 COMPARE(Sqshl(s10, s9, 3), "sqshl s10, s9, #3");
5748 COMPARE(Sqshl(d11, d10, 4), "sqshl d11, d10, #4");
5749
5750 COMPARE(Sqshlu(v1.V8B(), v8.V8B(), 1), "sqshlu v1.8b, v8.8b, #1");
5751 COMPARE(Sqshlu(v2.V16B(), v9.V16B(), 2), "sqshlu v2.16b, v9.16b, #2");
5752 COMPARE(Sqshlu(v3.V4H(), v1.V4H(), 3), "sqshlu v3.4h, v1.4h, #3");
5753 COMPARE(Sqshlu(v4.V8H(), v2.V8H(), 4), "sqshlu v4.8h, v2.8h, #4");
5754 COMPARE(Sqshlu(v5.V2S(), v3.V2S(), 5), "sqshlu v5.2s, v3.2s, #5");
5755 COMPARE(Sqshlu(v6.V4S(), v4.V4S(), 6), "sqshlu v6.4s, v4.4s, #6");
5756 COMPARE(Sqshlu(v7.V2D(), v5.V2D(), 7), "sqshlu v7.2d, v5.2d, #7");
5757 COMPARE(Sqshlu(b8, b7, 1), "sqshlu b8, b7, #1");
5758 COMPARE(Sqshlu(h9, h8, 2), "sqshlu h9, h8, #2");
5759 COMPARE(Sqshlu(s10, s9, 3), "sqshlu s10, s9, #3");
5760 COMPARE(Sqshlu(d11, d10, 4), "sqshlu d11, d10, #4");
5761
5762 COMPARE(Uqshl(v1.V8B(), v8.V8B(), 1), "uqshl v1.8b, v8.8b, #1");
5763 COMPARE(Uqshl(v2.V16B(), v9.V16B(), 2), "uqshl v2.16b, v9.16b, #2");
5764 COMPARE(Uqshl(v3.V4H(), v1.V4H(), 3), "uqshl v3.4h, v1.4h, #3");
5765 COMPARE(Uqshl(v4.V8H(), v2.V8H(), 4), "uqshl v4.8h, v2.8h, #4");
5766 COMPARE(Uqshl(v5.V2S(), v3.V2S(), 5), "uqshl v5.2s, v3.2s, #5");
5767 COMPARE(Uqshl(v6.V4S(), v4.V4S(), 6), "uqshl v6.4s, v4.4s, #6");
5768 COMPARE(Uqshl(v7.V2D(), v5.V2D(), 7), "uqshl v7.2d, v5.2d, #7");
5769 COMPARE(Uqshl(b8, b7, 1), "uqshl b8, b7, #1");
5770 COMPARE(Uqshl(h9, h8, 2), "uqshl h9, h8, #2");
5771 COMPARE(Uqshl(s10, s9, 3), "uqshl s10, s9, #3");
5772 COMPARE(Uqshl(d11, d10, 4), "uqshl d11, d10, #4");
5773
5774 COMPARE(Sshll(v1.V8H(), v8.V8B(), 1), "sshll v1.8h, v8.8b, #1");
5775 COMPARE(Sshll(v3.V4S(), v1.V4H(), 3), "sshll v3.4s, v1.4h, #3");
5776 COMPARE(Sshll(v5.V2D(), v3.V2S(), 5), "sshll v5.2d, v3.2s, #5");
5777 COMPARE(Sshll2(v2.V8H(), v9.V16B(), 2), "sshll2 v2.8h, v9.16b, #2");
5778 COMPARE(Sshll2(v4.V4S(), v2.V8H(), 4), "sshll2 v4.4s, v2.8h, #4");
5779 COMPARE(Sshll2(v6.V2D(), v4.V4S(), 6), "sshll2 v6.2d, v4.4s, #6");
5780
5781 COMPARE(Sshll(v1.V8H(), v8.V8B(), 0), "sxtl v1.8h, v8.8b");
5782 COMPARE(Sshll(v3.V4S(), v1.V4H(), 0), "sxtl v3.4s, v1.4h");
5783 COMPARE(Sshll(v5.V2D(), v3.V2S(), 0), "sxtl v5.2d, v3.2s");
5784 COMPARE(Sshll2(v2.V8H(), v9.V16B(), 0), "sxtl2 v2.8h, v9.16b");
5785 COMPARE(Sshll2(v4.V4S(), v2.V8H(), 0), "sxtl2 v4.4s, v2.8h");
5786 COMPARE(Sshll2(v6.V2D(), v4.V4S(), 0), "sxtl2 v6.2d, v4.4s");
5787
5788 COMPARE(Sxtl(v1.V8H(), v8.V8B()), "sxtl v1.8h, v8.8b");
5789 COMPARE(Sxtl(v3.V4S(), v1.V4H()), "sxtl v3.4s, v1.4h");
5790 COMPARE(Sxtl(v5.V2D(), v3.V2S()), "sxtl v5.2d, v3.2s");
5791 COMPARE(Sxtl2(v2.V8H(), v9.V16B()), "sxtl2 v2.8h, v9.16b");
5792 COMPARE(Sxtl2(v4.V4S(), v2.V8H()), "sxtl2 v4.4s, v2.8h");
5793 COMPARE(Sxtl2(v6.V2D(), v4.V4S()), "sxtl2 v6.2d, v4.4s");
5794
5795 COMPARE(Ushll(v1.V8H(), v8.V8B(), 1), "ushll v1.8h, v8.8b, #1");
5796 COMPARE(Ushll(v3.V4S(), v1.V4H(), 3), "ushll v3.4s, v1.4h, #3");
5797 COMPARE(Ushll(v5.V2D(), v3.V2S(), 5), "ushll v5.2d, v3.2s, #5");
5798 COMPARE(Ushll2(v2.V8H(), v9.V16B(), 2), "ushll2 v2.8h, v9.16b, #2");
5799 COMPARE(Ushll2(v4.V4S(), v2.V8H(), 4), "ushll2 v4.4s, v2.8h, #4");
5800 COMPARE(Ushll2(v6.V2D(), v4.V4S(), 6), "ushll2 v6.2d, v4.4s, #6");
5801
5802 COMPARE(Ushll(v1.V8H(), v8.V8B(), 0), "uxtl v1.8h, v8.8b");
5803 COMPARE(Ushll(v3.V4S(), v1.V4H(), 0), "uxtl v3.4s, v1.4h");
5804 COMPARE(Ushll(v5.V2D(), v3.V2S(), 0), "uxtl v5.2d, v3.2s");
5805 COMPARE(Ushll2(v2.V8H(), v9.V16B(), 0), "uxtl2 v2.8h, v9.16b");
5806 COMPARE(Ushll2(v4.V4S(), v2.V8H(), 0), "uxtl2 v4.4s, v2.8h");
5807 COMPARE(Ushll2(v6.V2D(), v4.V4S(), 0), "uxtl2 v6.2d, v4.4s");
5808
5809 COMPARE(Uxtl(v1.V8H(), v8.V8B()), "uxtl v1.8h, v8.8b");
5810 COMPARE(Uxtl(v3.V4S(), v1.V4H()), "uxtl v3.4s, v1.4h");
5811 COMPARE(Uxtl(v5.V2D(), v3.V2S()), "uxtl v5.2d, v3.2s");
5812 COMPARE(Uxtl2(v2.V8H(), v9.V16B()), "uxtl2 v2.8h, v9.16b");
5813 COMPARE(Uxtl2(v4.V4S(), v2.V8H()), "uxtl2 v4.4s, v2.8h");
5814 COMPARE(Uxtl2(v6.V2D(), v4.V4S()), "uxtl2 v6.2d, v4.4s");
5815
5816 COMPARE(Sri(v1.V8B(), v8.V8B(), 1), "sri v1.8b, v8.8b, #1");
5817 COMPARE(Sri(v2.V16B(), v9.V16B(), 2), "sri v2.16b, v9.16b, #2");
5818 COMPARE(Sri(v3.V4H(), v1.V4H(), 3), "sri v3.4h, v1.4h, #3");
5819 COMPARE(Sri(v4.V8H(), v2.V8H(), 4), "sri v4.8h, v2.8h, #4");
5820 COMPARE(Sri(v5.V2S(), v3.V2S(), 5), "sri v5.2s, v3.2s, #5");
5821 COMPARE(Sri(v6.V4S(), v4.V4S(), 6), "sri v6.4s, v4.4s, #6");
5822 COMPARE(Sri(v7.V2D(), v5.V2D(), 7), "sri v7.2d, v5.2d, #7");
5823 COMPARE(Sri(d8, d6, 8), "sri d8, d6, #8");
5824
5825 COMPARE(Shrn(v0.V8B(), v1.V8H(), 1), "shrn v0.8b, v1.8h, #1");
5826 COMPARE(Shrn(v1.V4H(), v2.V4S(), 2), "shrn v1.4h, v2.4s, #2");
5827 COMPARE(Shrn(v2.V2S(), v3.V2D(), 3), "shrn v2.2s, v3.2d, #3");
5828 COMPARE(Shrn2(v0.V16B(), v1.V8H(), 4), "shrn2 v0.16b, v1.8h, #4");
5829 COMPARE(Shrn2(v1.V8H(), v2.V4S(), 5), "shrn2 v1.8h, v2.4s, #5");
5830 COMPARE(Shrn2(v2.V4S(), v3.V2D(), 6), "shrn2 v2.4s, v3.2d, #6");
5831
5832 COMPARE(Rshrn(v0.V8B(), v1.V8H(), 1), "rshrn v0.8b, v1.8h, #1");
5833 COMPARE(Rshrn(v1.V4H(), v2.V4S(), 2), "rshrn v1.4h, v2.4s, #2");
5834 COMPARE(Rshrn(v2.V2S(), v3.V2D(), 3), "rshrn v2.2s, v3.2d, #3");
5835 COMPARE(Rshrn2(v0.V16B(), v1.V8H(), 4), "rshrn2 v0.16b, v1.8h, #4");
5836 COMPARE(Rshrn2(v1.V8H(), v2.V4S(), 5), "rshrn2 v1.8h, v2.4s, #5");
5837 COMPARE(Rshrn2(v2.V4S(), v3.V2D(), 6), "rshrn2 v2.4s, v3.2d, #6");
5838
5839 COMPARE(Uqshrn(v0.V8B(), v1.V8H(), 1), "uqshrn v0.8b, v1.8h, #1");
5840 COMPARE(Uqshrn(v1.V4H(), v2.V4S(), 2), "uqshrn v1.4h, v2.4s, #2");
5841 COMPARE(Uqshrn(v2.V2S(), v3.V2D(), 3), "uqshrn v2.2s, v3.2d, #3");
5842 COMPARE(Uqshrn2(v0.V16B(), v1.V8H(), 4), "uqshrn2 v0.16b, v1.8h, #4");
5843 COMPARE(Uqshrn2(v1.V8H(), v2.V4S(), 5), "uqshrn2 v1.8h, v2.4s, #5");
5844 COMPARE(Uqshrn2(v2.V4S(), v3.V2D(), 6), "uqshrn2 v2.4s, v3.2d, #6");
5845 COMPARE(Uqshrn(b0, h1, 1), "uqshrn b0, h1, #1");
5846 COMPARE(Uqshrn(h1, s2, 2), "uqshrn h1, s2, #2");
5847 COMPARE(Uqshrn(s2, d3, 3), "uqshrn s2, d3, #3");
5848
5849 COMPARE(Uqrshrn(v0.V8B(), v1.V8H(), 1), "uqrshrn v0.8b, v1.8h, #1");
5850 COMPARE(Uqrshrn(v1.V4H(), v2.V4S(), 2), "uqrshrn v1.4h, v2.4s, #2");
5851 COMPARE(Uqrshrn(v2.V2S(), v3.V2D(), 3), "uqrshrn v2.2s, v3.2d, #3");
5852 COMPARE(Uqrshrn2(v0.V16B(), v1.V8H(), 4), "uqrshrn2 v0.16b, v1.8h, #4");
5853 COMPARE(Uqrshrn2(v1.V8H(), v2.V4S(), 5), "uqrshrn2 v1.8h, v2.4s, #5");
5854 COMPARE(Uqrshrn2(v2.V4S(), v3.V2D(), 6), "uqrshrn2 v2.4s, v3.2d, #6");
5855 COMPARE(Uqrshrn(b0, h1, 1), "uqrshrn b0, h1, #1");
5856 COMPARE(Uqrshrn(h1, s2, 2), "uqrshrn h1, s2, #2");
5857 COMPARE(Uqrshrn(s2, d3, 3), "uqrshrn s2, d3, #3");
5858
5859 COMPARE(Sqshrn(v0.V8B(), v1.V8H(), 1), "sqshrn v0.8b, v1.8h, #1");
5860 COMPARE(Sqshrn(v1.V4H(), v2.V4S(), 2), "sqshrn v1.4h, v2.4s, #2");
5861 COMPARE(Sqshrn(v2.V2S(), v3.V2D(), 3), "sqshrn v2.2s, v3.2d, #3");
5862 COMPARE(Sqshrn2(v0.V16B(), v1.V8H(), 4), "sqshrn2 v0.16b, v1.8h, #4");
5863 COMPARE(Sqshrn2(v1.V8H(), v2.V4S(), 5), "sqshrn2 v1.8h, v2.4s, #5");
5864 COMPARE(Sqshrn2(v2.V4S(), v3.V2D(), 6), "sqshrn2 v2.4s, v3.2d, #6");
5865 COMPARE(Sqshrn(b0, h1, 1), "sqshrn b0, h1, #1");
5866 COMPARE(Sqshrn(h1, s2, 2), "sqshrn h1, s2, #2");
5867 COMPARE(Sqshrn(s2, d3, 3), "sqshrn s2, d3, #3");
5868
5869 COMPARE(Sqrshrn(v0.V8B(), v1.V8H(), 1), "sqrshrn v0.8b, v1.8h, #1");
5870 COMPARE(Sqrshrn(v1.V4H(), v2.V4S(), 2), "sqrshrn v1.4h, v2.4s, #2");
5871 COMPARE(Sqrshrn(v2.V2S(), v3.V2D(), 3), "sqrshrn v2.2s, v3.2d, #3");
5872 COMPARE(Sqrshrn2(v0.V16B(), v1.V8H(), 4), "sqrshrn2 v0.16b, v1.8h, #4");
5873 COMPARE(Sqrshrn2(v1.V8H(), v2.V4S(), 5), "sqrshrn2 v1.8h, v2.4s, #5");
5874 COMPARE(Sqrshrn2(v2.V4S(), v3.V2D(), 6), "sqrshrn2 v2.4s, v3.2d, #6");
5875 COMPARE(Sqrshrn(b0, h1, 1), "sqrshrn b0, h1, #1");
5876 COMPARE(Sqrshrn(h1, s2, 2), "sqrshrn h1, s2, #2");
5877 COMPARE(Sqrshrn(s2, d3, 3), "sqrshrn s2, d3, #3");
5878
5879 COMPARE(Sqshrun(v0.V8B(), v1.V8H(), 1), "sqshrun v0.8b, v1.8h, #1");
5880 COMPARE(Sqshrun(v1.V4H(), v2.V4S(), 2), "sqshrun v1.4h, v2.4s, #2");
5881 COMPARE(Sqshrun(v2.V2S(), v3.V2D(), 3), "sqshrun v2.2s, v3.2d, #3");
5882 COMPARE(Sqshrun2(v0.V16B(), v1.V8H(), 4), "sqshrun2 v0.16b, v1.8h, #4");
5883 COMPARE(Sqshrun2(v1.V8H(), v2.V4S(), 5), "sqshrun2 v1.8h, v2.4s, #5");
5884 COMPARE(Sqshrun2(v2.V4S(), v3.V2D(), 6), "sqshrun2 v2.4s, v3.2d, #6");
5885 COMPARE(Sqshrun(b0, h1, 1), "sqshrun b0, h1, #1");
5886 COMPARE(Sqshrun(h1, s2, 2), "sqshrun h1, s2, #2");
5887 COMPARE(Sqshrun(s2, d3, 3), "sqshrun s2, d3, #3");
5888
5889 COMPARE(Sqrshrun(v0.V8B(), v1.V8H(), 1), "sqrshrun v0.8b, v1.8h, #1");
5890 COMPARE(Sqrshrun(v1.V4H(), v2.V4S(), 2), "sqrshrun v1.4h, v2.4s, #2");
5891 COMPARE(Sqrshrun(v2.V2S(), v3.V2D(), 3), "sqrshrun v2.2s, v3.2d, #3");
5892 COMPARE(Sqrshrun2(v0.V16B(), v1.V8H(), 4), "sqrshrun2 v0.16b, v1.8h, #4");
5893 COMPARE(Sqrshrun2(v1.V8H(), v2.V4S(), 5), "sqrshrun2 v1.8h, v2.4s, #5");
5894 COMPARE(Sqrshrun2(v2.V4S(), v3.V2D(), 6), "sqrshrun2 v2.4s, v3.2d, #6");
5895 COMPARE(Sqrshrun(b0, h1, 1), "sqrshrun b0, h1, #1");
5896 COMPARE(Sqrshrun(h1, s2, 2), "sqrshrun h1, s2, #2");
5897 COMPARE(Sqrshrun(s2, d3, 3), "sqrshrun s2, d3, #3");
5898
5899 COMPARE(Scvtf(v5.V2S(), v3.V2S(), 11), "scvtf v5.2s, v3.2s, #11");
5900 COMPARE(Scvtf(v6.V4S(), v4.V4S(), 12), "scvtf v6.4s, v4.4s, #12");
5901 COMPARE(Scvtf(v7.V2D(), v5.V2D(), 33), "scvtf v7.2d, v5.2d, #33");
5902 COMPARE(Scvtf(s8, s6, 13), "scvtf s8, s6, #13");
5903 COMPARE(Scvtf(d8, d6, 34), "scvtf d8, d6, #34");
5904
5905 COMPARE(Ucvtf(v5.V2S(), v3.V2S(), 11), "ucvtf v5.2s, v3.2s, #11");
5906 COMPARE(Ucvtf(v6.V4S(), v4.V4S(), 12), "ucvtf v6.4s, v4.4s, #12");
5907 COMPARE(Ucvtf(v7.V2D(), v5.V2D(), 33), "ucvtf v7.2d, v5.2d, #33");
5908 COMPARE(Ucvtf(s8, s6, 13), "ucvtf s8, s6, #13");
5909 COMPARE(Ucvtf(d8, d6, 34), "ucvtf d8, d6, #34");
5910
5911 COMPARE(Fcvtzs(v5.V2S(), v3.V2S(), 11), "fcvtzs v5.2s, v3.2s, #11");
5912 COMPARE(Fcvtzs(v6.V4S(), v4.V4S(), 12), "fcvtzs v6.4s, v4.4s, #12");
5913 COMPARE(Fcvtzs(v7.V2D(), v5.V2D(), 33), "fcvtzs v7.2d, v5.2d, #33");
5914 COMPARE(Fcvtzs(s8, s6, 13), "fcvtzs s8, s6, #13");
5915 COMPARE(Fcvtzs(d8, d6, 34), "fcvtzs d8, d6, #34");
5916
5917 COMPARE(Fcvtzu(v5.V2S(), v3.V2S(), 11), "fcvtzu v5.2s, v3.2s, #11");
5918 COMPARE(Fcvtzu(v6.V4S(), v4.V4S(), 12), "fcvtzu v6.4s, v4.4s, #12");
5919 COMPARE(Fcvtzu(v7.V2D(), v5.V2D(), 33), "fcvtzu v7.2d, v5.2d, #33");
5920 COMPARE(Fcvtzu(s8, s6, 13), "fcvtzu s8, s6, #13");
5921 COMPARE(Fcvtzu(d8, d6, 34), "fcvtzu d8, d6, #34");
5922
5923 CLEANUP();
5924}
5925
armvixl330dc712014-11-25 10:38:32 +00005926TEST(address_map) {
5927 // Check that we can disassemble from a fake base address.
5928 SETUP();
5929
5930 disasm->MapCodeAddress(0, reinterpret_cast<Instruction*>(buf));
5931 COMPARE(ldr(x0, 0), "ldr x0, pc+0 (addr 0x0)");
5932 COMPARE(ldr(x0, -1), "ldr x0, pc-4 (addr -0x4)");
5933 COMPARE(ldr(x0, 1), "ldr x0, pc+4 (addr 0x4)");
5934 COMPARE(prfm(PLIL1KEEP, 0), "prfm plil1keep, pc+0 (addr 0x0)");
5935 COMPARE(prfm(PLIL1KEEP, -1), "prfm plil1keep, pc-4 (addr -0x4)");
5936 COMPARE(prfm(PLIL1KEEP, 1), "prfm plil1keep, pc+4 (addr 0x4)");
5937 COMPARE(adr(x0, 0), "adr x0, #+0x0 (addr 0x0)");
5938 COMPARE(adr(x0, -1), "adr x0, #-0x1 (addr -0x1)");
5939 COMPARE(adr(x0, 1), "adr x0, #+0x1 (addr 0x1)");
5940 COMPARE(adrp(x0, 0), "adrp x0, #+0x0 (addr 0x0)");
5941 COMPARE(adrp(x0, -1), "adrp x0, #-0x1000 (addr -0x1000)");
5942 COMPARE(adrp(x0, 1), "adrp x0, #+0x1000 (addr 0x1000)");
5943 COMPARE(b(0), "b #+0x0 (addr 0x0)");
5944 COMPARE(b(-1), "b #-0x4 (addr -0x4)");
5945 COMPARE(b(1), "b #+0x4 (addr 0x4)");
5946
5947 disasm->MapCodeAddress(0x1234, reinterpret_cast<Instruction*>(buf));
5948 COMPARE(ldr(x0, 0), "ldr x0, pc+0 (addr 0x1234)");
5949 COMPARE(ldr(x0, -1), "ldr x0, pc-4 (addr 0x1230)");
5950 COMPARE(ldr(x0, 1), "ldr x0, pc+4 (addr 0x1238)");
5951 COMPARE(prfm(PLIL1KEEP, 0), "prfm plil1keep, pc+0 (addr 0x1234)");
5952 COMPARE(prfm(PLIL1KEEP, -1), "prfm plil1keep, pc-4 (addr 0x1230)");
5953 COMPARE(prfm(PLIL1KEEP, 1), "prfm plil1keep, pc+4 (addr 0x1238)");
5954 COMPARE(adr(x0, 0), "adr x0, #+0x0 (addr 0x1234)");
5955 COMPARE(adr(x0, -1), "adr x0, #-0x1 (addr 0x1233)");
5956 COMPARE(adr(x0, 1), "adr x0, #+0x1 (addr 0x1235)");
5957 COMPARE(adrp(x0, 0), "adrp x0, #+0x0 (addr 0x1000)");
5958 COMPARE(adrp(x0, -1), "adrp x0, #-0x1000 (addr 0x0)");
5959 COMPARE(adrp(x0, 1), "adrp x0, #+0x1000 (addr 0x2000)");
5960 COMPARE(b(0), "b #+0x0 (addr 0x1234)");
5961 COMPARE(b(-1), "b #-0x4 (addr 0x1230)");
5962 COMPARE(b(1), "b #+0x4 (addr 0x1238)");
5963
5964 // Check that 64-bit addresses work.
5965 disasm->MapCodeAddress(UINT64_C(0x100000000),
5966 reinterpret_cast<Instruction*>(buf));
5967 COMPARE(ldr(x0, 0), "ldr x0, pc+0 (addr 0x100000000)");
5968 COMPARE(ldr(x0, -1), "ldr x0, pc-4 (addr 0xfffffffc)");
5969 COMPARE(ldr(x0, 1), "ldr x0, pc+4 (addr 0x100000004)");
5970 COMPARE(prfm(PLIL1KEEP, 0), "prfm plil1keep, pc+0 (addr 0x100000000)");
5971 COMPARE(prfm(PLIL1KEEP, -1), "prfm plil1keep, pc-4 (addr 0xfffffffc)");
5972 COMPARE(prfm(PLIL1KEEP, 1), "prfm plil1keep, pc+4 (addr 0x100000004)");
5973 COMPARE(adr(x0, 0), "adr x0, #+0x0 (addr 0x100000000)");
5974 COMPARE(adr(x0, -1), "adr x0, #-0x1 (addr 0xffffffff)");
5975 COMPARE(adr(x0, 1), "adr x0, #+0x1 (addr 0x100000001)");
5976 COMPARE(adrp(x0, 0), "adrp x0, #+0x0 (addr 0x100000000)");
5977 COMPARE(adrp(x0, -1), "adrp x0, #-0x1000 (addr 0xfffff000)");
5978 COMPARE(adrp(x0, 1), "adrp x0, #+0x1000 (addr 0x100001000)");
5979 COMPARE(b(0), "b #+0x0 (addr 0x100000000)");
5980 COMPARE(b(-1), "b #-0x4 (addr 0xfffffffc)");
5981 COMPARE(b(1), "b #+0x4 (addr 0x100000004)");
5982
5983 disasm->MapCodeAddress(0xfffffffc, reinterpret_cast<Instruction*>(buf));
5984 COMPARE(ldr(x0, 1), "ldr x0, pc+4 (addr 0x100000000)");
5985 COMPARE(prfm(PLIL1KEEP, 1), "prfm plil1keep, pc+4 (addr 0x100000000)");
5986 COMPARE(b(1), "b #+0x4 (addr 0x100000000)");
5987 COMPARE(adr(x0, 4), "adr x0, #+0x4 (addr 0x100000000)");
5988 COMPARE(adrp(x0, 1), "adrp x0, #+0x1000 (addr 0x100000000)");
5989
5990 // Check that very large offsets are handled properly. This detects misuse of
5991 // the host's ptrdiff_t type when run on a 32-bit host. Only adrp is capable
5992 // of encoding such offsets.
5993 disasm->MapCodeAddress(0, reinterpret_cast<Instruction*>(buf));
5994 COMPARE(adrp(x0, 0x000fffff), "adrp x0, #+0xfffff000 (addr 0xfffff000)");
5995 COMPARE(adrp(x0, -0x00100000), "adrp x0, #-0x100000000 (addr -0x100000000)");
5996
5997 CLEANUP();
5998}
armvixl5289c592015-03-02 13:52:04 +00005999
armvixlad96eda2013-06-14 11:42:37 +01006000} // namespace vixl