blob: d4fa02f3d90fa4dc4569253e155873c3b56c150d [file] [log] [blame]
armvixl5289c592015-03-02 13:52:04 +00001// Copyright 2015, ARM Limited
armvixlad96eda2013-06-14 11:42:37 +01002// All rights reserved.
3//
4// Redistribution and use in source and binary forms, with or without
5// modification, are permitted provided that the following conditions are met:
6//
7// * Redistributions of source code must retain the above copyright notice,
8// this list of conditions and the following disclaimer.
9// * Redistributions in binary form must reproduce the above copyright notice,
10// this list of conditions and the following disclaimer in the documentation
11// and/or other materials provided with the distribution.
12// * Neither the name of ARM Limited nor the names of its contributors may be
13// used to endorse or promote products derived from this software without
14// specific prior written permission.
15//
16// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS CONTRIBUTORS "AS IS" AND
17// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
20// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
23// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26
27#include <stdio.h>
28#include <cstring>
armvixl330dc712014-11-25 10:38:32 +000029#include "test-runner.h"
armvixlad96eda2013-06-14 11:42:37 +010030
armvixl6e2c8272015-03-31 11:04:14 +010031#include "vixl/a64/macro-assembler-a64.h"
32#include "vixl/a64/disasm-a64.h"
armvixlad96eda2013-06-14 11:42:37 +010033
34#define TEST(name) TEST_(DISASM_##name)
35
36#define EXP_SIZE (256)
37#define INSTR_SIZE (1024)
38#define SETUP_CLASS(ASMCLASS) \
armvixlc68cb642014-09-25 18:49:30 +010039 byte* buf = new byte[INSTR_SIZE]; \
armvixlad96eda2013-06-14 11:42:37 +010040 uint32_t encoding = 0; \
41 ASMCLASS* masm = new ASMCLASS(buf, INSTR_SIZE); \
42 Decoder* decoder = new Decoder(); \
43 Disassembler* disasm = new Disassembler(); \
44 decoder->AppendVisitor(disasm)
45
46#define SETUP() SETUP_CLASS(Assembler)
47
armvixl684cd2a2015-10-23 13:38:33 +010048#ifdef VIXL_INCLUDE_SIMULATOR
49// Run tests with the simulator.
50#define SETUP_MACRO() \
51 SETUP_CLASS(MacroAssembler); \
52 masm->SetAllowSimulatorInstructions(true)
53
54#else // ifdef VIXL_INCLUDE_SIMULATOR.
55#define SETUP_MACRO() \
56 SETUP_CLASS(MacroAssembler); \
57 masm->SetAllowSimulatorInstructions(false)
58
59#endif // ifdef VIXL_INCLUDE_SIMULATOR.
armvixlc68cb642014-09-25 18:49:30 +010060
armvixlad96eda2013-06-14 11:42:37 +010061#define COMPARE(ASM, EXP) \
62 masm->Reset(); \
armvixlc68cb642014-09-25 18:49:30 +010063 { \
64 CodeBufferCheckScope blind(masm); \
65 masm->ASM; \
66 } \
armvixlad96eda2013-06-14 11:42:37 +010067 masm->FinalizeCode(); \
68 decoder->Decode(reinterpret_cast<Instruction*>(buf)); \
69 encoding = *reinterpret_cast<uint32_t*>(buf); \
70 if (strcmp(disasm->GetOutput(), EXP) != 0) { \
armvixl330dc712014-11-25 10:38:32 +000071 printf("\nEncoding: %08" PRIx32 "\nExpected: %s\nFound: %s\n", \
armvixlad96eda2013-06-14 11:42:37 +010072 encoding, EXP, disasm->GetOutput()); \
73 abort(); \
armvixl330dc712014-11-25 10:38:32 +000074 } \
75 if (Test::trace_sim()) { \
76 printf("%08" PRIx32 "\t%s\n", encoding, disasm->GetOutput()); \
armvixlad96eda2013-06-14 11:42:37 +010077 }
78
armvixl578645f2013-08-15 17:21:42 +010079#define COMPARE_PREFIX(ASM, EXP) \
80 masm->Reset(); \
armvixlc68cb642014-09-25 18:49:30 +010081 { \
82 CodeBufferCheckScope blind(masm); \
83 masm->ASM; \
84 } \
85 masm->FinalizeCode(); \
86 decoder->Decode(reinterpret_cast<Instruction*>(buf)); \
87 encoding = *reinterpret_cast<uint32_t*>(buf); \
88 if (strncmp(disasm->GetOutput(), EXP, strlen(EXP)) != 0) { \
armvixl330dc712014-11-25 10:38:32 +000089 printf("\nEncoding: %08" PRIx32 "\nExpected: %s\nFound: %s\n", \
armvixlc68cb642014-09-25 18:49:30 +010090 encoding, EXP, disasm->GetOutput()); \
91 abort(); \
armvixl330dc712014-11-25 10:38:32 +000092 } \
93 if (Test::trace_sim()) { \
94 printf("%08" PRIx32 "\t%s\n", encoding, disasm->GetOutput()); \
armvixlc68cb642014-09-25 18:49:30 +010095 }
96
97#define COMPARE_MACRO(ASM, EXP) \
98 masm->Reset(); \
armvixl578645f2013-08-15 17:21:42 +010099 masm->ASM; \
100 masm->FinalizeCode(); \
101 decoder->Decode(reinterpret_cast<Instruction*>(buf)); \
102 encoding = *reinterpret_cast<uint32_t*>(buf); \
103 if (strncmp(disasm->GetOutput(), EXP, strlen(EXP)) != 0) { \
armvixl330dc712014-11-25 10:38:32 +0000104 printf("\nEncoding: %08" PRIx32 "\nExpected: %s\nFound: %s\n", \
armvixl578645f2013-08-15 17:21:42 +0100105 encoding, EXP, disasm->GetOutput()); \
106 abort(); \
armvixl330dc712014-11-25 10:38:32 +0000107 } \
108 if (Test::trace_sim()) { \
109 printf("%08" PRIx32 "\t%s\n", encoding, disasm->GetOutput()); \
armvixl578645f2013-08-15 17:21:42 +0100110 }
111
armvixlad96eda2013-06-14 11:42:37 +0100112#define CLEANUP() \
113 delete disasm; \
114 delete decoder; \
armvixlc68cb642014-09-25 18:49:30 +0100115 delete masm; \
armvixldb644342015-07-21 11:37:10 +0100116 delete[] buf
armvixlad96eda2013-06-14 11:42:37 +0100117
118namespace vixl {
119
120TEST(bootstrap) {
121 SETUP();
122
123 // Instructions generated by C compiler, disassembled by objdump, and
124 // reformatted to suit our disassembly style.
125 COMPARE(dci(0xa9ba7bfd), "stp x29, x30, [sp, #-96]!");
126 COMPARE(dci(0x910003fd), "mov x29, sp");
127 COMPARE(dci(0x9100e3a0), "add x0, x29, #0x38 (56)");
128 COMPARE(dci(0xb900001f), "str wzr, [x0]");
armvixl330dc712014-11-25 10:38:32 +0000129 COMPARE(dci(0x528000e1), "mov w1, #0x7");
armvixlad96eda2013-06-14 11:42:37 +0100130 COMPARE(dci(0xb9001c01), "str w1, [x0, #28]");
131 COMPARE(dci(0x390043a0), "strb w0, [x29, #16]");
132 COMPARE(dci(0x790027a0), "strh w0, [x29, #18]");
133 COMPARE(dci(0xb9400400), "ldr w0, [x0, #4]");
134 COMPARE(dci(0x0b000021), "add w1, w1, w0");
135 COMPARE(dci(0x531b6800), "lsl w0, w0, #5");
136 COMPARE(dci(0x521e0400), "eor w0, w0, #0xc");
137 COMPARE(dci(0x72af0f00), "movk w0, #0x7878, lsl #16");
138 COMPARE(dci(0xd360fc00), "lsr x0, x0, #32");
139 COMPARE(dci(0x13037c01), "asr w1, w0, #3");
140 COMPARE(dci(0x4b000021), "sub w1, w1, w0");
141 COMPARE(dci(0x2a0103e0), "mov w0, w1");
142 COMPARE(dci(0x93407c00), "sxtw x0, w0");
143 COMPARE(dci(0x2a000020), "orr w0, w1, w0");
144 COMPARE(dci(0xa8c67bfd), "ldp x29, x30, [sp], #96");
145
146 CLEANUP();
147}
148
armvixl4a102ba2014-07-14 09:02:40 +0100149
armvixlad96eda2013-06-14 11:42:37 +0100150TEST(mov_mvn) {
armvixl684cd2a2015-10-23 13:38:33 +0100151 SETUP_MACRO();
armvixlad96eda2013-06-14 11:42:37 +0100152
armvixl330dc712014-11-25 10:38:32 +0000153 COMPARE(Mov(w0, Operand(0x1234)), "mov w0, #0x1234");
154 COMPARE(Mov(x1, Operand(0x1234)), "mov x1, #0x1234");
armvixlad96eda2013-06-14 11:42:37 +0100155 COMPARE(Mov(w2, Operand(w3)), "mov w2, w3");
156 COMPARE(Mov(x4, Operand(x5)), "mov x4, x5");
157 COMPARE(Mov(w6, Operand(w7, LSL, 5)), "lsl w6, w7, #5");
158 COMPARE(Mov(x8, Operand(x9, ASR, 42)), "asr x8, x9, #42");
159 COMPARE(Mov(w10, Operand(w11, UXTB)), "uxtb w10, w11");
160 COMPARE(Mov(x12, Operand(x13, UXTB, 1)), "ubfiz x12, x13, #1, #8");
161 COMPARE(Mov(w14, Operand(w15, SXTH, 2)), "sbfiz w14, w15, #2, #16");
162 COMPARE(Mov(x16, Operand(x17, SXTW, 3)), "sbfiz x16, x17, #3, #32");
163
armvixl330dc712014-11-25 10:38:32 +0000164 COMPARE(Mvn(w0, Operand(0x101)), "mov w0, #0xfffffefe");
165 COMPARE(Mvn(x1, Operand(0xfff1)), "mov x1, #0xffffffffffff000e");
armvixlad96eda2013-06-14 11:42:37 +0100166 COMPARE(Mvn(w2, Operand(w3)), "mvn w2, w3");
167 COMPARE(Mvn(x4, Operand(x5)), "mvn x4, x5");
168 COMPARE(Mvn(w6, Operand(w7, LSL, 12)), "mvn w6, w7, lsl #12");
169 COMPARE(Mvn(x8, Operand(x9, ASR, 63)), "mvn x8, x9, asr #63");
170
171 CLEANUP();
172}
173
armvixl4a102ba2014-07-14 09:02:40 +0100174
armvixlad96eda2013-06-14 11:42:37 +0100175TEST(move_immediate) {
176 SETUP();
177
armvixl330dc712014-11-25 10:38:32 +0000178 COMPARE(movz(w0, 0x1234), "mov w0, #0x1234");
179 COMPARE(movz(x1, 0xabcd0000), "mov x1, #0xabcd0000");
180 COMPARE(movz(x2, 0x555500000000), "mov x2, #0x555500000000");
181 COMPARE(movz(x3, 0xaaaa000000000000), "mov x3, #0xaaaa000000000000");
182 COMPARE(movz(x4, 0xabcd, 16), "mov x4, #0xabcd0000");
183 COMPARE(movz(x5, 0x5555, 32), "mov x5, #0x555500000000");
184 COMPARE(movz(x6, 0xaaaa, 48), "mov x6, #0xaaaa000000000000");
armvixlad96eda2013-06-14 11:42:37 +0100185
186 COMPARE(movk(w7, 0x1234), "movk w7, #0x1234");
187 COMPARE(movk(x8, 0xabcd0000), "movk x8, #0xabcd, lsl #16");
188 COMPARE(movk(x9, 0x555500000000), "movk x9, #0x5555, lsl #32");
189 COMPARE(movk(x10, 0xaaaa000000000000), "movk x10, #0xaaaa, lsl #48");
190 COMPARE(movk(w11, 0xabcd, 16), "movk w11, #0xabcd, lsl #16");
191 COMPARE(movk(x12, 0x5555, 32), "movk x12, #0x5555, lsl #32");
192 COMPARE(movk(x13, 0xaaaa, 48), "movk x13, #0xaaaa, lsl #48");
193
armvixl330dc712014-11-25 10:38:32 +0000194 COMPARE(movn(w14, 0x1234), "mov w14, #0xffffedcb");
195 COMPARE(movn(x15, 0xabcd0000), "mov x15, #0xffffffff5432ffff");
196 COMPARE(movn(x16, 0x555500000000), "mov x16, #0xffffaaaaffffffff");
197 COMPARE(movn(x17, 0xaaaa000000000000), "mov x17, #0x5555ffffffffffff");
198 COMPARE(movn(w18, 0xabcd, 16), "mov w18, #0x5432ffff");
199 COMPARE(movn(x19, 0x5555, 32), "mov x19, #0xffffaaaaffffffff");
200 COMPARE(movn(x20, 0xaaaa, 48), "mov x20, #0x5555ffffffffffff");
armvixlad96eda2013-06-14 11:42:37 +0100201
202 COMPARE(movk(w21, 0), "movk w21, #0x0");
203 COMPARE(movk(x22, 0, 0), "movk x22, #0x0");
204 COMPARE(movk(w23, 0, 16), "movk w23, #0x0, lsl #16");
205 COMPARE(movk(x24, 0, 32), "movk x24, #0x0, lsl #32");
206 COMPARE(movk(x25, 0, 48), "movk x25, #0x0, lsl #48");
207
armvixl330dc712014-11-25 10:38:32 +0000208 COMPARE(movz(x26, 0, 48), "movz x26, #0x0");
209 COMPARE(movn(x27, 0, 48), "movn x27, #0x0");
210 COMPARE(movn(w28, 0xffff), "movn w28, #0xffff");
211
armvixlad96eda2013-06-14 11:42:37 +0100212 CLEANUP();
213}
214
armvixl4a102ba2014-07-14 09:02:40 +0100215
armvixlf37fdc02014-02-05 13:22:16 +0000216TEST(move_immediate_2) {
armvixl684cd2a2015-10-23 13:38:33 +0100217 SETUP_MACRO();
armvixlf37fdc02014-02-05 13:22:16 +0000218
219 // Move instructions expected for certain immediates. This is really a macro
220 // assembler test, to ensure it generates immediates efficiently.
armvixl330dc712014-11-25 10:38:32 +0000221 COMPARE(Mov(w0, 0), "mov w0, #0x0");
222 COMPARE(Mov(w0, 0x0000ffff), "mov w0, #0xffff");
223 COMPARE(Mov(w0, 0x00010000), "mov w0, #0x10000");
224 COMPARE(Mov(w0, 0xffff0000), "mov w0, #0xffff0000");
225 COMPARE(Mov(w0, 0x0001ffff), "mov w0, #0x1ffff");
226 COMPARE(Mov(w0, 0xffff8000), "mov w0, #0xffff8000");
227 COMPARE(Mov(w0, 0xfffffffe), "mov w0, #0xfffffffe");
228 COMPARE(Mov(w0, 0xffffffff), "mov w0, #0xffffffff");
armvixlf37fdc02014-02-05 13:22:16 +0000229 COMPARE(Mov(w0, 0x00ffff00), "mov w0, #0xffff00");
230 COMPARE(Mov(w0, 0xfffe7fff), "mov w0, #0xfffe7fff");
armvixl330dc712014-11-25 10:38:32 +0000231 COMPARE(Mov(w0, 0xfffeffff), "mov w0, #0xfffeffff");
232 COMPARE(Mov(w0, 0xffff7fff), "mov w0, #0xffff7fff");
armvixlf37fdc02014-02-05 13:22:16 +0000233
armvixl330dc712014-11-25 10:38:32 +0000234 COMPARE(Mov(x0, 0), "mov x0, #0x0");
235 COMPARE(Mov(x0, 0x0000ffff), "mov x0, #0xffff");
236 COMPARE(Mov(x0, 0x00010000), "mov x0, #0x10000");
237 COMPARE(Mov(x0, 0xffff0000), "mov x0, #0xffff0000");
armvixlf37fdc02014-02-05 13:22:16 +0000238 COMPARE(Mov(x0, 0x0001ffff), "mov x0, #0x1ffff");
239 COMPARE(Mov(x0, 0xffff8000), "mov x0, #0xffff8000");
240 COMPARE(Mov(x0, 0xfffffffe), "mov x0, #0xfffffffe");
241 COMPARE(Mov(x0, 0xffffffff), "mov x0, #0xffffffff");
242 COMPARE(Mov(x0, 0x00ffff00), "mov x0, #0xffff00");
armvixl330dc712014-11-25 10:38:32 +0000243 COMPARE(Mov(x0, 0xffff000000000000), "mov x0, #0xffff000000000000");
244 COMPARE(Mov(x0, 0x0000ffff00000000), "mov x0, #0xffff00000000");
245 COMPARE(Mov(x0, 0x00000000ffff0000), "mov x0, #0xffff0000");
246 COMPARE(Mov(x0, 0xffffffffffff0000), "mov x0, #0xffffffffffff0000");
247 COMPARE(Mov(x0, 0xffffffff0000ffff), "mov x0, #0xffffffff0000ffff");
248 COMPARE(Mov(x0, 0xffff0000ffffffff), "mov x0, #0xffff0000ffffffff");
249 COMPARE(Mov(x0, 0x0000ffffffffffff), "mov x0, #0xffffffffffff");
armvixlf37fdc02014-02-05 13:22:16 +0000250 COMPARE(Mov(x0, 0xfffe7fffffffffff), "mov x0, #0xfffe7fffffffffff");
armvixl330dc712014-11-25 10:38:32 +0000251 COMPARE(Mov(x0, 0xfffeffffffffffff), "mov x0, #0xfffeffffffffffff");
252 COMPARE(Mov(x0, 0xffff7fffffffffff), "mov x0, #0xffff7fffffffffff");
armvixlf37fdc02014-02-05 13:22:16 +0000253 COMPARE(Mov(x0, 0xfffffffe7fffffff), "mov x0, #0xfffffffe7fffffff");
armvixl330dc712014-11-25 10:38:32 +0000254 COMPARE(Mov(x0, 0xfffffffeffffffff), "mov x0, #0xfffffffeffffffff");
255 COMPARE(Mov(x0, 0xffffffff7fffffff), "mov x0, #0xffffffff7fffffff");
armvixlf37fdc02014-02-05 13:22:16 +0000256 COMPARE(Mov(x0, 0xfffffffffffe7fff), "mov x0, #0xfffffffffffe7fff");
armvixl330dc712014-11-25 10:38:32 +0000257 COMPARE(Mov(x0, 0xfffffffffffeffff), "mov x0, #0xfffffffffffeffff");
258 COMPARE(Mov(x0, 0xffffffffffff7fff), "mov x0, #0xffffffffffff7fff");
259 COMPARE(Mov(x0, 0xffffffffffffffff), "mov x0, #0xffffffffffffffff");
armvixlf37fdc02014-02-05 13:22:16 +0000260
261 COMPARE(Movk(w0, 0x1234, 0), "movk w0, #0x1234");
262 COMPARE(Movk(x1, 0x2345, 0), "movk x1, #0x2345");
263 COMPARE(Movk(w2, 0x3456, 16), "movk w2, #0x3456, lsl #16");
264 COMPARE(Movk(x3, 0x4567, 16), "movk x3, #0x4567, lsl #16");
265 COMPARE(Movk(x4, 0x5678, 32), "movk x4, #0x5678, lsl #32");
266 COMPARE(Movk(x5, 0x6789, 48), "movk x5, #0x6789, lsl #48");
267
268 CLEANUP();
269}
270
armvixl4a102ba2014-07-14 09:02:40 +0100271
armvixlad96eda2013-06-14 11:42:37 +0100272TEST(add_immediate) {
273 SETUP();
274
275 COMPARE(add(w0, w1, Operand(0xff)), "add w0, w1, #0xff (255)");
276 COMPARE(add(x2, x3, Operand(0x3ff)), "add x2, x3, #0x3ff (1023)");
277 COMPARE(add(w4, w5, Operand(0xfff)), "add w4, w5, #0xfff (4095)");
278 COMPARE(add(x6, x7, Operand(0x1000)), "add x6, x7, #0x1000 (4096)");
279 COMPARE(add(w8, w9, Operand(0xff000)), "add w8, w9, #0xff000 (1044480)");
280 COMPARE(add(x10, x11, Operand(0x3ff000)),
281 "add x10, x11, #0x3ff000 (4190208)");
282 COMPARE(add(w12, w13, Operand(0xfff000)),
283 "add w12, w13, #0xfff000 (16773120)");
armvixlf37fdc02014-02-05 13:22:16 +0000284 COMPARE(adds(w14, w15, Operand(0xff)), "adds w14, w15, #0xff (255)");
285 COMPARE(adds(x16, x17, Operand(0xaa000)), "adds x16, x17, #0xaa000 (696320)");
286
armvixlad96eda2013-06-14 11:42:37 +0100287 COMPARE(cmn(w18, Operand(0xff)), "cmn w18, #0xff (255)");
288 COMPARE(cmn(x19, Operand(0xff000)), "cmn x19, #0xff000 (1044480)");
289 COMPARE(add(w0, wsp, Operand(0)), "mov w0, wsp");
290 COMPARE(add(sp, x0, Operand(0)), "mov sp, x0");
291
292 COMPARE(add(w1, wsp, Operand(8)), "add w1, wsp, #0x8 (8)");
293 COMPARE(add(x2, sp, Operand(16)), "add x2, sp, #0x10 (16)");
294 COMPARE(add(wsp, wsp, Operand(42)), "add wsp, wsp, #0x2a (42)");
295 COMPARE(cmn(sp, Operand(24)), "cmn sp, #0x18 (24)");
armvixlf37fdc02014-02-05 13:22:16 +0000296 COMPARE(adds(wzr, wsp, Operand(9)), "cmn wsp, #0x9 (9)");
armvixlad96eda2013-06-14 11:42:37 +0100297
298 CLEANUP();
299}
300
armvixl4a102ba2014-07-14 09:02:40 +0100301
armvixlad96eda2013-06-14 11:42:37 +0100302TEST(sub_immediate) {
303 SETUP();
304
305 COMPARE(sub(w0, w1, Operand(0xff)), "sub w0, w1, #0xff (255)");
306 COMPARE(sub(x2, x3, Operand(0x3ff)), "sub x2, x3, #0x3ff (1023)");
307 COMPARE(sub(w4, w5, Operand(0xfff)), "sub w4, w5, #0xfff (4095)");
308 COMPARE(sub(x6, x7, Operand(0x1000)), "sub x6, x7, #0x1000 (4096)");
309 COMPARE(sub(w8, w9, Operand(0xff000)), "sub w8, w9, #0xff000 (1044480)");
310 COMPARE(sub(x10, x11, Operand(0x3ff000)),
311 "sub x10, x11, #0x3ff000 (4190208)");
312 COMPARE(sub(w12, w13, Operand(0xfff000)),
313 "sub w12, w13, #0xfff000 (16773120)");
armvixlf37fdc02014-02-05 13:22:16 +0000314 COMPARE(subs(w14, w15, Operand(0xff)), "subs w14, w15, #0xff (255)");
315 COMPARE(subs(x16, x17, Operand(0xaa000)), "subs x16, x17, #0xaa000 (696320)");
armvixlad96eda2013-06-14 11:42:37 +0100316 COMPARE(cmp(w18, Operand(0xff)), "cmp w18, #0xff (255)");
317 COMPARE(cmp(x19, Operand(0xff000)), "cmp x19, #0xff000 (1044480)");
318
319 COMPARE(sub(w1, wsp, Operand(8)), "sub w1, wsp, #0x8 (8)");
320 COMPARE(sub(x2, sp, Operand(16)), "sub x2, sp, #0x10 (16)");
321 COMPARE(sub(wsp, wsp, Operand(42)), "sub wsp, wsp, #0x2a (42)");
322 COMPARE(cmp(sp, Operand(24)), "cmp sp, #0x18 (24)");
armvixlf37fdc02014-02-05 13:22:16 +0000323 COMPARE(subs(wzr, wsp, Operand(9)), "cmp wsp, #0x9 (9)");
armvixlad96eda2013-06-14 11:42:37 +0100324
325 CLEANUP();
326}
327
328
329TEST(add_shifted) {
330 SETUP();
331
332 COMPARE(add(w0, w1, Operand(w2)), "add w0, w1, w2");
333 COMPARE(add(x3, x4, Operand(x5)), "add x3, x4, x5");
334 COMPARE(add(w6, w7, Operand(w8, LSL, 1)), "add w6, w7, w8, lsl #1");
335 COMPARE(add(x9, x10, Operand(x11, LSL, 2)), "add x9, x10, x11, lsl #2");
336 COMPARE(add(w12, w13, Operand(w14, LSR, 3)), "add w12, w13, w14, lsr #3");
337 COMPARE(add(x15, x16, Operand(x17, LSR, 4)), "add x15, x16, x17, lsr #4");
338 COMPARE(add(w18, w19, Operand(w20, ASR, 5)), "add w18, w19, w20, asr #5");
339 COMPARE(add(x21, x22, Operand(x23, ASR, 6)), "add x21, x22, x23, asr #6");
340 COMPARE(cmn(w24, Operand(w25)), "cmn w24, w25");
341 COMPARE(cmn(x26, Operand(x27, LSL, 63)), "cmn x26, x27, lsl #63");
342
343 COMPARE(add(x0, sp, Operand(x1)), "add x0, sp, x1");
344 COMPARE(add(w2, wsp, Operand(w3)), "add w2, wsp, w3");
345 COMPARE(add(x4, sp, Operand(x5, LSL, 1)), "add x4, sp, x5, lsl #1");
346 COMPARE(add(x4, xzr, Operand(x5, LSL, 1)), "add x4, xzr, x5, lsl #1");
347 COMPARE(add(w6, wsp, Operand(w7, LSL, 3)), "add w6, wsp, w7, lsl #3");
armvixlf37fdc02014-02-05 13:22:16 +0000348 COMPARE(adds(xzr, sp, Operand(x8, LSL, 4)), "cmn sp, x8, lsl #4");
349 COMPARE(adds(xzr, xzr, Operand(x8, LSL, 5)), "cmn xzr, x8, lsl #5");
armvixlad96eda2013-06-14 11:42:37 +0100350
351 CLEANUP();
352}
353
354
355TEST(sub_shifted) {
356 SETUP();
357
358 COMPARE(sub(w0, w1, Operand(w2)), "sub w0, w1, w2");
359 COMPARE(sub(x3, x4, Operand(x5)), "sub x3, x4, x5");
360 COMPARE(sub(w6, w7, Operand(w8, LSL, 1)), "sub w6, w7, w8, lsl #1");
361 COMPARE(sub(x9, x10, Operand(x11, LSL, 2)), "sub x9, x10, x11, lsl #2");
362 COMPARE(sub(w12, w13, Operand(w14, LSR, 3)), "sub w12, w13, w14, lsr #3");
363 COMPARE(sub(x15, x16, Operand(x17, LSR, 4)), "sub x15, x16, x17, lsr #4");
364 COMPARE(sub(w18, w19, Operand(w20, ASR, 5)), "sub w18, w19, w20, asr #5");
365 COMPARE(sub(x21, x22, Operand(x23, ASR, 6)), "sub x21, x22, x23, asr #6");
366 COMPARE(cmp(w24, Operand(w25)), "cmp w24, w25");
367 COMPARE(cmp(x26, Operand(x27, LSL, 63)), "cmp x26, x27, lsl #63");
368 COMPARE(neg(w28, Operand(w29)), "neg w28, w29");
369 COMPARE(neg(x30, Operand(x0, LSR, 62)), "neg x30, x0, lsr #62");
armvixlf37fdc02014-02-05 13:22:16 +0000370 COMPARE(negs(w1, Operand(w2)), "negs w1, w2");
371 COMPARE(negs(x3, Operand(x4, ASR, 61)), "negs x3, x4, asr #61");
armvixlad96eda2013-06-14 11:42:37 +0100372
373 COMPARE(sub(x0, sp, Operand(x1)), "sub x0, sp, x1");
374 COMPARE(sub(w2, wsp, Operand(w3)), "sub w2, wsp, w3");
375 COMPARE(sub(x4, sp, Operand(x5, LSL, 1)), "sub x4, sp, x5, lsl #1");
376 COMPARE(sub(x4, xzr, Operand(x5, LSL, 1)), "neg x4, x5, lsl #1");
377 COMPARE(sub(w6, wsp, Operand(w7, LSL, 3)), "sub w6, wsp, w7, lsl #3");
armvixlf37fdc02014-02-05 13:22:16 +0000378 COMPARE(subs(xzr, sp, Operand(x8, LSL, 4)), "cmp sp, x8, lsl #4");
379 COMPARE(subs(xzr, xzr, Operand(x8, LSL, 5)), "cmp xzr, x8, lsl #5");
armvixlad96eda2013-06-14 11:42:37 +0100380
381 CLEANUP();
382}
383
384
385TEST(add_extended) {
386 SETUP();
387
388 COMPARE(add(w0, w1, Operand(w2, UXTB)), "add w0, w1, w2, uxtb");
armvixlf37fdc02014-02-05 13:22:16 +0000389 COMPARE(adds(x3, x4, Operand(w5, UXTB, 1)), "adds x3, x4, w5, uxtb #1");
armvixlad96eda2013-06-14 11:42:37 +0100390 COMPARE(add(w6, w7, Operand(w8, UXTH, 2)), "add w6, w7, w8, uxth #2");
armvixlf37fdc02014-02-05 13:22:16 +0000391 COMPARE(adds(x9, x10, Operand(x11, UXTW, 3)), "adds x9, x10, w11, uxtw #3");
armvixlad96eda2013-06-14 11:42:37 +0100392 COMPARE(add(x12, x13, Operand(x14, UXTX, 4)), "add x12, x13, x14, uxtx #4");
armvixlf37fdc02014-02-05 13:22:16 +0000393 COMPARE(adds(w15, w16, Operand(w17, SXTB, 4)), "adds w15, w16, w17, sxtb #4");
armvixlad96eda2013-06-14 11:42:37 +0100394 COMPARE(add(x18, x19, Operand(x20, SXTB, 3)), "add x18, x19, w20, sxtb #3");
armvixlf37fdc02014-02-05 13:22:16 +0000395 COMPARE(adds(w21, w22, Operand(w23, SXTH, 2)), "adds w21, w22, w23, sxth #2");
armvixlad96eda2013-06-14 11:42:37 +0100396 COMPARE(add(x24, x25, Operand(x26, SXTW, 1)), "add x24, x25, w26, sxtw #1");
armvixlf37fdc02014-02-05 13:22:16 +0000397 COMPARE(adds(x27, x28, Operand(x29, SXTX)), "adds x27, x28, x29, sxtx");
armvixlad96eda2013-06-14 11:42:37 +0100398 COMPARE(cmn(w0, Operand(w1, UXTB, 2)), "cmn w0, w1, uxtb #2");
399 COMPARE(cmn(x2, Operand(x3, SXTH, 4)), "cmn x2, w3, sxth #4");
400
401 COMPARE(add(w0, wsp, Operand(w1, UXTB)), "add w0, wsp, w1, uxtb");
402 COMPARE(add(x2, sp, Operand(x3, UXTH, 1)), "add x2, sp, w3, uxth #1");
403 COMPARE(add(wsp, wsp, Operand(w4, UXTW, 2)), "add wsp, wsp, w4, lsl #2");
404 COMPARE(cmn(sp, Operand(xzr, UXTX, 3)), "cmn sp, xzr, lsl #3");
405 COMPARE(cmn(sp, Operand(xzr, LSL, 4)), "cmn sp, xzr, lsl #4");
406
407 CLEANUP();
408}
409
410
411TEST(sub_extended) {
412 SETUP();
413
414 COMPARE(sub(w0, w1, Operand(w2, UXTB)), "sub w0, w1, w2, uxtb");
armvixlf37fdc02014-02-05 13:22:16 +0000415 COMPARE(subs(x3, x4, Operand(w5, UXTB, 1)), "subs x3, x4, w5, uxtb #1");
armvixlad96eda2013-06-14 11:42:37 +0100416 COMPARE(sub(w6, w7, Operand(w8, UXTH, 2)), "sub w6, w7, w8, uxth #2");
armvixlf37fdc02014-02-05 13:22:16 +0000417 COMPARE(subs(x9, x10, Operand(x11, UXTW, 3)), "subs x9, x10, w11, uxtw #3");
armvixlad96eda2013-06-14 11:42:37 +0100418 COMPARE(sub(x12, x13, Operand(x14, UXTX, 4)), "sub x12, x13, x14, uxtx #4");
armvixlf37fdc02014-02-05 13:22:16 +0000419 COMPARE(subs(w15, w16, Operand(w17, SXTB, 4)), "subs w15, w16, w17, sxtb #4");
armvixlad96eda2013-06-14 11:42:37 +0100420 COMPARE(sub(x18, x19, Operand(x20, SXTB, 3)), "sub x18, x19, w20, sxtb #3");
armvixlf37fdc02014-02-05 13:22:16 +0000421 COMPARE(subs(w21, w22, Operand(w23, SXTH, 2)), "subs w21, w22, w23, sxth #2");
armvixlad96eda2013-06-14 11:42:37 +0100422 COMPARE(sub(x24, x25, Operand(x26, SXTW, 1)), "sub x24, x25, w26, sxtw #1");
armvixlf37fdc02014-02-05 13:22:16 +0000423 COMPARE(subs(x27, x28, Operand(x29, SXTX)), "subs x27, x28, x29, sxtx");
armvixlad96eda2013-06-14 11:42:37 +0100424 COMPARE(cmp(w0, Operand(w1, SXTB, 1)), "cmp w0, w1, sxtb #1");
425 COMPARE(cmp(x2, Operand(x3, UXTH, 3)), "cmp x2, w3, uxth #3");
426
427 COMPARE(sub(w0, wsp, Operand(w1, UXTB)), "sub w0, wsp, w1, uxtb");
428 COMPARE(sub(x2, sp, Operand(x3, UXTH, 1)), "sub x2, sp, w3, uxth #1");
429 COMPARE(sub(wsp, wsp, Operand(w4, UXTW, 2)), "sub wsp, wsp, w4, lsl #2");
430 COMPARE(cmp(sp, Operand(xzr, UXTX, 3)), "cmp sp, xzr, lsl #3");
431 COMPARE(cmp(sp, Operand(xzr, LSL, 4)), "cmp sp, xzr, lsl #4");
432
433 CLEANUP();
434}
435
436
437TEST(adc_subc_ngc) {
438 SETUP();
439
440 COMPARE(adc(w0, w1, Operand(w2)), "adc w0, w1, w2");
441 COMPARE(adc(x3, x4, Operand(x5)), "adc x3, x4, x5");
armvixlf37fdc02014-02-05 13:22:16 +0000442 COMPARE(adcs(w6, w7, Operand(w8)), "adcs w6, w7, w8");
443 COMPARE(adcs(x9, x10, Operand(x11)), "adcs x9, x10, x11");
armvixlad96eda2013-06-14 11:42:37 +0100444 COMPARE(sbc(w12, w13, Operand(w14)), "sbc w12, w13, w14");
445 COMPARE(sbc(x15, x16, Operand(x17)), "sbc x15, x16, x17");
armvixlf37fdc02014-02-05 13:22:16 +0000446 COMPARE(sbcs(w18, w19, Operand(w20)), "sbcs w18, w19, w20");
447 COMPARE(sbcs(x21, x22, Operand(x23)), "sbcs x21, x22, x23");
armvixlad96eda2013-06-14 11:42:37 +0100448 COMPARE(ngc(w24, Operand(w25)), "ngc w24, w25");
449 COMPARE(ngc(x26, Operand(x27)), "ngc x26, x27");
armvixlf37fdc02014-02-05 13:22:16 +0000450 COMPARE(ngcs(w28, Operand(w29)), "ngcs w28, w29");
451 COMPARE(ngcs(x30, Operand(x0)), "ngcs x30, x0");
armvixlad96eda2013-06-14 11:42:37 +0100452
453 CLEANUP();
454}
455
456
457TEST(mul_and_div) {
458 SETUP();
459
460 COMPARE(mul(w0, w1, w2), "mul w0, w1, w2");
461 COMPARE(mul(x3, x4, x5), "mul x3, x4, x5");
462 COMPARE(mul(w30, w0, w1), "mul w30, w0, w1");
463 COMPARE(mul(x30, x0, x1), "mul x30, x0, x1");
464 COMPARE(mneg(w0, w1, w2), "mneg w0, w1, w2");
465 COMPARE(mneg(x3, x4, x5), "mneg x3, x4, x5");
466 COMPARE(mneg(w30, w0, w1), "mneg w30, w0, w1");
467 COMPARE(mneg(x30, x0, x1), "mneg x30, x0, x1");
468 COMPARE(smull(x0, w0, w1), "smull x0, w0, w1");
469 COMPARE(smull(x30, w30, w0), "smull x30, w30, w0");
470 COMPARE(smulh(x0, x1, x2), "smulh x0, x1, x2");
armvixl6e2c8272015-03-31 11:04:14 +0100471 COMPARE(umulh(x0, x2, x1), "umulh x0, x2, x1");
armvixlad96eda2013-06-14 11:42:37 +0100472
473 COMPARE(sdiv(w0, w1, w2), "sdiv w0, w1, w2");
474 COMPARE(sdiv(x3, x4, x5), "sdiv x3, x4, x5");
475 COMPARE(udiv(w6, w7, w8), "udiv w6, w7, w8");
476 COMPARE(udiv(x9, x10, x11), "udiv x9, x10, x11");
477
478 CLEANUP();
479}
480
481
482TEST(madd) {
483 SETUP();
484
485 COMPARE(madd(w0, w1, w2, w3), "madd w0, w1, w2, w3");
486 COMPARE(madd(w30, w21, w22, w16), "madd w30, w21, w22, w16");
487 COMPARE(madd(x0, x1, x2, x3), "madd x0, x1, x2, x3");
488 COMPARE(madd(x30, x21, x22, x16), "madd x30, x21, x22, x16");
489
490 COMPARE(smaddl(x0, w1, w2, x3), "smaddl x0, w1, w2, x3");
491 COMPARE(smaddl(x30, w21, w22, x16), "smaddl x30, w21, w22, x16");
492 COMPARE(umaddl(x0, w1, w2, x3), "umaddl x0, w1, w2, x3");
493 COMPARE(umaddl(x30, w21, w22, x16), "umaddl x30, w21, w22, x16");
armvixl5289c592015-03-02 13:52:04 +0000494 COMPARE(umull(x0, w1, w2), "umull x0, w1, w2");
495 COMPARE(umull(x30, w21, w22), "umull x30, w21, w22");
armvixlad96eda2013-06-14 11:42:37 +0100496
497 CLEANUP();
498}
499
500
501TEST(msub) {
502 SETUP();
503
504 COMPARE(msub(w0, w1, w2, w3), "msub w0, w1, w2, w3");
505 COMPARE(msub(w30, w21, w22, w16), "msub w30, w21, w22, w16");
506 COMPARE(msub(x0, x1, x2, x3), "msub x0, x1, x2, x3");
507 COMPARE(msub(x30, x21, x22, x16), "msub x30, x21, x22, x16");
508
509 COMPARE(smsubl(x0, w1, w2, x3), "smsubl x0, w1, w2, x3");
510 COMPARE(smsubl(x30, w21, w22, x16), "smsubl x30, w21, w22, x16");
511 COMPARE(umsubl(x0, w1, w2, x3), "umsubl x0, w1, w2, x3");
512 COMPARE(umsubl(x30, w21, w22, x16), "umsubl x30, w21, w22, x16");
513
514 CLEANUP();
515}
516
517
518TEST(dp_1_source) {
519 SETUP();
520
521 COMPARE(rbit(w0, w1), "rbit w0, w1");
522 COMPARE(rbit(x2, x3), "rbit x2, x3");
523 COMPARE(rev16(w4, w5), "rev16 w4, w5");
524 COMPARE(rev16(x6, x7), "rev16 x6, x7");
525 COMPARE(rev32(x8, x9), "rev32 x8, x9");
526 COMPARE(rev(w10, w11), "rev w10, w11");
527 COMPARE(rev(x12, x13), "rev x12, x13");
528 COMPARE(clz(w14, w15), "clz w14, w15");
529 COMPARE(clz(x16, x17), "clz x16, x17");
530 COMPARE(cls(w18, w19), "cls w18, w19");
531 COMPARE(cls(x20, x21), "cls x20, x21");
532
533 CLEANUP();
534}
535
536
537TEST(bitfield) {
538 SETUP();
539
540 COMPARE(sxtb(w0, w1), "sxtb w0, w1");
541 COMPARE(sxtb(x2, x3), "sxtb x2, w3");
542 COMPARE(sxth(w4, w5), "sxth w4, w5");
543 COMPARE(sxth(x6, x7), "sxth x6, w7");
544 COMPARE(sxtw(x8, x9), "sxtw x8, w9");
armvixlf37fdc02014-02-05 13:22:16 +0000545 COMPARE(sxtb(x0, w1), "sxtb x0, w1");
546 COMPARE(sxth(x2, w3), "sxth x2, w3");
547 COMPARE(sxtw(x4, w5), "sxtw x4, w5");
548
armvixlad96eda2013-06-14 11:42:37 +0100549 COMPARE(uxtb(w10, w11), "uxtb w10, w11");
550 COMPARE(uxtb(x12, x13), "uxtb x12, w13");
551 COMPARE(uxth(w14, w15), "uxth w14, w15");
552 COMPARE(uxth(x16, x17), "uxth x16, w17");
553 COMPARE(uxtw(x18, x19), "ubfx x18, x19, #0, #32");
554
555 COMPARE(asr(w20, w21, 10), "asr w20, w21, #10");
556 COMPARE(asr(x22, x23, 20), "asr x22, x23, #20");
557 COMPARE(lsr(w24, w25, 10), "lsr w24, w25, #10");
558 COMPARE(lsr(x26, x27, 20), "lsr x26, x27, #20");
559 COMPARE(lsl(w28, w29, 10), "lsl w28, w29, #10");
560 COMPARE(lsl(x30, x0, 20), "lsl x30, x0, #20");
561
562 COMPARE(sbfiz(w1, w2, 1, 20), "sbfiz w1, w2, #1, #20");
563 COMPARE(sbfiz(x3, x4, 2, 19), "sbfiz x3, x4, #2, #19");
564 COMPARE(sbfx(w5, w6, 3, 18), "sbfx w5, w6, #3, #18");
565 COMPARE(sbfx(x7, x8, 4, 17), "sbfx x7, x8, #4, #17");
566 COMPARE(bfi(w9, w10, 5, 16), "bfi w9, w10, #5, #16");
567 COMPARE(bfi(x11, x12, 6, 15), "bfi x11, x12, #6, #15");
568 COMPARE(bfxil(w13, w14, 7, 14), "bfxil w13, w14, #7, #14");
569 COMPARE(bfxil(x15, x16, 8, 13), "bfxil x15, x16, #8, #13");
570 COMPARE(ubfiz(w17, w18, 9, 12), "ubfiz w17, w18, #9, #12");
571 COMPARE(ubfiz(x19, x20, 10, 11), "ubfiz x19, x20, #10, #11");
572 COMPARE(ubfx(w21, w22, 11, 10), "ubfx w21, w22, #11, #10");
573 COMPARE(ubfx(x23, x24, 12, 9), "ubfx x23, x24, #12, #9");
574
575 CLEANUP();
576}
577
578
armvixl5289c592015-03-02 13:52:04 +0000579TEST(crc32b) {
580 SETUP();
581
582 COMPARE(crc32b(w0, w1, w2), "crc32b w0, w1, w2");
583 COMPARE(crc32b(w0, w11, w22), "crc32b w0, w11, w22");
584 COMPARE(crc32b(w10, w20, w30), "crc32b w10, w20, w30");
585
586 CLEANUP();
587}
588
589
590TEST(crc32h) {
591 SETUP();
592
593 COMPARE(crc32h(w1, w2, w3), "crc32h w1, w2, w3");
594 COMPARE(crc32h(w2, w13, w23), "crc32h w2, w13, w23");
595 COMPARE(crc32h(w11, w12, w15), "crc32h w11, w12, w15");
596
597 CLEANUP();
598}
599
600
601TEST(crc32w) {
602 SETUP();
603
604 COMPARE(crc32w(w2, w3, w4), "crc32w w2, w3, w4");
605 COMPARE(crc32w(w3, w14, w24), "crc32w w3, w14, w24");
606 COMPARE(crc32w(w13, w13, w16), "crc32w w13, w13, w16");
607
608 CLEANUP();
609}
610
611
612TEST(crc32x) {
613 SETUP();
614
615 COMPARE(crc32x(w3, w4, x5), "crc32x w3, w4, x5");
616 COMPARE(crc32x(w4, w15, x25), "crc32x w4, w15, x25");
617 COMPARE(crc32x(w14, w14, x30), "crc32x w14, w14, x30");
618
619 CLEANUP();
620}
621
622
623TEST(crc32cb) {
624 SETUP();
625
626 COMPARE(crc32cb(w4, w5, w6), "crc32cb w4, w5, w6");
627 COMPARE(crc32cb(w5, w16, w26), "crc32cb w5, w16, w26");
628 COMPARE(crc32cb(w15, w15, w5), "crc32cb w15, w15, w5");
629
630 CLEANUP();
631}
632
633
634TEST(crc32ch) {
635 SETUP();
636
637 COMPARE(crc32ch(w5, w6, w7), "crc32ch w5, w6, w7");
638 COMPARE(crc32ch(w6, w17, w27), "crc32ch w6, w17, w27");
639 COMPARE(crc32ch(w16, w16, w2), "crc32ch w16, w16, w2");
640
641 CLEANUP();
642}
643
644
645TEST(crc32cw) {
646 SETUP();
647
648 COMPARE(crc32cw(w6, w7, w8), "crc32cw w6, w7, w8");
649 COMPARE(crc32cw(w7, w18, w28), "crc32cw w7, w18, w28");
650 COMPARE(crc32cw(w17, w17, w3), "crc32cw w17, w17, w3");
651
652 CLEANUP();
653}
654
655
656TEST(crc32cx) {
657 SETUP();
658
659 COMPARE(crc32cx(w7, w8, x9), "crc32cx w7, w8, x9");
660 COMPARE(crc32cx(w8, w19, x29), "crc32cx w8, w19, x29");
661 COMPARE(crc32cx(w18, w18, x4), "crc32cx w18, w18, x4");
662
663 CLEANUP();
664}
665
666
armvixlad96eda2013-06-14 11:42:37 +0100667TEST(extract) {
668 SETUP();
669
670 COMPARE(extr(w0, w1, w2, 0), "extr w0, w1, w2, #0");
671 COMPARE(extr(x3, x4, x5, 1), "extr x3, x4, x5, #1");
672 COMPARE(extr(w6, w7, w8, 31), "extr w6, w7, w8, #31");
673 COMPARE(extr(x9, x10, x11, 63), "extr x9, x10, x11, #63");
674 COMPARE(extr(w12, w13, w13, 10), "ror w12, w13, #10");
675 COMPARE(extr(x14, x15, x15, 42), "ror x14, x15, #42");
676
677 CLEANUP();
678}
679
680
681TEST(logical_immediate) {
682 SETUP();
683 #define RESULT_SIZE (256)
684
685 char result[RESULT_SIZE];
686
687 // Test immediate encoding - 64-bit destination.
688 // 64-bit patterns.
689 uint64_t value = 0x7fffffff;
690 for (int i = 0; i < 64; i++) {
691 snprintf(result, RESULT_SIZE, "and x0, x0, #0x%" PRIx64, value);
692 COMPARE(and_(x0, x0, Operand(value)), result);
693 value = ((value & 1) << 63) | (value >> 1); // Rotate right 1 bit.
694 }
695
696 // 32-bit patterns.
armvixlb0c8ae22014-03-21 14:03:59 +0000697 value = 0x00003fff00003fff;
armvixlad96eda2013-06-14 11:42:37 +0100698 for (int i = 0; i < 32; i++) {
699 snprintf(result, RESULT_SIZE, "and x0, x0, #0x%" PRIx64, value);
700 COMPARE(and_(x0, x0, Operand(value)), result);
701 value = ((value & 1) << 63) | (value >> 1); // Rotate right 1 bit.
702 }
703
704 // 16-bit patterns.
armvixlb0c8ae22014-03-21 14:03:59 +0000705 value = 0x001f001f001f001f;
armvixlad96eda2013-06-14 11:42:37 +0100706 for (int i = 0; i < 16; i++) {
707 snprintf(result, RESULT_SIZE, "and x0, x0, #0x%" PRIx64, value);
708 COMPARE(and_(x0, x0, Operand(value)), result);
709 value = ((value & 1) << 63) | (value >> 1); // Rotate right 1 bit.
710 }
711
712 // 8-bit patterns.
armvixlb0c8ae22014-03-21 14:03:59 +0000713 value = 0x0e0e0e0e0e0e0e0e;
armvixlad96eda2013-06-14 11:42:37 +0100714 for (int i = 0; i < 8; i++) {
715 snprintf(result, RESULT_SIZE, "and x0, x0, #0x%" PRIx64, value);
716 COMPARE(and_(x0, x0, Operand(value)), result);
717 value = ((value & 1) << 63) | (value >> 1); // Rotate right 1 bit.
718 }
719
720 // 4-bit patterns.
armvixlb0c8ae22014-03-21 14:03:59 +0000721 value = 0x6666666666666666;
armvixlad96eda2013-06-14 11:42:37 +0100722 for (int i = 0; i < 4; i++) {
723 snprintf(result, RESULT_SIZE, "and x0, x0, #0x%" PRIx64, value);
724 COMPARE(and_(x0, x0, Operand(value)), result);
725 value = ((value & 1) << 63) | (value >> 1); // Rotate right 1 bit.
726 }
727
728 // 2-bit patterns.
armvixlb0c8ae22014-03-21 14:03:59 +0000729 COMPARE(and_(x0, x0, Operand(0x5555555555555555)),
armvixlad96eda2013-06-14 11:42:37 +0100730 "and x0, x0, #0x5555555555555555");
armvixlb0c8ae22014-03-21 14:03:59 +0000731 COMPARE(and_(x0, x0, Operand(0xaaaaaaaaaaaaaaaa)),
armvixlad96eda2013-06-14 11:42:37 +0100732 "and x0, x0, #0xaaaaaaaaaaaaaaaa");
733
734 // Test immediate encoding - 32-bit destination.
735 COMPARE(and_(w0, w0, Operand(0xff8007ff)),
736 "and w0, w0, #0xff8007ff"); // 32-bit pattern.
737 COMPARE(and_(w0, w0, Operand(0xf87ff87f)),
738 "and w0, w0, #0xf87ff87f"); // 16-bit pattern.
739 COMPARE(and_(w0, w0, Operand(0x87878787)),
740 "and w0, w0, #0x87878787"); // 8-bit pattern.
741 COMPARE(and_(w0, w0, Operand(0x66666666)),
742 "and w0, w0, #0x66666666"); // 4-bit pattern.
743 COMPARE(and_(w0, w0, Operand(0x55555555)),
744 "and w0, w0, #0x55555555"); // 2-bit pattern.
745
746 // Test other instructions.
747 COMPARE(tst(w1, Operand(0x11111111)),
748 "tst w1, #0x11111111");
armvixlb0c8ae22014-03-21 14:03:59 +0000749 COMPARE(tst(x2, Operand(0x8888888888888888)),
armvixlad96eda2013-06-14 11:42:37 +0100750 "tst x2, #0x8888888888888888");
751 COMPARE(orr(w7, w8, Operand(0xaaaaaaaa)),
752 "orr w7, w8, #0xaaaaaaaa");
armvixlb0c8ae22014-03-21 14:03:59 +0000753 COMPARE(orr(x9, x10, Operand(0x5555555555555555)),
armvixlad96eda2013-06-14 11:42:37 +0100754 "orr x9, x10, #0x5555555555555555");
755 COMPARE(eor(w15, w16, Operand(0x00000001)),
756 "eor w15, w16, #0x1");
armvixlb0c8ae22014-03-21 14:03:59 +0000757 COMPARE(eor(x17, x18, Operand(0x0000000000000003)),
armvixlad96eda2013-06-14 11:42:37 +0100758 "eor x17, x18, #0x3");
armvixlf37fdc02014-02-05 13:22:16 +0000759 COMPARE(ands(w23, w24, Operand(0x0000000f)), "ands w23, w24, #0xf");
armvixlb0c8ae22014-03-21 14:03:59 +0000760 COMPARE(ands(x25, x26, Operand(0x800000000000000f)),
armvixlad96eda2013-06-14 11:42:37 +0100761 "ands x25, x26, #0x800000000000000f");
762
763 // Test inverse.
764 COMPARE(bic(w3, w4, Operand(0x20202020)),
765 "and w3, w4, #0xdfdfdfdf");
armvixlb0c8ae22014-03-21 14:03:59 +0000766 COMPARE(bic(x5, x6, Operand(0x4040404040404040)),
armvixlad96eda2013-06-14 11:42:37 +0100767 "and x5, x6, #0xbfbfbfbfbfbfbfbf");
768 COMPARE(orn(w11, w12, Operand(0x40004000)),
769 "orr w11, w12, #0xbfffbfff");
armvixlb0c8ae22014-03-21 14:03:59 +0000770 COMPARE(orn(x13, x14, Operand(0x8181818181818181)),
armvixlad96eda2013-06-14 11:42:37 +0100771 "orr x13, x14, #0x7e7e7e7e7e7e7e7e");
772 COMPARE(eon(w19, w20, Operand(0x80000001)),
773 "eor w19, w20, #0x7ffffffe");
armvixlb0c8ae22014-03-21 14:03:59 +0000774 COMPARE(eon(x21, x22, Operand(0xc000000000000003)),
armvixlad96eda2013-06-14 11:42:37 +0100775 "eor x21, x22, #0x3ffffffffffffffc");
armvixlf37fdc02014-02-05 13:22:16 +0000776 COMPARE(bics(w27, w28, Operand(0xfffffff7)), "ands w27, w28, #0x8");
armvixlb0c8ae22014-03-21 14:03:59 +0000777 COMPARE(bics(x29, x0, Operand(0xfffffffeffffffff)),
armvixlad96eda2013-06-14 11:42:37 +0100778 "ands x29, x0, #0x100000000");
779
780 // Test stack pointer.
781 COMPARE(and_(wsp, wzr, Operand(7)), "and wsp, wzr, #0x7");
armvixlf37fdc02014-02-05 13:22:16 +0000782 COMPARE(ands(xzr, xzr, Operand(7)), "tst xzr, #0x7");
armvixlad96eda2013-06-14 11:42:37 +0100783 COMPARE(orr(sp, xzr, Operand(15)), "orr sp, xzr, #0xf");
784 COMPARE(eor(wsp, w0, Operand(31)), "eor wsp, w0, #0x1f");
785
786 // Test move aliases.
787 COMPARE(orr(w0, wzr, Operand(0x00000780)), "orr w0, wzr, #0x780");
788 COMPARE(orr(w1, wzr, Operand(0x00007800)), "orr w1, wzr, #0x7800");
789 COMPARE(orr(w2, wzr, Operand(0x00078000)), "mov w2, #0x78000");
790 COMPARE(orr(w3, wzr, Operand(0x00780000)), "orr w3, wzr, #0x780000");
791 COMPARE(orr(w4, wzr, Operand(0x07800000)), "orr w4, wzr, #0x7800000");
armvixlb0c8ae22014-03-21 14:03:59 +0000792 COMPARE(orr(x5, xzr, Operand(0xffffffffffffc001)),
armvixlad96eda2013-06-14 11:42:37 +0100793 "orr x5, xzr, #0xffffffffffffc001");
armvixlb0c8ae22014-03-21 14:03:59 +0000794 COMPARE(orr(x6, xzr, Operand(0xfffffffffffc001f)),
armvixlad96eda2013-06-14 11:42:37 +0100795 "mov x6, #0xfffffffffffc001f");
armvixlb0c8ae22014-03-21 14:03:59 +0000796 COMPARE(orr(x7, xzr, Operand(0xffffffffffc001ff)),
armvixlad96eda2013-06-14 11:42:37 +0100797 "mov x7, #0xffffffffffc001ff");
armvixlb0c8ae22014-03-21 14:03:59 +0000798 COMPARE(orr(x8, xzr, Operand(0xfffffffffc001fff)),
armvixlad96eda2013-06-14 11:42:37 +0100799 "mov x8, #0xfffffffffc001fff");
armvixlb0c8ae22014-03-21 14:03:59 +0000800 COMPARE(orr(x9, xzr, Operand(0xffffffffc001ffff)),
armvixlad96eda2013-06-14 11:42:37 +0100801 "orr x9, xzr, #0xffffffffc001ffff");
802
803 CLEANUP();
804}
805
806
807TEST(logical_shifted) {
808 SETUP();
809
810 COMPARE(and_(w0, w1, Operand(w2)), "and w0, w1, w2");
811 COMPARE(and_(x3, x4, Operand(x5, LSL, 1)), "and x3, x4, x5, lsl #1");
812 COMPARE(and_(w6, w7, Operand(w8, LSR, 2)), "and w6, w7, w8, lsr #2");
813 COMPARE(and_(x9, x10, Operand(x11, ASR, 3)), "and x9, x10, x11, asr #3");
814 COMPARE(and_(w12, w13, Operand(w14, ROR, 4)), "and w12, w13, w14, ror #4");
815
816 COMPARE(bic(w15, w16, Operand(w17)), "bic w15, w16, w17");
817 COMPARE(bic(x18, x19, Operand(x20, LSL, 5)), "bic x18, x19, x20, lsl #5");
818 COMPARE(bic(w21, w22, Operand(w23, LSR, 6)), "bic w21, w22, w23, lsr #6");
819 COMPARE(bic(x24, x25, Operand(x26, ASR, 7)), "bic x24, x25, x26, asr #7");
820 COMPARE(bic(w27, w28, Operand(w29, ROR, 8)), "bic w27, w28, w29, ror #8");
821
822 COMPARE(orr(w0, w1, Operand(w2)), "orr w0, w1, w2");
823 COMPARE(orr(x3, x4, Operand(x5, LSL, 9)), "orr x3, x4, x5, lsl #9");
824 COMPARE(orr(w6, w7, Operand(w8, LSR, 10)), "orr w6, w7, w8, lsr #10");
825 COMPARE(orr(x9, x10, Operand(x11, ASR, 11)), "orr x9, x10, x11, asr #11");
826 COMPARE(orr(w12, w13, Operand(w14, ROR, 12)), "orr w12, w13, w14, ror #12");
827
828 COMPARE(orn(w15, w16, Operand(w17)), "orn w15, w16, w17");
829 COMPARE(orn(x18, x19, Operand(x20, LSL, 13)), "orn x18, x19, x20, lsl #13");
830 COMPARE(orn(w21, w22, Operand(w23, LSR, 14)), "orn w21, w22, w23, lsr #14");
831 COMPARE(orn(x24, x25, Operand(x26, ASR, 15)), "orn x24, x25, x26, asr #15");
832 COMPARE(orn(w27, w28, Operand(w29, ROR, 16)), "orn w27, w28, w29, ror #16");
833
834 COMPARE(eor(w0, w1, Operand(w2)), "eor w0, w1, w2");
835 COMPARE(eor(x3, x4, Operand(x5, LSL, 17)), "eor x3, x4, x5, lsl #17");
836 COMPARE(eor(w6, w7, Operand(w8, LSR, 18)), "eor w6, w7, w8, lsr #18");
837 COMPARE(eor(x9, x10, Operand(x11, ASR, 19)), "eor x9, x10, x11, asr #19");
838 COMPARE(eor(w12, w13, Operand(w14, ROR, 20)), "eor w12, w13, w14, ror #20");
839
840 COMPARE(eon(w15, w16, Operand(w17)), "eon w15, w16, w17");
841 COMPARE(eon(x18, x19, Operand(x20, LSL, 21)), "eon x18, x19, x20, lsl #21");
842 COMPARE(eon(w21, w22, Operand(w23, LSR, 22)), "eon w21, w22, w23, lsr #22");
843 COMPARE(eon(x24, x25, Operand(x26, ASR, 23)), "eon x24, x25, x26, asr #23");
844 COMPARE(eon(w27, w28, Operand(w29, ROR, 24)), "eon w27, w28, w29, ror #24");
845
armvixlf37fdc02014-02-05 13:22:16 +0000846 COMPARE(ands(w0, w1, Operand(w2)), "ands w0, w1, w2");
847 COMPARE(ands(x3, x4, Operand(x5, LSL, 1)), "ands x3, x4, x5, lsl #1");
848 COMPARE(ands(w6, w7, Operand(w8, LSR, 2)), "ands w6, w7, w8, lsr #2");
849 COMPARE(ands(x9, x10, Operand(x11, ASR, 3)), "ands x9, x10, x11, asr #3");
850 COMPARE(ands(w12, w13, Operand(w14, ROR, 4)), "ands w12, w13, w14, ror #4");
armvixlad96eda2013-06-14 11:42:37 +0100851
armvixlf37fdc02014-02-05 13:22:16 +0000852 COMPARE(bics(w15, w16, Operand(w17)), "bics w15, w16, w17");
853 COMPARE(bics(x18, x19, Operand(x20, LSL, 5)), "bics x18, x19, x20, lsl #5");
854 COMPARE(bics(w21, w22, Operand(w23, LSR, 6)), "bics w21, w22, w23, lsr #6");
855 COMPARE(bics(x24, x25, Operand(x26, ASR, 7)), "bics x24, x25, x26, asr #7");
856 COMPARE(bics(w27, w28, Operand(w29, ROR, 8)), "bics w27, w28, w29, ror #8");
armvixlad96eda2013-06-14 11:42:37 +0100857
858 COMPARE(tst(w0, Operand(w1)), "tst w0, w1");
859 COMPARE(tst(w2, Operand(w3, ROR, 10)), "tst w2, w3, ror #10");
860 COMPARE(tst(x0, Operand(x1)), "tst x0, x1");
861 COMPARE(tst(x2, Operand(x3, ROR, 42)), "tst x2, x3, ror #42");
862
863 COMPARE(orn(w0, wzr, Operand(w1)), "mvn w0, w1");
864 COMPARE(orn(w2, wzr, Operand(w3, ASR, 5)), "mvn w2, w3, asr #5");
865 COMPARE(orn(x0, xzr, Operand(x1)), "mvn x0, x1");
866 COMPARE(orn(x2, xzr, Operand(x3, ASR, 42)), "mvn x2, x3, asr #42");
867
868 COMPARE(orr(w0, wzr, Operand(w1)), "mov w0, w1");
869 COMPARE(orr(x0, xzr, Operand(x1)), "mov x0, x1");
870 COMPARE(orr(w16, wzr, Operand(w17, LSL, 1)), "orr w16, wzr, w17, lsl #1");
871 COMPARE(orr(x16, xzr, Operand(x17, ASR, 2)), "orr x16, xzr, x17, asr #2");
872
873 CLEANUP();
874}
875
876
877TEST(dp_2_source) {
878 SETUP();
879
880 COMPARE(lslv(w0, w1, w2), "lsl w0, w1, w2");
881 COMPARE(lslv(x3, x4, x5), "lsl x3, x4, x5");
882 COMPARE(lsrv(w6, w7, w8), "lsr w6, w7, w8");
883 COMPARE(lsrv(x9, x10, x11), "lsr x9, x10, x11");
884 COMPARE(asrv(w12, w13, w14), "asr w12, w13, w14");
885 COMPARE(asrv(x15, x16, x17), "asr x15, x16, x17");
886 COMPARE(rorv(w18, w19, w20), "ror w18, w19, w20");
887 COMPARE(rorv(x21, x22, x23), "ror x21, x22, x23");
888
889 CLEANUP();
890}
891
armvixl4a102ba2014-07-14 09:02:40 +0100892
armvixlad96eda2013-06-14 11:42:37 +0100893TEST(adr) {
894 SETUP();
895
armvixlb0c8ae22014-03-21 14:03:59 +0000896 COMPARE_PREFIX(adr(x0, 0), "adr x0, #+0x0");
897 COMPARE_PREFIX(adr(x1, 1), "adr x1, #+0x1");
898 COMPARE_PREFIX(adr(x2, -1), "adr x2, #-0x1");
899 COMPARE_PREFIX(adr(x3, 4), "adr x3, #+0x4");
900 COMPARE_PREFIX(adr(x4, -4), "adr x4, #-0x4");
901 COMPARE_PREFIX(adr(x5, 0x000fffff), "adr x5, #+0xfffff");
902 COMPARE_PREFIX(adr(x6, -0x00100000), "adr x6, #-0x100000");
903 COMPARE_PREFIX(adr(xzr, 0), "adr xzr, #+0x0");
armvixlad96eda2013-06-14 11:42:37 +0100904
905 CLEANUP();
906}
907
armvixl4a102ba2014-07-14 09:02:40 +0100908
909TEST(adrp) {
910 SETUP();
911
912 COMPARE_PREFIX(adrp(x0, 0), "adrp x0, #+0x0");
armvixl330dc712014-11-25 10:38:32 +0000913 COMPARE_PREFIX(adrp(x1, 1), "adrp x1, #+0x1000");
914 COMPARE_PREFIX(adrp(x2, -1), "adrp x2, #-0x1000");
915 COMPARE_PREFIX(adrp(x3, 4), "adrp x3, #+0x4000");
916 COMPARE_PREFIX(adrp(x4, -4), "adrp x4, #-0x4000");
917 COMPARE_PREFIX(adrp(x5, 0x000fffff), "adrp x5, #+0xfffff000");
918 COMPARE_PREFIX(adrp(x6, -0x00100000), "adrp x6, #-0x100000000");
armvixl4a102ba2014-07-14 09:02:40 +0100919 COMPARE_PREFIX(adrp(xzr, 0), "adrp xzr, #+0x0");
920
921 CLEANUP();
922}
923
924
armvixlad96eda2013-06-14 11:42:37 +0100925TEST(branch) {
926 SETUP();
927
928 #define INST_OFF(x) ((x) >> kInstructionSizeLog2)
armvixlb0c8ae22014-03-21 14:03:59 +0000929 COMPARE_PREFIX(b(INST_OFF(0x4)), "b #+0x4");
930 COMPARE_PREFIX(b(INST_OFF(-0x4)), "b #-0x4");
931 COMPARE_PREFIX(b(INST_OFF(0x7fffffc)), "b #+0x7fffffc");
932 COMPARE_PREFIX(b(INST_OFF(-0x8000000)), "b #-0x8000000");
933 COMPARE_PREFIX(b(INST_OFF(0xffffc), eq), "b.eq #+0xffffc");
934 COMPARE_PREFIX(b(INST_OFF(-0x100000), mi), "b.mi #-0x100000");
935 COMPARE_PREFIX(b(INST_OFF(0xffffc), al), "b.al #+0xffffc");
936 COMPARE_PREFIX(b(INST_OFF(-0x100000), nv), "b.nv #-0x100000");
937 COMPARE_PREFIX(bl(INST_OFF(0x4)), "bl #+0x4");
938 COMPARE_PREFIX(bl(INST_OFF(-0x4)), "bl #-0x4");
939 COMPARE_PREFIX(bl(INST_OFF(0xffffc)), "bl #+0xffffc");
940 COMPARE_PREFIX(bl(INST_OFF(-0x100000)), "bl #-0x100000");
941 COMPARE_PREFIX(cbz(w0, INST_OFF(0xffffc)), "cbz w0, #+0xffffc");
942 COMPARE_PREFIX(cbz(x1, INST_OFF(-0x100000)), "cbz x1, #-0x100000");
943 COMPARE_PREFIX(cbnz(w2, INST_OFF(0xffffc)), "cbnz w2, #+0xffffc");
944 COMPARE_PREFIX(cbnz(x3, INST_OFF(-0x100000)), "cbnz x3, #-0x100000");
945 COMPARE_PREFIX(tbz(w4, 0, INST_OFF(0x7ffc)), "tbz w4, #0, #+0x7ffc");
946 COMPARE_PREFIX(tbz(x5, 63, INST_OFF(-0x8000)), "tbz x5, #63, #-0x8000");
947 COMPARE_PREFIX(tbz(w6, 31, INST_OFF(0)), "tbz w6, #31, #+0x0");
948 COMPARE_PREFIX(tbz(x7, 31, INST_OFF(0x4)), "tbz w7, #31, #+0x4");
949 COMPARE_PREFIX(tbz(x8, 32, INST_OFF(0x8)), "tbz x8, #32, #+0x8");
950 COMPARE_PREFIX(tbnz(w8, 0, INST_OFF(0x7ffc)), "tbnz w8, #0, #+0x7ffc");
951 COMPARE_PREFIX(tbnz(x9, 63, INST_OFF(-0x8000)), "tbnz x9, #63, #-0x8000");
952 COMPARE_PREFIX(tbnz(w10, 31, INST_OFF(0)), "tbnz w10, #31, #+0x0");
953 COMPARE_PREFIX(tbnz(x11, 31, INST_OFF(0x4)), "tbnz w11, #31, #+0x4");
954 COMPARE_PREFIX(tbnz(x12, 32, INST_OFF(0x8)), "tbnz x12, #32, #+0x8");
armvixlad96eda2013-06-14 11:42:37 +0100955 COMPARE(br(x0), "br x0");
956 COMPARE(blr(x1), "blr x1");
957 COMPARE(ret(x2), "ret x2");
958 COMPARE(ret(lr), "ret")
959
960 CLEANUP();
961}
962
armvixl4a102ba2014-07-14 09:02:40 +0100963
armvixlad96eda2013-06-14 11:42:37 +0100964TEST(load_store) {
965 SETUP();
966
967 COMPARE(ldr(w0, MemOperand(x1)), "ldr w0, [x1]");
968 COMPARE(ldr(w2, MemOperand(x3, 4)), "ldr w2, [x3, #4]");
969 COMPARE(ldr(w4, MemOperand(x5, 16380)), "ldr w4, [x5, #16380]");
970 COMPARE(ldr(x6, MemOperand(x7)), "ldr x6, [x7]");
971 COMPARE(ldr(x8, MemOperand(x9, 8)), "ldr x8, [x9, #8]");
972 COMPARE(ldr(x10, MemOperand(x11, 32760)), "ldr x10, [x11, #32760]");
973 COMPARE(str(w12, MemOperand(x13)), "str w12, [x13]");
974 COMPARE(str(w14, MemOperand(x15, 4)), "str w14, [x15, #4]");
975 COMPARE(str(w16, MemOperand(x17, 16380)), "str w16, [x17, #16380]");
976 COMPARE(str(x18, MemOperand(x19)), "str x18, [x19]");
977 COMPARE(str(x20, MemOperand(x21, 8)), "str x20, [x21, #8]");
978 COMPARE(str(x22, MemOperand(x23, 32760)), "str x22, [x23, #32760]");
979
980 COMPARE(ldr(w0, MemOperand(x1, 4, PreIndex)), "ldr w0, [x1, #4]!");
981 COMPARE(ldr(w2, MemOperand(x3, 255, PreIndex)), "ldr w2, [x3, #255]!");
982 COMPARE(ldr(w4, MemOperand(x5, -256, PreIndex)), "ldr w4, [x5, #-256]!");
983 COMPARE(ldr(x6, MemOperand(x7, 8, PreIndex)), "ldr x6, [x7, #8]!");
984 COMPARE(ldr(x8, MemOperand(x9, 255, PreIndex)), "ldr x8, [x9, #255]!");
985 COMPARE(ldr(x10, MemOperand(x11, -256, PreIndex)), "ldr x10, [x11, #-256]!");
986 COMPARE(str(w12, MemOperand(x13, 4, PreIndex)), "str w12, [x13, #4]!");
987 COMPARE(str(w14, MemOperand(x15, 255, PreIndex)), "str w14, [x15, #255]!");
988 COMPARE(str(w16, MemOperand(x17, -256, PreIndex)), "str w16, [x17, #-256]!");
989 COMPARE(str(x18, MemOperand(x19, 8, PreIndex)), "str x18, [x19, #8]!");
990 COMPARE(str(x20, MemOperand(x21, 255, PreIndex)), "str x20, [x21, #255]!");
991 COMPARE(str(x22, MemOperand(x23, -256, PreIndex)), "str x22, [x23, #-256]!");
992
993 COMPARE(ldr(w0, MemOperand(x1, 4, PostIndex)), "ldr w0, [x1], #4");
994 COMPARE(ldr(w2, MemOperand(x3, 255, PostIndex)), "ldr w2, [x3], #255");
995 COMPARE(ldr(w4, MemOperand(x5, -256, PostIndex)), "ldr w4, [x5], #-256");
996 COMPARE(ldr(x6, MemOperand(x7, 8, PostIndex)), "ldr x6, [x7], #8");
997 COMPARE(ldr(x8, MemOperand(x9, 255, PostIndex)), "ldr x8, [x9], #255");
998 COMPARE(ldr(x10, MemOperand(x11, -256, PostIndex)), "ldr x10, [x11], #-256");
999 COMPARE(str(w12, MemOperand(x13, 4, PostIndex)), "str w12, [x13], #4");
1000 COMPARE(str(w14, MemOperand(x15, 255, PostIndex)), "str w14, [x15], #255");
1001 COMPARE(str(w16, MemOperand(x17, -256, PostIndex)), "str w16, [x17], #-256");
1002 COMPARE(str(x18, MemOperand(x19, 8, PostIndex)), "str x18, [x19], #8");
1003 COMPARE(str(x20, MemOperand(x21, 255, PostIndex)), "str x20, [x21], #255");
1004 COMPARE(str(x22, MemOperand(x23, -256, PostIndex)), "str x22, [x23], #-256");
1005
1006 COMPARE(ldr(w24, MemOperand(sp)), "ldr w24, [sp]");
1007 COMPARE(ldr(x25, MemOperand(sp, 8)), "ldr x25, [sp, #8]");
1008 COMPARE(str(w26, MemOperand(sp, 4, PreIndex)), "str w26, [sp, #4]!");
1009 COMPARE(str(x27, MemOperand(sp, -8, PostIndex)), "str x27, [sp], #-8");
1010
1011 COMPARE(ldrsw(x0, MemOperand(x1)), "ldrsw x0, [x1]");
1012 COMPARE(ldrsw(x2, MemOperand(x3, 8)), "ldrsw x2, [x3, #8]");
1013 COMPARE(ldrsw(x4, MemOperand(x5, 42, PreIndex)), "ldrsw x4, [x5, #42]!");
1014 COMPARE(ldrsw(x6, MemOperand(x7, -11, PostIndex)), "ldrsw x6, [x7], #-11");
1015
1016 CLEANUP();
1017}
1018
1019
1020TEST(load_store_regoffset) {
1021 SETUP();
1022
1023 COMPARE(ldr(w0, MemOperand(x1, w2, UXTW)), "ldr w0, [x1, w2, uxtw]");
1024 COMPARE(ldr(w3, MemOperand(x4, w5, UXTW, 2)), "ldr w3, [x4, w5, uxtw #2]");
1025 COMPARE(ldr(w6, MemOperand(x7, x8)), "ldr w6, [x7, x8]");
1026 COMPARE(ldr(w9, MemOperand(x10, x11, LSL, 2)), "ldr w9, [x10, x11, lsl #2]");
1027 COMPARE(ldr(w12, MemOperand(x13, w14, SXTW)), "ldr w12, [x13, w14, sxtw]");
1028 COMPARE(ldr(w15, MemOperand(x16, w17, SXTW, 2)),
1029 "ldr w15, [x16, w17, sxtw #2]");
1030 COMPARE(ldr(w18, MemOperand(x19, x20, SXTX)), "ldr w18, [x19, x20, sxtx]");
1031 COMPARE(ldr(w21, MemOperand(x22, x23, SXTX, 2)),
1032 "ldr w21, [x22, x23, sxtx #2]");
1033 COMPARE(ldr(x0, MemOperand(x1, w2, UXTW)), "ldr x0, [x1, w2, uxtw]");
1034 COMPARE(ldr(x3, MemOperand(x4, w5, UXTW, 3)), "ldr x3, [x4, w5, uxtw #3]");
1035 COMPARE(ldr(x6, MemOperand(x7, x8)), "ldr x6, [x7, x8]");
1036 COMPARE(ldr(x9, MemOperand(x10, x11, LSL, 3)), "ldr x9, [x10, x11, lsl #3]");
1037 COMPARE(ldr(x12, MemOperand(x13, w14, SXTW)), "ldr x12, [x13, w14, sxtw]");
1038 COMPARE(ldr(x15, MemOperand(x16, w17, SXTW, 3)),
1039 "ldr x15, [x16, w17, sxtw #3]");
1040 COMPARE(ldr(x18, MemOperand(x19, x20, SXTX)), "ldr x18, [x19, x20, sxtx]");
1041 COMPARE(ldr(x21, MemOperand(x22, x23, SXTX, 3)),
1042 "ldr x21, [x22, x23, sxtx #3]");
1043
1044 COMPARE(str(w0, MemOperand(x1, w2, UXTW)), "str w0, [x1, w2, uxtw]");
1045 COMPARE(str(w3, MemOperand(x4, w5, UXTW, 2)), "str w3, [x4, w5, uxtw #2]");
1046 COMPARE(str(w6, MemOperand(x7, x8)), "str w6, [x7, x8]");
1047 COMPARE(str(w9, MemOperand(x10, x11, LSL, 2)), "str w9, [x10, x11, lsl #2]");
1048 COMPARE(str(w12, MemOperand(x13, w14, SXTW)), "str w12, [x13, w14, sxtw]");
1049 COMPARE(str(w15, MemOperand(x16, w17, SXTW, 2)),
1050 "str w15, [x16, w17, sxtw #2]");
1051 COMPARE(str(w18, MemOperand(x19, x20, SXTX)), "str w18, [x19, x20, sxtx]");
1052 COMPARE(str(w21, MemOperand(x22, x23, SXTX, 2)),
1053 "str w21, [x22, x23, sxtx #2]");
1054 COMPARE(str(x0, MemOperand(x1, w2, UXTW)), "str x0, [x1, w2, uxtw]");
1055 COMPARE(str(x3, MemOperand(x4, w5, UXTW, 3)), "str x3, [x4, w5, uxtw #3]");
1056 COMPARE(str(x6, MemOperand(x7, x8)), "str x6, [x7, x8]");
1057 COMPARE(str(x9, MemOperand(x10, x11, LSL, 3)), "str x9, [x10, x11, lsl #3]");
1058 COMPARE(str(x12, MemOperand(x13, w14, SXTW)), "str x12, [x13, w14, sxtw]");
1059 COMPARE(str(x15, MemOperand(x16, w17, SXTW, 3)),
1060 "str x15, [x16, w17, sxtw #3]");
1061 COMPARE(str(x18, MemOperand(x19, x20, SXTX)), "str x18, [x19, x20, sxtx]");
1062 COMPARE(str(x21, MemOperand(x22, x23, SXTX, 3)),
1063 "str x21, [x22, x23, sxtx #3]");
1064
1065 COMPARE(ldrb(w0, MemOperand(x1, w2, UXTW)), "ldrb w0, [x1, w2, uxtw]");
1066 COMPARE(ldrb(w6, MemOperand(x7, x8)), "ldrb w6, [x7, x8]");
1067 COMPARE(ldrb(w12, MemOperand(x13, w14, SXTW)), "ldrb w12, [x13, w14, sxtw]");
1068 COMPARE(ldrb(w18, MemOperand(x19, x20, SXTX)), "ldrb w18, [x19, x20, sxtx]");
1069 COMPARE(strb(w0, MemOperand(x1, w2, UXTW)), "strb w0, [x1, w2, uxtw]");
1070 COMPARE(strb(w6, MemOperand(x7, x8)), "strb w6, [x7, x8]");
1071 COMPARE(strb(w12, MemOperand(x13, w14, SXTW)), "strb w12, [x13, w14, sxtw]");
1072 COMPARE(strb(w18, MemOperand(x19, x20, SXTX)), "strb w18, [x19, x20, sxtx]");
1073
1074 COMPARE(ldrh(w0, MemOperand(x1, w2, UXTW)), "ldrh w0, [x1, w2, uxtw]");
1075 COMPARE(ldrh(w3, MemOperand(x4, w5, UXTW, 1)), "ldrh w3, [x4, w5, uxtw #1]");
1076 COMPARE(ldrh(w6, MemOperand(x7, x8)), "ldrh w6, [x7, x8]");
1077 COMPARE(ldrh(w9, MemOperand(x10, x11, LSL, 1)),
1078 "ldrh w9, [x10, x11, lsl #1]");
1079 COMPARE(ldrh(w12, MemOperand(x13, w14, SXTW)), "ldrh w12, [x13, w14, sxtw]");
1080 COMPARE(ldrh(w15, MemOperand(x16, w17, SXTW, 1)),
1081 "ldrh w15, [x16, w17, sxtw #1]");
1082 COMPARE(ldrh(w18, MemOperand(x19, x20, SXTX)), "ldrh w18, [x19, x20, sxtx]");
1083 COMPARE(ldrh(w21, MemOperand(x22, x23, SXTX, 1)),
1084 "ldrh w21, [x22, x23, sxtx #1]");
1085 COMPARE(strh(w0, MemOperand(x1, w2, UXTW)), "strh w0, [x1, w2, uxtw]");
1086 COMPARE(strh(w3, MemOperand(x4, w5, UXTW, 1)), "strh w3, [x4, w5, uxtw #1]");
1087 COMPARE(strh(w6, MemOperand(x7, x8)), "strh w6, [x7, x8]");
1088 COMPARE(strh(w9, MemOperand(x10, x11, LSL, 1)),
1089 "strh w9, [x10, x11, lsl #1]");
1090 COMPARE(strh(w12, MemOperand(x13, w14, SXTW)), "strh w12, [x13, w14, sxtw]");
1091 COMPARE(strh(w15, MemOperand(x16, w17, SXTW, 1)),
1092 "strh w15, [x16, w17, sxtw #1]");
1093 COMPARE(strh(w18, MemOperand(x19, x20, SXTX)), "strh w18, [x19, x20, sxtx]");
1094 COMPARE(strh(w21, MemOperand(x22, x23, SXTX, 1)),
1095 "strh w21, [x22, x23, sxtx #1]");
1096
1097 COMPARE(ldr(x0, MemOperand(sp, wzr, SXTW)), "ldr x0, [sp, wzr, sxtw]");
1098 COMPARE(str(x1, MemOperand(sp, xzr)), "str x1, [sp, xzr]");
1099
1100 CLEANUP();
1101}
1102
1103
1104TEST(load_store_byte) {
1105 SETUP();
1106
1107 COMPARE(ldrb(w0, MemOperand(x1)), "ldrb w0, [x1]");
1108 COMPARE(ldrb(x2, MemOperand(x3)), "ldrb w2, [x3]");
1109 COMPARE(ldrb(w4, MemOperand(x5, 4095)), "ldrb w4, [x5, #4095]");
1110 COMPARE(ldrb(w6, MemOperand(x7, 255, PreIndex)), "ldrb w6, [x7, #255]!");
1111 COMPARE(ldrb(w8, MemOperand(x9, -256, PreIndex)), "ldrb w8, [x9, #-256]!");
1112 COMPARE(ldrb(w10, MemOperand(x11, 255, PostIndex)), "ldrb w10, [x11], #255");
1113 COMPARE(ldrb(w12, MemOperand(x13, -256, PostIndex)),
1114 "ldrb w12, [x13], #-256");
1115 COMPARE(strb(w14, MemOperand(x15)), "strb w14, [x15]");
1116 COMPARE(strb(x16, MemOperand(x17)), "strb w16, [x17]");
1117 COMPARE(strb(w18, MemOperand(x19, 4095)), "strb w18, [x19, #4095]");
1118 COMPARE(strb(w20, MemOperand(x21, 255, PreIndex)), "strb w20, [x21, #255]!");
1119 COMPARE(strb(w22, MemOperand(x23, -256, PreIndex)),
1120 "strb w22, [x23, #-256]!");
1121 COMPARE(strb(w24, MemOperand(x25, 255, PostIndex)), "strb w24, [x25], #255");
1122 COMPARE(strb(w26, MemOperand(x27, -256, PostIndex)),
1123 "strb w26, [x27], #-256");
1124 COMPARE(ldrb(w28, MemOperand(sp, 3, PostIndex)), "ldrb w28, [sp], #3");
1125 COMPARE(strb(x29, MemOperand(sp, -42, PreIndex)), "strb w29, [sp, #-42]!");
1126 COMPARE(ldrsb(w0, MemOperand(x1)), "ldrsb w0, [x1]");
1127 COMPARE(ldrsb(x2, MemOperand(x3, 8)), "ldrsb x2, [x3, #8]");
1128 COMPARE(ldrsb(w4, MemOperand(x5, 42, PreIndex)), "ldrsb w4, [x5, #42]!");
1129 COMPARE(ldrsb(x6, MemOperand(x7, -11, PostIndex)), "ldrsb x6, [x7], #-11");
1130
1131 CLEANUP();
1132}
1133
1134
1135TEST(load_store_half) {
1136 SETUP();
1137
1138 COMPARE(ldrh(w0, MemOperand(x1)), "ldrh w0, [x1]");
1139 COMPARE(ldrh(x2, MemOperand(x3)), "ldrh w2, [x3]");
1140 COMPARE(ldrh(w4, MemOperand(x5, 8190)), "ldrh w4, [x5, #8190]");
1141 COMPARE(ldrh(w6, MemOperand(x7, 255, PreIndex)), "ldrh w6, [x7, #255]!");
1142 COMPARE(ldrh(w8, MemOperand(x9, -256, PreIndex)), "ldrh w8, [x9, #-256]!");
1143 COMPARE(ldrh(w10, MemOperand(x11, 255, PostIndex)), "ldrh w10, [x11], #255");
1144 COMPARE(ldrh(w12, MemOperand(x13, -256, PostIndex)),
1145 "ldrh w12, [x13], #-256");
1146 COMPARE(strh(w14, MemOperand(x15)), "strh w14, [x15]");
1147 COMPARE(strh(x16, MemOperand(x17)), "strh w16, [x17]");
1148 COMPARE(strh(w18, MemOperand(x19, 8190)), "strh w18, [x19, #8190]");
1149 COMPARE(strh(w20, MemOperand(x21, 255, PreIndex)), "strh w20, [x21, #255]!");
1150 COMPARE(strh(w22, MemOperand(x23, -256, PreIndex)),
1151 "strh w22, [x23, #-256]!");
1152 COMPARE(strh(w24, MemOperand(x25, 255, PostIndex)), "strh w24, [x25], #255");
1153 COMPARE(strh(w26, MemOperand(x27, -256, PostIndex)),
1154 "strh w26, [x27], #-256");
1155 COMPARE(ldrh(w28, MemOperand(sp, 3, PostIndex)), "ldrh w28, [sp], #3");
1156 COMPARE(strh(x29, MemOperand(sp, -42, PreIndex)), "strh w29, [sp, #-42]!");
1157 COMPARE(ldrh(w30, MemOperand(x0, 255)), "ldurh w30, [x0, #255]");
1158 COMPARE(ldrh(x1, MemOperand(x2, -256)), "ldurh w1, [x2, #-256]");
1159 COMPARE(strh(w3, MemOperand(x4, 255)), "sturh w3, [x4, #255]");
1160 COMPARE(strh(x5, MemOperand(x6, -256)), "sturh w5, [x6, #-256]");
1161 COMPARE(ldrsh(w0, MemOperand(x1)), "ldrsh w0, [x1]");
1162 COMPARE(ldrsh(w2, MemOperand(x3, 8)), "ldrsh w2, [x3, #8]");
1163 COMPARE(ldrsh(w4, MemOperand(x5, 42, PreIndex)), "ldrsh w4, [x5, #42]!");
1164 COMPARE(ldrsh(x6, MemOperand(x7, -11, PostIndex)), "ldrsh x6, [x7], #-11");
1165
1166 CLEANUP();
1167}
1168
1169
armvixl5289c592015-03-02 13:52:04 +00001170TEST(load_store_v_offset) {
armvixlad96eda2013-06-14 11:42:37 +01001171 SETUP();
1172
1173 COMPARE(ldr(s0, MemOperand(x1)), "ldr s0, [x1]");
1174 COMPARE(ldr(s2, MemOperand(x3, 4)), "ldr s2, [x3, #4]");
1175 COMPARE(ldr(s4, MemOperand(x5, 16380)), "ldr s4, [x5, #16380]");
1176 COMPARE(ldr(d6, MemOperand(x7)), "ldr d6, [x7]");
1177 COMPARE(ldr(d8, MemOperand(x9, 8)), "ldr d8, [x9, #8]");
1178 COMPARE(ldr(d10, MemOperand(x11, 32760)), "ldr d10, [x11, #32760]");
1179 COMPARE(str(s12, MemOperand(x13)), "str s12, [x13]");
1180 COMPARE(str(s14, MemOperand(x15, 4)), "str s14, [x15, #4]");
1181 COMPARE(str(s16, MemOperand(x17, 16380)), "str s16, [x17, #16380]");
1182 COMPARE(str(d18, MemOperand(x19)), "str d18, [x19]");
1183 COMPARE(str(d20, MemOperand(x21, 8)), "str d20, [x21, #8]");
1184 COMPARE(str(d22, MemOperand(x23, 32760)), "str d22, [x23, #32760]");
1185
armvixl5289c592015-03-02 13:52:04 +00001186 COMPARE(ldr(b0, MemOperand(x1)), "ldr b0, [x1]");
1187 COMPARE(ldr(b2, MemOperand(x3, 1)), "ldr b2, [x3, #1]");
1188 COMPARE(ldr(b4, MemOperand(x5, 4095)), "ldr b4, [x5, #4095]");
1189 COMPARE(ldr(h6, MemOperand(x7)), "ldr h6, [x7]");
1190 COMPARE(ldr(h8, MemOperand(x9, 2)), "ldr h8, [x9, #2]");
1191 COMPARE(ldr(h10, MemOperand(x11, 8190)), "ldr h10, [x11, #8190]");
1192 COMPARE(ldr(q12, MemOperand(x13)), "ldr q12, [x13]");
1193 COMPARE(ldr(q14, MemOperand(x15, 16)), "ldr q14, [x15, #16]");
1194 COMPARE(ldr(q16, MemOperand(x17, 65520)), "ldr q16, [x17, #65520]");
1195 COMPARE(str(b18, MemOperand(x19)), "str b18, [x19]");
1196 COMPARE(str(b20, MemOperand(x21, 1)), "str b20, [x21, #1]");
1197 COMPARE(str(b22, MemOperand(x23, 4095)), "str b22, [x23, #4095]");
1198 COMPARE(str(h24, MemOperand(x25)), "str h24, [x25]");
1199 COMPARE(str(h26, MemOperand(x27, 2)), "str h26, [x27, #2]");
1200 COMPARE(str(h28, MemOperand(x29, 8190)), "str h28, [x29, #8190]");
1201 COMPARE(str(q30, MemOperand(x30)), "str q30, [x30]");
1202 COMPARE(str(q31, MemOperand(x1, 16)), "str q31, [x1, #16]");
1203 COMPARE(str(q0, MemOperand(x3, 65520)), "str q0, [x3, #65520]");
1204
1205 COMPARE(ldr(s24, MemOperand(sp)), "ldr s24, [sp]");
1206 COMPARE(ldr(d25, MemOperand(sp, 8)), "ldr d25, [sp, #8]");
1207 COMPARE(ldr(b26, MemOperand(sp, 1)), "ldr b26, [sp, #1]");
1208 COMPARE(ldr(h27, MemOperand(sp, 2)), "ldr h27, [sp, #2]");
1209 COMPARE(ldr(q28, MemOperand(sp, 16)), "ldr q28, [sp, #16]");
1210
1211 CLEANUP();
1212}
1213
1214
1215TEST(load_store_v_pre) {
1216 SETUP();
1217
armvixlad96eda2013-06-14 11:42:37 +01001218 COMPARE(ldr(s0, MemOperand(x1, 4, PreIndex)), "ldr s0, [x1, #4]!");
1219 COMPARE(ldr(s2, MemOperand(x3, 255, PreIndex)), "ldr s2, [x3, #255]!");
1220 COMPARE(ldr(s4, MemOperand(x5, -256, PreIndex)), "ldr s4, [x5, #-256]!");
1221 COMPARE(ldr(d6, MemOperand(x7, 8, PreIndex)), "ldr d6, [x7, #8]!");
1222 COMPARE(ldr(d8, MemOperand(x9, 255, PreIndex)), "ldr d8, [x9, #255]!");
1223 COMPARE(ldr(d10, MemOperand(x11, -256, PreIndex)), "ldr d10, [x11, #-256]!");
armvixl5289c592015-03-02 13:52:04 +00001224
armvixlad96eda2013-06-14 11:42:37 +01001225 COMPARE(str(s12, MemOperand(x13, 4, PreIndex)), "str s12, [x13, #4]!");
1226 COMPARE(str(s14, MemOperand(x15, 255, PreIndex)), "str s14, [x15, #255]!");
1227 COMPARE(str(s16, MemOperand(x17, -256, PreIndex)), "str s16, [x17, #-256]!");
1228 COMPARE(str(d18, MemOperand(x19, 8, PreIndex)), "str d18, [x19, #8]!");
1229 COMPARE(str(d20, MemOperand(x21, 255, PreIndex)), "str d20, [x21, #255]!");
1230 COMPARE(str(d22, MemOperand(x23, -256, PreIndex)), "str d22, [x23, #-256]!");
1231
armvixl5289c592015-03-02 13:52:04 +00001232 COMPARE(ldr(b0, MemOperand(x1, 1, PreIndex)), "ldr b0, [x1, #1]!");
1233 COMPARE(ldr(b2, MemOperand(x3, 255, PreIndex)), "ldr b2, [x3, #255]!");
1234 COMPARE(ldr(b4, MemOperand(x5, -256, PreIndex)), "ldr b4, [x5, #-256]!");
1235 COMPARE(ldr(h6, MemOperand(x7, 2, PreIndex)), "ldr h6, [x7, #2]!");
1236 COMPARE(ldr(h8, MemOperand(x9, 255, PreIndex)), "ldr h8, [x9, #255]!");
1237 COMPARE(ldr(h10, MemOperand(x11, -256, PreIndex)), "ldr h10, [x11, #-256]!");
1238 COMPARE(ldr(q12, MemOperand(x13, 16, PreIndex)), "ldr q12, [x13, #16]!");
1239 COMPARE(ldr(q14, MemOperand(x15, 255, PreIndex)), "ldr q14, [x15, #255]!");
1240 COMPARE(ldr(q16, MemOperand(x17, -256, PreIndex)), "ldr q16, [x17, #-256]!");
1241
1242 COMPARE(str(b18, MemOperand(x19, 1, PreIndex)), "str b18, [x19, #1]!");
1243 COMPARE(str(b20, MemOperand(x21, 255, PreIndex)), "str b20, [x21, #255]!");
1244 COMPARE(str(b22, MemOperand(x23, -256, PreIndex)), "str b22, [x23, #-256]!");
1245 COMPARE(str(h24, MemOperand(x25, 2, PreIndex)), "str h24, [x25, #2]!");
1246 COMPARE(str(h26, MemOperand(x27, 255, PreIndex)), "str h26, [x27, #255]!");
1247 COMPARE(str(h28, MemOperand(x29, -256, PreIndex)), "str h28, [x29, #-256]!");
1248 COMPARE(str(q30, MemOperand(x1, 16, PreIndex)), "str q30, [x1, #16]!");
1249 COMPARE(str(q31, MemOperand(x3, 255, PreIndex)), "str q31, [x3, #255]!");
1250 COMPARE(str(q0, MemOperand(x5, -256, PreIndex)), "str q0, [x5, #-256]!");
1251
1252 COMPARE(str(b24, MemOperand(sp, 1, PreIndex)), "str b24, [sp, #1]!");
1253 COMPARE(str(h25, MemOperand(sp, -2, PreIndex)), "str h25, [sp, #-2]!");
1254 COMPARE(str(s26, MemOperand(sp, 4, PreIndex)), "str s26, [sp, #4]!");
1255 COMPARE(str(d27, MemOperand(sp, -8, PreIndex)), "str d27, [sp, #-8]!");
1256 COMPARE(str(q28, MemOperand(sp, 16, PreIndex)), "str q28, [sp, #16]!");
1257
1258 CLEANUP();
1259}
1260
1261
1262TEST(load_store_v_post) {
1263 SETUP();
1264
armvixlad96eda2013-06-14 11:42:37 +01001265 COMPARE(ldr(s0, MemOperand(x1, 4, PostIndex)), "ldr s0, [x1], #4");
1266 COMPARE(ldr(s2, MemOperand(x3, 255, PostIndex)), "ldr s2, [x3], #255");
1267 COMPARE(ldr(s4, MemOperand(x5, -256, PostIndex)), "ldr s4, [x5], #-256");
1268 COMPARE(ldr(d6, MemOperand(x7, 8, PostIndex)), "ldr d6, [x7], #8");
1269 COMPARE(ldr(d8, MemOperand(x9, 255, PostIndex)), "ldr d8, [x9], #255");
1270 COMPARE(ldr(d10, MemOperand(x11, -256, PostIndex)), "ldr d10, [x11], #-256");
armvixl5289c592015-03-02 13:52:04 +00001271
armvixlad96eda2013-06-14 11:42:37 +01001272 COMPARE(str(s12, MemOperand(x13, 4, PostIndex)), "str s12, [x13], #4");
1273 COMPARE(str(s14, MemOperand(x15, 255, PostIndex)), "str s14, [x15], #255");
1274 COMPARE(str(s16, MemOperand(x17, -256, PostIndex)), "str s16, [x17], #-256");
1275 COMPARE(str(d18, MemOperand(x19, 8, PostIndex)), "str d18, [x19], #8");
1276 COMPARE(str(d20, MemOperand(x21, 255, PostIndex)), "str d20, [x21], #255");
1277 COMPARE(str(d22, MemOperand(x23, -256, PostIndex)), "str d22, [x23], #-256");
1278
armvixl5289c592015-03-02 13:52:04 +00001279 COMPARE(ldr(b0, MemOperand(x1, 4, PostIndex)), "ldr b0, [x1], #4");
1280 COMPARE(ldr(b2, MemOperand(x3, 255, PostIndex)), "ldr b2, [x3], #255");
1281 COMPARE(ldr(b4, MemOperand(x5, -256, PostIndex)), "ldr b4, [x5], #-256");
1282 COMPARE(ldr(h6, MemOperand(x7, 8, PostIndex)), "ldr h6, [x7], #8");
1283 COMPARE(ldr(h8, MemOperand(x9, 255, PostIndex)), "ldr h8, [x9], #255");
1284 COMPARE(ldr(h10, MemOperand(x11, -256, PostIndex)), "ldr h10, [x11], #-256");
1285 COMPARE(ldr(q12, MemOperand(x13, 8, PostIndex)), "ldr q12, [x13], #8");
1286 COMPARE(ldr(q14, MemOperand(x15, 255, PostIndex)), "ldr q14, [x15], #255");
1287 COMPARE(ldr(q16, MemOperand(x17, -256, PostIndex)), "ldr q16, [x17], #-256");
1288
1289 COMPARE(str(b18, MemOperand(x19, 4, PostIndex)), "str b18, [x19], #4");
1290 COMPARE(str(b20, MemOperand(x21, 255, PostIndex)), "str b20, [x21], #255");
1291 COMPARE(str(b22, MemOperand(x23, -256, PostIndex)), "str b22, [x23], #-256");
1292 COMPARE(str(h24, MemOperand(x25, 8, PostIndex)), "str h24, [x25], #8");
1293 COMPARE(str(h26, MemOperand(x27, 255, PostIndex)), "str h26, [x27], #255");
1294 COMPARE(str(h28, MemOperand(x29, -256, PostIndex)), "str h28, [x29], #-256");
1295 COMPARE(str(q30, MemOperand(x1, 8, PostIndex)), "str q30, [x1], #8");
1296 COMPARE(str(q31, MemOperand(x3, 255, PostIndex)), "str q31, [x3], #255");
1297 COMPARE(str(q0, MemOperand(x5, -256, PostIndex)), "str q0, [x5], #-256");
1298
1299 COMPARE(ldr(b24, MemOperand(sp, -1, PreIndex)), "ldr b24, [sp, #-1]!");
1300 COMPARE(ldr(h25, MemOperand(sp, 2, PreIndex)), "ldr h25, [sp, #2]!");
1301 COMPARE(ldr(s26, MemOperand(sp, -4, PreIndex)), "ldr s26, [sp, #-4]!");
1302 COMPARE(ldr(d27, MemOperand(sp, 8, PreIndex)), "ldr d27, [sp, #8]!");
1303 COMPARE(ldr(q28, MemOperand(sp, -16, PreIndex)), "ldr q28, [sp, #-16]!");
1304
1305 CLEANUP();
1306}
1307
1308
1309TEST(load_store_v_regoffset) {
1310 SETUP();
1311
1312 COMPARE(ldr(b0, MemOperand(x1, x2)), "ldr b0, [x1, x2]");
1313 COMPARE(ldr(b1, MemOperand(x2, w3, UXTW)), "ldr b1, [x2, w3, uxtw]");
1314 COMPARE(ldr(b2, MemOperand(x3, w4, SXTW)), "ldr b2, [x3, w4, sxtw]");
1315 // We can't assemble this instruction, but we check it disassembles correctly.
1316 COMPARE(dci(0x3c657883), "ldr b3, [x4, x5, lsl #0]");
1317 COMPARE(ldr(b30, MemOperand(sp, xzr)), "ldr b30, [sp, xzr]");
1318 COMPARE(ldr(b31, MemOperand(sp, wzr, UXTW)), "ldr b31, [sp, wzr, uxtw]");
1319
1320 COMPARE(ldr(h0, MemOperand(x1, x2)), "ldr h0, [x1, x2]");
1321 COMPARE(ldr(h1, MemOperand(x2, w3, UXTW)), "ldr h1, [x2, w3, uxtw]");
1322 COMPARE(ldr(h2, MemOperand(x3, w4, SXTW)), "ldr h2, [x3, w4, sxtw]");
1323 COMPARE(ldr(h3, MemOperand(x4, w5, UXTW, 1)), "ldr h3, [x4, w5, uxtw #1]");
1324 COMPARE(ldr(h4, MemOperand(x5, w5, SXTW, 1)), "ldr h4, [x5, w5, sxtw #1]");
1325 COMPARE(ldr(h30, MemOperand(sp, xzr)), "ldr h30, [sp, xzr]");
1326 COMPARE(ldr(h31, MemOperand(sp, wzr, SXTW, 1)),
1327 "ldr h31, [sp, wzr, sxtw #1]");
1328
1329 COMPARE(ldr(s0, MemOperand(x1, x2)), "ldr s0, [x1, x2]");
1330 COMPARE(ldr(s1, MemOperand(x2, w3, UXTW)), "ldr s1, [x2, w3, uxtw]");
1331 COMPARE(ldr(s2, MemOperand(x3, w4, SXTW)), "ldr s2, [x3, w4, sxtw]");
1332 COMPARE(ldr(s3, MemOperand(x4, w5, UXTW, 2)), "ldr s3, [x4, w5, uxtw #2]");
1333 COMPARE(ldr(s4, MemOperand(x5, w5, SXTW, 2)), "ldr s4, [x5, w5, sxtw #2]");
1334 COMPARE(ldr(s30, MemOperand(sp, xzr)), "ldr s30, [sp, xzr]");
1335 COMPARE(ldr(s31, MemOperand(sp, wzr, SXTW, 2)),
1336 "ldr s31, [sp, wzr, sxtw #2]");
1337
1338 COMPARE(ldr(d0, MemOperand(x1, x2)), "ldr d0, [x1, x2]");
1339 COMPARE(ldr(d1, MemOperand(x2, w3, UXTW)), "ldr d1, [x2, w3, uxtw]");
1340 COMPARE(ldr(d2, MemOperand(x3, w4, SXTW)), "ldr d2, [x3, w4, sxtw]");
1341 COMPARE(ldr(d3, MemOperand(x4, w5, UXTW, 3)), "ldr d3, [x4, w5, uxtw #3]");
1342 COMPARE(ldr(d4, MemOperand(x5, w5, SXTW, 3)), "ldr d4, [x5, w5, sxtw #3]");
1343 COMPARE(ldr(d30, MemOperand(sp, xzr)), "ldr d30, [sp, xzr]");
1344 COMPARE(ldr(d31, MemOperand(sp, wzr, SXTW, 3)),
1345 "ldr d31, [sp, wzr, sxtw #3]");
1346
1347 COMPARE(ldr(q0, MemOperand(x1, x2)), "ldr q0, [x1, x2]");
1348 COMPARE(ldr(q1, MemOperand(x2, w3, UXTW)), "ldr q1, [x2, w3, uxtw]");
1349 COMPARE(ldr(q2, MemOperand(x3, w4, SXTW)), "ldr q2, [x3, w4, sxtw]");
1350 COMPARE(ldr(q3, MemOperand(x4, w5, UXTW, 4)), "ldr q3, [x4, w5, uxtw #4]");
1351 COMPARE(ldr(q4, MemOperand(x5, w5, SXTW, 4)), "ldr q4, [x5, w5, sxtw #4]");
1352 COMPARE(ldr(q30, MemOperand(sp, xzr)), "ldr q30, [sp, xzr]");
1353 COMPARE(ldr(q31, MemOperand(sp, wzr, SXTW, 4)),
1354 "ldr q31, [sp, wzr, sxtw #4]");
1355
1356 COMPARE(str(b0, MemOperand(x1, x2)), "str b0, [x1, x2]");
1357 COMPARE(str(b1, MemOperand(x2, w3, UXTW)), "str b1, [x2, w3, uxtw]");
1358 COMPARE(str(b2, MemOperand(x3, w4, SXTW)), "str b2, [x3, w4, sxtw]");
1359 // We can't assemble this instruction, but we check it disassembles correctly.
1360 COMPARE(dci(0x3c257883), "str b3, [x4, x5, lsl #0]");
1361 COMPARE(str(b30, MemOperand(sp, xzr)), "str b30, [sp, xzr]");
1362 COMPARE(str(b31, MemOperand(sp, wzr, UXTW)), "str b31, [sp, wzr, uxtw]");
1363
1364 COMPARE(str(h0, MemOperand(x1, x2)), "str h0, [x1, x2]");
1365 COMPARE(str(h1, MemOperand(x2, w3, UXTW)), "str h1, [x2, w3, uxtw]");
1366 COMPARE(str(h2, MemOperand(x3, w4, SXTW)), "str h2, [x3, w4, sxtw]");
1367 COMPARE(str(h3, MemOperand(x4, w5, UXTW, 1)), "str h3, [x4, w5, uxtw #1]");
1368 COMPARE(str(h4, MemOperand(x5, w5, SXTW, 1)), "str h4, [x5, w5, sxtw #1]");
1369 COMPARE(str(h30, MemOperand(sp, xzr)), "str h30, [sp, xzr]");
1370 COMPARE(str(h31, MemOperand(sp, wzr, SXTW, 1)),
1371 "str h31, [sp, wzr, sxtw #1]");
1372
1373 COMPARE(str(s0, MemOperand(x1, x2)), "str s0, [x1, x2]");
1374 COMPARE(str(s1, MemOperand(x2, w3, UXTW)), "str s1, [x2, w3, uxtw]");
1375 COMPARE(str(s2, MemOperand(x3, w4, SXTW)), "str s2, [x3, w4, sxtw]");
1376 COMPARE(str(s3, MemOperand(x4, w5, UXTW, 2)), "str s3, [x4, w5, uxtw #2]");
1377 COMPARE(str(s4, MemOperand(x5, w5, SXTW, 2)), "str s4, [x5, w5, sxtw #2]");
1378 COMPARE(str(s30, MemOperand(sp, xzr)), "str s30, [sp, xzr]");
1379 COMPARE(str(s31, MemOperand(sp, wzr, SXTW, 2)),
1380 "str s31, [sp, wzr, sxtw #2]");
1381
1382 COMPARE(str(d0, MemOperand(x1, x2)), "str d0, [x1, x2]");
1383 COMPARE(str(d1, MemOperand(x2, w3, UXTW)), "str d1, [x2, w3, uxtw]");
1384 COMPARE(str(d2, MemOperand(x3, w4, SXTW)), "str d2, [x3, w4, sxtw]");
1385 COMPARE(str(d3, MemOperand(x4, w5, UXTW, 3)), "str d3, [x4, w5, uxtw #3]");
1386 COMPARE(str(d4, MemOperand(x5, w5, SXTW, 3)), "str d4, [x5, w5, sxtw #3]");
1387 COMPARE(str(d30, MemOperand(sp, xzr)), "str d30, [sp, xzr]");
1388 COMPARE(str(d31, MemOperand(sp, wzr, SXTW, 3)),
1389 "str d31, [sp, wzr, sxtw #3]");
1390
1391 COMPARE(str(q0, MemOperand(x1, x2)), "str q0, [x1, x2]");
1392 COMPARE(str(q1, MemOperand(x2, w3, UXTW)), "str q1, [x2, w3, uxtw]");
1393 COMPARE(str(q2, MemOperand(x3, w4, SXTW)), "str q2, [x3, w4, sxtw]");
1394 COMPARE(str(q3, MemOperand(x4, w5, UXTW, 4)), "str q3, [x4, w5, uxtw #4]");
1395 COMPARE(str(q4, MemOperand(x5, w5, SXTW, 4)), "str q4, [x5, w5, sxtw #4]");
1396 COMPARE(str(q30, MemOperand(sp, xzr)), "str q30, [sp, xzr]");
1397 COMPARE(str(q31, MemOperand(sp, wzr, SXTW, 4)),
1398 "str q31, [sp, wzr, sxtw #4]");
armvixlad96eda2013-06-14 11:42:37 +01001399
1400 CLEANUP();
1401}
1402
1403
1404TEST(load_store_unscaled) {
1405 SETUP();
1406
armvixl4a102ba2014-07-14 09:02:40 +01001407 // If an unscaled-offset instruction is requested, it is used, even if the
1408 // offset could be encoded in a scaled-offset instruction.
1409 COMPARE(ldurb(w0, MemOperand(x1)), "ldurb w0, [x1]");
1410 COMPARE(ldurb(x2, MemOperand(x3, 1)), "ldurb w2, [x3, #1]");
1411 COMPARE(ldurb(w4, MemOperand(x5, 255)), "ldurb w4, [x5, #255]");
1412 COMPARE(sturb(w14, MemOperand(x15)), "sturb w14, [x15]");
1413 COMPARE(sturb(x16, MemOperand(x17, 1)), "sturb w16, [x17, #1]");
1414 COMPARE(sturb(w18, MemOperand(x19, 255)), "sturb w18, [x19, #255]");
1415 COMPARE(ldursb(w0, MemOperand(x1)), "ldursb w0, [x1]");
1416 COMPARE(ldursb(w2, MemOperand(x3, 1)), "ldursb w2, [x3, #1]");
1417 COMPARE(ldursb(x2, MemOperand(x3, 255)), "ldursb x2, [x3, #255]");
1418
1419 COMPARE(ldurh(w0, MemOperand(x1)), "ldurh w0, [x1]");
1420 COMPARE(ldurh(x2, MemOperand(x3, 2)), "ldurh w2, [x3, #2]");
1421 COMPARE(ldurh(w4, MemOperand(x5, 254)), "ldurh w4, [x5, #254]");
1422 COMPARE(sturh(w14, MemOperand(x15)), "sturh w14, [x15]");
1423 COMPARE(sturh(x16, MemOperand(x17, 2)), "sturh w16, [x17, #2]");
1424 COMPARE(sturh(w18, MemOperand(x19, 254)), "sturh w18, [x19, #254]");
1425 COMPARE(ldursh(w0, MemOperand(x1)), "ldursh w0, [x1]");
1426 COMPARE(ldursh(w2, MemOperand(x3, 2)), "ldursh w2, [x3, #2]");
1427 COMPARE(ldursh(x4, MemOperand(x5, 254)), "ldursh x4, [x5, #254]");
1428
1429 COMPARE(ldur(w0, MemOperand(x1)), "ldur w0, [x1]");
1430 COMPARE(ldur(w2, MemOperand(x3, 4)), "ldur w2, [x3, #4]");
1431 COMPARE(ldur(w4, MemOperand(x5, 248)), "ldur w4, [x5, #248]");
1432 COMPARE(stur(w12, MemOperand(x13)), "stur w12, [x13]");
1433 COMPARE(stur(w14, MemOperand(x15, 4)), "stur w14, [x15, #4]");
1434 COMPARE(stur(w16, MemOperand(x17, 248)), "stur w16, [x17, #248]");
1435 COMPARE(ldursw(x0, MemOperand(x1)), "ldursw x0, [x1]");
1436 COMPARE(ldursw(x2, MemOperand(x3, 4)), "ldursw x2, [x3, #4]");
1437 COMPARE(ldursw(x4, MemOperand(x5, 248)), "ldursw x4, [x5, #248]");
1438
1439 COMPARE(ldur(x6, MemOperand(x7)), "ldur x6, [x7]");
1440 COMPARE(ldur(x8, MemOperand(x9, 8)), "ldur x8, [x9, #8]");
1441 COMPARE(ldur(x10, MemOperand(x11, 248)), "ldur x10, [x11, #248]");
1442 COMPARE(stur(x18, MemOperand(x19)), "stur x18, [x19]");
1443 COMPARE(stur(x20, MemOperand(x21, 8)), "stur x20, [x21, #8]");
1444 COMPARE(stur(x22, MemOperand(x23, 248)), "stur x22, [x23, #248]");
1445
armvixl5289c592015-03-02 13:52:04 +00001446 COMPARE(ldur(b0, MemOperand(x1)), "ldur b0, [x1]");
1447 COMPARE(ldur(h2, MemOperand(x3, -1)), "ldur h2, [x3, #-1]");
1448 COMPARE(ldur(s4, MemOperand(x5, 2)), "ldur s4, [x5, #2]");
1449 COMPARE(ldur(d6, MemOperand(x7, -3)), "ldur d6, [x7, #-3]");
1450 COMPARE(ldur(q8, MemOperand(x9, 4)), "ldur q8, [x9, #4]");
1451 COMPARE(stur(b10, MemOperand(x11)), "stur b10, [x11]");
1452 COMPARE(stur(h12, MemOperand(x13, -1)), "stur h12, [x13, #-1]");
1453 COMPARE(stur(s14, MemOperand(x15, 2)), "stur s14, [x15, #2]");
1454 COMPARE(stur(d16, MemOperand(x17, -3)), "stur d16, [x17, #-3]");
1455 COMPARE(stur(q18, MemOperand(x19, 4)), "stur q18, [x19, #4]");
1456
armvixl4a102ba2014-07-14 09:02:40 +01001457 // Normal loads and stores are converted to unscaled loads and stores if the
1458 // offset requires it.
armvixlad96eda2013-06-14 11:42:37 +01001459 COMPARE(ldr(w0, MemOperand(x1, 1)), "ldur w0, [x1, #1]");
1460 COMPARE(ldr(w2, MemOperand(x3, -1)), "ldur w2, [x3, #-1]");
1461 COMPARE(ldr(w4, MemOperand(x5, 255)), "ldur w4, [x5, #255]");
1462 COMPARE(ldr(w6, MemOperand(x7, -256)), "ldur w6, [x7, #-256]");
1463 COMPARE(ldr(x8, MemOperand(x9, 1)), "ldur x8, [x9, #1]");
1464 COMPARE(ldr(x10, MemOperand(x11, -1)), "ldur x10, [x11, #-1]");
1465 COMPARE(ldr(x12, MemOperand(x13, 255)), "ldur x12, [x13, #255]");
1466 COMPARE(ldr(x14, MemOperand(x15, -256)), "ldur x14, [x15, #-256]");
1467 COMPARE(str(w16, MemOperand(x17, 1)), "stur w16, [x17, #1]");
1468 COMPARE(str(w18, MemOperand(x19, -1)), "stur w18, [x19, #-1]");
1469 COMPARE(str(w20, MemOperand(x21, 255)), "stur w20, [x21, #255]");
1470 COMPARE(str(w22, MemOperand(x23, -256)), "stur w22, [x23, #-256]");
1471 COMPARE(str(x24, MemOperand(x25, 1)), "stur x24, [x25, #1]");
1472 COMPARE(str(x26, MemOperand(x27, -1)), "stur x26, [x27, #-1]");
1473 COMPARE(str(x28, MemOperand(x29, 255)), "stur x28, [x29, #255]");
1474 COMPARE(str(x30, MemOperand(x0, -256)), "stur x30, [x0, #-256]");
1475 COMPARE(ldr(w0, MemOperand(sp, 1)), "ldur w0, [sp, #1]");
1476 COMPARE(str(x1, MemOperand(sp, -1)), "stur x1, [sp, #-1]");
1477 COMPARE(ldrb(w2, MemOperand(x3, -2)), "ldurb w2, [x3, #-2]");
1478 COMPARE(ldrsb(w4, MemOperand(x5, -3)), "ldursb w4, [x5, #-3]");
1479 COMPARE(ldrsb(x6, MemOperand(x7, -4)), "ldursb x6, [x7, #-4]");
1480 COMPARE(ldrh(w8, MemOperand(x9, -5)), "ldurh w8, [x9, #-5]");
1481 COMPARE(ldrsh(w10, MemOperand(x11, -6)), "ldursh w10, [x11, #-6]");
1482 COMPARE(ldrsh(x12, MemOperand(x13, -7)), "ldursh x12, [x13, #-7]");
1483 COMPARE(ldrsw(x14, MemOperand(x15, -8)), "ldursw x14, [x15, #-8]");
1484
1485 CLEANUP();
1486}
1487
armvixl4a102ba2014-07-14 09:02:40 +01001488
1489TEST(load_store_unscaled_option) {
1490 SETUP();
1491
1492 // Just like load_store_unscaled, but specify the scaling option explicitly.
1493 LoadStoreScalingOption options[] = {
1494 PreferUnscaledOffset,
1495 RequireUnscaledOffset
1496 };
1497
1498 for (size_t i = 0; i < sizeof(options)/sizeof(options[0]); i++) {
1499 LoadStoreScalingOption option = options[i];
1500
1501 // If an unscaled-offset instruction is requested, it is used, even if the
1502 // offset could be encoded in a scaled-offset instruction.
1503 COMPARE(ldurb(w0, MemOperand(x1), option), "ldurb w0, [x1]");
1504 COMPARE(ldurb(x2, MemOperand(x3, 1), option), "ldurb w2, [x3, #1]");
1505 COMPARE(ldurb(w4, MemOperand(x5, 255), option), "ldurb w4, [x5, #255]");
1506 COMPARE(sturb(w14, MemOperand(x15), option), "sturb w14, [x15]");
1507 COMPARE(sturb(x16, MemOperand(x17, 1), option), "sturb w16, [x17, #1]");
1508 COMPARE(sturb(w18, MemOperand(x19, 255), option), "sturb w18, [x19, #255]");
1509 COMPARE(ldursb(w0, MemOperand(x1), option), "ldursb w0, [x1]");
1510 COMPARE(ldursb(w2, MemOperand(x3, 1), option), "ldursb w2, [x3, #1]");
1511 COMPARE(ldursb(x2, MemOperand(x3, 255), option), "ldursb x2, [x3, #255]");
1512
1513 COMPARE(ldurh(w0, MemOperand(x1), option), "ldurh w0, [x1]");
1514 COMPARE(ldurh(x2, MemOperand(x3, 2), option), "ldurh w2, [x3, #2]");
1515 COMPARE(ldurh(w4, MemOperand(x5, 254), option), "ldurh w4, [x5, #254]");
1516 COMPARE(sturh(w14, MemOperand(x15), option), "sturh w14, [x15]");
1517 COMPARE(sturh(x16, MemOperand(x17, 2), option), "sturh w16, [x17, #2]");
1518 COMPARE(sturh(w18, MemOperand(x19, 254), option), "sturh w18, [x19, #254]");
1519 COMPARE(ldursh(w0, MemOperand(x1), option), "ldursh w0, [x1]");
1520 COMPARE(ldursh(w2, MemOperand(x3, 2), option), "ldursh w2, [x3, #2]");
1521 COMPARE(ldursh(x4, MemOperand(x5, 254), option), "ldursh x4, [x5, #254]");
1522
1523 COMPARE(ldur(w0, MemOperand(x1), option), "ldur w0, [x1]");
1524 COMPARE(ldur(w2, MemOperand(x3, 4), option), "ldur w2, [x3, #4]");
1525 COMPARE(ldur(w4, MemOperand(x5, 248), option), "ldur w4, [x5, #248]");
1526 COMPARE(stur(w12, MemOperand(x13), option), "stur w12, [x13]");
1527 COMPARE(stur(w14, MemOperand(x15, 4), option), "stur w14, [x15, #4]");
1528 COMPARE(stur(w16, MemOperand(x17, 248), option), "stur w16, [x17, #248]");
1529 COMPARE(ldursw(x0, MemOperand(x1), option), "ldursw x0, [x1]");
1530 COMPARE(ldursw(x2, MemOperand(x3, 4), option), "ldursw x2, [x3, #4]");
1531 COMPARE(ldursw(x4, MemOperand(x5, 248), option), "ldursw x4, [x5, #248]");
1532
1533 COMPARE(ldur(x6, MemOperand(x7), option), "ldur x6, [x7]");
1534 COMPARE(ldur(x8, MemOperand(x9, 8), option), "ldur x8, [x9, #8]");
1535 COMPARE(ldur(x10, MemOperand(x11, 248), option), "ldur x10, [x11, #248]");
1536 COMPARE(stur(x18, MemOperand(x19), option), "stur x18, [x19]");
1537 COMPARE(stur(x20, MemOperand(x21, 8), option), "stur x20, [x21, #8]");
1538 COMPARE(stur(x22, MemOperand(x23, 248), option), "stur x22, [x23, #248]");
armvixl5289c592015-03-02 13:52:04 +00001539
1540 COMPARE(ldur(b0, MemOperand(x1), option), "ldur b0, [x1]");
1541 COMPARE(ldur(h2, MemOperand(x3, 2), option), "ldur h2, [x3, #2]");
1542 COMPARE(ldur(s4, MemOperand(x5, 4), option), "ldur s4, [x5, #4]");
1543 COMPARE(ldur(d6, MemOperand(x7, 8), option), "ldur d6, [x7, #8]");
1544 COMPARE(ldur(q8, MemOperand(x9, 16), option), "ldur q8, [x9, #16]");
1545 COMPARE(stur(b10, MemOperand(x11), option), "stur b10, [x11]");
1546 COMPARE(stur(h12, MemOperand(x13, 2), option), "stur h12, [x13, #2]");
1547 COMPARE(stur(s14, MemOperand(x15, 4), option), "stur s14, [x15, #4]");
1548 COMPARE(stur(d16, MemOperand(x17, 8), option), "stur d16, [x17, #8]");
1549 COMPARE(stur(q18, MemOperand(x19, 16), option), "stur q18, [x19, #16]");
armvixl4a102ba2014-07-14 09:02:40 +01001550 }
1551
1552 // Normal loads and stores are converted to unscaled loads and stores if the
1553 // offset requires it. PreferScaledOffset is the default for these cases, so
1554 // the behaviour here is the same when no option is specified.
1555 LoadStoreScalingOption option = PreferScaledOffset;
1556 COMPARE(ldr(w0, MemOperand(x1, 1), option), "ldur w0, [x1, #1]");
1557 COMPARE(ldr(w2, MemOperand(x3, -1), option), "ldur w2, [x3, #-1]");
1558 COMPARE(ldr(w4, MemOperand(x5, 255), option), "ldur w4, [x5, #255]");
1559 COMPARE(ldr(w6, MemOperand(x7, -256), option), "ldur w6, [x7, #-256]");
1560 COMPARE(ldr(x8, MemOperand(x9, 1), option), "ldur x8, [x9, #1]");
1561 COMPARE(ldr(x10, MemOperand(x11, -1), option), "ldur x10, [x11, #-1]");
1562 COMPARE(ldr(x12, MemOperand(x13, 255), option), "ldur x12, [x13, #255]");
1563 COMPARE(ldr(x14, MemOperand(x15, -256), option), "ldur x14, [x15, #-256]");
1564 COMPARE(str(w16, MemOperand(x17, 1), option), "stur w16, [x17, #1]");
1565 COMPARE(str(w18, MemOperand(x19, -1), option), "stur w18, [x19, #-1]");
1566 COMPARE(str(w20, MemOperand(x21, 255), option), "stur w20, [x21, #255]");
1567 COMPARE(str(w22, MemOperand(x23, -256), option), "stur w22, [x23, #-256]");
1568 COMPARE(str(x24, MemOperand(x25, 1), option), "stur x24, [x25, #1]");
1569 COMPARE(str(x26, MemOperand(x27, -1), option), "stur x26, [x27, #-1]");
1570 COMPARE(str(x28, MemOperand(x29, 255), option), "stur x28, [x29, #255]");
1571 COMPARE(str(x30, MemOperand(x0, -256), option), "stur x30, [x0, #-256]");
1572 COMPARE(ldr(w0, MemOperand(sp, 1), option), "ldur w0, [sp, #1]");
1573 COMPARE(str(x1, MemOperand(sp, -1), option), "stur x1, [sp, #-1]");
1574 COMPARE(ldrb(w2, MemOperand(x3, -2), option), "ldurb w2, [x3, #-2]");
1575 COMPARE(ldrsb(w4, MemOperand(x5, -3), option), "ldursb w4, [x5, #-3]");
1576 COMPARE(ldrsb(x6, MemOperand(x7, -4), option), "ldursb x6, [x7, #-4]");
1577 COMPARE(ldrh(w8, MemOperand(x9, -5), option), "ldurh w8, [x9, #-5]");
1578 COMPARE(ldrsh(w10, MemOperand(x11, -6), option), "ldursh w10, [x11, #-6]");
1579 COMPARE(ldrsh(x12, MemOperand(x13, -7), option), "ldursh x12, [x13, #-7]");
1580 COMPARE(ldrsw(x14, MemOperand(x15, -8), option), "ldursw x14, [x15, #-8]");
armvixl5289c592015-03-02 13:52:04 +00001581 COMPARE(ldr(b0, MemOperand(x1, 1), option), "ldr b0, [x1, #1]");
1582 COMPARE(ldr(h2, MemOperand(x3, 1), option), "ldur h2, [x3, #1]");
1583 COMPARE(ldr(s4, MemOperand(x5, 3), option), "ldur s4, [x5, #3]");
1584 COMPARE(ldr(d6, MemOperand(x7, 7), option), "ldur d6, [x7, #7]");
1585 COMPARE(ldr(q8, MemOperand(x9, 15), option), "ldur q8, [x9, #15]");
1586 COMPARE(str(b10, MemOperand(x11, 1), option), "str b10, [x11, #1]");
1587 COMPARE(str(h12, MemOperand(x13, 1), option), "stur h12, [x13, #1]");
1588 COMPARE(str(s14, MemOperand(x15, 3), option), "stur s14, [x15, #3]");
1589 COMPARE(str(d16, MemOperand(x17, 7), option), "stur d16, [x17, #7]");
1590 COMPARE(str(q18, MemOperand(x19, 15), option), "stur q18, [x19, #15]");
armvixl4a102ba2014-07-14 09:02:40 +01001591
1592 CLEANUP();
1593}
1594
1595
armvixlad96eda2013-06-14 11:42:37 +01001596TEST(load_store_pair) {
1597 SETUP();
1598
1599 COMPARE(ldp(w0, w1, MemOperand(x2)), "ldp w0, w1, [x2]");
1600 COMPARE(ldp(x3, x4, MemOperand(x5)), "ldp x3, x4, [x5]");
1601 COMPARE(ldp(w6, w7, MemOperand(x8, 4)), "ldp w6, w7, [x8, #4]");
1602 COMPARE(ldp(x9, x10, MemOperand(x11, 8)), "ldp x9, x10, [x11, #8]");
1603 COMPARE(ldp(w12, w13, MemOperand(x14, 252)), "ldp w12, w13, [x14, #252]");
1604 COMPARE(ldp(x15, x16, MemOperand(x17, 504)), "ldp x15, x16, [x17, #504]");
1605 COMPARE(ldp(w18, w19, MemOperand(x20, -256)), "ldp w18, w19, [x20, #-256]");
1606 COMPARE(ldp(x21, x22, MemOperand(x23, -512)), "ldp x21, x22, [x23, #-512]");
1607 COMPARE(ldp(w24, w25, MemOperand(x26, 252, PreIndex)),
1608 "ldp w24, w25, [x26, #252]!");
1609 COMPARE(ldp(x27, x28, MemOperand(x29, 504, PreIndex)),
1610 "ldp x27, x28, [x29, #504]!");
1611 COMPARE(ldp(w30, w0, MemOperand(x1, -256, PreIndex)),
1612 "ldp w30, w0, [x1, #-256]!");
1613 COMPARE(ldp(x2, x3, MemOperand(x4, -512, PreIndex)),
1614 "ldp x2, x3, [x4, #-512]!");
1615 COMPARE(ldp(w5, w6, MemOperand(x7, 252, PostIndex)),
1616 "ldp w5, w6, [x7], #252");
1617 COMPARE(ldp(x8, x9, MemOperand(x10, 504, PostIndex)),
1618 "ldp x8, x9, [x10], #504");
1619 COMPARE(ldp(w11, w12, MemOperand(x13, -256, PostIndex)),
1620 "ldp w11, w12, [x13], #-256");
1621 COMPARE(ldp(x14, x15, MemOperand(x16, -512, PostIndex)),
1622 "ldp x14, x15, [x16], #-512");
1623
1624 COMPARE(ldp(s17, s18, MemOperand(x19)), "ldp s17, s18, [x19]");
1625 COMPARE(ldp(s20, s21, MemOperand(x22, 252)), "ldp s20, s21, [x22, #252]");
1626 COMPARE(ldp(s23, s24, MemOperand(x25, -256)), "ldp s23, s24, [x25, #-256]");
1627 COMPARE(ldp(s26, s27, MemOperand(x28, 252, PreIndex)),
1628 "ldp s26, s27, [x28, #252]!");
1629 COMPARE(ldp(s29, s30, MemOperand(x29, -256, PreIndex)),
1630 "ldp s29, s30, [x29, #-256]!");
1631 COMPARE(ldp(s31, s0, MemOperand(x1, 252, PostIndex)),
1632 "ldp s31, s0, [x1], #252");
1633 COMPARE(ldp(s2, s3, MemOperand(x4, -256, PostIndex)),
1634 "ldp s2, s3, [x4], #-256");
1635 COMPARE(ldp(d17, d18, MemOperand(x19)), "ldp d17, d18, [x19]");
1636 COMPARE(ldp(d20, d21, MemOperand(x22, 504)), "ldp d20, d21, [x22, #504]");
1637 COMPARE(ldp(d23, d24, MemOperand(x25, -512)), "ldp d23, d24, [x25, #-512]");
1638 COMPARE(ldp(d26, d27, MemOperand(x28, 504, PreIndex)),
1639 "ldp d26, d27, [x28, #504]!");
1640 COMPARE(ldp(d29, d30, MemOperand(x29, -512, PreIndex)),
1641 "ldp d29, d30, [x29, #-512]!");
1642 COMPARE(ldp(d31, d0, MemOperand(x1, 504, PostIndex)),
1643 "ldp d31, d0, [x1], #504");
1644 COMPARE(ldp(d2, d3, MemOperand(x4, -512, PostIndex)),
1645 "ldp d2, d3, [x4], #-512");
1646
armvixl5289c592015-03-02 13:52:04 +00001647 COMPARE(ldp(q5, q6, MemOperand(x7)), "ldp q5, q6, [x7]");
1648 COMPARE(ldp(q8, q9, MemOperand(x10, 1008)), "ldp q8, q9, [x10, #1008]");
1649 COMPARE(ldp(q11, q12, MemOperand(x13, -1024)), "ldp q11, q12, [x13, #-1024]");
1650 COMPARE(ldp(q14, q15, MemOperand(x16, 1008, PreIndex)),
1651 "ldp q14, q15, [x16, #1008]!");
1652 COMPARE(ldp(q17, q18, MemOperand(x19, -1024, PreIndex)),
1653 "ldp q17, q18, [x19, #-1024]!");
1654 COMPARE(ldp(q20, q21, MemOperand(x22, 1008, PostIndex)),
1655 "ldp q20, q21, [x22], #1008");
1656 COMPARE(ldp(q23, q24, MemOperand(x25, -1024, PostIndex)),
1657 "ldp q23, q24, [x25], #-1024");
1658
armvixlad96eda2013-06-14 11:42:37 +01001659 COMPARE(stp(w0, w1, MemOperand(x2)), "stp w0, w1, [x2]");
1660 COMPARE(stp(x3, x4, MemOperand(x5)), "stp x3, x4, [x5]");
1661 COMPARE(stp(w6, w7, MemOperand(x8, 4)), "stp w6, w7, [x8, #4]");
1662 COMPARE(stp(x9, x10, MemOperand(x11, 8)), "stp x9, x10, [x11, #8]");
1663 COMPARE(stp(w12, w13, MemOperand(x14, 252)), "stp w12, w13, [x14, #252]");
1664 COMPARE(stp(x15, x16, MemOperand(x17, 504)), "stp x15, x16, [x17, #504]");
1665 COMPARE(stp(w18, w19, MemOperand(x20, -256)), "stp w18, w19, [x20, #-256]");
1666 COMPARE(stp(x21, x22, MemOperand(x23, -512)), "stp x21, x22, [x23, #-512]");
1667 COMPARE(stp(w24, w25, MemOperand(x26, 252, PreIndex)),
1668 "stp w24, w25, [x26, #252]!");
1669 COMPARE(stp(x27, x28, MemOperand(x29, 504, PreIndex)),
1670 "stp x27, x28, [x29, #504]!");
1671 COMPARE(stp(w30, w0, MemOperand(x1, -256, PreIndex)),
1672 "stp w30, w0, [x1, #-256]!");
1673 COMPARE(stp(x2, x3, MemOperand(x4, -512, PreIndex)),
1674 "stp x2, x3, [x4, #-512]!");
1675 COMPARE(stp(w5, w6, MemOperand(x7, 252, PostIndex)),
1676 "stp w5, w6, [x7], #252");
1677 COMPARE(stp(x8, x9, MemOperand(x10, 504, PostIndex)),
1678 "stp x8, x9, [x10], #504");
1679 COMPARE(stp(w11, w12, MemOperand(x13, -256, PostIndex)),
1680 "stp w11, w12, [x13], #-256");
1681 COMPARE(stp(x14, x15, MemOperand(x16, -512, PostIndex)),
1682 "stp x14, x15, [x16], #-512");
1683
1684 COMPARE(stp(s17, s18, MemOperand(x19)), "stp s17, s18, [x19]");
1685 COMPARE(stp(s20, s21, MemOperand(x22, 252)), "stp s20, s21, [x22, #252]");
1686 COMPARE(stp(s23, s24, MemOperand(x25, -256)), "stp s23, s24, [x25, #-256]");
1687 COMPARE(stp(s26, s27, MemOperand(x28, 252, PreIndex)),
1688 "stp s26, s27, [x28, #252]!");
1689 COMPARE(stp(s29, s30, MemOperand(x29, -256, PreIndex)),
1690 "stp s29, s30, [x29, #-256]!");
1691 COMPARE(stp(s31, s0, MemOperand(x1, 252, PostIndex)),
1692 "stp s31, s0, [x1], #252");
1693 COMPARE(stp(s2, s3, MemOperand(x4, -256, PostIndex)),
1694 "stp s2, s3, [x4], #-256");
1695 COMPARE(stp(d17, d18, MemOperand(x19)), "stp d17, d18, [x19]");
1696 COMPARE(stp(d20, d21, MemOperand(x22, 504)), "stp d20, d21, [x22, #504]");
1697 COMPARE(stp(d23, d24, MemOperand(x25, -512)), "stp d23, d24, [x25, #-512]");
1698 COMPARE(stp(d26, d27, MemOperand(x28, 504, PreIndex)),
1699 "stp d26, d27, [x28, #504]!");
1700 COMPARE(stp(d29, d30, MemOperand(x29, -512, PreIndex)),
1701 "stp d29, d30, [x29, #-512]!");
1702 COMPARE(stp(d31, d0, MemOperand(x1, 504, PostIndex)),
1703 "stp d31, d0, [x1], #504");
1704 COMPARE(stp(d2, d3, MemOperand(x4, -512, PostIndex)),
1705 "stp d2, d3, [x4], #-512");
1706
armvixl5289c592015-03-02 13:52:04 +00001707 COMPARE(stp(q5, q6, MemOperand(x7)), "stp q5, q6, [x7]");
1708 COMPARE(stp(q8, q9, MemOperand(x10, 1008)), "stp q8, q9, [x10, #1008]");
1709 COMPARE(stp(q11, q12, MemOperand(x13, -1024)), "stp q11, q12, [x13, #-1024]");
1710 COMPARE(stp(q14, q15, MemOperand(x16, 1008, PreIndex)),
1711 "stp q14, q15, [x16, #1008]!");
1712 COMPARE(stp(q17, q18, MemOperand(x19, -1024, PreIndex)),
1713 "stp q17, q18, [x19, #-1024]!");
1714 COMPARE(stp(q20, q21, MemOperand(x22, 1008, PostIndex)),
1715 "stp q20, q21, [x22], #1008");
1716 COMPARE(stp(q23, q24, MemOperand(x25, -1024, PostIndex)),
1717 "stp q23, q24, [x25], #-1024");
1718
armvixlad96eda2013-06-14 11:42:37 +01001719 COMPARE(ldp(w16, w17, MemOperand(sp, 4, PostIndex)),
1720 "ldp w16, w17, [sp], #4");
1721 COMPARE(stp(x18, x19, MemOperand(sp, -8, PreIndex)),
1722 "stp x18, x19, [sp, #-8]!");
1723 COMPARE(ldp(s30, s31, MemOperand(sp, 12, PostIndex)),
1724 "ldp s30, s31, [sp], #12");
1725 COMPARE(stp(d30, d31, MemOperand(sp, -16)),
1726 "stp d30, d31, [sp, #-16]");
armvixl5289c592015-03-02 13:52:04 +00001727 COMPARE(ldp(q30, q31, MemOperand(sp, 32, PostIndex)),
1728 "ldp q30, q31, [sp], #32");
armvixlad96eda2013-06-14 11:42:37 +01001729
1730 COMPARE(ldpsw(x0, x1, MemOperand(x2)), "ldpsw x0, x1, [x2]");
1731 COMPARE(ldpsw(x3, x4, MemOperand(x5, 16)), "ldpsw x3, x4, [x5, #16]");
1732 COMPARE(ldpsw(x6, x7, MemOperand(x8, -32, PreIndex)),
1733 "ldpsw x6, x7, [x8, #-32]!");
1734 COMPARE(ldpsw(x9, x10, MemOperand(x11, 128, PostIndex)),
1735 "ldpsw x9, x10, [x11], #128");
1736
1737 CLEANUP();
1738}
1739
armvixl4a102ba2014-07-14 09:02:40 +01001740
1741TEST(load_store_exclusive) {
1742 SETUP();
1743
1744 COMPARE(stxrb(w0, w1, MemOperand(x2)), "stxrb w0, w1, [x2]");
1745 COMPARE(stxrb(x3, w4, MemOperand(sp)), "stxrb w3, w4, [sp]");
1746 COMPARE(stxrb(w5, x6, MemOperand(x7)), "stxrb w5, w6, [x7]");
1747 COMPARE(stxrb(x8, x9, MemOperand(sp)), "stxrb w8, w9, [sp]");
1748 COMPARE(stxrh(w10, w11, MemOperand(x12)), "stxrh w10, w11, [x12]");
1749 COMPARE(stxrh(x13, w14, MemOperand(sp)), "stxrh w13, w14, [sp]");
1750 COMPARE(stxrh(w15, x16, MemOperand(x17)), "stxrh w15, w16, [x17]");
1751 COMPARE(stxrh(x18, x19, MemOperand(sp)), "stxrh w18, w19, [sp]");
1752 COMPARE(stxr(w20, w21, MemOperand(x22)), "stxr w20, w21, [x22]");
1753 COMPARE(stxr(x23, w24, MemOperand(sp)), "stxr w23, w24, [sp]");
1754 COMPARE(stxr(w25, x26, MemOperand(x27)), "stxr w25, x26, [x27]");
1755 COMPARE(stxr(x28, x29, MemOperand(sp)), "stxr w28, x29, [sp]");
1756 COMPARE(ldxrb(w30, MemOperand(x0)), "ldxrb w30, [x0]");
1757 COMPARE(ldxrb(w1, MemOperand(sp)), "ldxrb w1, [sp]");
1758 COMPARE(ldxrb(x2, MemOperand(x3)), "ldxrb w2, [x3]");
1759 COMPARE(ldxrb(x4, MemOperand(sp)), "ldxrb w4, [sp]");
1760 COMPARE(ldxrh(w5, MemOperand(x6)), "ldxrh w5, [x6]");
1761 COMPARE(ldxrh(w7, MemOperand(sp)), "ldxrh w7, [sp]");
1762 COMPARE(ldxrh(x8, MemOperand(x9)), "ldxrh w8, [x9]");
1763 COMPARE(ldxrh(x10, MemOperand(sp)), "ldxrh w10, [sp]");
1764 COMPARE(ldxr(w11, MemOperand(x12)), "ldxr w11, [x12]");
1765 COMPARE(ldxr(w13, MemOperand(sp)), "ldxr w13, [sp]");
1766 COMPARE(ldxr(x14, MemOperand(x15)), "ldxr x14, [x15]");
1767 COMPARE(ldxr(x16, MemOperand(sp)), "ldxr x16, [sp]");
1768 COMPARE(stxp(w17, w18, w19, MemOperand(x20)), "stxp w17, w18, w19, [x20]");
1769 COMPARE(stxp(x21, w22, w23, MemOperand(sp)), "stxp w21, w22, w23, [sp]");
1770 COMPARE(stxp(w24, x25, x26, MemOperand(x27)), "stxp w24, x25, x26, [x27]");
1771 COMPARE(stxp(x28, x29, x30, MemOperand(sp)), "stxp w28, x29, x30, [sp]");
1772 COMPARE(ldxp(w0, w1, MemOperand(x2)), "ldxp w0, w1, [x2]");
1773 COMPARE(ldxp(w3, w4, MemOperand(sp)), "ldxp w3, w4, [sp]");
1774 COMPARE(ldxp(x5, x6, MemOperand(x7)), "ldxp x5, x6, [x7]");
1775 COMPARE(ldxp(x8, x9, MemOperand(sp)), "ldxp x8, x9, [sp]");
1776 COMPARE(stlxrb(w10, w11, MemOperand(x12)), "stlxrb w10, w11, [x12]");
1777 COMPARE(stlxrb(x13, w14, MemOperand(sp)), "stlxrb w13, w14, [sp]");
1778 COMPARE(stlxrb(w15, x16, MemOperand(x17)), "stlxrb w15, w16, [x17]");
1779 COMPARE(stlxrb(x18, x19, MemOperand(sp)), "stlxrb w18, w19, [sp]");
1780 COMPARE(stlxrh(w20, w21, MemOperand(x22)), "stlxrh w20, w21, [x22]");
1781 COMPARE(stlxrh(x23, w24, MemOperand(sp)), "stlxrh w23, w24, [sp]");
1782 COMPARE(stlxrh(w25, x26, MemOperand(x27)), "stlxrh w25, w26, [x27]");
1783 COMPARE(stlxrh(x28, x29, MemOperand(sp)), "stlxrh w28, w29, [sp]");
1784 COMPARE(stlxr(w30, w0, MemOperand(x1)), "stlxr w30, w0, [x1]");
1785 COMPARE(stlxr(x2, w3, MemOperand(sp)), "stlxr w2, w3, [sp]");
1786 COMPARE(stlxr(w4, x5, MemOperand(x6)), "stlxr w4, x5, [x6]");
1787 COMPARE(stlxr(x7, x8, MemOperand(sp)), "stlxr w7, x8, [sp]");
1788 COMPARE(ldaxrb(w9, MemOperand(x10)), "ldaxrb w9, [x10]");
1789 COMPARE(ldaxrb(w11, MemOperand(sp)), "ldaxrb w11, [sp]");
1790 COMPARE(ldaxrb(x12, MemOperand(x13)), "ldaxrb w12, [x13]");
1791 COMPARE(ldaxrb(x14, MemOperand(sp)), "ldaxrb w14, [sp]");
1792 COMPARE(ldaxrh(w15, MemOperand(x16)), "ldaxrh w15, [x16]");
1793 COMPARE(ldaxrh(w17, MemOperand(sp)), "ldaxrh w17, [sp]");
1794 COMPARE(ldaxrh(x18, MemOperand(x19)), "ldaxrh w18, [x19]");
1795 COMPARE(ldaxrh(x20, MemOperand(sp)), "ldaxrh w20, [sp]");
1796 COMPARE(ldaxr(w21, MemOperand(x22)), "ldaxr w21, [x22]");
1797 COMPARE(ldaxr(w23, MemOperand(sp)), "ldaxr w23, [sp]");
1798 COMPARE(ldaxr(x24, MemOperand(x25)), "ldaxr x24, [x25]");
1799 COMPARE(ldaxr(x26, MemOperand(sp)), "ldaxr x26, [sp]");
1800 COMPARE(stlxp(w27, w28, w29, MemOperand(x30)), "stlxp w27, w28, w29, [x30]");
1801 COMPARE(stlxp(x0, w1, w2, MemOperand(sp)), "stlxp w0, w1, w2, [sp]");
1802 COMPARE(stlxp(w3, x4, x5, MemOperand(x6)), "stlxp w3, x4, x5, [x6]");
1803 COMPARE(stlxp(x7, x8, x9, MemOperand(sp)), "stlxp w7, x8, x9, [sp]");
1804 COMPARE(ldaxp(w10, w11, MemOperand(x12)), "ldaxp w10, w11, [x12]");
1805 COMPARE(ldaxp(w13, w14, MemOperand(sp)), "ldaxp w13, w14, [sp]");
1806 COMPARE(ldaxp(x15, x16, MemOperand(x17)), "ldaxp x15, x16, [x17]");
1807 COMPARE(ldaxp(x18, x19, MemOperand(sp)), "ldaxp x18, x19, [sp]");
1808 COMPARE(stlrb(w20, MemOperand(x21)), "stlrb w20, [x21]");
1809 COMPARE(stlrb(w22, MemOperand(sp)), "stlrb w22, [sp]");
1810 COMPARE(stlrb(x23, MemOperand(x24)), "stlrb w23, [x24]");
1811 COMPARE(stlrb(x25, MemOperand(sp)), "stlrb w25, [sp]");
1812 COMPARE(stlrh(w26, MemOperand(x27)), "stlrh w26, [x27]");
1813 COMPARE(stlrh(w28, MemOperand(sp)), "stlrh w28, [sp]");
1814 COMPARE(stlrh(x29, MemOperand(x30)), "stlrh w29, [x30]");
1815 COMPARE(stlrh(x0, MemOperand(sp)), "stlrh w0, [sp]");
1816 COMPARE(stlr(w1, MemOperand(x2)), "stlr w1, [x2]");
1817 COMPARE(stlr(w3, MemOperand(sp)), "stlr w3, [sp]");
1818 COMPARE(stlr(x4, MemOperand(x5)), "stlr x4, [x5]");
1819 COMPARE(stlr(x6, MemOperand(sp)), "stlr x6, [sp]");
1820 COMPARE(ldarb(w7, MemOperand(x8)), "ldarb w7, [x8]");
1821 COMPARE(ldarb(w9, MemOperand(sp)), "ldarb w9, [sp]");
1822 COMPARE(ldarb(x10, MemOperand(x11)), "ldarb w10, [x11]");
1823 COMPARE(ldarb(x12, MemOperand(sp)), "ldarb w12, [sp]");
1824 COMPARE(ldarh(w13, MemOperand(x14)), "ldarh w13, [x14]");
1825 COMPARE(ldarh(w15, MemOperand(sp)), "ldarh w15, [sp]");
1826 COMPARE(ldarh(x16, MemOperand(x17)), "ldarh w16, [x17]");
1827 COMPARE(ldarh(x18, MemOperand(sp)), "ldarh w18, [sp]");
1828 COMPARE(ldar(w19, MemOperand(x20)), "ldar w19, [x20]");
1829 COMPARE(ldar(w21, MemOperand(sp)), "ldar w21, [sp]");
1830 COMPARE(ldar(x22, MemOperand(x23)), "ldar x22, [x23]");
1831 COMPARE(ldar(x24, MemOperand(sp)), "ldar x24, [sp]");
1832
1833 CLEANUP();
1834}
1835
1836
armvixlad96eda2013-06-14 11:42:37 +01001837TEST(load_store_pair_nontemp) {
1838 SETUP();
1839
1840 COMPARE(ldnp(w0, w1, MemOperand(x2)), "ldnp w0, w1, [x2]");
1841 COMPARE(stnp(w3, w4, MemOperand(x5, 252)), "stnp w3, w4, [x5, #252]");
1842 COMPARE(ldnp(w6, w7, MemOperand(x8, -256)), "ldnp w6, w7, [x8, #-256]");
1843 COMPARE(stnp(x9, x10, MemOperand(x11)), "stnp x9, x10, [x11]");
1844 COMPARE(ldnp(x12, x13, MemOperand(x14, 504)), "ldnp x12, x13, [x14, #504]");
1845 COMPARE(stnp(x15, x16, MemOperand(x17, -512)), "stnp x15, x16, [x17, #-512]");
1846 COMPARE(ldnp(s18, s19, MemOperand(x20)), "ldnp s18, s19, [x20]");
1847 COMPARE(stnp(s21, s22, MemOperand(x23, 252)), "stnp s21, s22, [x23, #252]");
1848 COMPARE(ldnp(s24, s25, MemOperand(x26, -256)), "ldnp s24, s25, [x26, #-256]");
1849 COMPARE(stnp(d27, d28, MemOperand(x29)), "stnp d27, d28, [x29]");
1850 COMPARE(ldnp(d30, d31, MemOperand(x0, 504)), "ldnp d30, d31, [x0, #504]");
1851 COMPARE(stnp(d1, d2, MemOperand(x3, -512)), "stnp d1, d2, [x3, #-512]");
armvixl5289c592015-03-02 13:52:04 +00001852 COMPARE(ldnp(q4, q5, MemOperand(x6)), "ldnp q4, q5, [x6]");
1853 COMPARE(stnp(q7, q8, MemOperand(x9, 1008)), "stnp q7, q8, [x9, #1008]");
1854 COMPARE(ldnp(q10, q11, MemOperand(x12, -1024)),
1855 "ldnp q10, q11, [x12, #-1024]");
armvixlad96eda2013-06-14 11:42:37 +01001856
1857 CLEANUP();
1858}
1859
armvixl4a102ba2014-07-14 09:02:40 +01001860
armvixl330dc712014-11-25 10:38:32 +00001861TEST(load_literal_macro) {
armvixl684cd2a2015-10-23 13:38:33 +01001862 SETUP_MACRO();
armvixlad96eda2013-06-14 11:42:37 +01001863
armvixl330dc712014-11-25 10:38:32 +00001864 // In each case, the literal will be placed at PC+8:
1865 // ldr x10, pc+8 // Test instruction.
1866 // ldr xzr, pc+12 // Pool marker.
1867 // .word64 #0x1234567890abcdef // Test literal.
1868
1869 COMPARE_PREFIX(Ldr(x10, 0x1234567890abcdef), "ldr x10, pc+8");
1870 COMPARE_PREFIX(Ldr(w20, 0xfedcba09), "ldr w20, pc+8");
1871 COMPARE_PREFIX(Ldr(d11, 1.234), "ldr d11, pc+8");
1872 COMPARE_PREFIX(Ldr(s22, 2.5f), "ldr s22, pc+8");
1873 COMPARE_PREFIX(Ldrsw(x21, 0x80000000), "ldrsw x21, pc+8");
1874
1875 CLEANUP();
1876}
1877
1878
1879TEST(load_literal) {
1880 SETUP();
1881
1882 COMPARE_PREFIX(ldr(x20, 0), "ldr x20, pc+0");
1883 COMPARE_PREFIX(ldr(x20, 1), "ldr x20, pc+4");
1884 COMPARE_PREFIX(ldr(x20, -1), "ldr x20, pc-4");
1885 COMPARE_PREFIX(ldr(x20, 0x3ffff), "ldr x20, pc+1048572");
1886 COMPARE_PREFIX(ldr(x20, -0x40000), "ldr x20, pc-1048576");
1887 COMPARE_PREFIX(ldr(w21, 0), "ldr w21, pc+0");
1888 COMPARE_PREFIX(ldr(w21, 1), "ldr w21, pc+4");
1889 COMPARE_PREFIX(ldr(w21, -1), "ldr w21, pc-4");
1890 COMPARE_PREFIX(ldr(w21, 0x3ffff), "ldr w21, pc+1048572");
1891 COMPARE_PREFIX(ldr(w21, -0x40000), "ldr w21, pc-1048576");
1892 COMPARE_PREFIX(ldr(d22, 0), "ldr d22, pc+0");
1893 COMPARE_PREFIX(ldr(d22, 1), "ldr d22, pc+4");
1894 COMPARE_PREFIX(ldr(d22, -1), "ldr d22, pc-4");
1895 COMPARE_PREFIX(ldr(d22, 0x3ffff), "ldr d22, pc+1048572");
1896 COMPARE_PREFIX(ldr(d22, -0x40000), "ldr d22, pc-1048576");
1897 COMPARE_PREFIX(ldr(s23, 0), "ldr s23, pc+0");
1898 COMPARE_PREFIX(ldr(s23, 1), "ldr s23, pc+4");
1899 COMPARE_PREFIX(ldr(s23, -1), "ldr s23, pc-4");
1900 COMPARE_PREFIX(ldr(s23, 0x3ffff), "ldr s23, pc+1048572");
1901 COMPARE_PREFIX(ldr(s23, -0x40000), "ldr s23, pc-1048576");
1902 COMPARE_PREFIX(ldrsw(x24, 0), "ldrsw x24, pc+0");
1903 COMPARE_PREFIX(ldrsw(x24, 1), "ldrsw x24, pc+4");
1904 COMPARE_PREFIX(ldrsw(x24, -1), "ldrsw x24, pc-4");
1905 COMPARE_PREFIX(ldrsw(x24, 0x3ffff), "ldrsw x24, pc+1048572");
1906 COMPARE_PREFIX(ldrsw(x24, -0x40000), "ldrsw x24, pc-1048576");
1907
1908 CLEANUP();
1909}
1910
1911
1912TEST(prfm_operations) {
1913 SETUP();
1914
1915 // Test every encodable prefetch operation.
1916 const char* expected[] = {
1917 "prfm pldl1keep, ",
1918 "prfm pldl1strm, ",
1919 "prfm pldl2keep, ",
1920 "prfm pldl2strm, ",
1921 "prfm pldl3keep, ",
1922 "prfm pldl3strm, ",
1923 "prfm #0b00110, ",
1924 "prfm #0b00111, ",
1925 "prfm plil1keep, ",
1926 "prfm plil1strm, ",
1927 "prfm plil2keep, ",
1928 "prfm plil2strm, ",
1929 "prfm plil3keep, ",
1930 "prfm plil3strm, ",
1931 "prfm #0b01110, ",
1932 "prfm #0b01111, ",
1933 "prfm pstl1keep, ",
1934 "prfm pstl1strm, ",
1935 "prfm pstl2keep, ",
1936 "prfm pstl2strm, ",
1937 "prfm pstl3keep, ",
1938 "prfm pstl3strm, ",
1939 "prfm #0b10110, ",
1940 "prfm #0b10111, ",
1941 "prfm #0b11000, ",
1942 "prfm #0b11001, ",
1943 "prfm #0b11010, ",
1944 "prfm #0b11011, ",
1945 "prfm #0b11100, ",
1946 "prfm #0b11101, ",
1947 "prfm #0b11110, ",
1948 "prfm #0b11111, ",
1949 };
1950 const int expected_count = sizeof(expected) / sizeof(expected[0]);
1951 VIXL_STATIC_ASSERT((1 << ImmPrefetchOperation_width) == expected_count);
1952
1953 for (int i = 0; i < (1 << ImmPrefetchOperation_width); i++) {
1954 PrefetchOperation op = static_cast<PrefetchOperation>(i);
1955 COMPARE_PREFIX(prfm(op, 0), expected[i]);
1956 COMPARE_PREFIX(prfm(op, MemOperand(x0, 0)), expected[i]);
1957 COMPARE_PREFIX(prfm(op, MemOperand(x0, x1)), expected[i]);
1958 }
1959
1960 CLEANUP();
1961}
1962
1963
1964TEST(prfum_operations) {
1965 SETUP();
1966
1967 // Test every encodable prefetch operation.
1968 const char* expected[] = {
1969 "prfum pldl1keep, ",
1970 "prfum pldl1strm, ",
1971 "prfum pldl2keep, ",
1972 "prfum pldl2strm, ",
1973 "prfum pldl3keep, ",
1974 "prfum pldl3strm, ",
1975 "prfum #0b00110, ",
1976 "prfum #0b00111, ",
1977 "prfum plil1keep, ",
1978 "prfum plil1strm, ",
1979 "prfum plil2keep, ",
1980 "prfum plil2strm, ",
1981 "prfum plil3keep, ",
1982 "prfum plil3strm, ",
1983 "prfum #0b01110, ",
1984 "prfum #0b01111, ",
1985 "prfum pstl1keep, ",
1986 "prfum pstl1strm, ",
1987 "prfum pstl2keep, ",
1988 "prfum pstl2strm, ",
1989 "prfum pstl3keep, ",
1990 "prfum pstl3strm, ",
1991 "prfum #0b10110, ",
1992 "prfum #0b10111, ",
1993 "prfum #0b11000, ",
1994 "prfum #0b11001, ",
1995 "prfum #0b11010, ",
1996 "prfum #0b11011, ",
1997 "prfum #0b11100, ",
1998 "prfum #0b11101, ",
1999 "prfum #0b11110, ",
2000 "prfum #0b11111, ",
2001 };
2002 const int expected_count = sizeof(expected) / sizeof(expected[0]);
2003 VIXL_STATIC_ASSERT((1 << ImmPrefetchOperation_width) == expected_count);
2004
2005 for (int i = 0; i < (1 << ImmPrefetchOperation_width); i++) {
2006 PrefetchOperation op = static_cast<PrefetchOperation>(i);
2007 COMPARE_PREFIX(prfum(op, MemOperand(x0, 0)), expected[i]);
2008 }
2009
2010 CLEANUP();
2011}
2012
2013
2014TEST(prfm_offset) {
2015 SETUP();
2016
2017 COMPARE(prfm(PLDL1KEEP, MemOperand(x1)), "prfm pldl1keep, [x1]");
2018 COMPARE(prfm(PLDL1STRM, MemOperand(x3, 8)), "prfm pldl1strm, [x3, #8]");
2019 COMPARE(prfm(PLDL2KEEP, MemOperand(x5, 32760)),
2020 "prfm pldl2keep, [x5, #32760]");
2021
2022 COMPARE(prfm(PLDL2STRM, MemOperand(sp)), "prfm pldl2strm, [sp]");
2023 COMPARE(prfm(PLDL3KEEP, MemOperand(sp, 8)), "prfm pldl3keep, [sp, #8]");
2024 COMPARE(prfm(PLDL3STRM, MemOperand(sp, 32760)),
2025 "prfm pldl3strm, [sp, #32760]");
2026
2027 CLEANUP();
2028}
2029
2030
2031TEST(prfm_regoffset) {
2032 SETUP();
2033
2034 COMPARE(prfm(PLIL1KEEP, MemOperand(x1, x2)), "prfm plil1keep, [x1, x2]");
2035 COMPARE(prfm(PLIL1STRM, MemOperand(x3, w4, SXTW)),
2036 "prfm plil1strm, [x3, w4, sxtw]");
2037 COMPARE(prfm(PLIL2KEEP, MemOperand(x5, x6, LSL, 3)),
2038 "prfm plil2keep, [x5, x6, lsl #3]");
2039
2040 COMPARE(prfm(PLIL2STRM, MemOperand(sp, xzr)), "prfm plil2strm, [sp, xzr]");
2041 COMPARE(prfm(PLIL3KEEP, MemOperand(sp, wzr, SXTW)),
2042 "prfm plil3keep, [sp, wzr, sxtw]");
2043 COMPARE(prfm(PLIL3STRM, MemOperand(sp, xzr, LSL, 3)),
2044 "prfm plil3strm, [sp, xzr, lsl #3]");
2045
2046 CLEANUP();
2047}
2048
2049
2050TEST(prfm_literal) {
2051 SETUP();
2052
2053 COMPARE_PREFIX(prfm(PSTL1KEEP, 0), "prfm pstl1keep, pc+0");
2054 COMPARE_PREFIX(prfm(PSTL1STRM, 1), "prfm pstl1strm, pc+4");
2055 COMPARE_PREFIX(prfm(PSTL2KEEP, -1), "prfm pstl2keep, pc-4");
2056 COMPARE_PREFIX(prfm(PSTL2STRM, 0x3ffff), "prfm pstl2strm, pc+1048572");
2057 COMPARE_PREFIX(prfm(PSTL3KEEP, -0x3ffff), "prfm pstl3keep, pc-1048572");
2058 COMPARE_PREFIX(prfm(PSTL3STRM, -0x40000), "prfm pstl3strm, pc-1048576");
2059
2060 CLEANUP();
2061}
2062
2063
2064TEST(prfm_unscaled) {
2065 SETUP();
2066
2067 // If an unscaled-offset instruction is requested, it is used, even if the
2068 // offset could be encoded in a scaled-offset instruction.
2069 COMPARE(prfum(PLDL1KEEP, MemOperand(x1)), "prfum pldl1keep, [x1]");
2070 COMPARE(prfum(PLDL1STRM, MemOperand(x1, 8)), "prfum pldl1strm, [x1, #8]");
2071 COMPARE(prfum(PLDL2KEEP, MemOperand(x1, 248)), "prfum pldl2keep, [x1, #248]");
2072
2073 // Normal offsets are converted to unscaled offsets if necssary.
2074 COMPARE(prfm(PLDL2STRM, MemOperand(x1, 1)), "prfum pldl2strm, [x1, #1]");
2075 COMPARE(prfm(PLDL3KEEP, MemOperand(x1, -1)), "prfum pldl3keep, [x1, #-1]");
2076 COMPARE(prfm(PLDL3STRM, MemOperand(x1, 255)), "prfum pldl3strm, [x1, #255]");
2077 COMPARE(prfm(PLDL3STRM, MemOperand(x1, -256)),
2078 "prfum pldl3strm, [x1, #-256]");
2079
2080 CLEANUP();
2081}
2082
2083
2084TEST(prfm_unscaled_option) {
2085 SETUP();
2086
2087 // Just like prfm_unscaled, but specify the scaling option explicitly.
2088
2089 // Require unscaled-offset forms.
2090 LoadStoreScalingOption option = RequireUnscaledOffset;
2091
2092 COMPARE(prfum(PLDL1KEEP, MemOperand(x1), option), "prfum pldl1keep, [x1]");
2093 COMPARE(prfum(PLDL1STRM, MemOperand(x1, 8), option),
2094 "prfum pldl1strm, [x1, #8]");
2095 COMPARE(prfum(PLDL2KEEP, MemOperand(x1, 248), option),
2096 "prfum pldl2keep, [x1, #248]");
2097 COMPARE(prfum(PLDL2STRM, MemOperand(x1, 1), option),
2098 "prfum pldl2strm, [x1, #1]");
2099 COMPARE(prfum(PLDL3KEEP, MemOperand(x1, -1), option),
2100 "prfum pldl3keep, [x1, #-1]");
2101 COMPARE(prfum(PLDL3STRM, MemOperand(x1, 255), option),
2102 "prfum pldl3strm, [x1, #255]");
2103 COMPARE(prfum(PLIL1KEEP, MemOperand(x1, -256), option),
2104 "prfum plil1keep, [x1, #-256]");
2105
2106 // Require scaled-offset forms..
2107 option = RequireScaledOffset;
2108
2109 COMPARE(prfm(PLDL1KEEP, MemOperand(x1), option), "prfm pldl1keep, [x1]");
2110 COMPARE(prfm(PLDL1STRM, MemOperand(x1, 8), option),
2111 "prfm pldl1strm, [x1, #8]");
2112 COMPARE(prfm(PLDL2KEEP, MemOperand(x1, 248), option),
2113 "prfm pldl2keep, [x1, #248]");
2114 COMPARE(prfm(PLIL2STRM, MemOperand(x1, 256), option),
2115 "prfm plil2strm, [x1, #256]");
2116 COMPARE(prfm(PLIL3KEEP, MemOperand(x1, 32760), option),
2117 "prfm plil3keep, [x1, #32760]");
2118
2119 // Prefer unscaled-offset forms, but allow scaled-offset forms if necessary.
2120 option = PreferUnscaledOffset;
2121
2122 COMPARE(prfum(PLDL1KEEP, MemOperand(x1), option), "prfum pldl1keep, [x1]");
2123 COMPARE(prfum(PLDL1STRM, MemOperand(x1, 8), option),
2124 "prfum pldl1strm, [x1, #8]");
2125 COMPARE(prfum(PLDL2KEEP, MemOperand(x1, 248), option),
2126 "prfum pldl2keep, [x1, #248]");
2127 COMPARE(prfum(PLDL2STRM, MemOperand(x1, 1), option),
2128 "prfum pldl2strm, [x1, #1]");
2129 COMPARE(prfum(PLDL3KEEP, MemOperand(x1, -1), option),
2130 "prfum pldl3keep, [x1, #-1]");
2131 COMPARE(prfum(PLDL3STRM, MemOperand(x1, 255), option),
2132 "prfum pldl3strm, [x1, #255]");
2133 COMPARE(prfum(PLIL1KEEP, MemOperand(x1, -256), option),
2134 "prfum plil1keep, [x1, #-256]");
2135 COMPARE(prfum(PLIL1STRM, MemOperand(x1, 256), option),
2136 "prfm plil1strm, [x1, #256]");
2137 COMPARE(prfum(PLIL2KEEP, MemOperand(x1, 32760), option),
2138 "prfm plil2keep, [x1, #32760]");
2139
2140 // Prefer scaled-offset forms, but allow unscaled-offset forms if necessary.
2141 option = PreferScaledOffset;
2142
2143 COMPARE(prfm(PLDL1KEEP, MemOperand(x1), option), "prfm pldl1keep, [x1]");
2144 COMPARE(prfm(PLDL1STRM, MemOperand(x1, 8), option),
2145 "prfm pldl1strm, [x1, #8]");
2146 COMPARE(prfm(PLDL2KEEP, MemOperand(x1, 248), option),
2147 "prfm pldl2keep, [x1, #248]");
2148 COMPARE(prfm(PLDL2STRM, MemOperand(x1, 1), option),
2149 "prfum pldl2strm, [x1, #1]");
2150 COMPARE(prfm(PLDL3KEEP, MemOperand(x1, -1), option),
2151 "prfum pldl3keep, [x1, #-1]");
2152 COMPARE(prfm(PLDL3STRM, MemOperand(x1, 255), option),
2153 "prfum pldl3strm, [x1, #255]");
2154 COMPARE(prfm(PLIL1KEEP, MemOperand(x1, -256), option),
2155 "prfum plil1keep, [x1, #-256]");
2156 COMPARE(prfm(PLIL1STRM, MemOperand(x1, 256), option),
2157 "prfm plil1strm, [x1, #256]");
2158 COMPARE(prfm(PLIL2KEEP, MemOperand(x1, 32760), option),
2159 "prfm plil2keep, [x1, #32760]");
armvixlad96eda2013-06-14 11:42:37 +01002160
2161 CLEANUP();
2162}
2163
armvixl4a102ba2014-07-14 09:02:40 +01002164
armvixlad96eda2013-06-14 11:42:37 +01002165TEST(cond_select) {
2166 SETUP();
2167
2168 COMPARE(csel(w0, w1, w2, eq), "csel w0, w1, w2, eq");
2169 COMPARE(csel(x3, x4, x5, ne), "csel x3, x4, x5, ne");
2170 COMPARE(csinc(w6, w7, w8, hs), "csinc w6, w7, w8, hs");
2171 COMPARE(csinc(x9, x10, x11, lo), "csinc x9, x10, x11, lo");
2172 COMPARE(csinv(w12, w13, w14, mi), "csinv w12, w13, w14, mi");
2173 COMPARE(csinv(x15, x16, x17, pl), "csinv x15, x16, x17, pl");
2174 COMPARE(csneg(w18, w19, w20, vs), "csneg w18, w19, w20, vs");
2175 COMPARE(csneg(x21, x22, x23, vc), "csneg x21, x22, x23, vc");
2176 COMPARE(cset(w24, hi), "cset w24, hi");
2177 COMPARE(cset(x25, ls), "cset x25, ls");
2178 COMPARE(csetm(w26, ge), "csetm w26, ge");
2179 COMPARE(csetm(x27, lt), "csetm x27, lt");
2180 COMPARE(cinc(w28, w29, gt), "cinc w28, w29, gt");
2181 COMPARE(cinc(x30, x0, le), "cinc x30, x0, le");
2182 COMPARE(cinv(w1, w2, eq), "cinv w1, w2, eq");
2183 COMPARE(cinv(x3, x4, ne), "cinv x3, x4, ne");
2184 COMPARE(cneg(w5, w6, hs), "cneg w5, w6, hs");
2185 COMPARE(cneg(x7, x8, lo), "cneg x7, x8, lo");
2186
armvixl578645f2013-08-15 17:21:42 +01002187 COMPARE(csel(x0, x1, x2, al), "csel x0, x1, x2, al");
2188 COMPARE(csel(x1, x2, x3, nv), "csel x1, x2, x3, nv");
2189 COMPARE(csinc(x2, x3, x4, al), "csinc x2, x3, x4, al");
2190 COMPARE(csinc(x3, x4, x5, nv), "csinc x3, x4, x5, nv");
2191 COMPARE(csinv(x4, x5, x6, al), "csinv x4, x5, x6, al");
2192 COMPARE(csinv(x5, x6, x7, nv), "csinv x5, x6, x7, nv");
2193 COMPARE(csneg(x6, x7, x8, al), "csneg x6, x7, x8, al");
2194 COMPARE(csneg(x7, x8, x9, nv), "csneg x7, x8, x9, nv");
2195
armvixlad96eda2013-06-14 11:42:37 +01002196 CLEANUP();
2197}
2198
armvixl4a102ba2014-07-14 09:02:40 +01002199
armvixlf37fdc02014-02-05 13:22:16 +00002200TEST(cond_select_macro) {
armvixl684cd2a2015-10-23 13:38:33 +01002201 SETUP_MACRO();
armvixlf37fdc02014-02-05 13:22:16 +00002202
2203 COMPARE(Csel(w0, w1, -1, eq), "csinv w0, w1, wzr, eq");
2204 COMPARE(Csel(w2, w3, 0, ne), "csel w2, w3, wzr, ne");
2205 COMPARE(Csel(w4, w5, 1, hs), "csinc w4, w5, wzr, hs");
2206 COMPARE(Csel(x6, x7, -1, lo), "csinv x6, x7, xzr, lo");
2207 COMPARE(Csel(x8, x9, 0, mi), "csel x8, x9, xzr, mi");
2208 COMPARE(Csel(x10, x11, 1, pl), "csinc x10, x11, xzr, pl");
2209
2210 CLEANUP();
2211}
2212
armvixl4a102ba2014-07-14 09:02:40 +01002213
armvixlad96eda2013-06-14 11:42:37 +01002214TEST(cond_cmp) {
2215 SETUP();
2216
armvixl578645f2013-08-15 17:21:42 +01002217 COMPARE(ccmn(w0, w1, NZCVFlag, eq), "ccmn w0, w1, #NZCV, eq");
2218 COMPARE(ccmn(x2, x3, NZCFlag, ne), "ccmn x2, x3, #NZCv, ne");
2219 COMPARE(ccmp(w4, w5, NZVFlag, hs), "ccmp w4, w5, #NZcV, hs");
2220 COMPARE(ccmp(x6, x7, NZFlag, lo), "ccmp x6, x7, #NZcv, lo");
2221 COMPARE(ccmn(w8, 31, NFlag, mi), "ccmn w8, #31, #Nzcv, mi");
2222 COMPARE(ccmn(x9, 30, NCFlag, pl), "ccmn x9, #30, #NzCv, pl");
2223 COMPARE(ccmp(w10, 29, NVFlag, vs), "ccmp w10, #29, #NzcV, vs");
2224 COMPARE(ccmp(x11, 28, NFlag, vc), "ccmp x11, #28, #Nzcv, vc");
2225 COMPARE(ccmn(w12, w13, NoFlag, al), "ccmn w12, w13, #nzcv, al");
2226 COMPARE(ccmp(x14, 27, ZVFlag, nv), "ccmp x14, #27, #nZcV, nv");
armvixlad96eda2013-06-14 11:42:37 +01002227
2228 CLEANUP();
2229}
2230
armvixl4a102ba2014-07-14 09:02:40 +01002231
armvixlf37fdc02014-02-05 13:22:16 +00002232TEST(cond_cmp_macro) {
armvixl684cd2a2015-10-23 13:38:33 +01002233 SETUP_MACRO();
armvixlf37fdc02014-02-05 13:22:16 +00002234
2235 COMPARE(Ccmp(w0, -1, VFlag, hi), "ccmn w0, #1, #nzcV, hi");
2236 COMPARE(Ccmp(x1, -31, CFlag, ge), "ccmn x1, #31, #nzCv, ge");
2237 COMPARE(Ccmn(w2, -1, CVFlag, gt), "ccmp w2, #1, #nzCV, gt");
2238 COMPARE(Ccmn(x3, -31, ZCVFlag, ls), "ccmp x3, #31, #nZCV, ls");
2239
2240 CLEANUP();
2241}
2242
armvixl4a102ba2014-07-14 09:02:40 +01002243
armvixlad96eda2013-06-14 11:42:37 +01002244TEST(fmov_imm) {
2245 SETUP();
2246
armvixlb0c8ae22014-03-21 14:03:59 +00002247 COMPARE(fmov(s0, 1.0f), "fmov s0, #0x70 (1.0000)");
2248 COMPARE(fmov(s31, -13.0f), "fmov s31, #0xaa (-13.0000)");
armvixlad96eda2013-06-14 11:42:37 +01002249 COMPARE(fmov(d1, 1.0), "fmov d1, #0x70 (1.0000)");
2250 COMPARE(fmov(d29, -13.0), "fmov d29, #0xaa (-13.0000)");
2251
2252 CLEANUP();
2253}
2254
armvixl4a102ba2014-07-14 09:02:40 +01002255
armvixlad96eda2013-06-14 11:42:37 +01002256TEST(fmov_reg) {
2257 SETUP();
2258
2259 COMPARE(fmov(w3, s13), "fmov w3, s13");
2260 COMPARE(fmov(x6, d26), "fmov x6, d26");
2261 COMPARE(fmov(s11, w30), "fmov s11, w30");
2262 COMPARE(fmov(d31, x2), "fmov d31, x2");
2263 COMPARE(fmov(s12, s13), "fmov s12, s13");
2264 COMPARE(fmov(d22, d23), "fmov d22, d23");
armvixl5289c592015-03-02 13:52:04 +00002265 COMPARE(fmov(v0.D(), 1, x13), "fmov v0.D[1], x13");
2266 COMPARE(fmov(x13, v0.D(), 1), "fmov x13, v0.D[1]");
armvixlad96eda2013-06-14 11:42:37 +01002267
2268 CLEANUP();
2269}
2270
2271
2272TEST(fp_dp1) {
2273 SETUP();
2274
2275 COMPARE(fabs(s0, s1), "fabs s0, s1");
2276 COMPARE(fabs(s31, s30), "fabs s31, s30");
2277 COMPARE(fabs(d2, d3), "fabs d2, d3");
2278 COMPARE(fabs(d31, d30), "fabs d31, d30");
2279 COMPARE(fneg(s4, s5), "fneg s4, s5");
2280 COMPARE(fneg(s31, s30), "fneg s31, s30");
2281 COMPARE(fneg(d6, d7), "fneg d6, d7");
2282 COMPARE(fneg(d31, d30), "fneg d31, d30");
2283 COMPARE(fsqrt(s8, s9), "fsqrt s8, s9");
2284 COMPARE(fsqrt(s31, s30), "fsqrt s31, s30");
2285 COMPARE(fsqrt(d10, d11), "fsqrt d10, d11");
2286 COMPARE(fsqrt(d31, d30), "fsqrt d31, d30");
armvixlf37fdc02014-02-05 13:22:16 +00002287 COMPARE(frinta(s10, s11), "frinta s10, s11");
2288 COMPARE(frinta(s31, s30), "frinta s31, s30");
2289 COMPARE(frinta(d12, d13), "frinta d12, d13");
2290 COMPARE(frinta(d31, d30), "frinta d31, d30");
armvixl330dc712014-11-25 10:38:32 +00002291 COMPARE(frinti(s10, s11), "frinti s10, s11");
2292 COMPARE(frinti(s31, s30), "frinti s31, s30");
2293 COMPARE(frinti(d12, d13), "frinti d12, d13");
2294 COMPARE(frinti(d31, d30), "frinti d31, d30");
2295 COMPARE(frintm(s10, s11), "frintm s10, s11");
2296 COMPARE(frintm(s31, s30), "frintm s31, s30");
2297 COMPARE(frintm(d12, d13), "frintm d12, d13");
2298 COMPARE(frintm(d31, d30), "frintm d31, d30");
armvixlad96eda2013-06-14 11:42:37 +01002299 COMPARE(frintn(s10, s11), "frintn s10, s11");
2300 COMPARE(frintn(s31, s30), "frintn s31, s30");
2301 COMPARE(frintn(d12, d13), "frintn d12, d13");
2302 COMPARE(frintn(d31, d30), "frintn d31, d30");
armvixl330dc712014-11-25 10:38:32 +00002303 COMPARE(frintx(s10, s11), "frintx s10, s11");
2304 COMPARE(frintx(s31, s30), "frintx s31, s30");
2305 COMPARE(frintx(d12, d13), "frintx d12, d13");
2306 COMPARE(frintx(d31, d30), "frintx d31, d30");
armvixlad96eda2013-06-14 11:42:37 +01002307 COMPARE(frintz(s10, s11), "frintz s10, s11");
2308 COMPARE(frintz(s31, s30), "frintz s31, s30");
2309 COMPARE(frintz(d12, d13), "frintz d12, d13");
2310 COMPARE(frintz(d31, d30), "frintz d31, d30");
2311 COMPARE(fcvt(d14, s15), "fcvt d14, s15");
2312 COMPARE(fcvt(d31, s31), "fcvt d31, s31");
armvixl5289c592015-03-02 13:52:04 +00002313 COMPARE(fcvt(s0, d1), "fcvt s0, d1");
2314 COMPARE(fcvt(s2, h3), "fcvt s2, h3");
2315 COMPARE(fcvt(d4, h5), "fcvt d4, h5");
2316 COMPARE(fcvt(h6, s7), "fcvt h6, s7");
2317 COMPARE(fcvt(h8, d9), "fcvt h8, d9");
armvixlad96eda2013-06-14 11:42:37 +01002318
2319 CLEANUP();
2320}
2321
2322
2323TEST(fp_dp2) {
2324 SETUP();
2325
2326 COMPARE(fadd(s0, s1, s2), "fadd s0, s1, s2");
2327 COMPARE(fadd(d3, d4, d5), "fadd d3, d4, d5");
2328 COMPARE(fsub(s31, s30, s29), "fsub s31, s30, s29");
2329 COMPARE(fsub(d31, d30, d29), "fsub d31, d30, d29");
2330 COMPARE(fmul(s7, s8, s9), "fmul s7, s8, s9");
2331 COMPARE(fmul(d10, d11, d12), "fmul d10, d11, d12");
armvixl5289c592015-03-02 13:52:04 +00002332 COMPARE(fnmul(s7, s8, s9), "fnmul s7, s8, s9");
2333 COMPARE(fnmul(d10, d11, d12), "fnmul d10, d11, d12");
armvixlad96eda2013-06-14 11:42:37 +01002334 COMPARE(fdiv(s13, s14, s15), "fdiv s13, s14, s15");
2335 COMPARE(fdiv(d16, d17, d18), "fdiv d16, d17, d18");
2336 COMPARE(fmax(s19, s20, s21), "fmax s19, s20, s21");
2337 COMPARE(fmax(d22, d23, d24), "fmax d22, d23, d24");
2338 COMPARE(fmin(s25, s26, s27), "fmin s25, s26, s27");
2339 COMPARE(fmin(d28, d29, d30), "fmin d28, d29, d30");
armvixlf37fdc02014-02-05 13:22:16 +00002340 COMPARE(fmaxnm(s31, s0, s1), "fmaxnm s31, s0, s1");
2341 COMPARE(fmaxnm(d2, d3, d4), "fmaxnm d2, d3, d4");
2342 COMPARE(fminnm(s5, s6, s7), "fminnm s5, s6, s7");
2343 COMPARE(fminnm(d8, d9, d10), "fminnm d8, d9, d10");
armvixlad96eda2013-06-14 11:42:37 +01002344
2345 CLEANUP();
2346}
2347
2348
2349TEST(fp_dp3) {
2350 SETUP();
2351
armvixlf37fdc02014-02-05 13:22:16 +00002352 COMPARE(fmadd(s7, s8, s9, s10), "fmadd s7, s8, s9, s10");
2353 COMPARE(fmadd(d10, d11, d12, d10), "fmadd d10, d11, d12, d10");
armvixlad96eda2013-06-14 11:42:37 +01002354 COMPARE(fmsub(s7, s8, s9, s10), "fmsub s7, s8, s9, s10");
2355 COMPARE(fmsub(d10, d11, d12, d10), "fmsub d10, d11, d12, d10");
2356
armvixlf37fdc02014-02-05 13:22:16 +00002357 COMPARE(fnmadd(s7, s8, s9, s10), "fnmadd s7, s8, s9, s10");
2358 COMPARE(fnmadd(d10, d11, d12, d10), "fnmadd d10, d11, d12, d10");
2359 COMPARE(fnmsub(s7, s8, s9, s10), "fnmsub s7, s8, s9, s10");
2360 COMPARE(fnmsub(d10, d11, d12, d10), "fnmsub d10, d11, d12, d10");
2361
armvixlad96eda2013-06-14 11:42:37 +01002362 CLEANUP();
2363}
2364
2365
2366TEST(fp_compare) {
2367 SETUP();
2368
2369 COMPARE(fcmp(s0, s1), "fcmp s0, s1");
2370 COMPARE(fcmp(s31, s30), "fcmp s31, s30");
2371 COMPARE(fcmp(d0, d1), "fcmp d0, d1");
2372 COMPARE(fcmp(d31, d30), "fcmp d31, d30");
2373 COMPARE(fcmp(s12, 0), "fcmp s12, #0.0");
2374 COMPARE(fcmp(d12, 0), "fcmp d12, #0.0");
2375
armvixl6e2c8272015-03-31 11:04:14 +01002376 COMPARE(fcmpe(s0, s1), "fcmpe s0, s1");
2377 COMPARE(fcmpe(s31, s30), "fcmpe s31, s30");
2378 COMPARE(fcmpe(d0, d1), "fcmpe d0, d1");
2379 COMPARE(fcmpe(d31, d30), "fcmpe d31, d30");
2380 COMPARE(fcmpe(s12, 0), "fcmpe s12, #0.0");
2381 COMPARE(fcmpe(d12, 0), "fcmpe d12, #0.0");
2382
armvixlad96eda2013-06-14 11:42:37 +01002383 CLEANUP();
2384}
2385
2386
2387TEST(fp_cond_compare) {
2388 SETUP();
2389
2390 COMPARE(fccmp(s0, s1, NoFlag, eq), "fccmp s0, s1, #nzcv, eq");
2391 COMPARE(fccmp(s2, s3, ZVFlag, ne), "fccmp s2, s3, #nZcV, ne");
2392 COMPARE(fccmp(s30, s16, NCFlag, pl), "fccmp s30, s16, #NzCv, pl");
2393 COMPARE(fccmp(s31, s31, NZCVFlag, le), "fccmp s31, s31, #NZCV, le");
2394 COMPARE(fccmp(d4, d5, VFlag, gt), "fccmp d4, d5, #nzcV, gt");
2395 COMPARE(fccmp(d6, d7, NFlag, vs), "fccmp d6, d7, #Nzcv, vs");
2396 COMPARE(fccmp(d30, d0, NZFlag, vc), "fccmp d30, d0, #NZcv, vc");
2397 COMPARE(fccmp(d31, d31, ZFlag, hs), "fccmp d31, d31, #nZcv, hs");
armvixl578645f2013-08-15 17:21:42 +01002398 COMPARE(fccmp(s14, s15, CVFlag, al), "fccmp s14, s15, #nzCV, al");
2399 COMPARE(fccmp(d16, d17, CFlag, nv), "fccmp d16, d17, #nzCv, nv");
armvixlad96eda2013-06-14 11:42:37 +01002400
armvixl6e2c8272015-03-31 11:04:14 +01002401 COMPARE(fccmpe(s0, s1, NoFlag, eq), "fccmpe s0, s1, #nzcv, eq");
2402 COMPARE(fccmpe(s2, s3, ZVFlag, ne), "fccmpe s2, s3, #nZcV, ne");
2403 COMPARE(fccmpe(s30, s16, NCFlag, pl), "fccmpe s30, s16, #NzCv, pl");
2404 COMPARE(fccmpe(s31, s31, NZCVFlag, le), "fccmpe s31, s31, #NZCV, le");
2405 COMPARE(fccmpe(d4, d5, VFlag, gt), "fccmpe d4, d5, #nzcV, gt");
2406 COMPARE(fccmpe(d6, d7, NFlag, vs), "fccmpe d6, d7, #Nzcv, vs");
2407 COMPARE(fccmpe(d30, d0, NZFlag, vc), "fccmpe d30, d0, #NZcv, vc");
2408 COMPARE(fccmpe(d31, d31, ZFlag, hs), "fccmpe d31, d31, #nZcv, hs");
2409 COMPARE(fccmpe(s14, s15, CVFlag, al), "fccmpe s14, s15, #nzCV, al");
2410 COMPARE(fccmpe(d16, d17, CFlag, nv), "fccmpe d16, d17, #nzCv, nv");
2411
armvixlad96eda2013-06-14 11:42:37 +01002412 CLEANUP();
2413}
2414
2415
2416TEST(fp_select) {
2417 SETUP();
2418
2419 COMPARE(fcsel(s0, s1, s2, eq), "fcsel s0, s1, s2, eq")
2420 COMPARE(fcsel(s31, s31, s30, ne), "fcsel s31, s31, s30, ne");
2421 COMPARE(fcsel(d0, d1, d2, mi), "fcsel d0, d1, d2, mi");
2422 COMPARE(fcsel(d31, d30, d31, pl), "fcsel d31, d30, d31, pl");
armvixl578645f2013-08-15 17:21:42 +01002423 COMPARE(fcsel(s14, s15, s16, al), "fcsel s14, s15, s16, al");
2424 COMPARE(fcsel(d17, d18, d19, nv), "fcsel d17, d18, d19, nv");
armvixlad96eda2013-06-14 11:42:37 +01002425
2426 CLEANUP();
2427}
2428
2429
2430TEST(fcvt_scvtf_ucvtf) {
2431 SETUP();
2432
armvixlf37fdc02014-02-05 13:22:16 +00002433 COMPARE(fcvtas(w0, s1), "fcvtas w0, s1");
2434 COMPARE(fcvtas(x2, s3), "fcvtas x2, s3");
2435 COMPARE(fcvtas(w4, d5), "fcvtas w4, d5");
2436 COMPARE(fcvtas(x6, d7), "fcvtas x6, d7");
2437 COMPARE(fcvtau(w8, s9), "fcvtau w8, s9");
2438 COMPARE(fcvtau(x10, s11), "fcvtau x10, s11");
2439 COMPARE(fcvtau(w12, d13), "fcvtau w12, d13");
2440 COMPARE(fcvtau(x14, d15), "fcvtau x14, d15");
armvixlad96eda2013-06-14 11:42:37 +01002441 COMPARE(fcvtns(w0, s1), "fcvtns w0, s1");
2442 COMPARE(fcvtns(x2, s3), "fcvtns x2, s3");
2443 COMPARE(fcvtns(w4, d5), "fcvtns w4, d5");
2444 COMPARE(fcvtns(x6, d7), "fcvtns x6, d7");
2445 COMPARE(fcvtnu(w8, s9), "fcvtnu w8, s9");
2446 COMPARE(fcvtnu(x10, s11), "fcvtnu x10, s11");
2447 COMPARE(fcvtnu(w12, d13), "fcvtnu w12, d13");
2448 COMPARE(fcvtnu(x14, d15), "fcvtnu x14, d15");
2449 COMPARE(fcvtzu(x16, d17), "fcvtzu x16, d17");
2450 COMPARE(fcvtzu(w18, d19), "fcvtzu w18, d19");
2451 COMPARE(fcvtzs(x20, d21), "fcvtzs x20, d21");
2452 COMPARE(fcvtzs(w22, d23), "fcvtzs w22, d23");
2453 COMPARE(fcvtzu(x16, s17), "fcvtzu x16, s17");
2454 COMPARE(fcvtzu(w18, s19), "fcvtzu w18, s19");
2455 COMPARE(fcvtzs(x20, s21), "fcvtzs x20, s21");
2456 COMPARE(fcvtzs(w22, s23), "fcvtzs w22, s23");
armvixl5289c592015-03-02 13:52:04 +00002457 COMPARE(fcvtzs(w2, d1, 1), "fcvtzs w2, d1, #1");
2458 COMPARE(fcvtzs(w2, s1, 1), "fcvtzs w2, s1, #1");
2459 COMPARE(fcvtzs(x4, d3, 15), "fcvtzs x4, d3, #15");
2460 COMPARE(fcvtzs(x4, s3, 15), "fcvtzs x4, s3, #15");
2461 COMPARE(fcvtzs(w6, d5, 32), "fcvtzs w6, d5, #32");
2462 COMPARE(fcvtzs(w6, s5, 32), "fcvtzs w6, s5, #32");
2463 COMPARE(fcvtzu(w2, d1, 1), "fcvtzu w2, d1, #1");
2464 COMPARE(fcvtzu(w2, s1, 1), "fcvtzu w2, s1, #1");
2465 COMPARE(fcvtzu(x4, d3, 15), "fcvtzu x4, d3, #15");
2466 COMPARE(fcvtzu(x4, s3, 15), "fcvtzu x4, s3, #15");
2467 COMPARE(fcvtzu(w6, d5, 32), "fcvtzu w6, d5, #32");
2468 COMPARE(fcvtzu(w6, s5, 32), "fcvtzu w6, s5, #32");
2469 COMPARE(fcvtpu(x24, d25), "fcvtpu x24, d25");
2470 COMPARE(fcvtpu(w26, d27), "fcvtpu w26, d27");
2471 COMPARE(fcvtps(x28, d29), "fcvtps x28, d29");
2472 COMPARE(fcvtps(w30, d31), "fcvtps w30, d31");
2473 COMPARE(fcvtpu(x0, s1), "fcvtpu x0, s1");
2474 COMPARE(fcvtpu(w2, s3), "fcvtpu w2, s3");
2475 COMPARE(fcvtps(x4, s5), "fcvtps x4, s5");
2476 COMPARE(fcvtps(w6, s7), "fcvtps w6, s7");
armvixlad96eda2013-06-14 11:42:37 +01002477 COMPARE(scvtf(d24, w25), "scvtf d24, w25");
armvixl578645f2013-08-15 17:21:42 +01002478 COMPARE(scvtf(s24, w25), "scvtf s24, w25");
2479 COMPARE(scvtf(d26, x0), "scvtf d26, x0");
2480 COMPARE(scvtf(s26, x0), "scvtf s26, x0");
armvixlad96eda2013-06-14 11:42:37 +01002481 COMPARE(ucvtf(d28, w29), "ucvtf d28, w29");
armvixl578645f2013-08-15 17:21:42 +01002482 COMPARE(ucvtf(s28, w29), "ucvtf s28, w29");
armvixlad96eda2013-06-14 11:42:37 +01002483 COMPARE(ucvtf(d0, x1), "ucvtf d0, x1");
armvixl578645f2013-08-15 17:21:42 +01002484 COMPARE(ucvtf(s0, x1), "ucvtf s0, x1");
2485 COMPARE(ucvtf(d0, x1, 0), "ucvtf d0, x1");
2486 COMPARE(ucvtf(s0, x1, 0), "ucvtf s0, x1");
armvixlad96eda2013-06-14 11:42:37 +01002487 COMPARE(scvtf(d1, x2, 1), "scvtf d1, x2, #1");
armvixl578645f2013-08-15 17:21:42 +01002488 COMPARE(scvtf(s1, x2, 1), "scvtf s1, x2, #1");
armvixlad96eda2013-06-14 11:42:37 +01002489 COMPARE(scvtf(d3, x4, 15), "scvtf d3, x4, #15");
armvixl578645f2013-08-15 17:21:42 +01002490 COMPARE(scvtf(s3, x4, 15), "scvtf s3, x4, #15");
armvixlad96eda2013-06-14 11:42:37 +01002491 COMPARE(scvtf(d5, x6, 32), "scvtf d5, x6, #32");
armvixl578645f2013-08-15 17:21:42 +01002492 COMPARE(scvtf(s5, x6, 32), "scvtf s5, x6, #32");
armvixlad96eda2013-06-14 11:42:37 +01002493 COMPARE(ucvtf(d7, x8, 2), "ucvtf d7, x8, #2");
armvixl578645f2013-08-15 17:21:42 +01002494 COMPARE(ucvtf(s7, x8, 2), "ucvtf s7, x8, #2");
armvixlad96eda2013-06-14 11:42:37 +01002495 COMPARE(ucvtf(d9, x10, 16), "ucvtf d9, x10, #16");
armvixl578645f2013-08-15 17:21:42 +01002496 COMPARE(ucvtf(s9, x10, 16), "ucvtf s9, x10, #16");
armvixlad96eda2013-06-14 11:42:37 +01002497 COMPARE(ucvtf(d11, x12, 33), "ucvtf d11, x12, #33");
armvixl578645f2013-08-15 17:21:42 +01002498 COMPARE(ucvtf(s11, x12, 33), "ucvtf s11, x12, #33");
armvixlad96eda2013-06-14 11:42:37 +01002499 COMPARE(fcvtms(w0, s1), "fcvtms w0, s1");
2500 COMPARE(fcvtms(x2, s3), "fcvtms x2, s3");
2501 COMPARE(fcvtms(w4, d5), "fcvtms w4, d5");
2502 COMPARE(fcvtms(x6, d7), "fcvtms x6, d7");
2503 COMPARE(fcvtmu(w8, s9), "fcvtmu w8, s9");
2504 COMPARE(fcvtmu(x10, s11), "fcvtmu x10, s11");
2505 COMPARE(fcvtmu(w12, d13), "fcvtmu w12, d13");
2506 COMPARE(fcvtmu(x14, d15), "fcvtmu x14, d15");
2507
2508 CLEANUP();
2509}
2510
2511
armvixl4a102ba2014-07-14 09:02:40 +01002512TEST(system_clrex) {
2513 SETUP();
2514
2515 COMPARE(clrex(0), "clrex #0x0");
2516 COMPARE(clrex(14), "clrex #0xe");
2517 COMPARE(clrex(15), "clrex");
2518 COMPARE(clrex(), "clrex");
2519
2520 CLEANUP();
2521}
2522
2523
armvixlad96eda2013-06-14 11:42:37 +01002524TEST(system_mrs) {
2525 SETUP();
2526
2527 COMPARE(mrs(x0, NZCV), "mrs x0, nzcv");
2528 COMPARE(mrs(x30, NZCV), "mrs x30, nzcv");
armvixl578645f2013-08-15 17:21:42 +01002529 COMPARE(mrs(x15, FPCR), "mrs x15, fpcr");
armvixlad96eda2013-06-14 11:42:37 +01002530
2531 CLEANUP();
2532}
2533
2534
2535TEST(system_msr) {
2536 SETUP();
2537
2538 COMPARE(msr(NZCV, x0), "msr nzcv, x0");
2539 COMPARE(msr(NZCV, x30), "msr nzcv, x30");
armvixl578645f2013-08-15 17:21:42 +01002540 COMPARE(msr(FPCR, x15), "msr fpcr, x15");
armvixlad96eda2013-06-14 11:42:37 +01002541
2542 CLEANUP();
2543}
2544
2545
armvixl5289c592015-03-02 13:52:04 +00002546TEST(system_sys) {
2547 SETUP();
2548
2549 COMPARE(sys(0x3, 0x7, 0x5, 0x1, x1), "ic ivau, x1");
2550 COMPARE(sys(0x3, 0x7, 0xa, 0x1, x2), "dc cvac, x2");
2551 COMPARE(sys(0x3, 0x7, 0xb, 0x1, x3), "dc cvau, x3");
2552 COMPARE(sys(0x3, 0x7, 0xe, 0x1, x4), "dc civac, x4");
2553 COMPARE(sys(0x3, 0x7, 0x4, 0x1, x0), "dc zva, x0");
2554 COMPARE(sys(0x0, 0x0, 0x0, 0x0, x0), "sys #0, C0, C0, #0, x0");
2555 COMPARE(sys(0x1, 0x2, 0x5, 0x2, x5), "sys #1, C2, C5, #2, x5");
2556 COMPARE(sys(0x2, 0x8, 0xa, 0x3, x6), "sys #2, C8, C10, #3, x6");
2557 COMPARE(sys(0x2, 0xf, 0xf, 0x1, xzr), "sys #2, C15, C15, #1");
2558 COMPARE(sys(0x2, 0xf, 0xf, 0x1), "sys #2, C15, C15, #1");
2559
2560 CLEANUP();
2561}
2562
2563
2564TEST(system_ic) {
2565 SETUP();
2566
2567 COMPARE(ic(IVAU, x0), "ic ivau, x0");
2568 COMPARE(ic(IVAU, x1), "ic ivau, x1");
2569 COMPARE(ic(IVAU, xzr), "ic ivau, xzr");
2570
2571 CLEANUP();
2572}
2573
2574
2575TEST(system_dc) {
2576 SETUP();
2577
2578 COMPARE(dc(CVAC, x2), "dc cvac, x2");
2579 COMPARE(dc(CVAU, x3), "dc cvau, x3");
2580 COMPARE(dc(CIVAC, x4), "dc civac, x4");
2581 COMPARE(dc(ZVA, x0), "dc zva, x0");
2582 COMPARE(dc(ZVA, xzr), "dc zva, xzr");
2583
2584 CLEANUP();
2585}
2586
2587
armvixlad96eda2013-06-14 11:42:37 +01002588TEST(system_nop) {
2589 SETUP();
2590
2591 COMPARE(nop(), "nop");
2592
2593 CLEANUP();
2594}
2595
2596
2597TEST(unreachable) {
armvixl684cd2a2015-10-23 13:38:33 +01002598 SETUP_MACRO();
armvixlad96eda2013-06-14 11:42:37 +01002599
armvixl684cd2a2015-10-23 13:38:33 +01002600#ifdef VIXL_INCLUDE_SIMULATOR
armvixlb0c8ae22014-03-21 14:03:59 +00002601 VIXL_ASSERT(kUnreachableOpcode == 0xdeb0);
armvixlad96eda2013-06-14 11:42:37 +01002602 COMPARE(Unreachable(), "hlt #0xdeb0");
2603#else
2604 COMPARE(Unreachable(), "blr xzr");
2605#endif
2606
2607 CLEANUP();
2608}
2609
2610
armvixl684cd2a2015-10-23 13:38:33 +01002611#ifdef VIXL_INCLUDE_SIMULATOR
armvixlad96eda2013-06-14 11:42:37 +01002612TEST(trace) {
armvixl684cd2a2015-10-23 13:38:33 +01002613 SETUP_MACRO();
armvixlad96eda2013-06-14 11:42:37 +01002614
armvixlb0c8ae22014-03-21 14:03:59 +00002615 VIXL_ASSERT(kTraceOpcode == 0xdeb2);
armvixlad96eda2013-06-14 11:42:37 +01002616
2617 // All Trace calls should produce the same instruction.
armvixlc68cb642014-09-25 18:49:30 +01002618 COMPARE_MACRO(Trace(LOG_ALL, TRACE_ENABLE), "hlt #0xdeb2");
2619 COMPARE_MACRO(Trace(LOG_REGS, TRACE_DISABLE), "hlt #0xdeb2");
armvixlad96eda2013-06-14 11:42:37 +01002620
2621 CLEANUP();
2622}
2623#endif
2624
2625
armvixl684cd2a2015-10-23 13:38:33 +01002626#ifdef VIXL_INCLUDE_SIMULATOR
armvixlad96eda2013-06-14 11:42:37 +01002627TEST(log) {
armvixl684cd2a2015-10-23 13:38:33 +01002628 SETUP_MACRO();
armvixlad96eda2013-06-14 11:42:37 +01002629
armvixlb0c8ae22014-03-21 14:03:59 +00002630 VIXL_ASSERT(kLogOpcode == 0xdeb3);
armvixlad96eda2013-06-14 11:42:37 +01002631
2632 // All Log calls should produce the same instruction.
armvixlc68cb642014-09-25 18:49:30 +01002633 COMPARE_MACRO(Log(LOG_ALL), "hlt #0xdeb3");
armvixl5289c592015-03-02 13:52:04 +00002634 COMPARE_MACRO(Log(LOG_SYSREGS), "hlt #0xdeb3");
armvixlad96eda2013-06-14 11:42:37 +01002635
2636 CLEANUP();
2637}
2638#endif
2639
2640
2641TEST(hlt) {
2642 SETUP();
2643
2644 COMPARE(hlt(0), "hlt #0x0");
2645 COMPARE(hlt(1), "hlt #0x1");
2646 COMPARE(hlt(65535), "hlt #0xffff");
2647
2648 CLEANUP();
2649}
2650
2651
2652TEST(brk) {
2653 SETUP();
2654
2655 COMPARE(brk(0), "brk #0x0");
2656 COMPARE(brk(1), "brk #0x1");
2657 COMPARE(brk(65535), "brk #0xffff");
2658
2659 CLEANUP();
2660}
2661
2662
armvixl5289c592015-03-02 13:52:04 +00002663TEST(svc) {
2664 SETUP();
2665
2666 COMPARE(svc(0), "svc #0x0");
2667 COMPARE(svc(1), "svc #0x1");
2668 COMPARE(svc(65535), "svc #0xffff");
2669
2670 CLEANUP();
2671}
2672
2673
armvixlad96eda2013-06-14 11:42:37 +01002674TEST(add_sub_negative) {
armvixl684cd2a2015-10-23 13:38:33 +01002675 SETUP_MACRO();
armvixlad96eda2013-06-14 11:42:37 +01002676
2677 COMPARE(Add(x10, x0, -42), "sub x10, x0, #0x2a (42)");
2678 COMPARE(Add(x11, x1, -687), "sub x11, x1, #0x2af (687)");
2679 COMPARE(Add(x12, x2, -0x88), "sub x12, x2, #0x88 (136)");
2680
2681 COMPARE(Sub(x13, x0, -600), "add x13, x0, #0x258 (600)");
2682 COMPARE(Sub(x14, x1, -313), "add x14, x1, #0x139 (313)");
2683 COMPARE(Sub(x15, x2, -0x555), "add x15, x2, #0x555 (1365)");
2684
2685 COMPARE(Add(w19, w3, -0x344), "sub w19, w3, #0x344 (836)");
2686 COMPARE(Add(w20, w4, -2000), "sub w20, w4, #0x7d0 (2000)");
2687
armvixl6e2c8272015-03-31 11:04:14 +01002688 COMPARE(Add(w0, w1, 5, LeaveFlags), "add w0, w1, #0x5 (5)");
2689 COMPARE(Add(w1, w2, 15, SetFlags), "adds w1, w2, #0xf (15)");
2690
2691 COMPARE(Sub(w0, w1, 5, LeaveFlags), "sub w0, w1, #0x5 (5)");
2692 COMPARE(Sub(w1, w2, 15, SetFlags), "subs w1, w2, #0xf (15)");
2693
armvixlad96eda2013-06-14 11:42:37 +01002694 COMPARE(Sub(w21, w3, -0xbc), "add w21, w3, #0xbc (188)");
2695 COMPARE(Sub(w22, w4, -2000), "add w22, w4, #0x7d0 (2000)");
2696
armvixlf37fdc02014-02-05 13:22:16 +00002697 COMPARE(Cmp(w0, -1), "cmn w0, #0x1 (1)");
2698 COMPARE(Cmp(x1, -1), "cmn x1, #0x1 (1)");
2699 COMPARE(Cmp(w2, -4095), "cmn w2, #0xfff (4095)");
2700 COMPARE(Cmp(x3, -4095), "cmn x3, #0xfff (4095)");
2701
2702 COMPARE(Cmn(w0, -1), "cmp w0, #0x1 (1)");
2703 COMPARE(Cmn(x1, -1), "cmp x1, #0x1 (1)");
2704 COMPARE(Cmn(w2, -4095), "cmp w2, #0xfff (4095)");
2705 COMPARE(Cmn(x3, -4095), "cmp x3, #0xfff (4095)");
2706
armvixlad96eda2013-06-14 11:42:37 +01002707 CLEANUP();
2708}
2709
2710
2711TEST(logical_immediate_move) {
armvixl684cd2a2015-10-23 13:38:33 +01002712 SETUP_MACRO();
armvixlad96eda2013-06-14 11:42:37 +01002713
armvixl330dc712014-11-25 10:38:32 +00002714 COMPARE(And(w0, w1, 0), "mov w0, #0x0");
2715 COMPARE(And(x0, x1, 0), "mov x0, #0x0");
armvixlad96eda2013-06-14 11:42:37 +01002716 COMPARE(Orr(w2, w3, 0), "mov w2, w3");
2717 COMPARE(Orr(x2, x3, 0), "mov x2, x3");
2718 COMPARE(Eor(w4, w5, 0), "mov w4, w5");
2719 COMPARE(Eor(x4, x5, 0), "mov x4, x5");
2720 COMPARE(Bic(w6, w7, 0), "mov w6, w7");
2721 COMPARE(Bic(x6, x7, 0), "mov x6, x7");
armvixl330dc712014-11-25 10:38:32 +00002722 COMPARE(Orn(w8, w9, 0), "mov w8, #0xffffffff");
2723 COMPARE(Orn(x8, x9, 0), "mov x8, #0xffffffffffffffff");
armvixlad96eda2013-06-14 11:42:37 +01002724 COMPARE(Eon(w10, w11, 0), "mvn w10, w11");
2725 COMPARE(Eon(x10, x11, 0), "mvn x10, x11");
2726
2727 COMPARE(And(w12, w13, 0xffffffff), "mov w12, w13");
2728 COMPARE(And(x12, x13, 0xffffffff), "and x12, x13, #0xffffffff");
2729 COMPARE(And(x12, x13, 0xffffffffffffffff), "mov x12, x13");
armvixl330dc712014-11-25 10:38:32 +00002730 COMPARE(Orr(w14, w15, 0xffffffff), "mov w14, #0xffffffff");
armvixlad96eda2013-06-14 11:42:37 +01002731 COMPARE(Orr(x14, x15, 0xffffffff), "orr x14, x15, #0xffffffff");
armvixl330dc712014-11-25 10:38:32 +00002732 COMPARE(Orr(x14, x15, 0xffffffffffffffff), "mov x14, #0xffffffffffffffff");
armvixlad96eda2013-06-14 11:42:37 +01002733 COMPARE(Eor(w16, w17, 0xffffffff), "mvn w16, w17");
2734 COMPARE(Eor(x16, x17, 0xffffffff), "eor x16, x17, #0xffffffff");
2735 COMPARE(Eor(x16, x17, 0xffffffffffffffff), "mvn x16, x17");
armvixl330dc712014-11-25 10:38:32 +00002736 COMPARE(Bic(w18, w19, 0xffffffff), "mov w18, #0x0");
armvixlad96eda2013-06-14 11:42:37 +01002737 COMPARE(Bic(x18, x19, 0xffffffff), "and x18, x19, #0xffffffff00000000");
armvixl330dc712014-11-25 10:38:32 +00002738 COMPARE(Bic(x18, x19, 0xffffffffffffffff), "mov x18, #0x0");
armvixlad96eda2013-06-14 11:42:37 +01002739 COMPARE(Orn(w20, w21, 0xffffffff), "mov w20, w21");
2740 COMPARE(Orn(x20, x21, 0xffffffff), "orr x20, x21, #0xffffffff00000000");
2741 COMPARE(Orn(x20, x21, 0xffffffffffffffff), "mov x20, x21");
2742 COMPARE(Eon(w22, w23, 0xffffffff), "mov w22, w23");
2743 COMPARE(Eon(x22, x23, 0xffffffff), "eor x22, x23, #0xffffffff00000000");
2744 COMPARE(Eon(x22, x23, 0xffffffffffffffff), "mov x22, x23");
2745
2746 CLEANUP();
2747}
armvixlf37fdc02014-02-05 13:22:16 +00002748
armvixl4a102ba2014-07-14 09:02:40 +01002749
armvixlf37fdc02014-02-05 13:22:16 +00002750TEST(barriers) {
armvixl684cd2a2015-10-23 13:38:33 +01002751 SETUP_MACRO();
armvixlf37fdc02014-02-05 13:22:16 +00002752
2753 // DMB
2754 COMPARE(Dmb(FullSystem, BarrierAll), "dmb sy");
2755 COMPARE(Dmb(FullSystem, BarrierReads), "dmb ld");
2756 COMPARE(Dmb(FullSystem, BarrierWrites), "dmb st");
2757
2758 COMPARE(Dmb(InnerShareable, BarrierAll), "dmb ish");
2759 COMPARE(Dmb(InnerShareable, BarrierReads), "dmb ishld");
2760 COMPARE(Dmb(InnerShareable, BarrierWrites), "dmb ishst");
2761
2762 COMPARE(Dmb(NonShareable, BarrierAll), "dmb nsh");
2763 COMPARE(Dmb(NonShareable, BarrierReads), "dmb nshld");
2764 COMPARE(Dmb(NonShareable, BarrierWrites), "dmb nshst");
2765
2766 COMPARE(Dmb(OuterShareable, BarrierAll), "dmb osh");
2767 COMPARE(Dmb(OuterShareable, BarrierReads), "dmb oshld");
2768 COMPARE(Dmb(OuterShareable, BarrierWrites), "dmb oshst");
2769
2770 COMPARE(Dmb(FullSystem, BarrierOther), "dmb sy (0b1100)");
2771 COMPARE(Dmb(InnerShareable, BarrierOther), "dmb sy (0b1000)");
2772 COMPARE(Dmb(NonShareable, BarrierOther), "dmb sy (0b0100)");
2773 COMPARE(Dmb(OuterShareable, BarrierOther), "dmb sy (0b0000)");
2774
2775 // DSB
2776 COMPARE(Dsb(FullSystem, BarrierAll), "dsb sy");
2777 COMPARE(Dsb(FullSystem, BarrierReads), "dsb ld");
2778 COMPARE(Dsb(FullSystem, BarrierWrites), "dsb st");
2779
2780 COMPARE(Dsb(InnerShareable, BarrierAll), "dsb ish");
2781 COMPARE(Dsb(InnerShareable, BarrierReads), "dsb ishld");
2782 COMPARE(Dsb(InnerShareable, BarrierWrites), "dsb ishst");
2783
2784 COMPARE(Dsb(NonShareable, BarrierAll), "dsb nsh");
2785 COMPARE(Dsb(NonShareable, BarrierReads), "dsb nshld");
2786 COMPARE(Dsb(NonShareable, BarrierWrites), "dsb nshst");
2787
2788 COMPARE(Dsb(OuterShareable, BarrierAll), "dsb osh");
2789 COMPARE(Dsb(OuterShareable, BarrierReads), "dsb oshld");
2790 COMPARE(Dsb(OuterShareable, BarrierWrites), "dsb oshst");
2791
2792 COMPARE(Dsb(FullSystem, BarrierOther), "dsb sy (0b1100)");
2793 COMPARE(Dsb(InnerShareable, BarrierOther), "dsb sy (0b1000)");
2794 COMPARE(Dsb(NonShareable, BarrierOther), "dsb sy (0b0100)");
2795 COMPARE(Dsb(OuterShareable, BarrierOther), "dsb sy (0b0000)");
2796
2797 // ISB
2798 COMPARE(Isb(), "isb");
2799
2800 CLEANUP();
2801}
armvixl330dc712014-11-25 10:38:32 +00002802
2803
armvixl5289c592015-03-02 13:52:04 +00002804#define VLIST2(v) v, VRegister((v.code()+1)%32, v.size(), v.lanes())
2805#define VLIST3(v) VLIST2(v), VRegister((v.code()+2)%32, v.size(), v.lanes())
2806#define VLIST4(v) VLIST3(v), VRegister((v.code()+3)%32, v.size(), v.lanes())
2807
2808
2809#define NEON_FORMAT_LIST(V) \
2810 V(V8B(), "8b") \
2811 V(V16B(), "16b") \
2812 V(V4H(), "4h") \
2813 V(V8H(), "8h") \
2814 V(V2S(), "2s") \
2815 V(V4S(), "4s") \
2816 V(V2D(), "2d")
2817
2818#define NEON_FORMAT_LIST_LP(V) \
2819 V(V4H(), "4h", V8B(), "8b") \
2820 V(V2S(), "2s", V4H(), "4h") \
2821 V(V1D(), "1d", V2S(), "2s") \
2822 V(V8H(), "8h", V16B(), "16b") \
2823 V(V4S(), "4s", V8H(), "8h") \
2824 V(V2D(), "2d", V4S(), "4s")
2825
2826#define NEON_FORMAT_LIST_LW(V) \
2827 V(V8H(), "8h", V8B(), "8b") \
2828 V(V4S(), "4s", V4H(), "4h") \
2829 V(V2D(), "2d", V2S(), "2s")
2830
2831#define NEON_FORMAT_LIST_LW2(V) \
2832 V(V8H(), "8h", V16B(), "16b") \
2833 V(V4S(), "4s", V8H(), "8h") \
2834 V(V2D(), "2d", V4S(), "4s")
2835
2836#define NEON_FORMAT_LIST_BHS(V) \
2837 V(V8B(), "8b") \
2838 V(V16B(), "16b") \
2839 V(V4H(), "4h") \
2840 V(V8H(), "8h") \
2841 V(V2S(), "2s") \
2842 V(V4S(), "4s")
2843
2844#define NEON_FORMAT_LIST_HS(V) \
2845 V(V4H(), "4h") \
2846 V(V8H(), "8h") \
2847 V(V2S(), "2s") \
2848 V(V4S(), "4s")
2849
2850TEST(neon_load_store_vector) {
armvixl684cd2a2015-10-23 13:38:33 +01002851 SETUP_MACRO();
armvixl5289c592015-03-02 13:52:04 +00002852
2853 #define DISASM_INST(M, S) \
2854 COMPARE(Ld1(v0.M, MemOperand(x15)), \
2855 "ld1 {v0." S "}, [x15]"); \
2856 COMPARE(Ld1(v1.M, v2.M, MemOperand(x16)), \
2857 "ld1 {v1." S ", v2." S "}, [x16]"); \
2858 COMPARE(Ld1(v3.M, v4.M, v5.M, MemOperand(x17)), \
2859 "ld1 {v3." S ", v4." S ", v5." S "}, [x17]"); \
2860 COMPARE(Ld1(v6.M, v7.M, v8.M, v9.M, MemOperand(x18)), \
2861 "ld1 {v6." S ", v7." S ", v8." S ", v9." S "}, [x18]") \
2862 COMPARE(Ld1(v30.M, v31.M, v0.M, v1.M, MemOperand(sp)), \
2863 "ld1 {v30." S ", v31." S ", v0." S ", v1." S "}, [sp]") \
2864 COMPARE(Ld2(v1.M, v2.M, MemOperand(x16)), \
2865 "ld2 {v1." S ", v2." S "}, [x16]"); \
2866 COMPARE(Ld3(v3.M, v4.M, v5.M, MemOperand(x17)), \
2867 "ld3 {v3." S ", v4." S ", v5." S "}, [x17]"); \
2868 COMPARE(Ld4(v6.M, v7.M, v8.M, v9.M, MemOperand(x18)), \
2869 "ld4 {v6." S ", v7." S ", v8." S ", v9." S "}, [x18]") \
2870 COMPARE(Ld4(v30.M, v31.M, v0.M, v1.M, MemOperand(sp)), \
2871 "ld4 {v30." S ", v31." S ", v0." S ", v1." S "}, [sp]") \
2872 NEON_FORMAT_LIST(DISASM_INST);
2873 #undef DISASM_INST
2874
2875 #define DISASM_INST(M, S) \
2876 COMPARE(Ld1(v0.M, MemOperand(x15, x20, PostIndex)), \
2877 "ld1 {v0." S "}, [x15], x20"); \
2878 COMPARE(Ld1(v1.M, v2.M, MemOperand(x16, x21, PostIndex)), \
2879 "ld1 {v1." S ", v2." S "}, [x16], x21"); \
2880 COMPARE(Ld1(v3.M, v4.M, v5.M, MemOperand(x17, x22, PostIndex)), \
2881 "ld1 {v3." S ", v4." S ", v5." S "}, [x17], x22"); \
2882 COMPARE(Ld1(v6.M, v7.M, v8.M, v9.M, MemOperand(x18, x23, PostIndex)), \
2883 "ld1 {v6." S ", v7." S ", v8." S ", v9." S "}, [x18], x23") \
2884 COMPARE(Ld1(v30.M, v31.M, v0.M, v1.M, MemOperand(sp, x24, PostIndex)), \
2885 "ld1 {v30." S ", v31." S ", v0." S ", v1." S "}, [sp], x24") \
2886 COMPARE(Ld2(v1.M, v2.M, MemOperand(x16, x21, PostIndex)), \
2887 "ld2 {v1." S ", v2." S "}, [x16], x21"); \
2888 COMPARE(Ld3(v3.M, v4.M, v5.M, MemOperand(x17, x22, PostIndex)), \
2889 "ld3 {v3." S ", v4." S ", v5." S "}, [x17], x22"); \
2890 COMPARE(Ld4(v6.M, v7.M, v8.M, v9.M, MemOperand(x18, x23, PostIndex)), \
2891 "ld4 {v6." S ", v7." S ", v8." S ", v9." S "}, [x18], x23") \
2892 COMPARE(Ld4(v30.M, v31.M, v0.M, v1.M, MemOperand(sp, x24, PostIndex)), \
2893 "ld4 {v30." S ", v31." S ", v0." S ", v1." S "}, [sp], x24") \
2894 NEON_FORMAT_LIST(DISASM_INST);
2895 #undef DISASM_INST
2896
2897 COMPARE(Ld1(v0.V8B(), MemOperand(x15, 8, PostIndex)),
2898 "ld1 {v0.8b}, [x15], #8");
2899 COMPARE(Ld1(v1.V16B(), MemOperand(x16, 16, PostIndex)),
2900 "ld1 {v1.16b}, [x16], #16");
2901 COMPARE(Ld1(v2.V4H(), v3.V4H(), MemOperand(x17, 16, PostIndex)),
2902 "ld1 {v2.4h, v3.4h}, [x17], #16");
2903 COMPARE(Ld1(v4.V8H(), v5.V8H(), MemOperand(x18, 32, PostIndex)),
2904 "ld1 {v4.8h, v5.8h}, [x18], #32");
2905 COMPARE(Ld1(v16.V2S(), v17.V2S(), v18.V2S(), MemOperand(x19, 24, PostIndex)),
2906 "ld1 {v16.2s, v17.2s, v18.2s}, [x19], #24");
2907 COMPARE(Ld1(v16.V4S(), v17.V4S(), v18.V4S(), MemOperand(x19, 48, PostIndex)),
2908 "ld1 {v16.4s, v17.4s, v18.4s}, [x19], #48");
2909 COMPARE(Ld1(v19.V2S(), v20.V2S(), v21.V2S(), v22.V2S(),
2910 MemOperand(x20, 32, PostIndex)),
2911 "ld1 {v19.2s, v20.2s, v21.2s, v22.2s}, [x20], #32");
2912 COMPARE(Ld1(v23.V2D(), v24.V2D(), v25.V2D(), v26.V2D(),
2913 MemOperand(x21, 64, PostIndex)),
2914 "ld1 {v23.2d, v24.2d, v25.2d, v26.2d}, [x21], #64");
2915
2916 COMPARE(Ld2(v2.V4H(), v3.V4H(), MemOperand(x17, 16, PostIndex)),
2917 "ld2 {v2.4h, v3.4h}, [x17], #16");
2918 COMPARE(Ld2(v4.V8H(), v5.V8H(), MemOperand(x18, 32, PostIndex)),
2919 "ld2 {v4.8h, v5.8h}, [x18], #32");
2920 COMPARE(Ld3(v16.V2S(), v17.V2S(), v18.V2S(), MemOperand(x19, 24, PostIndex)),
2921 "ld3 {v16.2s, v17.2s, v18.2s}, [x19], #24");
2922 COMPARE(Ld3(v16.V4S(), v17.V4S(), v18.V4S(), MemOperand(x19, 48, PostIndex)),
2923 "ld3 {v16.4s, v17.4s, v18.4s}, [x19], #48");
2924 COMPARE(Ld4(v19.V2S(), v20.V2S(), v21.V2S(), v22.V2S(),
2925 MemOperand(x20, 32, PostIndex)),
2926 "ld4 {v19.2s, v20.2s, v21.2s, v22.2s}, [x20], #32");
2927 COMPARE(Ld4(v23.V2D(), v24.V2D(), v25.V2D(), v26.V2D(),
2928 MemOperand(x21, 64, PostIndex)),
2929 "ld4 {v23.2d, v24.2d, v25.2d, v26.2d}, [x21], #64");
2930
2931 COMPARE(Ld1(v0.V1D(), MemOperand(x16)), "ld1 {v0.1d}, [x16]");
2932 COMPARE(Ld1(v1.V1D(), v2.V1D(), MemOperand(x17, 16, PostIndex)),
2933 "ld1 {v1.1d, v2.1d}, [x17], #16");
2934 COMPARE(Ld1(v3.V1D(), v4.V1D(), v5.V1D(), MemOperand(x18, x19, PostIndex)),
2935 "ld1 {v3.1d, v4.1d, v5.1d}, [x18], x19");
2936 COMPARE(Ld1(v30.V1D(), v31.V1D(), v0.V1D(), v1.V1D(),
2937 MemOperand(x20, 32, PostIndex)),
2938 "ld1 {v30.1d, v31.1d, v0.1d, v1.1d}, [x20], #32");
2939 COMPARE(Ld1(d30, d31, d0, d1, MemOperand(x21, x22, PostIndex)),
2940 "ld1 {v30.1d, v31.1d, v0.1d, v1.1d}, [x21], x22");
2941
2942 #define DISASM_INST(M, S) \
2943 COMPARE(St1(v20.M, MemOperand(x15)), \
2944 "st1 {v20." S "}, [x15]"); \
2945 COMPARE(St1(v21.M, v22.M, MemOperand(x16)), \
2946 "st1 {v21." S ", v22." S "}, [x16]"); \
2947 COMPARE(St1(v23.M, v24.M, v25.M, MemOperand(x17)), \
2948 "st1 {v23." S ", v24." S ", v25." S "}, [x17]"); \
2949 COMPARE(St1(v26.M, v27.M, v28.M, v29.M, MemOperand(x18)), \
2950 "st1 {v26." S ", v27." S ", v28." S ", v29." S "}, [x18]") \
2951 COMPARE(St1(v30.M, v31.M, v0.M, v1.M, MemOperand(sp)), \
2952 "st1 {v30." S ", v31." S ", v0." S ", v1." S "}, [sp]") \
2953 COMPARE(St2(VLIST2(v21.M), MemOperand(x16)), \
2954 "st2 {v21." S ", v22." S "}, [x16]"); \
2955 COMPARE(St3(v23.M, v24.M, v25.M, MemOperand(x17)), \
2956 "st3 {v23." S ", v24." S ", v25." S "}, [x17]"); \
2957 COMPARE(St4(v30.M, v31.M, v0.M, v1.M, MemOperand(sp)), \
2958 "st4 {v30." S ", v31." S ", v0." S ", v1." S "}, [sp]")
2959 NEON_FORMAT_LIST(DISASM_INST);
2960 #undef DISASM_INST
2961
2962 #define DISASM_INST(M, S) \
2963 COMPARE(St1(v0.M, MemOperand(x15, x20, PostIndex)), \
2964 "st1 {v0." S "}, [x15], x20"); \
2965 COMPARE(St1(v1.M, v2.M, MemOperand(x16, x21, PostIndex)), \
2966 "st1 {v1." S ", v2." S "}, [x16], x21"); \
2967 COMPARE(St1(v3.M, v4.M, v5.M, MemOperand(x17, x22, PostIndex)), \
2968 "st1 {v3." S ", v4." S ", v5." S "}, [x17], x22"); \
2969 COMPARE(St1(v6.M, v7.M, v8.M, v9.M, MemOperand(x18, x23, PostIndex)), \
2970 "st1 {v6." S ", v7." S ", v8." S ", v9." S "}, [x18], x23") \
2971 COMPARE(St1(v30.M, v31.M, v0.M, v1.M, MemOperand(sp, x24, PostIndex)), \
2972 "st1 {v30." S ", v31." S ", v0." S ", v1." S "}, [sp], x24") \
2973 COMPARE(St2(v1.M, v2.M, MemOperand(x16, x21, PostIndex)), \
2974 "st2 {v1." S ", v2." S "}, [x16], x21"); \
2975 COMPARE(St3(v3.M, v4.M, v5.M, MemOperand(x17, x22, PostIndex)), \
2976 "st3 {v3." S ", v4." S ", v5." S "}, [x17], x22"); \
2977 COMPARE(St4(v6.M, v7.M, v8.M, v9.M, MemOperand(x18, x23, PostIndex)), \
2978 "st4 {v6." S ", v7." S ", v8." S ", v9." S "}, [x18], x23") \
2979 COMPARE(St4(v30.M, v31.M, v0.M, v1.M, MemOperand(sp, x24, PostIndex)), \
2980 "st4 {v30." S ", v31." S ", v0." S ", v1." S "}, [sp], x24")
2981 NEON_FORMAT_LIST(DISASM_INST);
2982 #undef DISASM_INST
2983
2984 COMPARE(St1(v0.V8B(), MemOperand(x15, 8, PostIndex)),
2985 "st1 {v0.8b}, [x15], #8");
2986 COMPARE(St1(v1.V16B(), MemOperand(x16, 16, PostIndex)),
2987 "st1 {v1.16b}, [x16], #16");
2988 COMPARE(St1(v2.V4H(), v3.V4H(), MemOperand(x17, 16, PostIndex)),
2989 "st1 {v2.4h, v3.4h}, [x17], #16");
2990 COMPARE(St1(v4.V8H(), v5.V8H(), MemOperand(x18, 32, PostIndex)),
2991 "st1 {v4.8h, v5.8h}, [x18], #32");
2992 COMPARE(St1(v16.V2S(), v17.V2S(), v18.V2S(), MemOperand(x19, 24, PostIndex)),
2993 "st1 {v16.2s, v17.2s, v18.2s}, [x19], #24");
2994 COMPARE(St1(v16.V4S(), v17.V4S(), v18.V4S(), MemOperand(x19, 48, PostIndex)),
2995 "st1 {v16.4s, v17.4s, v18.4s}, [x19], #48");
2996 COMPARE(St1(v19.V2S(), v20.V2S(), v21.V2S(), v22.V2S(),
2997 MemOperand(x20, 32, PostIndex)),
2998 "st1 {v19.2s, v20.2s, v21.2s, v22.2s}, [x20], #32");
2999 COMPARE(St1(v23.V2D(), v24.V2D(), v25.V2D(), v26.V2D(),
3000 MemOperand(x21, 64, PostIndex)),
3001 "st1 {v23.2d, v24.2d, v25.2d, v26.2d}, [x21], #64");
3002 COMPARE(St2(v1.V16B(), v2.V16B(), MemOperand(x16, 32, PostIndex)),
3003 "st2 {v1.16b, v2.16b}, [x16], #32");
3004 COMPARE(St2(v2.V4H(), v3.V4H(), MemOperand(x17, 16, PostIndex)),
3005 "st2 {v2.4h, v3.4h}, [x17], #16");
3006 COMPARE(St2(v4.V8H(), v5.V8H(), MemOperand(x18, 32, PostIndex)),
3007 "st2 {v4.8h, v5.8h}, [x18], #32");
3008 COMPARE(St3(v16.V2S(), v17.V2S(), v18.V2S(),
3009 MemOperand(x19, 24, PostIndex)),
3010 "st3 {v16.2s, v17.2s, v18.2s}, [x19], #24");
3011 COMPARE(St3(v16.V4S(), v17.V4S(), v18.V4S(),
3012 MemOperand(x19, 48, PostIndex)),
3013 "st3 {v16.4s, v17.4s, v18.4s}, [x19], #48");
3014 COMPARE(St4(v19.V2S(), v20.V2S(), v21.V2S(), v22.V2S(),
3015 MemOperand(x20, 32, PostIndex)),
3016 "st4 {v19.2s, v20.2s, v21.2s, v22.2s}, [x20], #32");
3017 COMPARE(St4(v23.V2D(), v24.V2D(), v25.V2D(), v26.V2D(),
3018 MemOperand(x21, 64, PostIndex)),
3019 "st4 {v23.2d, v24.2d, v25.2d, v26.2d}, [x21], #64");
3020
3021 COMPARE(St1(v0.V1D(), MemOperand(x16)), "st1 {v0.1d}, [x16]");
3022 COMPARE(St1(v1.V1D(), v2.V1D(), MemOperand(x17, 16, PostIndex)),
3023 "st1 {v1.1d, v2.1d}, [x17], #16");
3024 COMPARE(St1(v3.V1D(), v4.V1D(), v5.V1D(), MemOperand(x18, x19, PostIndex)),
3025 "st1 {v3.1d, v4.1d, v5.1d}, [x18], x19");
3026 COMPARE(St1(v30.V1D(), v31.V1D(), v0.V1D(), v1.V1D(),
3027 MemOperand(x20, 32, PostIndex)),
3028 "st1 {v30.1d, v31.1d, v0.1d, v1.1d}, [x20], #32");
3029 COMPARE(St1(d30, d31, d0, d1, MemOperand(x21, x22, PostIndex)),
3030 "st1 {v30.1d, v31.1d, v0.1d, v1.1d}, [x21], x22");
3031
3032 CLEANUP();
3033}
3034
3035
3036TEST(neon_load_store_lane) {
armvixl684cd2a2015-10-23 13:38:33 +01003037 SETUP_MACRO();
armvixl5289c592015-03-02 13:52:04 +00003038
3039 COMPARE(Ld1(v0.V8B(), 0, MemOperand(x15)), "ld1 {v0.b}[0], [x15]");
3040 COMPARE(Ld1(v1.V16B(), 1, MemOperand(x16)), "ld1 {v1.b}[1], [x16]");
3041 COMPARE(Ld1(v2.V4H(), 2, MemOperand(x17)), "ld1 {v2.h}[2], [x17]");
3042 COMPARE(Ld1(v3.V8H(), 3, MemOperand(x18)), "ld1 {v3.h}[3], [x18]");
3043 COMPARE(Ld1(v4.V2S(), 0, MemOperand(x19)), "ld1 {v4.s}[0], [x19]");
3044 COMPARE(Ld1(v5.V4S(), 1, MemOperand(x20)), "ld1 {v5.s}[1], [x20]");
3045 COMPARE(Ld1(v6.V2D(), 0, MemOperand(x21)), "ld1 {v6.d}[0], [x21]");
3046 COMPARE(Ld1(v7.B(), 7, MemOperand(x22)), "ld1 {v7.b}[7], [x22]");
3047 COMPARE(Ld1(v8.B(), 15, MemOperand(x23)), "ld1 {v8.b}[15], [x23]");
3048 COMPARE(Ld1(v9.H(), 3, MemOperand(x24)), "ld1 {v9.h}[3], [x24]");
3049 COMPARE(Ld1(v10.H(), 7, MemOperand(x25)), "ld1 {v10.h}[7], [x25]");
3050 COMPARE(Ld1(v11.S(), 1, MemOperand(x26)), "ld1 {v11.s}[1], [x26]");
3051 COMPARE(Ld1(v12.S(), 3, MemOperand(x27)), "ld1 {v12.s}[3], [x27]");
3052 COMPARE(Ld1(v13.D(), 1, MemOperand(sp)), "ld1 {v13.d}[1], [sp]");
3053
3054 COMPARE(Ld1(v0.V8B(), 0, MemOperand(x15, x0, PostIndex)),
3055 "ld1 {v0.b}[0], [x15], x0");
3056 COMPARE(Ld1(v1.V16B(), 1, MemOperand(x16, 1, PostIndex)),
3057 "ld1 {v1.b}[1], [x16], #1");
3058 COMPARE(Ld1(v2.V4H(), 2, MemOperand(x17, 2, PostIndex)),
3059 "ld1 {v2.h}[2], [x17], #2");
3060 COMPARE(Ld1(v3.V8H(), 3, MemOperand(x18, x1, PostIndex)),
3061 "ld1 {v3.h}[3], [x18], x1");
3062 COMPARE(Ld1(v4.V2S(), 0, MemOperand(x19, x2, PostIndex)),
3063 "ld1 {v4.s}[0], [x19], x2");
3064 COMPARE(Ld1(v5.V4S(), 1, MemOperand(x20, 4, PostIndex)),
3065 "ld1 {v5.s}[1], [x20], #4");
3066 COMPARE(Ld1(v6.V2D(), 0, MemOperand(x21, 8, PostIndex)),
3067 "ld1 {v6.d}[0], [x21], #8");
3068 COMPARE(Ld1(v7.B(), 7, MemOperand(x22, 1, PostIndex)),
3069 "ld1 {v7.b}[7], [x22], #1");
3070 COMPARE(Ld1(v8.B(), 15, MemOperand(x23, x3, PostIndex)),
3071 "ld1 {v8.b}[15], [x23], x3");
3072 COMPARE(Ld1(v9.H(), 3, MemOperand(x24, x4, PostIndex)),
3073 "ld1 {v9.h}[3], [x24], x4");
3074 COMPARE(Ld1(v10.H(), 7, MemOperand(x25, 2, PostIndex)),
3075 "ld1 {v10.h}[7], [x25], #2");
3076 COMPARE(Ld1(v11.S(), 1, MemOperand(x26, 4, PostIndex)),
3077 "ld1 {v11.s}[1], [x26], #4");
3078 COMPARE(Ld1(v12.S(), 3, MemOperand(x27, x5, PostIndex)),
3079 "ld1 {v12.s}[3], [x27], x5");
3080 COMPARE(Ld1(v13.D(), 1, MemOperand(sp, x6, PostIndex)),
3081 "ld1 {v13.d}[1], [sp], x6");
3082
3083 COMPARE(Ld2(v0.V8B(), v1.V8B(), 0, MemOperand(x15)),
3084 "ld2 {v0.b, v1.b}[0], [x15]");
3085 COMPARE(Ld2(v1.V16B(), v2.V16B(), 1, MemOperand(x16)),
3086 "ld2 {v1.b, v2.b}[1], [x16]");
3087 COMPARE(Ld2(v2.V4H(), v3.V4H(), 2, MemOperand(x17)),
3088 "ld2 {v2.h, v3.h}[2], [x17]");
3089 COMPARE(Ld2(v3.V8H(), v4.V8H(), 3, MemOperand(x18)),
3090 "ld2 {v3.h, v4.h}[3], [x18]");
3091 COMPARE(Ld2(v4.V2S(), v5.V2S(), 0, MemOperand(x19)),
3092 "ld2 {v4.s, v5.s}[0], [x19]");
3093 COMPARE(Ld2(v5.V4S(), v6.V4S(), 1, MemOperand(x20)),
3094 "ld2 {v5.s, v6.s}[1], [x20]");
3095 COMPARE(Ld2(v6.V2D(), v7.V2D(), 0, MemOperand(x21)),
3096 "ld2 {v6.d, v7.d}[0], [x21]");
3097 COMPARE(Ld2(v7.B(), v8.B(), 7, MemOperand(x22)),
3098 "ld2 {v7.b, v8.b}[7], [x22]");
3099 COMPARE(Ld2(v8.B(), v9.B(), 15, MemOperand(x23)),
3100 "ld2 {v8.b, v9.b}[15], [x23]");
3101 COMPARE(Ld2(v9.H(), v10.H(), 3, MemOperand(x24)),
3102 "ld2 {v9.h, v10.h}[3], [x24]");
3103 COMPARE(Ld2(v10.H(), v11.H(), 7, MemOperand(x25)),
3104 "ld2 {v10.h, v11.h}[7], [x25]");
3105 COMPARE(Ld2(v11.S(), v12.S(), 1, MemOperand(x26)),
3106 "ld2 {v11.s, v12.s}[1], [x26]");
3107 COMPARE(Ld2(v12.S(), v13.S(), 3, MemOperand(x27)),
3108 "ld2 {v12.s, v13.s}[3], [x27]");
3109 COMPARE(Ld2(v13.D(), v14.D(), 1, MemOperand(sp)),
3110 "ld2 {v13.d, v14.d}[1], [sp]");
3111
3112 COMPARE(Ld2(v0.V8B(), v1.V8B(), 0, MemOperand(x15, x0, PostIndex)),
3113 "ld2 {v0.b, v1.b}[0], [x15], x0");
3114 COMPARE(Ld2(v1.V16B(), v2.V16B(), 1, MemOperand(x16, 2, PostIndex)),
3115 "ld2 {v1.b, v2.b}[1], [x16], #2");
3116 COMPARE(Ld2(v2.V4H(), v3.V4H(), 2, MemOperand(x17, 4, PostIndex)),
3117 "ld2 {v2.h, v3.h}[2], [x17], #4");
3118 COMPARE(Ld2(v3.V8H(), v4.V8H(), 3, MemOperand(x18, x1, PostIndex)),
3119 "ld2 {v3.h, v4.h}[3], [x18], x1");
3120 COMPARE(Ld2(v4.V2S(), v5.V2S(), 0, MemOperand(x19, x2, PostIndex)),
3121 "ld2 {v4.s, v5.s}[0], [x19], x2");
3122 COMPARE(Ld2(v5.V4S(), v6.V4S(), 1, MemOperand(x20, 8, PostIndex)),
3123 "ld2 {v5.s, v6.s}[1], [x20], #8");
3124 COMPARE(Ld2(v6.V2D(), v7.V2D(), 0, MemOperand(x21, 16, PostIndex)),
3125 "ld2 {v6.d, v7.d}[0], [x21], #16");
3126 COMPARE(Ld2(v7.B(), v8.B(), 7, MemOperand(x22, 2, PostIndex)),
3127 "ld2 {v7.b, v8.b}[7], [x22], #2");
3128 COMPARE(Ld2(v8.B(), v9.B(), 15, MemOperand(x23, x3, PostIndex)),
3129 "ld2 {v8.b, v9.b}[15], [x23], x3");
3130 COMPARE(Ld2(v9.H(), v10.H(), 3, MemOperand(x24, x4, PostIndex)),
3131 "ld2 {v9.h, v10.h}[3], [x24], x4");
3132 COMPARE(Ld2(v10.H(), v11.H(), 7, MemOperand(x25, 4, PostIndex)),
3133 "ld2 {v10.h, v11.h}[7], [x25], #4");
3134 COMPARE(Ld2(v11.S(), v12.S(), 1, MemOperand(x26, 8, PostIndex)),
3135 "ld2 {v11.s, v12.s}[1], [x26], #8");
3136 COMPARE(Ld2(v12.S(), v13.S(), 3, MemOperand(x27, x5, PostIndex)),
3137 "ld2 {v12.s, v13.s}[3], [x27], x5");
3138 COMPARE(Ld2(v13.D(), v14.D(), 1, MemOperand(sp, x6, PostIndex)),
3139 "ld2 {v13.d, v14.d}[1], [sp], x6");
3140
3141 COMPARE(Ld3(v0.V8B(), v1.V8B(), v2.V8B(), 0, MemOperand(x15)),
3142 "ld3 {v0.b, v1.b, v2.b}[0], [x15]");
3143 COMPARE(Ld3(v1.V16B(), v2.V16B(), v3.V16B(), 1, MemOperand(x16)),
3144 "ld3 {v1.b, v2.b, v3.b}[1], [x16]");
3145 COMPARE(Ld3(v2.V4H(), v3.V4H(), v4.V4H(), 2, MemOperand(x17)),
3146 "ld3 {v2.h, v3.h, v4.h}[2], [x17]");
3147 COMPARE(Ld3(v3.V8H(), v4.V8H(), v5.V8H(), 3, MemOperand(x18)),
3148 "ld3 {v3.h, v4.h, v5.h}[3], [x18]");
3149 COMPARE(Ld3(v4.V2S(), v5.V2S(), v6.V2S(), 0, MemOperand(x19)),
3150 "ld3 {v4.s, v5.s, v6.s}[0], [x19]");
3151 COMPARE(Ld3(v5.V4S(), v6.V4S(), v7.V4S(), 1, MemOperand(x20)),
3152 "ld3 {v5.s, v6.s, v7.s}[1], [x20]");
3153 COMPARE(Ld3(v6.V2D(), v7.V2D(), v8.V2D(), 0, MemOperand(x21)),
3154 "ld3 {v6.d, v7.d, v8.d}[0], [x21]");
3155 COMPARE(Ld3(v7.B(), v8.B(), v9.B(), 7, MemOperand(x22)),
3156 "ld3 {v7.b, v8.b, v9.b}[7], [x22]");
3157 COMPARE(Ld3(v8.B(), v9.B(), v10.B(), 15, MemOperand(x23)),
3158 "ld3 {v8.b, v9.b, v10.b}[15], [x23]");
3159 COMPARE(Ld3(v9.H(), v10.H(), v11.H(), 3, MemOperand(x24)),
3160 "ld3 {v9.h, v10.h, v11.h}[3], [x24]");
3161 COMPARE(Ld3(v10.H(), v11.H(), v12.H(), 7, MemOperand(x25)),
3162 "ld3 {v10.h, v11.h, v12.h}[7], [x25]");
3163 COMPARE(Ld3(v11.S(), v12.S(), v13.S(), 1, MemOperand(x26)),
3164 "ld3 {v11.s, v12.s, v13.s}[1], [x26]");
3165 COMPARE(Ld3(v12.S(), v13.S(), v14.S(), 3, MemOperand(x27)),
3166 "ld3 {v12.s, v13.s, v14.s}[3], [x27]");
3167 COMPARE(Ld3(v13.D(), v14.D(), v15.D(), 1, MemOperand(sp)),
3168 "ld3 {v13.d, v14.d, v15.d}[1], [sp]");
3169
3170 COMPARE(Ld3(v0.V8B(), v1.V8B(), v2.V8B(), 0,
3171 MemOperand(x15, x0, PostIndex)),
3172 "ld3 {v0.b, v1.b, v2.b}[0], [x15], x0");
3173 COMPARE(Ld3(v1.V16B(), v2.V16B(), v3.V16B(), 1,
3174 MemOperand(x16, 3, PostIndex)),
3175 "ld3 {v1.b, v2.b, v3.b}[1], [x16], #3");
3176 COMPARE(Ld3(v2.V4H(), v3.V4H(), v4.V4H(), 2,
3177 MemOperand(x17, 6, PostIndex)),
3178 "ld3 {v2.h, v3.h, v4.h}[2], [x17], #6");
3179 COMPARE(Ld3(v3.V8H(), v4.V8H(), v5.V8H(), 3,
3180 MemOperand(x18, x1, PostIndex)),
3181 "ld3 {v3.h, v4.h, v5.h}[3], [x18], x1");
3182 COMPARE(Ld3(v4.V2S(), v5.V2S(), v6.V2S(), 0,
3183 MemOperand(x19, x2, PostIndex)),
3184 "ld3 {v4.s, v5.s, v6.s}[0], [x19], x2");
3185 COMPARE(Ld3(v5.V4S(), v6.V4S(), v7.V4S(), 1,
3186 MemOperand(x20, 12, PostIndex)),
3187 "ld3 {v5.s, v6.s, v7.s}[1], [x20], #12");
3188 COMPARE(Ld3(v6.V2D(), v7.V2D(), v8.V2D(), 0,
3189 MemOperand(x21, 24, PostIndex)),
3190 "ld3 {v6.d, v7.d, v8.d}[0], [x21], #24");
3191 COMPARE(Ld3(v7.B(), v8.B(), v9.B(), 7,
3192 MemOperand(x22, 3, PostIndex)),
3193 "ld3 {v7.b, v8.b, v9.b}[7], [x22], #3");
3194 COMPARE(Ld3(v8.B(), v9.B(), v10.B(), 15,
3195 MemOperand(x23, x3, PostIndex)),
3196 "ld3 {v8.b, v9.b, v10.b}[15], [x23], x3");
3197 COMPARE(Ld3(v9.H(), v10.H(), v11.H(), 3,
3198 MemOperand(x24, x4, PostIndex)),
3199 "ld3 {v9.h, v10.h, v11.h}[3], [x24], x4");
3200 COMPARE(Ld3(v10.H(), v11.H(), v12.H(), 7,
3201 MemOperand(x25, 6, PostIndex)),
3202 "ld3 {v10.h, v11.h, v12.h}[7], [x25], #6");
3203 COMPARE(Ld3(v11.S(), v12.S(), v13.S(), 1,
3204 MemOperand(x26, 12, PostIndex)),
3205 "ld3 {v11.s, v12.s, v13.s}[1], [x26], #12");
3206 COMPARE(Ld3(v12.S(), v13.S(), v14.S(), 3,
3207 MemOperand(x27, x5, PostIndex)),
3208 "ld3 {v12.s, v13.s, v14.s}[3], [x27], x5");
3209 COMPARE(Ld3(v13.D(), v14.D(), v15.D(), 1,
3210 MemOperand(sp, x6, PostIndex)),
3211 "ld3 {v13.d, v14.d, v15.d}[1], [sp], x6");
3212
3213 COMPARE(Ld4(v0.V8B(), v1.V8B(), v2.V8B(), v3.V8B(), 0,
3214 MemOperand(x15)),
3215 "ld4 {v0.b, v1.b, v2.b, v3.b}[0], [x15]");
3216 COMPARE(Ld4(v1.V16B(), v2.V16B(), v3.V16B(), v4.V16B(), 1,
3217 MemOperand(x16)),
3218 "ld4 {v1.b, v2.b, v3.b, v4.b}[1], [x16]");
3219 COMPARE(Ld4(v2.V4H(), v3.V4H(), v4.V4H(), v5.V4H(), 2,
3220 MemOperand(x17)),
3221 "ld4 {v2.h, v3.h, v4.h, v5.h}[2], [x17]");
3222 COMPARE(Ld4(v3.V8H(), v4.V8H(), v5.V8H(), v6.V8H(), 3,
3223 MemOperand(x18)),
3224 "ld4 {v3.h, v4.h, v5.h, v6.h}[3], [x18]");
3225 COMPARE(Ld4(v4.V2S(), v5.V2S(), v6.V2S(), v7.V2S(), 0,
3226 MemOperand(x19)),
3227 "ld4 {v4.s, v5.s, v6.s, v7.s}[0], [x19]");
3228 COMPARE(Ld4(v5.V4S(), v6.V4S(), v7.V4S(), v8.V4S(), 1,
3229 MemOperand(x20)),
3230 "ld4 {v5.s, v6.s, v7.s, v8.s}[1], [x20]");
3231 COMPARE(Ld4(v6.V2D(), v7.V2D(), v8.V2D(), v9.V2D(), 0,
3232 MemOperand(x21)),
3233 "ld4 {v6.d, v7.d, v8.d, v9.d}[0], [x21]");
3234 COMPARE(Ld4(v7.B(), v8.B(), v9.B(), v10.B(), 7,
3235 MemOperand(x22)),
3236 "ld4 {v7.b, v8.b, v9.b, v10.b}[7], [x22]");
3237 COMPARE(Ld4(v8.B(), v9.B(), v10.B(), v11.B(), 15,
3238 MemOperand(x23)),
3239 "ld4 {v8.b, v9.b, v10.b, v11.b}[15], [x23]");
3240 COMPARE(Ld4(v9.H(), v10.H(), v11.H(), v12.H(), 3,
3241 MemOperand(x24)),
3242 "ld4 {v9.h, v10.h, v11.h, v12.h}[3], [x24]");
3243 COMPARE(Ld4(v10.H(), v11.H(), v12.H(), v13.H(), 7,
3244 MemOperand(x25)),
3245 "ld4 {v10.h, v11.h, v12.h, v13.h}[7], [x25]");
3246 COMPARE(Ld4(v11.S(), v12.S(), v13.S(), v14.S(), 1,
3247 MemOperand(x26)),
3248 "ld4 {v11.s, v12.s, v13.s, v14.s}[1], [x26]");
3249 COMPARE(Ld4(v12.S(), v13.S(), v14.S(), v15.S(), 3,
3250 MemOperand(x27)),
3251 "ld4 {v12.s, v13.s, v14.s, v15.s}[3], [x27]");
3252 COMPARE(Ld4(v13.D(), v14.D(), v15.D(), v16.D(), 1,
3253 MemOperand(sp)),
3254 "ld4 {v13.d, v14.d, v15.d, v16.d}[1], [sp]");
3255
3256 COMPARE(Ld4(v0.V8B(), v1.V8B(), v2.V8B(), v3.V8B(), 0,
3257 MemOperand(x15, x0, PostIndex)),
3258 "ld4 {v0.b, v1.b, v2.b, v3.b}[0], [x15], x0");
3259 COMPARE(Ld4(v1.V16B(), v2.V16B(), v3.V16B(), v4.V16B(), 1,
3260 MemOperand(x16, 4, PostIndex)),
3261 "ld4 {v1.b, v2.b, v3.b, v4.b}[1], [x16], #4");
3262 COMPARE(Ld4(v2.V4H(), v3.V4H(), v4.V4H(), v5.V4H(), 2,
3263 MemOperand(x17, 8, PostIndex)),
3264 "ld4 {v2.h, v3.h, v4.h, v5.h}[2], [x17], #8");
3265 COMPARE(Ld4(v3.V8H(), v4.V8H(), v5.V8H(), v6.V8H(), 3,
3266 MemOperand(x18, x1, PostIndex)),
3267 "ld4 {v3.h, v4.h, v5.h, v6.h}[3], [x18], x1");
3268 COMPARE(Ld4(v4.V2S(), v5.V2S(), v6.V2S(), v7.V2S(), 0,
3269 MemOperand(x19, x2, PostIndex)),
3270 "ld4 {v4.s, v5.s, v6.s, v7.s}[0], [x19], x2");
3271 COMPARE(Ld4(v5.V4S(), v6.V4S(), v7.V4S(), v8.V4S(), 1,
3272 MemOperand(x20, 16, PostIndex)),
3273 "ld4 {v5.s, v6.s, v7.s, v8.s}[1], [x20], #16");
3274 COMPARE(Ld4(v6.V2D(), v7.V2D(), v8.V2D(), v9.V2D(), 0,
3275 MemOperand(x21, 32, PostIndex)),
3276 "ld4 {v6.d, v7.d, v8.d, v9.d}[0], [x21], #32");
3277 COMPARE(Ld4(v7.B(), v8.B(), v9.B(), v10.B(), 7,
3278 MemOperand(x22, 4, PostIndex)),
3279 "ld4 {v7.b, v8.b, v9.b, v10.b}[7], [x22], #4");
3280 COMPARE(Ld4(v8.B(), v9.B(), v10.B(), v11.B(), 15,
3281 MemOperand(x23, x3, PostIndex)),
3282 "ld4 {v8.b, v9.b, v10.b, v11.b}[15], [x23], x3");
3283 COMPARE(Ld4(v9.H(), v10.H(), v11.H(), v12.H(), 3,
3284 MemOperand(x24, x4, PostIndex)),
3285 "ld4 {v9.h, v10.h, v11.h, v12.h}[3], [x24], x4");
3286 COMPARE(Ld4(v10.H(), v11.H(), v12.H(), v13.H(), 7,
3287 MemOperand(x25, 8, PostIndex)),
3288 "ld4 {v10.h, v11.h, v12.h, v13.h}[7], [x25], #8");
3289 COMPARE(Ld4(v11.S(), v12.S(), v13.S(), v14.S(), 1,
3290 MemOperand(x26, 16, PostIndex)),
3291 "ld4 {v11.s, v12.s, v13.s, v14.s}[1], [x26], #16");
3292 COMPARE(Ld4(v12.S(), v13.S(), v14.S(), v15.S(), 3,
3293 MemOperand(x27, x5, PostIndex)),
3294 "ld4 {v12.s, v13.s, v14.s, v15.s}[3], [x27], x5");
3295 COMPARE(Ld4(v13.D(), v14.D(), v15.D(), v16.D(), 1,
3296 MemOperand(sp, x6, PostIndex)),
3297 "ld4 {v13.d, v14.d, v15.d, v16.d}[1], [sp], x6");
3298
3299 COMPARE(St1(v0.V8B(), 0, MemOperand(x15)), "st1 {v0.b}[0], [x15]");
3300 COMPARE(St1(v1.V16B(), 1, MemOperand(x16)), "st1 {v1.b}[1], [x16]");
3301 COMPARE(St1(v2.V4H(), 2, MemOperand(x17)), "st1 {v2.h}[2], [x17]");
3302 COMPARE(St1(v3.V8H(), 3, MemOperand(x18)), "st1 {v3.h}[3], [x18]");
3303 COMPARE(St1(v4.V2S(), 0, MemOperand(x19)), "st1 {v4.s}[0], [x19]");
3304 COMPARE(St1(v5.V4S(), 1, MemOperand(x20)), "st1 {v5.s}[1], [x20]");
3305 COMPARE(St1(v6.V2D(), 0, MemOperand(x21)), "st1 {v6.d}[0], [x21]");
3306 COMPARE(St1(v7.B(), 7, MemOperand(x22)), "st1 {v7.b}[7], [x22]");
3307 COMPARE(St1(v8.B(), 15, MemOperand(x23)), "st1 {v8.b}[15], [x23]");
3308 COMPARE(St1(v9.H(), 3, MemOperand(x24)), "st1 {v9.h}[3], [x24]");
3309 COMPARE(St1(v10.H(), 7, MemOperand(x25)), "st1 {v10.h}[7], [x25]");
3310 COMPARE(St1(v11.S(), 1, MemOperand(x26)), "st1 {v11.s}[1], [x26]");
3311 COMPARE(St1(v12.S(), 3, MemOperand(x27)), "st1 {v12.s}[3], [x27]");
3312 COMPARE(St1(v13.D(), 1, MemOperand(sp)), "st1 {v13.d}[1], [sp]");
3313
3314 COMPARE(St1(v0.V8B(), 0, MemOperand(x15, x0, PostIndex)),
3315 "st1 {v0.b}[0], [x15], x0");
3316 COMPARE(St1(v1.V16B(), 1, MemOperand(x16, 1, PostIndex)),
3317 "st1 {v1.b}[1], [x16], #1");
3318 COMPARE(St1(v2.V4H(), 2, MemOperand(x17, 2, PostIndex)),
3319 "st1 {v2.h}[2], [x17], #2");
3320 COMPARE(St1(v3.V8H(), 3, MemOperand(x18, x1, PostIndex)),
3321 "st1 {v3.h}[3], [x18], x1");
3322 COMPARE(St1(v4.V2S(), 0, MemOperand(x19, x2, PostIndex)),
3323 "st1 {v4.s}[0], [x19], x2");
3324 COMPARE(St1(v5.V4S(), 1, MemOperand(x20, 4, PostIndex)),
3325 "st1 {v5.s}[1], [x20], #4");
3326 COMPARE(St1(v6.V2D(), 0, MemOperand(x21, 8, PostIndex)),
3327 "st1 {v6.d}[0], [x21], #8");
3328 COMPARE(St1(v7.B(), 7, MemOperand(x22, 1, PostIndex)),
3329 "st1 {v7.b}[7], [x22], #1");
3330 COMPARE(St1(v8.B(), 15, MemOperand(x23, x3, PostIndex)),
3331 "st1 {v8.b}[15], [x23], x3");
3332 COMPARE(St1(v9.H(), 3, MemOperand(x24, x4, PostIndex)),
3333 "st1 {v9.h}[3], [x24], x4");
3334 COMPARE(St1(v10.H(), 7, MemOperand(x25, 2, PostIndex)),
3335 "st1 {v10.h}[7], [x25], #2");
3336 COMPARE(St1(v11.S(), 1, MemOperand(x26, 4, PostIndex)),
3337 "st1 {v11.s}[1], [x26], #4");
3338 COMPARE(St1(v12.S(), 3, MemOperand(x27, x5, PostIndex)),
3339 "st1 {v12.s}[3], [x27], x5");
3340 COMPARE(St1(v13.D(), 1, MemOperand(sp, x6, PostIndex)),
3341 "st1 {v13.d}[1], [sp], x6");
3342 COMPARE(St2(v0.V8B(), v1.V8B(), 0, MemOperand(x15, x0, PostIndex)),
3343 "st2 {v0.b, v1.b}[0], [x15], x0");
3344 COMPARE(St2(v1.V16B(), v2.V16B(), 1, MemOperand(x16, 2, PostIndex)),
3345 "st2 {v1.b, v2.b}[1], [x16], #2");
3346 COMPARE(St2(v2.V4H(), v3.V4H(), 2, MemOperand(x17, 4, PostIndex)),
3347 "st2 {v2.h, v3.h}[2], [x17], #4");
3348 COMPARE(St2(v3.V8H(), v4.V8H(), 3, MemOperand(x18, x1, PostIndex)),
3349 "st2 {v3.h, v4.h}[3], [x18], x1");
3350 COMPARE(St2(v4.V2S(), v5.V2S(), 0, MemOperand(x19, x2, PostIndex)),
3351 "st2 {v4.s, v5.s}[0], [x19], x2");
3352 COMPARE(St2(v5.V4S(), v6.V4S(), 1, MemOperand(x20, 8, PostIndex)),
3353 "st2 {v5.s, v6.s}[1], [x20], #8");
3354 COMPARE(St2(v6.V2D(), v7.V2D(), 0, MemOperand(x21, 16, PostIndex)),
3355 "st2 {v6.d, v7.d}[0], [x21], #16");
3356 COMPARE(St2(v7.B(), v8.B(), 7, MemOperand(x22, 2, PostIndex)),
3357 "st2 {v7.b, v8.b}[7], [x22], #2");
3358 COMPARE(St2(v8.B(), v9.B(), 15, MemOperand(x23, x3, PostIndex)),
3359 "st2 {v8.b, v9.b}[15], [x23], x3");
3360 COMPARE(St2(v9.H(), v10.H(), 3, MemOperand(x24, x4, PostIndex)),
3361 "st2 {v9.h, v10.h}[3], [x24], x4");
3362 COMPARE(St2(v10.H(), v11.H(), 7, MemOperand(x25, 4, PostIndex)),
3363 "st2 {v10.h, v11.h}[7], [x25], #4");
3364 COMPARE(St2(v11.S(), v12.S(), 1, MemOperand(x26, 8, PostIndex)),
3365 "st2 {v11.s, v12.s}[1], [x26], #8");
3366 COMPARE(St2(v12.S(), v13.S(), 3, MemOperand(x27, x5, PostIndex)),
3367 "st2 {v12.s, v13.s}[3], [x27], x5");
3368 COMPARE(St2(v13.D(), v14.D(), 1, MemOperand(sp, x6, PostIndex)),
3369 "st2 {v13.d, v14.d}[1], [sp], x6");
3370 COMPARE(St3(VLIST3(v0.V8B()), 0, MemOperand(x15, x0, PostIndex)),
3371 "st3 {v0.b, v1.b, v2.b}[0], [x15], x0");
3372 COMPARE(St3(VLIST3(v1.V16B()), 1, MemOperand(x16, 3, PostIndex)),
3373 "st3 {v1.b, v2.b, v3.b}[1], [x16], #3");
3374 COMPARE(St3(VLIST3(v2.V4H()), 2, MemOperand(x17, 6, PostIndex)),
3375 "st3 {v2.h, v3.h, v4.h}[2], [x17], #6");
3376 COMPARE(St3(VLIST3(v3.V8H()), 3, MemOperand(x18, x1, PostIndex)),
3377 "st3 {v3.h, v4.h, v5.h}[3], [x18], x1");
3378 COMPARE(St3(VLIST3(v4.V2S()), 0, MemOperand(x19, x2, PostIndex)),
3379 "st3 {v4.s, v5.s, v6.s}[0], [x19], x2");
3380 COMPARE(St3(VLIST3(v5.V4S()), 1, MemOperand(x20, 12, PostIndex)),
3381 "st3 {v5.s, v6.s, v7.s}[1], [x20], #12");
3382 COMPARE(St3(VLIST3(v6.V2D()), 0, MemOperand(x21, 24, PostIndex)),
3383 "st3 {v6.d, v7.d, v8.d}[0], [x21], #24");
3384 COMPARE(St3(VLIST3(v7.B()), 7, MemOperand(x22, 3, PostIndex)),
3385 "st3 {v7.b, v8.b, v9.b}[7], [x22], #3");
3386 COMPARE(St3(VLIST3(v8.B()), 15, MemOperand(x23, x3, PostIndex)),
3387 "st3 {v8.b, v9.b, v10.b}[15], [x23], x3");
3388 COMPARE(St3(VLIST3(v9.H()), 3, MemOperand(x24, x4, PostIndex)),
3389 "st3 {v9.h, v10.h, v11.h}[3], [x24], x4");
3390 COMPARE(St3(VLIST3(v10.H()), 7, MemOperand(x25, 6, PostIndex)),
3391 "st3 {v10.h, v11.h, v12.h}[7], [x25], #6");
3392 COMPARE(St3(VLIST3(v11.S()), 1, MemOperand(x26, 12, PostIndex)),
3393 "st3 {v11.s, v12.s, v13.s}[1], [x26], #12");
3394 COMPARE(St3(VLIST3(v12.S()), 3, MemOperand(x27, x5, PostIndex)),
3395 "st3 {v12.s, v13.s, v14.s}[3], [x27], x5");
3396 COMPARE(St3(VLIST3(v13.D()), 1, MemOperand(sp, x6, PostIndex)),
3397 "st3 {v13.d, v14.d, v15.d}[1], [sp], x6");
3398
3399 COMPARE(St4(VLIST4(v0.V8B()), 0, MemOperand(x15, x0, PostIndex)),
3400 "st4 {v0.b, v1.b, v2.b, v3.b}[0], [x15], x0");
3401 COMPARE(St4(VLIST4(v1.V16B()), 1, MemOperand(x16, 4, PostIndex)),
3402 "st4 {v1.b, v2.b, v3.b, v4.b}[1], [x16], #4");
3403 COMPARE(St4(VLIST4(v2.V4H()), 2, MemOperand(x17, 8, PostIndex)),
3404 "st4 {v2.h, v3.h, v4.h, v5.h}[2], [x17], #8");
3405 COMPARE(St4(VLIST4(v3.V8H()), 3, MemOperand(x18, x1, PostIndex)),
3406 "st4 {v3.h, v4.h, v5.h, v6.h}[3], [x18], x1");
3407 COMPARE(St4(VLIST4(v4.V2S()), 0, MemOperand(x19, x2, PostIndex)),
3408 "st4 {v4.s, v5.s, v6.s, v7.s}[0], [x19], x2");
3409 COMPARE(St4(VLIST4(v5.V4S()), 1, MemOperand(x20, 16, PostIndex)),
3410 "st4 {v5.s, v6.s, v7.s, v8.s}[1], [x20], #16");
3411 COMPARE(St4(VLIST4(v6.V2D()), 0, MemOperand(x21, 32, PostIndex)),
3412 "st4 {v6.d, v7.d, v8.d, v9.d}[0], [x21], #32");
3413 COMPARE(St4(VLIST4(v7.B()), 7, MemOperand(x22, 4, PostIndex)),
3414 "st4 {v7.b, v8.b, v9.b, v10.b}[7], [x22], #4");
3415 COMPARE(St4(VLIST4(v8.B()), 15, MemOperand(x23, x3, PostIndex)),
3416 "st4 {v8.b, v9.b, v10.b, v11.b}[15], [x23], x3");
3417 COMPARE(St4(VLIST4(v9.H()), 3, MemOperand(x24, x4, PostIndex)),
3418 "st4 {v9.h, v10.h, v11.h, v12.h}[3], [x24], x4");
3419 COMPARE(St4(VLIST4(v10.H()), 7, MemOperand(x25, 8, PostIndex)),
3420 "st4 {v10.h, v11.h, v12.h, v13.h}[7], [x25], #8");
3421 COMPARE(St4(VLIST4(v11.S()), 1, MemOperand(x26, 16, PostIndex)),
3422 "st4 {v11.s, v12.s, v13.s, v14.s}[1], [x26], #16");
3423 COMPARE(St4(VLIST4(v12.S()), 3, MemOperand(x27, x5, PostIndex)),
3424 "st4 {v12.s, v13.s, v14.s, v15.s}[3], [x27], x5");
3425 COMPARE(St4(VLIST4(v13.D()), 1, MemOperand(sp, x6, PostIndex)),
3426 "st4 {v13.d, v14.d, v15.d, v16.d}[1], [sp], x6");
3427
3428 CLEANUP();
3429}
3430
3431
3432TEST(neon_load_all_lanes) {
armvixl684cd2a2015-10-23 13:38:33 +01003433 SETUP_MACRO();
armvixl5289c592015-03-02 13:52:04 +00003434
3435 COMPARE(Ld1r(v14.V8B(), MemOperand(x0)), "ld1r {v14.8b}, [x0]");
3436 COMPARE(Ld1r(v15.V16B(), MemOperand(x1)), "ld1r {v15.16b}, [x1]");
3437 COMPARE(Ld1r(v16.V4H(), MemOperand(x2)), "ld1r {v16.4h}, [x2]");
3438 COMPARE(Ld1r(v17.V8H(), MemOperand(x3)), "ld1r {v17.8h}, [x3]");
3439 COMPARE(Ld1r(v18.V2S(), MemOperand(x4)), "ld1r {v18.2s}, [x4]");
3440 COMPARE(Ld1r(v19.V4S(), MemOperand(x5)), "ld1r {v19.4s}, [x5]");
3441 COMPARE(Ld1r(v20.V2D(), MemOperand(sp)), "ld1r {v20.2d}, [sp]");
3442 COMPARE(Ld1r(v21.V1D(), MemOperand(x30)), "ld1r {v21.1d}, [x30]");
3443
3444 COMPARE(Ld1r(v22.V8B(), MemOperand(x6, 1, PostIndex)),
3445 "ld1r {v22.8b}, [x6], #1");
3446 COMPARE(Ld1r(v23.V16B(), MemOperand(x7, x16, PostIndex)),
3447 "ld1r {v23.16b}, [x7], x16");
3448 COMPARE(Ld1r(v24.V4H(), MemOperand(x8, x17, PostIndex)),
3449 "ld1r {v24.4h}, [x8], x17");
3450 COMPARE(Ld1r(v25.V8H(), MemOperand(x9, 2, PostIndex)),
3451 "ld1r {v25.8h}, [x9], #2");
3452 COMPARE(Ld1r(v26.V2S(), MemOperand(x10, 4, PostIndex)),
3453 "ld1r {v26.2s}, [x10], #4");
3454 COMPARE(Ld1r(v27.V4S(), MemOperand(x11, x18, PostIndex)),
3455 "ld1r {v27.4s}, [x11], x18");
3456 COMPARE(Ld1r(v28.V2D(), MemOperand(x12, 8, PostIndex)),
3457 "ld1r {v28.2d}, [x12], #8");
3458 COMPARE(Ld1r(v29.V1D(), MemOperand(x13, 8, PostIndex)),
3459 "ld1r {v29.1d}, [x13], #8");
3460
3461 COMPARE(Ld2r(v14.V8B(), v15.V8B(), MemOperand(x0)),
3462 "ld2r {v14.8b, v15.8b}, [x0]");
3463 COMPARE(Ld2r(v15.V16B(), v16.V16B(), MemOperand(x1)),
3464 "ld2r {v15.16b, v16.16b}, [x1]");
3465 COMPARE(Ld2r(v16.V4H(), v17.V4H(), MemOperand(x2)),
3466 "ld2r {v16.4h, v17.4h}, [x2]");
3467 COMPARE(Ld2r(v17.V8H(), v18.V8H(), MemOperand(x3)),
3468 "ld2r {v17.8h, v18.8h}, [x3]");
3469 COMPARE(Ld2r(v18.V2S(), v19.V2S(), MemOperand(x4)),
3470 "ld2r {v18.2s, v19.2s}, [x4]");
3471 COMPARE(Ld2r(v19.V4S(), v20.V4S(), MemOperand(x5)),
3472 "ld2r {v19.4s, v20.4s}, [x5]");
3473 COMPARE(Ld2r(v20.V2D(), v21.V2D(), MemOperand(sp)),
3474 "ld2r {v20.2d, v21.2d}, [sp]");
3475 COMPARE(Ld2r(v21.V8B(), v22.V8B(), MemOperand(x6, 2, PostIndex)),
3476 "ld2r {v21.8b, v22.8b}, [x6], #2");
3477 COMPARE(Ld2r(v22.V16B(), v23.V16B(), MemOperand(x7, x16, PostIndex)),
3478 "ld2r {v22.16b, v23.16b}, [x7], x16");
3479 COMPARE(Ld2r(v23.V4H(), v24.V4H(), MemOperand(x8, x17, PostIndex)),
3480 "ld2r {v23.4h, v24.4h}, [x8], x17");
3481 COMPARE(Ld2r(v24.V8H(), v25.V8H(), MemOperand(x9, 4, PostIndex)),
3482 "ld2r {v24.8h, v25.8h}, [x9], #4");
3483 COMPARE(Ld2r(v25.V2S(), v26.V2S(), MemOperand(x10, 8, PostIndex)),
3484 "ld2r {v25.2s, v26.2s}, [x10], #8");
3485 COMPARE(Ld2r(v26.V4S(), v27.V4S(), MemOperand(x11, x18, PostIndex)),
3486 "ld2r {v26.4s, v27.4s}, [x11], x18");
3487 COMPARE(Ld2r(v27.V2D(), v28.V2D(), MemOperand(x12, 16, PostIndex)),
3488 "ld2r {v27.2d, v28.2d}, [x12], #16");
3489
3490 COMPARE(Ld3r(v14.V8B(), v15.V8B(), v16.V8B(),
3491 MemOperand(x0)),
3492 "ld3r {v14.8b, v15.8b, v16.8b}, [x0]");
3493 COMPARE(Ld3r(v15.V16B(), v16.V16B(), v17.V16B(),
3494 MemOperand(x1)),
3495 "ld3r {v15.16b, v16.16b, v17.16b}, [x1]");
3496 COMPARE(Ld3r(v16.V4H(), v17.V4H(), v18.V4H(),
3497 MemOperand(x2)),
3498 "ld3r {v16.4h, v17.4h, v18.4h}, [x2]");
3499 COMPARE(Ld3r(v17.V8H(), v18.V8H(), v19.V8H(),
3500 MemOperand(x3)),
3501 "ld3r {v17.8h, v18.8h, v19.8h}, [x3]");
3502 COMPARE(Ld3r(v18.V2S(), v19.V2S(), v20.V2S(),
3503 MemOperand(x4)),
3504 "ld3r {v18.2s, v19.2s, v20.2s}, [x4]");
3505 COMPARE(Ld3r(v19.V4S(), v20.V4S(), v21.V4S(),
3506 MemOperand(x5)),
3507 "ld3r {v19.4s, v20.4s, v21.4s}, [x5]");
3508 COMPARE(Ld3r(v20.V2D(), v21.V2D(), v22.V2D(),
3509 MemOperand(sp)),
3510 "ld3r {v20.2d, v21.2d, v22.2d}, [sp]");
3511 COMPARE(Ld3r(v21.V8B(), v22.V8B(), v23.V8B(),
3512 MemOperand(x6, 3, PostIndex)),
3513 "ld3r {v21.8b, v22.8b, v23.8b}, [x6], #3");
3514 COMPARE(Ld3r(v22.V16B(), v23.V16B(), v24.V16B(),
3515 MemOperand(x7, x16, PostIndex)),
3516 "ld3r {v22.16b, v23.16b, v24.16b}, [x7], x16");
3517 COMPARE(Ld3r(v23.V4H(), v24.V4H(), v25.V4H(),
3518 MemOperand(x8, x17, PostIndex)),
3519 "ld3r {v23.4h, v24.4h, v25.4h}, [x8], x17");
3520 COMPARE(Ld3r(v24.V8H(), v25.V8H(), v26.V8H(),
3521 MemOperand(x9, 6, PostIndex)),
3522 "ld3r {v24.8h, v25.8h, v26.8h}, [x9], #6");
3523 COMPARE(Ld3r(v25.V2S(), v26.V2S(), v27.V2S(),
3524 MemOperand(x10, 12, PostIndex)),
3525 "ld3r {v25.2s, v26.2s, v27.2s}, [x10], #12");
3526 COMPARE(Ld3r(v26.V4S(), v27.V4S(), v28.V4S(),
3527 MemOperand(x11, x18, PostIndex)),
3528 "ld3r {v26.4s, v27.4s, v28.4s}, [x11], x18");
3529 COMPARE(Ld3r(v27.V2D(), v28.V2D(), v29.V2D(),
3530 MemOperand(x12, 24, PostIndex)),
3531 "ld3r {v27.2d, v28.2d, v29.2d}, [x12], #24");
3532
3533 COMPARE(Ld4r(v14.V8B(), v15.V8B(), v16.V8B(), v17.V8B(),
3534 MemOperand(x0)),
3535 "ld4r {v14.8b, v15.8b, v16.8b, v17.8b}, [x0]");
3536 COMPARE(Ld4r(v15.V16B(), v16.V16B(), v17.V16B(), v18.V16B(),
3537 MemOperand(x1)),
3538 "ld4r {v15.16b, v16.16b, v17.16b, v18.16b}, [x1]");
3539 COMPARE(Ld4r(v16.V4H(), v17.V4H(), v18.V4H(), v19.V4H(),
3540 MemOperand(x2)),
3541 "ld4r {v16.4h, v17.4h, v18.4h, v19.4h}, [x2]");
3542 COMPARE(Ld4r(v17.V8H(), v18.V8H(), v19.V8H(), v20.V8H(),
3543 MemOperand(x3)),
3544 "ld4r {v17.8h, v18.8h, v19.8h, v20.8h}, [x3]");
3545 COMPARE(Ld4r(v18.V2S(), v19.V2S(), v20.V2S(), v21.V2S(),
3546 MemOperand(x4)),
3547 "ld4r {v18.2s, v19.2s, v20.2s, v21.2s}, [x4]");
3548 COMPARE(Ld4r(v19.V4S(), v20.V4S(), v21.V4S(), v22.V4S(),
3549 MemOperand(x5)),
3550 "ld4r {v19.4s, v20.4s, v21.4s, v22.4s}, [x5]");
3551 COMPARE(Ld4r(v20.V2D(), v21.V2D(), v22.V2D(), v23.V2D(),
3552 MemOperand(sp)),
3553 "ld4r {v20.2d, v21.2d, v22.2d, v23.2d}, [sp]");
3554 COMPARE(Ld4r(v21.V8B(), v22.V8B(), v23.V8B(), v24.V8B(),
3555 MemOperand(x6, 4, PostIndex)),
3556 "ld4r {v21.8b, v22.8b, v23.8b, v24.8b}, [x6], #4");
3557 COMPARE(Ld4r(v22.V16B(), v23.V16B(), v24.V16B(), v25.V16B(),
3558 MemOperand(x7, x16, PostIndex)),
3559 "ld4r {v22.16b, v23.16b, v24.16b, v25.16b}, [x7], x16");
3560 COMPARE(Ld4r(v23.V4H(), v24.V4H(), v25.V4H(), v26.V4H(),
3561 MemOperand(x8, x17, PostIndex)),
3562 "ld4r {v23.4h, v24.4h, v25.4h, v26.4h}, [x8], x17");
3563 COMPARE(Ld4r(v24.V8H(), v25.V8H(), v26.V8H(), v27.V8H(),
3564 MemOperand(x9, 8, PostIndex)),
3565 "ld4r {v24.8h, v25.8h, v26.8h, v27.8h}, [x9], #8");
3566 COMPARE(Ld4r(v25.V2S(), v26.V2S(), v27.V2S(), v28.V2S(),
3567 MemOperand(x10, 16, PostIndex)),
3568 "ld4r {v25.2s, v26.2s, v27.2s, v28.2s}, [x10], #16");
3569 COMPARE(Ld4r(v26.V4S(), v27.V4S(), v28.V4S(), v29.V4S(),
3570 MemOperand(x11, x18, PostIndex)),
3571 "ld4r {v26.4s, v27.4s, v28.4s, v29.4s}, [x11], x18");
3572 COMPARE(Ld4r(v27.V2D(), v28.V2D(), v29.V2D(), v30.V2D(),
3573 MemOperand(x12, 32, PostIndex)),
3574 "ld4r {v27.2d, v28.2d, v29.2d, v30.2d}, [x12], #32");
3575
3576 CLEANUP();
3577}
3578
3579
3580TEST(neon_3same) {
armvixl684cd2a2015-10-23 13:38:33 +01003581 SETUP_MACRO();
armvixl5289c592015-03-02 13:52:04 +00003582
3583 #define DISASM_INST(M, S) \
3584 COMPARE(Cmeq(v0.M, v1.M, v2.M), "cmeq v0." S ", v1." S ", v2." S);
3585 NEON_FORMAT_LIST(DISASM_INST)
3586 #undef DISASM_INST
3587
3588 #define DISASM_INST(M, S) \
3589 COMPARE(Cmge(v0.M, v1.M, v2.M), "cmge v0." S ", v1." S ", v2." S);
3590 NEON_FORMAT_LIST(DISASM_INST)
3591 #undef DISASM_INST
3592
3593 #define DISASM_INST(M, S) \
3594 COMPARE(Cmgt(v0.M, v1.M, v2.M), "cmgt v0." S ", v1." S ", v2." S);
3595 NEON_FORMAT_LIST(DISASM_INST)
3596 #undef DISASM_INST
3597
3598 #define DISASM_INST(M, S) \
3599 COMPARE(Cmhi(v0.M, v1.M, v2.M), "cmhi v0." S ", v1." S ", v2." S);
3600 NEON_FORMAT_LIST(DISASM_INST)
3601 #undef DISASM_INST
3602
3603 #define DISASM_INST(M, S) \
3604 COMPARE(Cmhs(v0.M, v1.M, v2.M), "cmhs v0." S ", v1." S ", v2." S);
3605 NEON_FORMAT_LIST(DISASM_INST)
3606 #undef DISASM_INST
3607
3608 #define DISASM_INST(M, S) \
3609 COMPARE(Cmtst(v0.M, v1.M, v2.M), "cmtst v0." S ", v1." S ", v2." S);
3610 NEON_FORMAT_LIST(DISASM_INST)
3611 #undef DISASM_INST
3612
3613 #define DISASM_INST(M, S) \
3614 COMPARE(Add(v0.M, v1.M, v2.M), "add v0." S ", v1." S ", v2." S);
3615 NEON_FORMAT_LIST(DISASM_INST)
3616 #undef DISASM_INST
3617
3618 #define DISASM_INST(M, S) \
3619 COMPARE(Sub(v3.M, v4.M, v5.M), "sub v3." S ", v4." S ", v5." S);
3620 NEON_FORMAT_LIST(DISASM_INST)
3621 #undef DISASM_INST
3622
3623 #define DISASM_INST(M, S) \
3624 COMPARE(Sabd(v3.M, v4.M, v5.M), "sabd v3." S ", v4." S ", v5." S);
3625 NEON_FORMAT_LIST_BHS(DISASM_INST)
3626 #undef DISASM_INST
3627
3628 #define DISASM_INST(M, S) \
3629 COMPARE(Uabd(v3.M, v4.M, v5.M), "uabd v3." S ", v4." S ", v5." S);
3630 NEON_FORMAT_LIST_BHS(DISASM_INST)
3631 #undef DISASM_INST
3632
3633 #define DISASM_INST(M, S) \
3634 COMPARE(Saba(v3.M, v4.M, v5.M), "saba v3." S ", v4." S ", v5." S);
3635 NEON_FORMAT_LIST_BHS(DISASM_INST)
3636 #undef DISASM_INST
3637
3638 #define DISASM_INST(M, S) \
3639 COMPARE(Uaba(v3.M, v4.M, v5.M), "uaba v3." S ", v4." S ", v5." S);
3640 NEON_FORMAT_LIST_BHS(DISASM_INST)
3641 #undef DISASM_INST
3642
3643 #define DISASM_INST(M, S) \
3644 COMPARE(Smax(v3.M, v4.M, v5.M), "smax v3." S ", v4." S ", v5." S);
3645 NEON_FORMAT_LIST_BHS(DISASM_INST)
3646 #undef DISASM_INST
3647
3648 #define DISASM_INST(M, S) \
3649 COMPARE(Smin(v3.M, v4.M, v5.M), "smin v3." S ", v4." S ", v5." S);
3650 NEON_FORMAT_LIST_BHS(DISASM_INST)
3651 #undef DISASM_INST
3652
3653 #define DISASM_INST(M, S) \
3654 COMPARE(Umax(v3.M, v4.M, v5.M), "umax v3." S ", v4." S ", v5." S);
3655 NEON_FORMAT_LIST_BHS(DISASM_INST)
3656 #undef DISASM_INST
3657
3658 #define DISASM_INST(M, S) \
3659 COMPARE(Umin(v3.M, v4.M, v5.M), "umin v3." S ", v4." S ", v5." S);
3660 NEON_FORMAT_LIST_BHS(DISASM_INST)
3661 #undef DISASM_INST
3662
3663 #define DISASM_INST(M, S) \
3664 COMPARE(Smaxp(v3.M, v4.M, v5.M), "smaxp v3." S ", v4." S ", v5." S);
3665 NEON_FORMAT_LIST_BHS(DISASM_INST)
3666 #undef DISASM_INST
3667
3668 #define DISASM_INST(M, S) \
3669 COMPARE(Sminp(v3.M, v4.M, v5.M), "sminp v3." S ", v4." S ", v5." S);
3670 NEON_FORMAT_LIST_BHS(DISASM_INST)
3671 #undef DISASM_INST
3672
3673 #define DISASM_INST(M, S) \
3674 COMPARE(Umaxp(v3.M, v4.M, v5.M), "umaxp v3." S ", v4." S ", v5." S);
3675 NEON_FORMAT_LIST_BHS(DISASM_INST)
3676 #undef DISASM_INST
3677
3678 #define DISASM_INST(M, S) \
3679 COMPARE(Uminp(v3.M, v4.M, v5.M), "uminp v3." S ", v4." S ", v5." S);
3680 NEON_FORMAT_LIST_BHS(DISASM_INST)
3681 #undef DISASM_INST
3682
3683 #define DISASM_INST(M, S) \
3684 COMPARE(Uqadd(v6.M, v7.M, v8.M), "uqadd v6." S ", v7." S ", v8." S);
3685 NEON_FORMAT_LIST(DISASM_INST)
3686 #undef DISASM_INST
3687
3688 #define DISASM_INST(M, S) \
3689 COMPARE(Sqadd(v9.M, v10.M, v11.M), "sqadd v9." S ", v10." S ", v11." S);
3690 NEON_FORMAT_LIST(DISASM_INST)
3691 #undef DISASM_INST
3692
3693 #define DISASM_INST(M, S) \
3694 COMPARE(Uqsub(v6.M, v7.M, v8.M), "uqsub v6." S ", v7." S ", v8." S);
3695 NEON_FORMAT_LIST(DISASM_INST)
3696 #undef DISASM_INST
3697
3698 #define DISASM_INST(M, S) \
3699 COMPARE(Sqsub(v9.M, v10.M, v11.M), "sqsub v9." S ", v10." S ", v11." S);
3700 NEON_FORMAT_LIST(DISASM_INST)
3701 #undef DISASM_INST
3702
3703 #define DISASM_INST(M, S) \
3704 COMPARE(Sshl(v12.M, v13.M, v14.M), "sshl v12." S ", v13." S ", v14." S);
3705 NEON_FORMAT_LIST(DISASM_INST)
3706 #undef DISASM_INST
3707
3708 #define DISASM_INST(M, S) \
3709 COMPARE(Ushl(v15.M, v16.M, v17.M), "ushl v15." S ", v16." S ", v17." S);
3710 NEON_FORMAT_LIST(DISASM_INST)
3711 #undef DISASM_INST
3712
3713 #define DISASM_INST(M, S) \
3714 COMPARE(Sqshl(v18.M, v19.M, v20.M), "sqshl v18." S ", v19." S ", v20." S);
3715 NEON_FORMAT_LIST(DISASM_INST)
3716 #undef DISASM_INST
3717
3718 #define DISASM_INST(M, S) \
3719 COMPARE(Uqshl(v21.M, v22.M, v23.M), "uqshl v21." S ", v22." S ", v23." S);
3720 NEON_FORMAT_LIST(DISASM_INST)
3721 #undef DISASM_INST
3722
3723 #define DISASM_INST(M, S) \
3724 COMPARE(Srshl(v24.M, v25.M, v26.M), "srshl v24." S ", v25." S ", v26." S);
3725 NEON_FORMAT_LIST(DISASM_INST)
3726 #undef DISASM_INST
3727
3728 #define DISASM_INST(M, S) \
3729 COMPARE(Urshl(v27.M, v28.M, v29.M), "urshl v27." S ", v28." S ", v29." S);
3730 NEON_FORMAT_LIST(DISASM_INST)
3731 #undef DISASM_INST
3732
3733 #define DISASM_INST(M, S) \
3734 COMPARE(Sqrshl(v30.M, v31.M, v0.M), "sqrshl v30." S ", v31." S ", v0." S);
3735 NEON_FORMAT_LIST(DISASM_INST)
3736 #undef DISASM_INST
3737
3738 #define DISASM_INST(M, S) \
3739 COMPARE(Uqrshl(v1.M, v2.M, v3.M), "uqrshl v1." S ", v2." S ", v3." S);
3740 NEON_FORMAT_LIST(DISASM_INST)
3741 #undef DISASM_INST
3742
3743 #define DISASM_INST(M, S) \
3744 COMPARE(Shadd(v4.M, v5.M, v6.M), "shadd v4." S ", v5." S ", v6." S);
3745 NEON_FORMAT_LIST_BHS(DISASM_INST)
3746 #undef DISASM_INST
3747
3748 #define DISASM_INST(M, S) \
3749 COMPARE(Uhadd(v7.M, v8.M, v9.M), "uhadd v7." S ", v8." S ", v9." S);
3750 NEON_FORMAT_LIST_BHS(DISASM_INST)
3751 #undef DISASM_INST
3752
3753 #define DISASM_INST(M, S) \
3754 COMPARE(Srhadd(v10.M, v11.M, v12.M), "srhadd v10." S ", v11." S ", v12." S);
3755 NEON_FORMAT_LIST_BHS(DISASM_INST)
3756 #undef DISASM_INST
3757
3758 #define DISASM_INST(M, S) \
3759 COMPARE(Urhadd(v13.M, v14.M, v15.M), "urhadd v13." S ", v14." S ", v15." S);
3760 NEON_FORMAT_LIST_BHS(DISASM_INST)
3761 #undef DISASM_INST
3762
3763 #define DISASM_INST(M, S) \
3764 COMPARE(Shsub(v16.M, v17.M, v18.M), "shsub v16." S ", v17." S ", v18." S);
3765 NEON_FORMAT_LIST_BHS(DISASM_INST)
3766 #undef DISASM_INST
3767
3768 #define DISASM_INST(M, S) \
3769 COMPARE(Uhsub(v19.M, v20.M, v21.M), "uhsub v19." S ", v20." S ", v21." S);
3770 NEON_FORMAT_LIST_BHS(DISASM_INST)
3771 #undef DISASM_INST
3772
3773 #define DISASM_INST(M, S) \
3774 COMPARE(Addp(v19.M, v20.M, v21.M), "addp v19." S ", v20." S ", v21." S);
3775 NEON_FORMAT_LIST(DISASM_INST)
3776 #undef DISASM_INST
3777
3778 #define DISASM_INST(M, S) \
3779 COMPARE(Mla(v19.M, v20.M, v21.M), "mla v19." S ", v20." S ", v21." S);
3780 NEON_FORMAT_LIST_BHS(DISASM_INST)
3781 #undef DISASM_INST
3782
3783 #define DISASM_INST(M, S) \
3784 COMPARE(Mls(v19.M, v20.M, v21.M), "mls v19." S ", v20." S ", v21." S);
3785 NEON_FORMAT_LIST_BHS(DISASM_INST)
3786 #undef DISASM_INST
3787
3788 #define DISASM_INST(M, S) \
3789 COMPARE(Mul(v19.M, v20.M, v21.M), "mul v19." S ", v20." S ", v21." S);
3790 NEON_FORMAT_LIST_BHS(DISASM_INST)
3791 #undef DISASM_INST
3792
3793 #define DISASM_INST(M, S) \
3794 COMPARE(Sqdmulh(v1.M, v2.M, v3.M), "sqdmulh v1." S ", v2." S ", v3." S);
3795 NEON_FORMAT_LIST_HS(DISASM_INST)
3796 #undef DISASM_INST
3797
3798 #define DISASM_INST(M, S) \
3799 COMPARE(Sqrdmulh(v1.M, v2.M, v3.M), "sqrdmulh v1." S ", v2." S ", v3." S);
3800 NEON_FORMAT_LIST_HS(DISASM_INST)
3801 #undef DISASM_INST
3802
3803 COMPARE(And(v6.V8B(), v7.V8B(), v8.V8B()), "and v6.8b, v7.8b, v8.8b");
3804 COMPARE(And(v6.V16B(), v7.V16B(), v8.V16B()), "and v6.16b, v7.16b, v8.16b");
3805
3806 COMPARE(Bic(v6.V8B(), v7.V8B(), v8.V8B()), "bic v6.8b, v7.8b, v8.8b");
3807 COMPARE(Bic(v6.V16B(), v7.V16B(), v8.V16B()), "bic v6.16b, v7.16b, v8.16b");
3808
3809 COMPARE(Orr(v6.V8B(), v7.V8B(), v8.V8B()), "orr v6.8b, v7.8b, v8.8b");
3810 COMPARE(Orr(v6.V16B(), v7.V16B(), v8.V16B()), "orr v6.16b, v7.16b, v8.16b");
3811
3812 COMPARE(Orr(v6.V8B(), v7.V8B(), v7.V8B()), "mov v6.8b, v7.8b");
3813 COMPARE(Orr(v6.V16B(), v7.V16B(), v7.V16B()), "mov v6.16b, v7.16b");
3814
3815 COMPARE(Mov(v6.V8B(), v8.V8B()), "mov v6.8b, v8.8b");
3816 COMPARE(Mov(v6.V16B(), v8.V16B()), "mov v6.16b, v8.16b");
3817
3818 COMPARE(Orn(v6.V8B(), v7.V8B(), v8.V8B()), "orn v6.8b, v7.8b, v8.8b");
3819 COMPARE(Orn(v6.V16B(), v7.V16B(), v8.V16B()), "orn v6.16b, v7.16b, v8.16b");
3820
3821 COMPARE(Eor(v6.V8B(), v7.V8B(), v8.V8B()), "eor v6.8b, v7.8b, v8.8b");
3822 COMPARE(Eor(v6.V16B(), v7.V16B(), v8.V16B()), "eor v6.16b, v7.16b, v8.16b");
3823
3824 COMPARE(Bif(v6.V8B(), v7.V8B(), v8.V8B()), "bif v6.8b, v7.8b, v8.8b");
3825 COMPARE(Bif(v6.V16B(), v7.V16B(), v8.V16B()), "bif v6.16b, v7.16b, v8.16b");
3826
3827 COMPARE(Bit(v6.V8B(), v7.V8B(), v8.V8B()), "bit v6.8b, v7.8b, v8.8b");
3828 COMPARE(Bit(v6.V16B(), v7.V16B(), v8.V16B()), "bit v6.16b, v7.16b, v8.16b");
3829
3830 COMPARE(Bsl(v6.V8B(), v7.V8B(), v8.V8B()), "bsl v6.8b, v7.8b, v8.8b");
3831 COMPARE(Bsl(v6.V16B(), v7.V16B(), v8.V16B()), "bsl v6.16b, v7.16b, v8.16b");
3832
3833 COMPARE(Pmul(v6.V8B(), v7.V8B(), v8.V8B()), "pmul v6.8b, v7.8b, v8.8b");
3834 COMPARE(Pmul(v6.V16B(), v7.V16B(), v8.V16B()), "pmul v6.16b, v7.16b, v8.16b");
3835
3836 CLEANUP();
3837}
3838
3839
3840#define NEON_FORMAT_LIST_FP(V) \
3841 V(V2S(), "2s") \
3842 V(V4S(), "4s") \
3843 V(V2D(), "2d")
3844
3845TEST(neon_fp_3same) {
armvixl684cd2a2015-10-23 13:38:33 +01003846 SETUP_MACRO();
armvixl5289c592015-03-02 13:52:04 +00003847
3848 #define DISASM_INST(M, S) \
3849 COMPARE(Fadd(v0.M, v1.M, v2.M), "fadd v0." S ", v1." S ", v2." S);
3850 NEON_FORMAT_LIST_FP(DISASM_INST)
3851 #undef DISASM_INST
3852
3853 #define DISASM_INST(M, S) \
3854 COMPARE(Fsub(v3.M, v4.M, v5.M), "fsub v3." S ", v4." S ", v5." S);
3855 NEON_FORMAT_LIST_FP(DISASM_INST)
3856 #undef DISASM_INST
3857
3858 #define DISASM_INST(M, S) \
3859 COMPARE(Fmul(v6.M, v7.M, v8.M), "fmul v6." S ", v7." S ", v8." S);
3860 NEON_FORMAT_LIST_FP(DISASM_INST)
3861 #undef DISASM_INST
3862
3863 #define DISASM_INST(M, S) \
3864 COMPARE(Fdiv(v9.M, v10.M, v11.M), "fdiv v9." S ", v10." S ", v11." S);
3865 NEON_FORMAT_LIST_FP(DISASM_INST)
3866 #undef DISASM_INST
3867
3868 #define DISASM_INST(M, S) \
3869 COMPARE(Fmin(v12.M, v13.M, v14.M), "fmin v12." S ", v13." S ", v14." S);
3870 NEON_FORMAT_LIST_FP(DISASM_INST)
3871 #undef DISASM_INST
3872
3873 #define DISASM_INST(M, S) \
3874 COMPARE(Fminnm(v15.M, v16.M, v17.M), "fminnm v15." S ", v16." S ", v17." S);
3875 NEON_FORMAT_LIST_FP(DISASM_INST)
3876 #undef DISASM_INST
3877
3878 #define DISASM_INST(M, S) \
3879 COMPARE(Fmax(v18.M, v19.M, v20.M), "fmax v18." S ", v19." S ", v20." S);
3880 NEON_FORMAT_LIST_FP(DISASM_INST)
3881 #undef DISASM_INST
3882
3883 #define DISASM_INST(M, S) \
3884 COMPARE(Fmaxnm(v21.M, v22.M, v23.M), "fmaxnm v21." S ", v22." S ", v23." S);
3885 NEON_FORMAT_LIST_FP(DISASM_INST)
3886 #undef DISASM_INST
3887
3888 #define DISASM_INST(M, S) \
3889 COMPARE(Frecps(v24.M, v25.M, v26.M), "frecps v24." S ", v25." S ", v26." S);
3890 NEON_FORMAT_LIST_FP(DISASM_INST)
3891 #undef DISASM_INST
3892
3893 #define DISASM_INST(M, S) \
3894 COMPARE(Frsqrts(v27.M, v28.M, v29.M), "frsqrts v27." S ", v28." S ", v29." S);
3895 NEON_FORMAT_LIST_FP(DISASM_INST)
3896 #undef DISASM_INST
3897
3898 #define DISASM_INST(M, S) \
3899 COMPARE(Fmulx(v30.M, v31.M, v0.M), "fmulx v30." S ", v31." S ", v0." S);
3900 NEON_FORMAT_LIST_FP(DISASM_INST)
3901 #undef DISASM_INST
3902
3903 #define DISASM_INST(M, S) \
3904 COMPARE(Fmla(v1.M, v2.M, v3.M), "fmla v1." S ", v2." S ", v3." S);
3905 NEON_FORMAT_LIST_FP(DISASM_INST)
3906 #undef DISASM_INST
3907
3908 #define DISASM_INST(M, S) \
3909 COMPARE(Fmls(v4.M, v5.M, v6.M), "fmls v4." S ", v5." S ", v6." S);
3910 NEON_FORMAT_LIST_FP(DISASM_INST)
3911 #undef DISASM_INST
3912
3913 #define DISASM_INST(M, S) \
3914 COMPARE(Fabd(v7.M, v8.M, v9.M), "fabd v7." S ", v8." S ", v9." S);
3915 NEON_FORMAT_LIST_FP(DISASM_INST)
3916 #undef DISASM_INST
3917
3918 #define DISASM_INST(M, S) \
3919 COMPARE(Faddp(v10.M, v11.M, v12.M), "faddp v10." S ", v11." S ", v12." S);
3920 NEON_FORMAT_LIST_FP(DISASM_INST)
3921 #undef DISASM_INST
3922
3923 #define DISASM_INST(M, S) \
3924 COMPARE(Fmaxp(v13.M, v14.M, v15.M), "fmaxp v13." S ", v14." S ", v15." S);
3925 NEON_FORMAT_LIST_FP(DISASM_INST)
3926 #undef DISASM_INST
3927
3928 #define DISASM_INST(M, S) \
3929 COMPARE(Fminp(v16.M, v17.M, v18.M), "fminp v16." S ", v17." S ", v18." S);
3930 NEON_FORMAT_LIST_FP(DISASM_INST)
3931 #undef DISASM_INST
3932
3933 #define DISASM_INST(M, S) \
3934 COMPARE(Fmaxnmp(v19.M, v20.M, v21.M), "fmaxnmp v19." S ", v20." S ", v21." S);
3935 NEON_FORMAT_LIST_FP(DISASM_INST)
3936 #undef DISASM_INST
3937
3938 #define DISASM_INST(M, S) \
3939 COMPARE(Fminnmp(v22.M, v23.M, v24.M), "fminnmp v22." S ", v23." S ", v24." S);
3940 NEON_FORMAT_LIST_FP(DISASM_INST)
3941 #undef DISASM_INST
3942
3943 #define DISASM_INST(M, S) \
3944 COMPARE(Fcmeq(v25.M, v26.M, v27.M), "fcmeq v25." S ", v26." S ", v27." S);
3945 NEON_FORMAT_LIST_FP(DISASM_INST)
3946 #undef DISASM_INST
3947
3948 #define DISASM_INST(M, S) \
3949 COMPARE(Fcmge(v25.M, v26.M, v27.M), "fcmge v25." S ", v26." S ", v27." S);
3950 NEON_FORMAT_LIST_FP(DISASM_INST)
3951 #undef DISASM_INST
3952
3953 #define DISASM_INST(M, S) \
3954 COMPARE(Fcmgt(v25.M, v26.M, v27.M), "fcmgt v25." S ", v26." S ", v27." S);
3955 NEON_FORMAT_LIST_FP(DISASM_INST)
3956 #undef DISASM_INST
3957
3958 #define DISASM_INST(M, S) \
3959 COMPARE(Facge(v25.M, v26.M, v27.M), "facge v25." S ", v26." S ", v27." S);
3960 NEON_FORMAT_LIST_FP(DISASM_INST)
3961 #undef DISASM_INST
3962
3963 #define DISASM_INST(M, S) \
3964 COMPARE(Facgt(v25.M, v26.M, v27.M), "facgt v25." S ", v26." S ", v27." S);
3965 NEON_FORMAT_LIST_FP(DISASM_INST)
3966 #undef DISASM_INST
3967
3968 CLEANUP();
3969}
3970
3971
3972#define NEON_SCALAR_FORMAT_LIST(V) \
3973 V(B(), "b") \
3974 V(H(), "h") \
3975 V(S(), "s") \
3976 V(D(), "d")
3977
3978TEST(neon_scalar_3same) {
armvixl684cd2a2015-10-23 13:38:33 +01003979 SETUP_MACRO();
armvixl5289c592015-03-02 13:52:04 +00003980
3981 // Instructions that only support D-sized scalar operations.
3982 COMPARE(Add(v0.D(), v1.D(), v2.D()), "add d0, d1, d2");
3983 COMPARE(Sub(v3.D(), v4.D(), v5.D()), "sub d3, d4, d5");
3984 COMPARE(Cmeq(v0.D(), v1.D(), v2.D()), "cmeq d0, d1, d2");
3985 COMPARE(Cmge(v3.D(), v4.D(), v5.D()), "cmge d3, d4, d5");
3986 COMPARE(Cmgt(v6.D(), v7.D(), v8.D()), "cmgt d6, d7, d8");
3987 COMPARE(Cmhi(v0.D(), v1.D(), v2.D()), "cmhi d0, d1, d2");
3988 COMPARE(Cmhs(v3.D(), v4.D(), v5.D()), "cmhs d3, d4, d5");
3989 COMPARE(Cmtst(v6.D(), v7.D(), v8.D()), "cmtst d6, d7, d8");
3990 COMPARE(Ushl(v6.D(), v7.D(), v8.D()), "ushl d6, d7, d8");
3991 COMPARE(Sshl(v6.D(), v7.D(), v8.D()), "sshl d6, d7, d8");
3992 COMPARE(Urshl(v9.D(), v10.D(), v11.D()), "urshl d9, d10, d11");
3993 COMPARE(Srshl(v9.D(), v10.D(), v11.D()), "srshl d9, d10, d11");
3994
3995 // Instructions that support S and D-sized scalar operations.
3996 COMPARE(Frecps(v12.S(), v13.S(), v14.S()), "frecps s12, s13, s14");
3997 COMPARE(Frecps(v15.D(), v16.D(), v17.D()), "frecps d15, d16, d17");
3998 COMPARE(Frsqrts(v18.S(), v19.S(), v20.S()), "frsqrts s18, s19, s20");
3999 COMPARE(Frsqrts(v21.D(), v22.D(), v23.D()), "frsqrts d21, d22, d23");
4000 COMPARE(Fmulx(v12.S(), v13.S(), v14.S()), "fmulx s12, s13, s14");
4001 COMPARE(Fmulx(v15.D(), v16.D(), v17.D()), "fmulx d15, d16, d17");
4002 COMPARE(Fcmeq(v12.S(), v13.S(), v14.S()), "fcmeq s12, s13, s14");
4003 COMPARE(Fcmeq(v15.D(), v16.D(), v17.D()), "fcmeq d15, d16, d17");
4004 COMPARE(Fcmge(v12.S(), v13.S(), v14.S()), "fcmge s12, s13, s14");
4005 COMPARE(Fcmge(v15.D(), v16.D(), v17.D()), "fcmge d15, d16, d17");
4006 COMPARE(Fcmgt(v12.S(), v13.S(), v14.S()), "fcmgt s12, s13, s14");
4007 COMPARE(Fcmgt(v15.D(), v16.D(), v17.D()), "fcmgt d15, d16, d17");
4008 COMPARE(Fcmge(v12.S(), v13.S(), v14.S()), "fcmge s12, s13, s14");
4009 COMPARE(Fcmge(v15.D(), v16.D(), v17.D()), "fcmge d15, d16, d17");
4010 COMPARE(Facgt(v12.S(), v13.S(), v14.S()), "facgt s12, s13, s14");
4011 COMPARE(Facgt(v15.D(), v16.D(), v17.D()), "facgt d15, d16, d17");
4012
4013 // Instructions that support H and S-sized scalar operations.
4014 COMPARE(Sqdmulh(v12.S(), v13.S(), v14.S()), "sqdmulh s12, s13, s14");
4015 COMPARE(Sqdmulh(v15.H(), v16.H(), v17.H()), "sqdmulh h15, h16, h17");
4016 COMPARE(Sqrdmulh(v12.S(), v13.S(), v14.S()), "sqrdmulh s12, s13, s14");
4017 COMPARE(Sqrdmulh(v15.H(), v16.H(), v17.H()), "sqrdmulh h15, h16, h17");
4018
4019 #define DISASM_INST(M, R) \
4020 COMPARE(Uqadd(v6.M, v7.M, v8.M), "uqadd " R "6, " R "7, " R "8");
4021 NEON_SCALAR_FORMAT_LIST(DISASM_INST)
4022 #undef DISASM_INST
4023
4024 #define DISASM_INST(M, R) \
4025 COMPARE(Uqsub(v9.M, v10.M, v11.M), "uqsub " R "9, " R "10, " R "11");
4026 NEON_SCALAR_FORMAT_LIST(DISASM_INST)
4027 #undef DISASM_INST
4028
4029 #define DISASM_INST(M, R) \
4030 COMPARE(Sqadd(v12.M, v13.M, v14.M), "sqadd " R "12, " R "13, " R "14");
4031 NEON_SCALAR_FORMAT_LIST(DISASM_INST)
4032 #undef DISASM_INST
4033
4034 #define DISASM_INST(M, R) \
4035 COMPARE(Sqsub(v15.M, v16.M, v17.M), "sqsub " R "15, " R "16, " R "17");
4036 NEON_SCALAR_FORMAT_LIST(DISASM_INST)
4037 #undef DISASM_INST
4038
4039 #define DISASM_INST(M, R) \
4040 COMPARE(Uqshl(v18.M, v19.M, v20.M), "uqshl " R "18, " R "19, " R "20");
4041 NEON_SCALAR_FORMAT_LIST(DISASM_INST)
4042 #undef DISASM_INST
4043
4044 #define DISASM_INST(M, R) \
4045 COMPARE(Sqshl(v21.M, v22.M, v23.M), "sqshl " R "21, " R "22, " R "23");
4046 NEON_SCALAR_FORMAT_LIST(DISASM_INST)
4047 #undef DISASM_INST
4048
4049 #define DISASM_INST(M, R) \
4050 COMPARE(Uqrshl(v30.M, v31.M, v0.M), "uqrshl " R "30, " R "31, " R "0");
4051 NEON_SCALAR_FORMAT_LIST(DISASM_INST)
4052 #undef DISASM_INST
4053
4054 #define DISASM_INST(M, R) \
4055 COMPARE(Sqrshl(v1.M, v2.M, v3.M), "sqrshl " R "1, " R "2, " R "3");
4056 NEON_SCALAR_FORMAT_LIST(DISASM_INST)
4057 #undef DISASM_INST
4058
4059 CLEANUP();
4060}
4061
4062
4063TEST(neon_byelement) {
armvixl684cd2a2015-10-23 13:38:33 +01004064 SETUP_MACRO();
armvixl5289c592015-03-02 13:52:04 +00004065
4066 COMPARE(Mul(v0.V4H(), v1.V4H(), v2.H(), 0), "mul v0.4h, v1.4h, v2.h[0]");
4067 COMPARE(Mul(v2.V8H(), v3.V8H(), v15.H(), 7), "mul v2.8h, v3.8h, v15.h[7]");
4068 COMPARE(Mul(v0.V2S(), v1.V2S(), v2.S(), 0), "mul v0.2s, v1.2s, v2.s[0]");
4069 COMPARE(Mul(v2.V4S(), v3.V4S(), v15.S(), 3), "mul v2.4s, v3.4s, v15.s[3]");
4070
4071 COMPARE(Mla(v0.V4H(), v1.V4H(), v2.H(), 0), "mla v0.4h, v1.4h, v2.h[0]");
4072 COMPARE(Mla(v2.V8H(), v3.V8H(), v15.H(), 7), "mla v2.8h, v3.8h, v15.h[7]");
4073 COMPARE(Mla(v0.V2S(), v1.V2S(), v2.S(), 0), "mla v0.2s, v1.2s, v2.s[0]");
4074 COMPARE(Mla(v2.V4S(), v3.V4S(), v15.S(), 3), "mla v2.4s, v3.4s, v15.s[3]");
4075
4076 COMPARE(Mls(v0.V4H(), v1.V4H(), v2.H(), 0), "mls v0.4h, v1.4h, v2.h[0]");
4077 COMPARE(Mls(v2.V8H(), v3.V8H(), v15.H(), 7), "mls v2.8h, v3.8h, v15.h[7]");
4078 COMPARE(Mls(v0.V2S(), v1.V2S(), v2.S(), 0), "mls v0.2s, v1.2s, v2.s[0]");
4079 COMPARE(Mls(v2.V4S(), v3.V4S(), v15.S(), 3), "mls v2.4s, v3.4s, v15.s[3]");
4080
4081 COMPARE(Sqdmulh(v0.V4H(), v1.V4H(), v2.H(), 0),
4082 "sqdmulh v0.4h, v1.4h, v2.h[0]");
4083 COMPARE(Sqdmulh(v2.V8H(), v3.V8H(), v15.H(), 7),
4084 "sqdmulh v2.8h, v3.8h, v15.h[7]");
4085 COMPARE(Sqdmulh(v0.V2S(), v1.V2S(), v2.S(), 0),
4086 "sqdmulh v0.2s, v1.2s, v2.s[0]");
4087 COMPARE(Sqdmulh(v2.V4S(), v3.V4S(), v15.S(), 3),
4088 "sqdmulh v2.4s, v3.4s, v15.s[3]");
4089 COMPARE(Sqdmulh(h0, h1, v2.H(), 0), "sqdmulh h0, h1, v2.h[0]");
4090 COMPARE(Sqdmulh(s0, s1, v2.S(), 0), "sqdmulh s0, s1, v2.s[0]");
4091
4092 COMPARE(Sqrdmulh(v0.V4H(), v1.V4H(), v2.H(), 0),
4093 "sqrdmulh v0.4h, v1.4h, v2.h[0]");
4094 COMPARE(Sqrdmulh(v2.V8H(), v3.V8H(), v15.H(), 7),
4095 "sqrdmulh v2.8h, v3.8h, v15.h[7]");
4096 COMPARE(Sqrdmulh(v0.V2S(), v1.V2S(), v2.S(), 0),
4097 "sqrdmulh v0.2s, v1.2s, v2.s[0]");
4098 COMPARE(Sqrdmulh(v2.V4S(), v3.V4S(), v15.S(), 3),
4099 "sqrdmulh v2.4s, v3.4s, v15.s[3]");
4100 COMPARE(Sqrdmulh(h0, h1, v2.H(), 0), "sqrdmulh h0, h1, v2.h[0]");
4101 COMPARE(Sqrdmulh(s0, s1, v2.S(), 0), "sqrdmulh s0, s1, v2.s[0]");
4102
4103 COMPARE(Smull(v0.V4S(), v1.V4H(), v2.H(), 0), "smull v0.4s, v1.4h, v2.h[0]");
4104 COMPARE(Smull2(v2.V4S(), v3.V8H(), v4.H(), 7),
4105 "smull2 v2.4s, v3.8h, v4.h[7]");
4106 COMPARE(Smull(v0.V2D(), v1.V2S(), v2.S(), 0), "smull v0.2d, v1.2s, v2.s[0]");
4107 COMPARE(Smull2(v2.V2D(), v3.V4S(), v4.S(), 3),
4108 "smull2 v2.2d, v3.4s, v4.s[3]");
4109
4110 COMPARE(Umull(v0.V4S(), v1.V4H(), v2.H(), 0), "umull v0.4s, v1.4h, v2.h[0]");
4111 COMPARE(Umull2(v2.V4S(), v3.V8H(), v4.H(), 7),
4112 "umull2 v2.4s, v3.8h, v4.h[7]");
4113 COMPARE(Umull(v0.V2D(), v1.V2S(), v2.S(), 0), "umull v0.2d, v1.2s, v2.s[0]");
4114 COMPARE(Umull2(v2.V2D(), v3.V4S(), v4.S(), 3),
4115 "umull2 v2.2d, v3.4s, v4.s[3]");
4116
4117 COMPARE(Smlal(v0.V4S(), v1.V4H(), v2.H(), 0), "smlal v0.4s, v1.4h, v2.h[0]");
4118 COMPARE(Smlal2(v2.V4S(), v3.V8H(), v4.H(), 7),
4119 "smlal2 v2.4s, v3.8h, v4.h[7]");
4120 COMPARE(Smlal(v0.V2D(), v1.V2S(), v2.S(), 0), "smlal v0.2d, v1.2s, v2.s[0]");
4121 COMPARE(Smlal2(v2.V2D(), v3.V4S(), v4.S(), 3),
4122 "smlal2 v2.2d, v3.4s, v4.s[3]");
4123
4124 COMPARE(Umlal(v0.V4S(), v1.V4H(), v2.H(), 0), "umlal v0.4s, v1.4h, v2.h[0]");
4125 COMPARE(Umlal2(v2.V4S(), v3.V8H(), v4.H(), 7),
4126 "umlal2 v2.4s, v3.8h, v4.h[7]");
4127 COMPARE(Umlal(v0.V2D(), v1.V2S(), v2.S(), 0), "umlal v0.2d, v1.2s, v2.s[0]");
4128 COMPARE(Umlal2(v2.V2D(), v3.V4S(), v4.S(), 3),
4129 "umlal2 v2.2d, v3.4s, v4.s[3]");
4130
4131 COMPARE(Smlsl(v0.V4S(), v1.V4H(), v2.H(), 0), "smlsl v0.4s, v1.4h, v2.h[0]");
4132 COMPARE(Smlsl2(v2.V4S(), v3.V8H(), v4.H(), 7),
4133 "smlsl2 v2.4s, v3.8h, v4.h[7]");
4134 COMPARE(Smlsl(v0.V2D(), v1.V2S(), v2.S(), 0), "smlsl v0.2d, v1.2s, v2.s[0]");
4135 COMPARE(Smlsl2(v2.V2D(), v3.V4S(), v4.S(), 3),
4136 "smlsl2 v2.2d, v3.4s, v4.s[3]");
4137
4138 COMPARE(Umlsl(v0.V4S(), v1.V4H(), v2.H(), 0), "umlsl v0.4s, v1.4h, v2.h[0]");
4139 COMPARE(Umlsl2(v2.V4S(), v3.V8H(), v4.H(), 7),
4140 "umlsl2 v2.4s, v3.8h, v4.h[7]");
4141 COMPARE(Umlsl(v0.V2D(), v1.V2S(), v2.S(), 0), "umlsl v0.2d, v1.2s, v2.s[0]");
4142 COMPARE(Umlsl2(v2.V2D(), v3.V4S(), v4.S(), 3),
4143 "umlsl2 v2.2d, v3.4s, v4.s[3]");
4144
4145 COMPARE(Sqdmull(v0.V4S(), v1.V4H(), v2.H(), 0),
4146 "sqdmull v0.4s, v1.4h, v2.h[0]");
4147 COMPARE(Sqdmull2(v2.V4S(), v3.V8H(), v4.H(), 7),
4148 "sqdmull2 v2.4s, v3.8h, v4.h[7]");
4149 COMPARE(Sqdmull(v0.V2D(), v1.V2S(), v2.S(), 0),
4150 "sqdmull v0.2d, v1.2s, v2.s[0]");
4151 COMPARE(Sqdmull2(v2.V2D(), v3.V4S(), v4.S(), 3),
4152 "sqdmull2 v2.2d, v3.4s, v4.s[3]");
4153 COMPARE(Sqdmull(s0, h1, v2.H(), 0), "sqdmull s0, h1, v2.h[0]");
4154 COMPARE(Sqdmull(d0, s1, v2.S(), 0), "sqdmull d0, s1, v2.s[0]");
4155
4156 COMPARE(Sqdmlal(v0.V4S(), v1.V4H(), v2.H(), 0),
4157 "sqdmlal v0.4s, v1.4h, v2.h[0]");
4158 COMPARE(Sqdmlal2(v2.V4S(), v3.V8H(), v4.H(), 7),
4159 "sqdmlal2 v2.4s, v3.8h, v4.h[7]");
4160 COMPARE(Sqdmlal(v0.V2D(), v1.V2S(), v2.S(), 0),
4161 "sqdmlal v0.2d, v1.2s, v2.s[0]");
4162 COMPARE(Sqdmlal2(v2.V2D(), v3.V4S(), v4.S(), 3),
4163 "sqdmlal2 v2.2d, v3.4s, v4.s[3]");
4164 COMPARE(Sqdmlal(s0, h1, v2.H(), 0), "sqdmlal s0, h1, v2.h[0]");
4165 COMPARE(Sqdmlal(d0, s1, v2.S(), 0), "sqdmlal d0, s1, v2.s[0]");
4166
4167 COMPARE(Sqdmlsl(v0.V4S(), v1.V4H(), v2.H(), 0),
4168 "sqdmlsl v0.4s, v1.4h, v2.h[0]");
4169 COMPARE(Sqdmlsl2(v2.V4S(), v3.V8H(), v4.H(), 7),
4170 "sqdmlsl2 v2.4s, v3.8h, v4.h[7]");
4171 COMPARE(Sqdmlsl(v0.V2D(), v1.V2S(), v2.S(), 0),
4172 "sqdmlsl v0.2d, v1.2s, v2.s[0]");
4173 COMPARE(Sqdmlsl2(v2.V2D(), v3.V4S(), v4.S(), 3),
4174 "sqdmlsl2 v2.2d, v3.4s, v4.s[3]");
4175 COMPARE(Sqdmlsl(s0, h1, v2.H(), 0), "sqdmlsl s0, h1, v2.h[0]");
4176 COMPARE(Sqdmlsl(d0, s1, v2.S(), 0), "sqdmlsl d0, s1, v2.s[0]");
4177
4178 CLEANUP();
4179}
4180
4181
4182TEST(neon_fp_byelement) {
armvixl684cd2a2015-10-23 13:38:33 +01004183 SETUP_MACRO();
armvixl5289c592015-03-02 13:52:04 +00004184
4185 COMPARE(Fmul(v0.V2S(), v1.V2S(), v2.S(), 0), "fmul v0.2s, v1.2s, v2.s[0]");
4186 COMPARE(Fmul(v2.V4S(), v3.V4S(), v15.S(), 3), "fmul v2.4s, v3.4s, v15.s[3]");
4187 COMPARE(Fmul(v0.V2D(), v1.V2D(), v2.D(), 0), "fmul v0.2d, v1.2d, v2.d[0]");
4188 COMPARE(Fmul(d0, d1, v2.D(), 0), "fmul d0, d1, v2.d[0]");
4189 COMPARE(Fmul(s0, s1, v2.S(), 0), "fmul s0, s1, v2.s[0]");
4190
4191 COMPARE(Fmla(v0.V2S(), v1.V2S(), v2.S(), 0), "fmla v0.2s, v1.2s, v2.s[0]");
4192 COMPARE(Fmla(v2.V4S(), v3.V4S(), v15.S(), 3), "fmla v2.4s, v3.4s, v15.s[3]");
4193 COMPARE(Fmla(v0.V2D(), v1.V2D(), v2.D(), 0), "fmla v0.2d, v1.2d, v2.d[0]");
4194 COMPARE(Fmla(d0, d1, v2.D(), 0), "fmla d0, d1, v2.d[0]");
4195 COMPARE(Fmla(s0, s1, v2.S(), 0), "fmla s0, s1, v2.s[0]");
4196
4197 COMPARE(Fmls(v0.V2S(), v1.V2S(), v2.S(), 0), "fmls v0.2s, v1.2s, v2.s[0]");
4198 COMPARE(Fmls(v2.V4S(), v3.V4S(), v15.S(), 3), "fmls v2.4s, v3.4s, v15.s[3]");
4199 COMPARE(Fmls(v0.V2D(), v1.V2D(), v2.D(), 0), "fmls v0.2d, v1.2d, v2.d[0]");
4200 COMPARE(Fmls(d0, d1, v2.D(), 0), "fmls d0, d1, v2.d[0]");
4201 COMPARE(Fmls(s0, s1, v2.S(), 0), "fmls s0, s1, v2.s[0]");
4202
4203 COMPARE(Fmulx(v0.V2S(), v1.V2S(), v2.S(), 0), "fmulx v0.2s, v1.2s, v2.s[0]");
4204 COMPARE(Fmulx(v2.V4S(), v3.V4S(), v8.S(), 3), "fmulx v2.4s, v3.4s, v8.s[3]");
4205 COMPARE(Fmulx(v0.V2D(), v1.V2D(), v2.D(), 0), "fmulx v0.2d, v1.2d, v2.d[0]");
4206 COMPARE(Fmulx(d0, d1, v2.D(), 0), "fmulx d0, d1, v2.d[0]");
4207 COMPARE(Fmulx(s0, s1, v2.S(), 0), "fmulx s0, s1, v2.s[0]");
4208
4209 CLEANUP();
4210}
4211
4212
4213TEST(neon_3different) {
armvixl684cd2a2015-10-23 13:38:33 +01004214 SETUP_MACRO();
armvixl5289c592015-03-02 13:52:04 +00004215
4216 #define DISASM_INST(TA, TAS, TB, TBS) \
4217 COMPARE(Uaddl(v0.TA, v1.TB, v2.TB), "uaddl v0." TAS ", v1." TBS ", v2." TBS);
4218 NEON_FORMAT_LIST_LW(DISASM_INST)
4219 #undef DISASM_INST
4220
4221 #define DISASM_INST(TA, TAS, TB, TBS) \
4222 COMPARE(Uaddl2(v0.TA, v1.TB, v2.TB), \
4223 "uaddl2 v0." TAS ", v1." TBS ", v2." TBS);
4224 NEON_FORMAT_LIST_LW2(DISASM_INST)
4225 #undef DISASM_INST
4226
4227 #define DISASM_INST(TA, TAS, TB, TBS) \
4228 COMPARE(Uaddw(v0.TA, v1.TA, v2.TB), "uaddw v0." TAS ", v1." TAS ", v2." TBS);
4229 NEON_FORMAT_LIST_LW(DISASM_INST)
4230 #undef DISASM_INST
4231
4232 #define DISASM_INST(TA, TAS, TB, TBS) \
4233 COMPARE(Uaddw2(v0.TA, v1.TA, v2.TB), \
4234 "uaddw2 v0." TAS ", v1." TAS ", v2." TBS);
4235 NEON_FORMAT_LIST_LW2(DISASM_INST)
4236 #undef DISASM_INST
4237
4238 #define DISASM_INST(TA, TAS, TB, TBS) \
4239 COMPARE(Saddl(v0.TA, v1.TB, v2.TB), "saddl v0." TAS ", v1." TBS ", v2." TBS);
4240 NEON_FORMAT_LIST_LW(DISASM_INST)
4241 #undef DISASM_INST
4242
4243 #define DISASM_INST(TA, TAS, TB, TBS) \
4244 COMPARE(Saddl2(v0.TA, v1.TB, v2.TB), \
4245 "saddl2 v0." TAS ", v1." TBS ", v2." TBS);
4246 NEON_FORMAT_LIST_LW2(DISASM_INST)
4247 #undef DISASM_INST
4248
4249 #define DISASM_INST(TA, TAS, TB, TBS) \
4250 COMPARE(Saddw(v0.TA, v1.TA, v2.TB), "saddw v0." TAS ", v1." TAS ", v2." TBS);
4251 NEON_FORMAT_LIST_LW(DISASM_INST)
4252 #undef DISASM_INST
4253
4254 #define DISASM_INST(TA, TAS, TB, TBS) \
4255 COMPARE(Saddw2(v0.TA, v1.TA, v2.TB), \
4256 "saddw2 v0." TAS ", v1." TAS ", v2." TBS);
4257 NEON_FORMAT_LIST_LW2(DISASM_INST)
4258 #undef DISASM_INST
4259
4260 #define DISASM_INST(TA, TAS, TB, TBS) \
4261 COMPARE(Usubl(v0.TA, v1.TB, v2.TB), "usubl v0." TAS ", v1." TBS ", v2." TBS);
4262 NEON_FORMAT_LIST_LW(DISASM_INST)
4263 #undef DISASM_INST
4264
4265 #define DISASM_INST(TA, TAS, TB, TBS) \
4266 COMPARE(Usubl2(v0.TA, v1.TB, v2.TB), \
4267 "usubl2 v0." TAS ", v1." TBS ", v2." TBS);
4268 NEON_FORMAT_LIST_LW2(DISASM_INST)
4269 #undef DISASM_INST
4270
4271 #define DISASM_INST(TA, TAS, TB, TBS) \
4272 COMPARE(Usubw(v0.TA, v1.TA, v2.TB), "usubw v0." TAS ", v1." TAS ", v2." TBS);
4273 NEON_FORMAT_LIST_LW(DISASM_INST)
4274 #undef DISASM_INST
4275
4276 #define DISASM_INST(TA, TAS, TB, TBS) \
4277 COMPARE(Usubw2(v0.TA, v1.TA, v2.TB), \
4278 "usubw2 v0." TAS ", v1." TAS ", v2." TBS);
4279 NEON_FORMAT_LIST_LW2(DISASM_INST)
4280 #undef DISASM_INST
4281
4282 #define DISASM_INST(TA, TAS, TB, TBS) \
4283 COMPARE(Ssubl(v0.TA, v1.TB, v2.TB), "ssubl v0." TAS ", v1." TBS ", v2." TBS);
4284 NEON_FORMAT_LIST_LW(DISASM_INST)
4285 #undef DISASM_INST
4286
4287 #define DISASM_INST(TA, TAS, TB, TBS) \
4288 COMPARE(Ssubl2(v0.TA, v1.TB, v2.TB), \
4289 "ssubl2 v0." TAS ", v1." TBS ", v2." TBS);
4290 NEON_FORMAT_LIST_LW2(DISASM_INST)
4291 #undef DISASM_INST
4292
4293 #define DISASM_INST(TA, TAS, TB, TBS) \
4294 COMPARE(Ssubw(v0.TA, v1.TA, v2.TB), "ssubw v0." TAS ", v1." TAS ", v2." TBS);
4295 NEON_FORMAT_LIST_LW(DISASM_INST)
4296 #undef DISASM_INST
4297
4298 #define DISASM_INST(TA, TAS, TB, TBS) \
4299 COMPARE(Ssubw2(v0.TA, v1.TA, v2.TB), \
4300 "ssubw2 v0." TAS ", v1." TAS ", v2." TBS);
4301 NEON_FORMAT_LIST_LW2(DISASM_INST)
4302 #undef DISASM_INST
4303
4304 #define DISASM_INST(TA, TAS, TB, TBS) \
4305 COMPARE(Sabal(v0.TA, v1.TB, v2.TB), "sabal v0." TAS ", v1." TBS ", v2." TBS);
4306 NEON_FORMAT_LIST_LW(DISASM_INST)
4307 #undef DISASM_INST
4308
4309 #define DISASM_INST(TA, TAS, TB, TBS) \
4310 COMPARE(Sabal2(v0.TA, v1.TB, v2.TB), \
4311 "sabal2 v0." TAS ", v1." TBS ", v2." TBS);
4312 NEON_FORMAT_LIST_LW2(DISASM_INST)
4313 #undef DISASM_INST
4314
4315 #define DISASM_INST(TA, TAS, TB, TBS) \
4316 COMPARE(Uabal(v0.TA, v1.TB, v2.TB), "uabal v0." TAS ", v1." TBS ", v2." TBS);
4317 NEON_FORMAT_LIST_LW(DISASM_INST)
4318 #undef DISASM_INST
4319
4320 #define DISASM_INST(TA, TAS, TB, TBS) \
4321 COMPARE(Uabal2(v0.TA, v1.TB, v2.TB), \
4322 "uabal2 v0." TAS ", v1." TBS ", v2." TBS);
4323 NEON_FORMAT_LIST_LW2(DISASM_INST)
4324 #undef DISASM_INST
4325
4326 #define DISASM_INST(TA, TAS, TB, TBS) \
4327 COMPARE(Sabdl(v0.TA, v1.TB, v2.TB), "sabdl v0." TAS ", v1." TBS ", v2." TBS);
4328 NEON_FORMAT_LIST_LW(DISASM_INST)
4329 #undef DISASM_INST
4330
4331 #define DISASM_INST(TA, TAS, TB, TBS) \
4332 COMPARE(Sabdl2(v0.TA, v1.TB, v2.TB), \
4333 "sabdl2 v0." TAS ", v1." TBS ", v2." TBS);
4334 NEON_FORMAT_LIST_LW2(DISASM_INST)
4335 #undef DISASM_INST
4336
4337 #define DISASM_INST(TA, TAS, TB, TBS) \
4338 COMPARE(Uabdl(v0.TA, v1.TB, v2.TB), "uabdl v0." TAS ", v1." TBS ", v2." TBS);
4339 NEON_FORMAT_LIST_LW(DISASM_INST)
4340 #undef DISASM_INST
4341
4342 #define DISASM_INST(TA, TAS, TB, TBS) \
4343 COMPARE(Uabdl2(v0.TA, v1.TB, v2.TB), \
4344 "uabdl2 v0." TAS ", v1." TBS ", v2." TBS);
4345 NEON_FORMAT_LIST_LW2(DISASM_INST)
4346 #undef DISASM_INST
4347
4348 #define DISASM_INST(TA, TAS, TB, TBS) \
4349 COMPARE(Smlal(v0.TA, v1.TB, v2.TB), "smlal v0." TAS ", v1." TBS ", v2." TBS);
4350 NEON_FORMAT_LIST_LW(DISASM_INST)
4351 #undef DISASM_INST
4352
4353 #define DISASM_INST(TA, TAS, TB, TBS) \
4354 COMPARE(Smlal2(v0.TA, v1.TB, v2.TB), \
4355 "smlal2 v0." TAS ", v1." TBS ", v2." TBS);
4356 NEON_FORMAT_LIST_LW2(DISASM_INST)
4357 #undef DISASM_INST
4358
4359 #define DISASM_INST(TA, TAS, TB, TBS) \
4360 COMPARE(Umlsl(v0.TA, v1.TB, v2.TB), "umlsl v0." TAS ", v1." TBS ", v2." TBS);
4361 NEON_FORMAT_LIST_LW(DISASM_INST)
4362 #undef DISASM_INST
4363
4364 #define DISASM_INST(TA, TAS, TB, TBS) \
4365 COMPARE(Umlsl2(v0.TA, v1.TB, v2.TB), \
4366 "umlsl2 v0." TAS ", v1." TBS ", v2." TBS);
4367 NEON_FORMAT_LIST_LW2(DISASM_INST)
4368 #undef DISASM_INST
4369
4370 #define DISASM_INST(TA, TAS, TB, TBS) \
4371 COMPARE(Smlsl(v0.TA, v1.TB, v2.TB), "smlsl v0." TAS ", v1." TBS ", v2." TBS);
4372 NEON_FORMAT_LIST_LW(DISASM_INST)
4373 #undef DISASM_INST
4374
4375 #define DISASM_INST(TA, TAS, TB, TBS) \
4376 COMPARE(Smlsl2(v0.TA, v1.TB, v2.TB), \
4377 "smlsl2 v0." TAS ", v1." TBS ", v2." TBS);
4378 NEON_FORMAT_LIST_LW2(DISASM_INST)
4379 #undef DISASM_INST
4380
4381 #define DISASM_INST(TA, TAS, TB, TBS) \
4382 COMPARE(Umlsl(v0.TA, v1.TB, v2.TB), "umlsl v0." TAS ", v1." TBS ", v2." TBS);
4383 NEON_FORMAT_LIST_LW(DISASM_INST)
4384 #undef DISASM_INST
4385
4386 #define DISASM_INST(TA, TAS, TB, TBS) \
4387 COMPARE(Umlsl2(v0.TA, v1.TB, v2.TB), \
4388 "umlsl2 v0." TAS ", v1." TBS ", v2." TBS);
4389 NEON_FORMAT_LIST_LW2(DISASM_INST)
4390 #undef DISASM_INST
4391
4392 #define DISASM_INST(TA, TAS, TB, TBS) \
4393 COMPARE(Smull(v0.TA, v1.TB, v2.TB), "smull v0." TAS ", v1." TBS ", v2." TBS);
4394 NEON_FORMAT_LIST_LW(DISASM_INST)
4395 #undef DISASM_INST
4396
4397 #define DISASM_INST(TA, TAS, TB, TBS) \
4398 COMPARE(Smull2(v0.TA, v1.TB, v2.TB), \
4399 "smull2 v0." TAS ", v1." TBS ", v2." TBS);
4400 NEON_FORMAT_LIST_LW2(DISASM_INST)
4401 #undef DISASM_INST
4402
4403 #define DISASM_INST(TA, TAS, TB, TBS) \
4404 COMPARE(Umull(v0.TA, v1.TB, v2.TB), "umull v0." TAS ", v1." TBS ", v2." TBS);
4405 NEON_FORMAT_LIST_LW(DISASM_INST)
4406 #undef DISASM_INST
4407
4408 #define DISASM_INST(TA, TAS, TB, TBS) \
4409 COMPARE(Umull2(v0.TA, v1.TB, v2.TB), \
4410 "umull2 v0." TAS ", v1." TBS ", v2." TBS);
4411 NEON_FORMAT_LIST_LW2(DISASM_INST)
4412 #undef DISASM_INST
4413
4414 COMPARE(Sqdmull(v0.V4S(), v1.V4H(), v2.V4H()), "sqdmull v0.4s, v1.4h, v2.4h");
4415 COMPARE(Sqdmull(v1.V2D(), v2.V2S(), v3.V2S()), "sqdmull v1.2d, v2.2s, v3.2s");
4416 COMPARE(Sqdmull2(v2.V4S(), v3.V8H(), v4.V8H()),
4417 "sqdmull2 v2.4s, v3.8h, v4.8h");
4418 COMPARE(Sqdmull2(v3.V2D(), v4.V4S(), v5.V4S()),
4419 "sqdmull2 v3.2d, v4.4s, v5.4s");
4420 COMPARE(Sqdmull(s0, h1, h2), "sqdmull s0, h1, h2");
4421 COMPARE(Sqdmull(d1, s2, s3), "sqdmull d1, s2, s3");
4422
4423 COMPARE(Sqdmlal(v0.V4S(), v1.V4H(), v2.V4H()), "sqdmlal v0.4s, v1.4h, v2.4h");
4424 COMPARE(Sqdmlal(v1.V2D(), v2.V2S(), v3.V2S()), "sqdmlal v1.2d, v2.2s, v3.2s");
4425 COMPARE(Sqdmlal2(v2.V4S(), v3.V8H(), v4.V8H()),
4426 "sqdmlal2 v2.4s, v3.8h, v4.8h");
4427 COMPARE(Sqdmlal2(v3.V2D(), v4.V4S(), v5.V4S()),
4428 "sqdmlal2 v3.2d, v4.4s, v5.4s");
4429 COMPARE(Sqdmlal(s0, h1, h2), "sqdmlal s0, h1, h2");
4430 COMPARE(Sqdmlal(d1, s2, s3), "sqdmlal d1, s2, s3");
4431
4432 COMPARE(Sqdmlsl(v0.V4S(), v1.V4H(), v2.V4H()), "sqdmlsl v0.4s, v1.4h, v2.4h");
4433 COMPARE(Sqdmlsl(v1.V2D(), v2.V2S(), v3.V2S()), "sqdmlsl v1.2d, v2.2s, v3.2s");
4434 COMPARE(Sqdmlsl2(v2.V4S(), v3.V8H(), v4.V8H()),
4435 "sqdmlsl2 v2.4s, v3.8h, v4.8h");
4436 COMPARE(Sqdmlsl2(v3.V2D(), v4.V4S(), v5.V4S()),
4437 "sqdmlsl2 v3.2d, v4.4s, v5.4s");
4438 COMPARE(Sqdmlsl(s0, h1, h2), "sqdmlsl s0, h1, h2");
4439 COMPARE(Sqdmlsl(d1, s2, s3), "sqdmlsl d1, s2, s3");
4440
4441 COMPARE(Addhn(v0.V8B(), v1.V8H(), v2.V8H()), "addhn v0.8b, v1.8h, v2.8h");
4442 COMPARE(Addhn(v1.V4H(), v2.V4S(), v3.V4S()), "addhn v1.4h, v2.4s, v3.4s");
4443 COMPARE(Addhn(v2.V2S(), v3.V2D(), v4.V2D()), "addhn v2.2s, v3.2d, v4.2d");
4444 COMPARE(Addhn2(v0.V16B(), v1.V8H(), v5.V8H()), "addhn2 v0.16b, v1.8h, v5.8h");
4445 COMPARE(Addhn2(v1.V8H(), v2.V4S(), v6.V4S()), "addhn2 v1.8h, v2.4s, v6.4s");
4446 COMPARE(Addhn2(v2.V4S(), v3.V2D(), v7.V2D()), "addhn2 v2.4s, v3.2d, v7.2d");
4447
4448 COMPARE(Raddhn(v0.V8B(), v1.V8H(), v2.V8H()), "raddhn v0.8b, v1.8h, v2.8h");
4449 COMPARE(Raddhn(v1.V4H(), v2.V4S(), v3.V4S()), "raddhn v1.4h, v2.4s, v3.4s");
4450 COMPARE(Raddhn(v2.V2S(), v3.V2D(), v4.V2D()), "raddhn v2.2s, v3.2d, v4.2d");
4451 COMPARE(Raddhn2(v0.V16B(), v1.V8H(), v5.V8H()),
4452 "raddhn2 v0.16b, v1.8h, v5.8h");
4453 COMPARE(Raddhn2(v1.V8H(), v2.V4S(), v6.V4S()), "raddhn2 v1.8h, v2.4s, v6.4s");
4454 COMPARE(Raddhn2(v2.V4S(), v3.V2D(), v7.V2D()), "raddhn2 v2.4s, v3.2d, v7.2d");
4455
4456 COMPARE(Subhn(v1.V4H(), v2.V4S(), v3.V4S()), "subhn v1.4h, v2.4s, v3.4s");
4457 COMPARE(Subhn(v2.V2S(), v3.V2D(), v4.V2D()), "subhn v2.2s, v3.2d, v4.2d");
4458 COMPARE(Subhn2(v0.V16B(), v1.V8H(), v5.V8H()), "subhn2 v0.16b, v1.8h, v5.8h");
4459 COMPARE(Subhn2(v1.V8H(), v2.V4S(), v6.V4S()), "subhn2 v1.8h, v2.4s, v6.4s");
4460 COMPARE(Subhn2(v2.V4S(), v3.V2D(), v7.V2D()), "subhn2 v2.4s, v3.2d, v7.2d");
4461
4462 COMPARE(Rsubhn(v0.V8B(), v1.V8H(), v2.V8H()), "rsubhn v0.8b, v1.8h, v2.8h");
4463 COMPARE(Rsubhn(v1.V4H(), v2.V4S(), v3.V4S()), "rsubhn v1.4h, v2.4s, v3.4s");
4464 COMPARE(Rsubhn(v2.V2S(), v3.V2D(), v4.V2D()), "rsubhn v2.2s, v3.2d, v4.2d");
4465 COMPARE(Rsubhn2(v0.V16B(), v1.V8H(), v5.V8H()),
4466 "rsubhn2 v0.16b, v1.8h, v5.8h");
4467 COMPARE(Rsubhn2(v1.V8H(), v2.V4S(), v6.V4S()), "rsubhn2 v1.8h, v2.4s, v6.4s");
4468 COMPARE(Rsubhn2(v2.V4S(), v3.V2D(), v7.V2D()), "rsubhn2 v2.4s, v3.2d, v7.2d");
4469
4470 COMPARE(Pmull(v0.V8H(), v1.V8B(), v2.V8B()), "pmull v0.8h, v1.8b, v2.8b");
4471 COMPARE(Pmull2(v2.V8H(), v3.V16B(), v4.V16B()),
4472 "pmull2 v2.8h, v3.16b, v4.16b");
4473
4474 CLEANUP();
4475}
4476
4477
4478TEST(neon_perm) {
armvixl684cd2a2015-10-23 13:38:33 +01004479 SETUP_MACRO();
armvixl5289c592015-03-02 13:52:04 +00004480
4481 #define DISASM_INST(M, S) \
4482 COMPARE(Trn1(v0.M, v1.M, v2.M), "trn1 v0." S ", v1." S ", v2." S);
4483 NEON_FORMAT_LIST(DISASM_INST)
4484 #undef DISASM_INST
4485
4486 #define DISASM_INST(M, S) \
4487 COMPARE(Trn2(v0.M, v1.M, v2.M), "trn2 v0." S ", v1." S ", v2." S);
4488 NEON_FORMAT_LIST(DISASM_INST)
4489 #undef DISASM_INST
4490
4491 #define DISASM_INST(M, S) \
4492 COMPARE(Uzp1(v0.M, v1.M, v2.M), "uzp1 v0." S ", v1." S ", v2." S);
4493 NEON_FORMAT_LIST(DISASM_INST)
4494 #undef DISASM_INST
4495
4496 #define DISASM_INST(M, S) \
4497 COMPARE(Uzp2(v0.M, v1.M, v2.M), "uzp2 v0." S ", v1." S ", v2." S);
4498 NEON_FORMAT_LIST(DISASM_INST)
4499 #undef DISASM_INST
4500
4501 #define DISASM_INST(M, S) \
4502 COMPARE(Zip1(v0.M, v1.M, v2.M), "zip1 v0." S ", v1." S ", v2." S);
4503 NEON_FORMAT_LIST(DISASM_INST)
4504 #undef DISASM_INST
4505
4506 #define DISASM_INST(M, S) \
4507 COMPARE(Zip2(v0.M, v1.M, v2.M), "zip2 v0." S ", v1." S ", v2." S);
4508 NEON_FORMAT_LIST(DISASM_INST)
4509 #undef DISASM_INST
4510
4511 CLEANUP();
4512}
4513
4514
4515TEST(neon_copy) {
armvixl684cd2a2015-10-23 13:38:33 +01004516 SETUP_MACRO();
armvixl5289c592015-03-02 13:52:04 +00004517
4518 COMPARE(Ins(v1.V16B(), 4, v5.V16B(), 0), "mov v1.b[4], v5.b[0]");
4519 COMPARE(Ins(v2.V8B(), 5, v6.V8B(), 1), "mov v2.b[5], v6.b[1]");
4520 COMPARE(Ins(v3.B(), 6, v7.B(), 2), "mov v3.b[6], v7.b[2]");
4521 COMPARE(Ins(v4.V8H(), 7, v8.V8H(), 3), "mov v4.h[7], v8.h[3]");
4522 COMPARE(Ins(v5.V4H(), 3, v9.V4H(), 0), "mov v5.h[3], v9.h[0]");
4523 COMPARE(Ins(v6.H(), 6, v1.H(), 1), "mov v6.h[6], v1.h[1]");
4524 COMPARE(Ins(v7.V4S(), 2, v2.V4S(), 2), "mov v7.s[2], v2.s[2]");
4525 COMPARE(Ins(v8.V2S(), 1, v3.V2S(), 0), "mov v8.s[1], v3.s[0]");
4526 COMPARE(Ins(v9.S(), 0, v4.S(), 1), "mov v9.s[0], v4.s[1]");
4527 COMPARE(Ins(v1.V2D(), 1, v5.V2D(), 0), "mov v1.d[1], v5.d[0]");
4528 COMPARE(Ins(v2.D(), 0, v6.D(), 1), "mov v2.d[0], v6.d[1]");
4529
4530 COMPARE(Mov(v3.V16B(), 4, v7.V16B(), 0), "mov v3.b[4], v7.b[0]");
4531 COMPARE(Mov(v4.V8B(), 5, v8.V8B(), 1), "mov v4.b[5], v8.b[1]");
4532 COMPARE(Mov(v5.B(), 6, v9.B(), 2), "mov v5.b[6], v9.b[2]");
4533 COMPARE(Mov(v6.V8H(), 7, v1.V8H(), 3), "mov v6.h[7], v1.h[3]");
4534 COMPARE(Mov(v7.V4H(), 0, v2.V4H(), 0), "mov v7.h[0], v2.h[0]");
4535 COMPARE(Mov(v8.H(), 1, v3.H(), 1), "mov v8.h[1], v3.h[1]");
4536 COMPARE(Mov(v9.V4S(), 2, v4.V4S(), 2), "mov v9.s[2], v4.s[2]");
4537 COMPARE(Mov(v1.V2S(), 3, v5.V2S(), 0), "mov v1.s[3], v5.s[0]");
4538 COMPARE(Mov(v2.S(), 0, v6.S(), 1), "mov v2.s[0], v6.s[1]");
4539 COMPARE(Mov(v3.V2D(), 1, v7.V2D(), 0), "mov v3.d[1], v7.d[0]");
4540 COMPARE(Mov(v4.D(), 0, v8.D(), 1), "mov v4.d[0], v8.d[1]");
4541
4542 COMPARE(Ins(v1.V16B(), 4, w0), "mov v1.b[4], w0");
4543 COMPARE(Ins(v2.V8B(), 5, w1), "mov v2.b[5], w1");
4544 COMPARE(Ins(v3.B(), 6, w2), "mov v3.b[6], w2");
4545 COMPARE(Ins(v4.V8H(), 7, w3), "mov v4.h[7], w3");
4546 COMPARE(Ins(v5.V4H(), 3, w0), "mov v5.h[3], w0");
4547 COMPARE(Ins(v6.H(), 6, w1), "mov v6.h[6], w1");
4548 COMPARE(Ins(v7.V4S(), 2, w2), "mov v7.s[2], w2");
4549 COMPARE(Ins(v8.V2S(), 1, w0), "mov v8.s[1], w0");
4550 COMPARE(Ins(v9.S(), 0, w1), "mov v9.s[0], w1");
4551 COMPARE(Ins(v1.V2D(), 1, x0), "mov v1.d[1], x0");
4552 COMPARE(Ins(v2.D(), 0, x1), "mov v2.d[0], x1");
4553
4554 COMPARE(Mov(v1.V16B(), 4, w0), "mov v1.b[4], w0");
4555 COMPARE(Mov(v2.V8B(), 5, w1), "mov v2.b[5], w1");
4556 COMPARE(Mov(v3.B(), 6, w2), "mov v3.b[6], w2");
4557 COMPARE(Mov(v4.V8H(), 7, w3), "mov v4.h[7], w3");
4558 COMPARE(Mov(v5.V4H(), 3, w0), "mov v5.h[3], w0");
4559 COMPARE(Mov(v6.H(), 6, w1), "mov v6.h[6], w1");
4560 COMPARE(Mov(v7.V4S(), 2, w2), "mov v7.s[2], w2");
4561 COMPARE(Mov(v8.V2S(), 1, w0), "mov v8.s[1], w0");
4562 COMPARE(Mov(v9.S(), 0, w1), "mov v9.s[0], w1");
4563 COMPARE(Mov(v1.V2D(), 1, x0), "mov v1.d[1], x0");
4564 COMPARE(Mov(v2.D(), 0, x1), "mov v2.d[0], x1");
4565
4566 COMPARE(Dup(v5.V8B(), v9.V8B(), 6), "dup v5.8b, v9.b[6]");
4567 COMPARE(Dup(v6.V16B(), v1.V16B(), 5), "dup v6.16b, v1.b[5]");
4568 COMPARE(Dup(v7.V4H(), v2.V4H(), 4), "dup v7.4h, v2.h[4]");
4569 COMPARE(Dup(v8.V8H(), v3.V8H(), 3), "dup v8.8h, v3.h[3]");
4570 COMPARE(Dup(v9.V2S(), v4.V2S(), 2), "dup v9.2s, v4.s[2]");
4571 COMPARE(Dup(v1.V4S(), v5.V4S(), 1), "dup v1.4s, v5.s[1]");
4572 COMPARE(Dup(v2.V2D(), v6.V2D(), 0), "dup v2.2d, v6.d[0]");
4573
4574 COMPARE(Dup(v5.B(), v9.B(), 6), "mov b5, v9.b[6]");
4575 COMPARE(Dup(v7.H(), v2.H(), 4), "mov h7, v2.h[4]");
4576 COMPARE(Dup(v9.S(), v4.S(), 2), "mov s9, v4.s[2]");
4577 COMPARE(Dup(v2.D(), v6.D(), 0), "mov d2, v6.d[0]");
4578
4579 COMPARE(Mov(v5.B(), v9.B(), 6), "mov b5, v9.b[6]");
4580 COMPARE(Mov(v7.H(), v2.H(), 4), "mov h7, v2.h[4]");
4581 COMPARE(Mov(v9.S(), v4.S(), 2), "mov s9, v4.s[2]");
4582 COMPARE(Mov(v2.D(), v6.D(), 0), "mov d2, v6.d[0]");
4583
4584 COMPARE(Dup(v5.V8B(), w0), "dup v5.8b, w0");
4585 COMPARE(Dup(v6.V16B(), w1), "dup v6.16b, w1");
4586 COMPARE(Dup(v7.V4H(), w2), "dup v7.4h, w2");
4587 COMPARE(Dup(v8.V8H(), w3), "dup v8.8h, w3");
4588 COMPARE(Dup(v9.V2S(), w4), "dup v9.2s, w4");
4589 COMPARE(Dup(v1.V4S(), w5), "dup v1.4s, w5");
4590 COMPARE(Dup(v2.V2D(), x6), "dup v2.2d, x6");
4591
4592 COMPARE(Smov(w0, v1.V16B(), 4), "smov w0, v1.b[4]");
4593 COMPARE(Smov(w1, v2.V8B(), 5), "smov w1, v2.b[5]");
4594 COMPARE(Smov(w2, v3.B(), 6), "smov w2, v3.b[6]");
4595 COMPARE(Smov(w3, v4.V8H(), 7), "smov w3, v4.h[7]");
4596 COMPARE(Smov(w0, v5.V4H(), 3), "smov w0, v5.h[3]");
4597 COMPARE(Smov(w1, v6.H(), 6), "smov w1, v6.h[6]");
4598
4599 COMPARE(Smov(x0, v1.V16B(), 4), "smov x0, v1.b[4]");
4600 COMPARE(Smov(x1, v2.V8B(), 5), "smov x1, v2.b[5]");
4601 COMPARE(Smov(x2, v3.B(), 6), "smov x2, v3.b[6]");
4602 COMPARE(Smov(x3, v4.V8H(), 7), "smov x3, v4.h[7]");
4603 COMPARE(Smov(x0, v5.V4H(), 3), "smov x0, v5.h[3]");
4604 COMPARE(Smov(x1, v6.H(), 6), "smov x1, v6.h[6]");
4605 COMPARE(Smov(x2, v7.V4S(), 2), "smov x2, v7.s[2]");
4606 COMPARE(Smov(x0, v8.V2S(), 1), "smov x0, v8.s[1]");
4607 COMPARE(Smov(x1, v9.S(), 0), "smov x1, v9.s[0]");
4608
4609 COMPARE(Umov(w0, v1.V16B(), 4), "umov w0, v1.b[4]");
4610 COMPARE(Umov(w1, v2.V8B(), 5), "umov w1, v2.b[5]");
4611 COMPARE(Umov(w2, v3.B(), 6), "umov w2, v3.b[6]");
4612 COMPARE(Umov(w3, v4.V8H(), 7), "umov w3, v4.h[7]");
4613 COMPARE(Umov(w0, v5.V4H(), 3), "umov w0, v5.h[3]");
4614 COMPARE(Umov(w1, v6.H(), 6), "umov w1, v6.h[6]");
4615 COMPARE(Umov(w2, v7.V4S(), 2), "mov w2, v7.s[2]");
4616 COMPARE(Umov(w0, v8.V2S(), 1), "mov w0, v8.s[1]");
4617 COMPARE(Umov(w1, v9.S(), 0), "mov w1, v9.s[0]");
4618 COMPARE(Umov(x0, v1.V2D(), 1), "mov x0, v1.d[1]");
4619 COMPARE(Umov(x1, v2.D(), 0), "mov x1, v2.d[0]");
4620
4621 COMPARE(Mov(w2, v7.V4S(), 2), "mov w2, v7.s[2]");
4622 COMPARE(Mov(w0, v8.V2S(), 1), "mov w0, v8.s[1]");
4623 COMPARE(Mov(w1, v9.S(), 0), "mov w1, v9.s[0]");
4624 COMPARE(Mov(x0, v1.V2D(), 1), "mov x0, v1.d[1]");
4625 COMPARE(Mov(x1, v2.D(), 0), "mov x1, v2.d[0]");
4626
4627 CLEANUP();
4628}
4629
4630
4631TEST(neon_extract) {
armvixl684cd2a2015-10-23 13:38:33 +01004632 SETUP_MACRO();
armvixl5289c592015-03-02 13:52:04 +00004633
4634 COMPARE(Ext(v4.V8B(), v5.V8B(), v6.V8B(), 0), "ext v4.8b, v5.8b, v6.8b, #0");
4635 COMPARE(Ext(v1.V8B(), v2.V8B(), v3.V8B(), 7), "ext v1.8b, v2.8b, v3.8b, #7");
4636 COMPARE(Ext(v1.V16B(), v2.V16B(), v3.V16B(), 0),
4637 "ext v1.16b, v2.16b, v3.16b, #0");
4638 COMPARE(Ext(v1.V16B(), v2.V16B(), v3.V16B(), 15),
4639 "ext v1.16b, v2.16b, v3.16b, #15");
4640
4641 CLEANUP();
4642}
4643
4644
4645TEST(neon_modimm) {
armvixl684cd2a2015-10-23 13:38:33 +01004646 SETUP_MACRO();
armvixl5289c592015-03-02 13:52:04 +00004647
4648 COMPARE(Orr(v4.V4H(), 0xaa, 0), "orr v4.4h, #0xaa, lsl #0");
4649 COMPARE(Orr(v1.V8H(), 0xcc, 8), "orr v1.8h, #0xcc, lsl #8");
4650 COMPARE(Orr(v4.V2S(), 0xaa, 0), "orr v4.2s, #0xaa, lsl #0");
4651 COMPARE(Orr(v1.V2S(), 0xcc, 8), "orr v1.2s, #0xcc, lsl #8");
4652 COMPARE(Orr(v4.V4S(), 0xaa, 16), "orr v4.4s, #0xaa, lsl #16");
4653 COMPARE(Orr(v1.V4S(), 0xcc, 24), "orr v1.4s, #0xcc, lsl #24");
4654
4655 COMPARE(Bic(v4.V4H(), 0xaa, 0), "bic v4.4h, #0xaa, lsl #0");
4656 COMPARE(Bic(v1.V8H(), 0xcc, 8), "bic v1.8h, #0xcc, lsl #8");
4657 COMPARE(Bic(v4.V2S(), 0xaa, 0), "bic v4.2s, #0xaa, lsl #0");
4658 COMPARE(Bic(v1.V2S(), 0xcc, 8), "bic v1.2s, #0xcc, lsl #8");
4659 COMPARE(Bic(v4.V4S(), 0xaa, 16), "bic v4.4s, #0xaa, lsl #16");
4660 COMPARE(Bic(v1.V4S(), 0xcc, 24), "bic v1.4s, #0xcc, lsl #24");
4661
4662 COMPARE(Mvni(v4.V4H(), 0xaa, LSL, 0), "mvni v4.4h, #0xaa, lsl #0");
4663 COMPARE(Mvni(v1.V8H(), 0xcc, LSL, 8), "mvni v1.8h, #0xcc, lsl #8");
4664 COMPARE(Mvni(v4.V2S(), 0xaa, LSL, 0), "mvni v4.2s, #0xaa, lsl #0");
4665 COMPARE(Mvni(v1.V2S(), 0xcc, LSL, 8), "mvni v1.2s, #0xcc, lsl #8");
4666 COMPARE(Mvni(v4.V4S(), 0xaa, LSL, 16), "mvni v4.4s, #0xaa, lsl #16");
4667 COMPARE(Mvni(v1.V4S(), 0xcc, LSL, 24), "mvni v1.4s, #0xcc, lsl #24");
4668
4669 COMPARE(Mvni(v4.V2S(), 0xaa, MSL, 8), "mvni v4.2s, #0xaa, msl #8");
4670 COMPARE(Mvni(v1.V2S(), 0xcc, MSL, 16), "mvni v1.2s, #0xcc, msl #16");
4671 COMPARE(Mvni(v4.V4S(), 0xaa, MSL, 8), "mvni v4.4s, #0xaa, msl #8");
4672 COMPARE(Mvni(v1.V4S(), 0xcc, MSL, 16), "mvni v1.4s, #0xcc, msl #16");
4673
4674 COMPARE(Movi(v4.V8B(), 0xaa), "movi v4.8b, #0xaa");
4675 COMPARE(Movi(v1.V16B(), 0xcc), "movi v1.16b, #0xcc");
4676
4677 COMPARE(Movi(v4.V4H(), 0xaa, LSL, 0), "movi v4.4h, #0xaa, lsl #0");
4678 COMPARE(Movi(v1.V8H(), 0xcc, LSL, 8), "movi v1.8h, #0xcc, lsl #8");
4679
4680 COMPARE(Movi(v4.V2S(), 0xaa, LSL, 0), "movi v4.2s, #0xaa, lsl #0");
4681 COMPARE(Movi(v1.V2S(), 0xcc, LSL, 8), "movi v1.2s, #0xcc, lsl #8");
4682 COMPARE(Movi(v4.V4S(), 0xaa, LSL, 16), "movi v4.4s, #0xaa, lsl #16");
4683 COMPARE(Movi(v1.V4S(), 0xcc, LSL, 24), "movi v1.4s, #0xcc, lsl #24");
4684
4685 COMPARE(Movi(v4.V2S(), 0xaa, MSL, 8), "movi v4.2s, #0xaa, msl #8");
4686 COMPARE(Movi(v1.V2S(), 0xcc, MSL, 16), "movi v1.2s, #0xcc, msl #16");
4687 COMPARE(Movi(v4.V4S(), 0xaa, MSL, 8), "movi v4.4s, #0xaa, msl #8");
4688 COMPARE(Movi(v1.V4S(), 0xcc, MSL, 16), "movi v1.4s, #0xcc, msl #16");
4689
4690 COMPARE(Movi(d2, 0xffff0000ffffff), "movi d2, #0xffff0000ffffff");
4691 COMPARE(Movi(v1.V2D(), 0xffff0000ffffff), "movi v1.2d, #0xffff0000ffffff");
4692
4693 COMPARE(Fmov(v0.V2S(), 1.0f), "fmov v0.2s, #0x70 (1.0000)");
4694 COMPARE(Fmov(v31.V2S(), -13.0f), "fmov v31.2s, #0xaa (-13.0000)");
4695 COMPARE(Fmov(v0.V4S(), 1.0f), "fmov v0.4s, #0x70 (1.0000)");
4696 COMPARE(Fmov(v31.V4S(), -13.0f), "fmov v31.4s, #0xaa (-13.0000)");
4697 COMPARE(Fmov(v1.V2D(), 1.0), "fmov v1.2d, #0x70 (1.0000)");
4698 COMPARE(Fmov(v29.V2D(), -13.0), "fmov v29.2d, #0xaa (-13.0000)");
4699
4700 CLEANUP();
4701}
4702
4703
4704TEST(neon_2regmisc) {
armvixl684cd2a2015-10-23 13:38:33 +01004705 SETUP_MACRO();
armvixl5289c592015-03-02 13:52:04 +00004706
4707 COMPARE(Shll(v1.V8H(), v8.V8B(), 8), "shll v1.8h, v8.8b, #8");
4708 COMPARE(Shll(v3.V4S(), v1.V4H(), 16), "shll v3.4s, v1.4h, #16");
4709 COMPARE(Shll(v5.V2D(), v3.V2S(), 32), "shll v5.2d, v3.2s, #32");
4710 COMPARE(Shll2(v2.V8H(), v9.V16B(), 8), "shll2 v2.8h, v9.16b, #8");
4711 COMPARE(Shll2(v4.V4S(), v2.V8H(), 16), "shll2 v4.4s, v2.8h, #16");
4712 COMPARE(Shll2(v6.V2D(), v4.V4S(), 32), "shll2 v6.2d, v4.4s, #32");
4713
4714 #define DISASM_INST(M, S) \
4715 COMPARE(Cmeq(v0.M, v1.M, 0), "cmeq v0." S ", v1." S ", #0");
4716 NEON_FORMAT_LIST(DISASM_INST)
4717 #undef DISASM_INST
4718
4719 #define DISASM_INST(M, S) \
4720 COMPARE(Cmge(v0.M, v1.M, 0), "cmge v0." S ", v1." S ", #0");
4721 NEON_FORMAT_LIST(DISASM_INST)
4722 #undef DISASM_INST
4723
4724 #define DISASM_INST(M, S) \
4725 COMPARE(Cmgt(v0.M, v1.M, 0), "cmgt v0." S ", v1." S ", #0");
4726 NEON_FORMAT_LIST(DISASM_INST)
4727 #undef DISASM_INST
4728
4729 #define DISASM_INST(M, S) \
4730 COMPARE(Cmle(v0.M, v1.M, 0), "cmle v0." S ", v1." S ", #0");
4731 NEON_FORMAT_LIST(DISASM_INST)
4732 #undef DISASM_INST
4733
4734 #define DISASM_INST(M, S) \
4735 COMPARE(Cmlt(v0.M, v1.M, 0), "cmlt v0." S ", v1." S ", #0");
4736 NEON_FORMAT_LIST(DISASM_INST)
4737 #undef DISASM_INST
4738
4739 COMPARE(Cmeq(v0.D(), v1.D(), 0), "cmeq d0, d1, #0");
4740 COMPARE(Cmge(v3.D(), v4.D(), 0), "cmge d3, d4, #0");
4741 COMPARE(Cmgt(v6.D(), v7.D(), 0), "cmgt d6, d7, #0");
4742 COMPARE(Cmle(v0.D(), v1.D(), 0), "cmle d0, d1, #0");
4743 COMPARE(Cmlt(v3.D(), v4.D(), 0), "cmlt d3, d4, #0");
4744
4745 #define DISASM_INST(M, S) \
4746 COMPARE(Fcmeq(v0.M, v1.M, 0), "fcmeq v0." S ", v1." S ", #0.0");
4747 NEON_FORMAT_LIST_FP(DISASM_INST)
4748 #undef DISASM_INST
4749
4750 COMPARE(Fcmeq(v0.S(), v1.S(), 0), "fcmeq s0, s1, #0.0");
4751 COMPARE(Fcmeq(v0.D(), v1.D(), 0), "fcmeq d0, d1, #0.0");
4752
4753 #define DISASM_INST(M, S) \
4754 COMPARE(Fcmge(v0.M, v1.M, 0), "fcmge v0." S ", v1." S ", #0.0");
4755 NEON_FORMAT_LIST_FP(DISASM_INST)
4756 #undef DISASM_INST
4757
4758 COMPARE(Fcmge(v0.S(), v1.S(), 0), "fcmge s0, s1, #0.0");
4759 COMPARE(Fcmge(v0.D(), v1.D(), 0), "fcmge d0, d1, #0.0");
4760
4761 #define DISASM_INST(M, S) \
4762 COMPARE(Fcmgt(v0.M, v1.M, 0), "fcmgt v0." S ", v1." S ", #0.0");
4763 NEON_FORMAT_LIST_FP(DISASM_INST)
4764 #undef DISASM_INST
4765
4766 COMPARE(Fcmgt(v0.S(), v1.S(), 0), "fcmgt s0, s1, #0.0");
4767 COMPARE(Fcmgt(v0.D(), v1.D(), 0), "fcmgt d0, d1, #0.0");
4768
4769 #define DISASM_INST(M, S) \
4770 COMPARE(Fcmle(v0.M, v1.M, 0), "fcmle v0." S ", v1." S ", #0.0");
4771 NEON_FORMAT_LIST_FP(DISASM_INST)
4772 #undef DISASM_INST
4773
4774 COMPARE(Fcmle(v0.S(), v1.S(), 0), "fcmle s0, s1, #0.0");
4775 COMPARE(Fcmle(v0.D(), v1.D(), 0), "fcmle d0, d1, #0.0");
4776
4777 #define DISASM_INST(M, S) \
4778 COMPARE(Fcmlt(v0.M, v1.M, 0), "fcmlt v0." S ", v1." S ", #0.0");
4779 NEON_FORMAT_LIST_FP(DISASM_INST)
4780 #undef DISASM_INST
4781
4782 COMPARE(Fcmlt(v0.S(), v1.S(), 0), "fcmlt s0, s1, #0.0");
4783 COMPARE(Fcmlt(v0.D(), v1.D(), 0), "fcmlt d0, d1, #0.0");
4784
4785 #define DISASM_INST(M, S) \
4786 COMPARE(Neg(v0.M, v1.M), "neg v0." S ", v1." S);
4787 NEON_FORMAT_LIST(DISASM_INST)
4788 #undef DISASM_INST
4789
4790 COMPARE(Neg(v0.D(), v1.D()), "neg d0, d1");
4791
4792 #define DISASM_INST(M, S) \
4793 COMPARE(Sqneg(v0.M, v1.M), "sqneg v0." S ", v1." S);
4794 NEON_FORMAT_LIST(DISASM_INST)
4795 #undef DISASM_INST
4796
4797 COMPARE(Sqneg(b0, b1), "sqneg b0, b1");
4798 COMPARE(Sqneg(h1, h2), "sqneg h1, h2");
4799 COMPARE(Sqneg(s2, s3), "sqneg s2, s3");
4800 COMPARE(Sqneg(d3, d4), "sqneg d3, d4");
4801
4802 #define DISASM_INST(M, S) \
4803 COMPARE(Abs(v0.M, v1.M), "abs v0." S ", v1." S);
4804 NEON_FORMAT_LIST(DISASM_INST)
4805 #undef DISASM_INST
4806
4807 COMPARE(Abs(v0.D(), v1.D()), "abs d0, d1");
4808
4809 #define DISASM_INST(M, S) \
4810 COMPARE(Sqabs(v0.M, v1.M), "sqabs v0." S ", v1." S);
4811 NEON_FORMAT_LIST(DISASM_INST)
4812 #undef DISASM_INST
4813
4814 COMPARE(Sqabs(b0, b1), "sqabs b0, b1");
4815 COMPARE(Sqabs(h1, h2), "sqabs h1, h2");
4816 COMPARE(Sqabs(s2, s3), "sqabs s2, s3");
4817 COMPARE(Sqabs(d3, d4), "sqabs d3, d4");
4818
4819 #define DISASM_INST(M, S) \
4820 COMPARE(Suqadd(v0.M, v1.M), "suqadd v0." S ", v1." S);
4821 NEON_FORMAT_LIST(DISASM_INST)
4822 #undef DISASM_INST
4823
4824 COMPARE(Suqadd(b0, b1), "suqadd b0, b1");
4825 COMPARE(Suqadd(h1, h2), "suqadd h1, h2");
4826 COMPARE(Suqadd(s2, s3), "suqadd s2, s3");
4827 COMPARE(Suqadd(d3, d4), "suqadd d3, d4");
4828
4829 #define DISASM_INST(M, S) \
4830 COMPARE(Usqadd(v0.M, v1.M), "usqadd v0." S ", v1." S);
4831 NEON_FORMAT_LIST(DISASM_INST)
4832 #undef DISASM_INST
4833
4834 COMPARE(Usqadd(b0, b1), "usqadd b0, b1");
4835 COMPARE(Usqadd(h1, h2), "usqadd h1, h2");
4836 COMPARE(Usqadd(s2, s3), "usqadd s2, s3");
4837 COMPARE(Usqadd(d3, d4), "usqadd d3, d4");
4838
4839 COMPARE(Xtn(v0.V8B(), v1.V8H()), "xtn v0.8b, v1.8h");
4840 COMPARE(Xtn(v1.V4H(), v2.V4S()), "xtn v1.4h, v2.4s");
4841 COMPARE(Xtn(v2.V2S(), v3.V2D()), "xtn v2.2s, v3.2d");
4842 COMPARE(Xtn2(v0.V16B(), v1.V8H()), "xtn2 v0.16b, v1.8h");
4843 COMPARE(Xtn2(v1.V8H(), v2.V4S()), "xtn2 v1.8h, v2.4s");
4844 COMPARE(Xtn2(v2.V4S(), v3.V2D()), "xtn2 v2.4s, v3.2d");
4845
4846 COMPARE(Sqxtn(v0.V8B(), v1.V8H()), "sqxtn v0.8b, v1.8h");
4847 COMPARE(Sqxtn(v1.V4H(), v2.V4S()), "sqxtn v1.4h, v2.4s");
4848 COMPARE(Sqxtn(v2.V2S(), v3.V2D()), "sqxtn v2.2s, v3.2d");
4849 COMPARE(Sqxtn2(v0.V16B(), v1.V8H()), "sqxtn2 v0.16b, v1.8h");
4850 COMPARE(Sqxtn2(v1.V8H(), v2.V4S()), "sqxtn2 v1.8h, v2.4s");
4851 COMPARE(Sqxtn2(v2.V4S(), v3.V2D()), "sqxtn2 v2.4s, v3.2d");
4852 COMPARE(Sqxtn(b19, h0), "sqxtn b19, h0");
4853 COMPARE(Sqxtn(h20, s0), "sqxtn h20, s0") ;
4854 COMPARE(Sqxtn(s21, d0), "sqxtn s21, d0");
4855
4856 COMPARE(Uqxtn(v0.V8B(), v1.V8H()), "uqxtn v0.8b, v1.8h");
4857 COMPARE(Uqxtn(v1.V4H(), v2.V4S()), "uqxtn v1.4h, v2.4s");
4858 COMPARE(Uqxtn(v2.V2S(), v3.V2D()), "uqxtn v2.2s, v3.2d");
4859 COMPARE(Uqxtn2(v0.V16B(), v1.V8H()), "uqxtn2 v0.16b, v1.8h");
4860 COMPARE(Uqxtn2(v1.V8H(), v2.V4S()), "uqxtn2 v1.8h, v2.4s");
4861 COMPARE(Uqxtn2(v2.V4S(), v3.V2D()), "uqxtn2 v2.4s, v3.2d");
4862 COMPARE(Uqxtn(b19, h0), "uqxtn b19, h0");
4863 COMPARE(Uqxtn(h20, s0), "uqxtn h20, s0") ;
4864 COMPARE(Uqxtn(s21, d0), "uqxtn s21, d0");
4865
4866 COMPARE(Sqxtun(v0.V8B(), v1.V8H()), "sqxtun v0.8b, v1.8h");
4867 COMPARE(Sqxtun(v1.V4H(), v2.V4S()), "sqxtun v1.4h, v2.4s");
4868 COMPARE(Sqxtun(v2.V2S(), v3.V2D()), "sqxtun v2.2s, v3.2d");
4869 COMPARE(Sqxtun2(v0.V16B(), v1.V8H()), "sqxtun2 v0.16b, v1.8h");
4870 COMPARE(Sqxtun2(v1.V8H(), v2.V4S()), "sqxtun2 v1.8h, v2.4s");
4871 COMPARE(Sqxtun2(v2.V4S(), v3.V2D()), "sqxtun2 v2.4s, v3.2d");
4872 COMPARE(Sqxtun(b19, h0), "sqxtun b19, h0");
4873 COMPARE(Sqxtun(h20, s0), "sqxtun h20, s0") ;
4874 COMPARE(Sqxtun(s21, d0), "sqxtun s21, d0");
4875
4876 COMPARE(Cls(v1.V8B(), v8.V8B()), "cls v1.8b, v8.8b");
4877 COMPARE(Cls(v2.V16B(), v9.V16B()), "cls v2.16b, v9.16b");
4878 COMPARE(Cls(v3.V4H(), v1.V4H()), "cls v3.4h, v1.4h");
4879 COMPARE(Cls(v4.V8H(), v2.V8H()), "cls v4.8h, v2.8h");
4880 COMPARE(Cls(v5.V2S(), v3.V2S()), "cls v5.2s, v3.2s");
4881 COMPARE(Cls(v6.V4S(), v4.V4S()), "cls v6.4s, v4.4s");
4882
4883 COMPARE(Clz(v1.V8B(), v8.V8B()), "clz v1.8b, v8.8b");
4884 COMPARE(Clz(v2.V16B(), v9.V16B()), "clz v2.16b, v9.16b");
4885 COMPARE(Clz(v3.V4H(), v1.V4H()), "clz v3.4h, v1.4h");
4886 COMPARE(Clz(v4.V8H(), v2.V8H()), "clz v4.8h, v2.8h");
4887 COMPARE(Clz(v5.V2S(), v3.V2S()), "clz v5.2s, v3.2s");
4888 COMPARE(Clz(v6.V4S(), v4.V4S()), "clz v6.4s, v4.4s");
4889
4890 COMPARE(Cnt(v1.V8B(), v8.V8B()), "cnt v1.8b, v8.8b");
4891 COMPARE(Cnt(v2.V16B(), v9.V16B()), "cnt v2.16b, v9.16b");
4892
4893 COMPARE(Mvn(v4.V8B(), v5.V8B()), "mvn v4.8b, v5.8b");
4894 COMPARE(Mvn(v4.V16B(), v5.V16B()), "mvn v4.16b, v5.16b");
4895
4896 COMPARE(Not(v4.V8B(), v5.V8B()), "mvn v4.8b, v5.8b");
4897 COMPARE(Not(v4.V16B(), v5.V16B()), "mvn v4.16b, v5.16b");
4898
4899 COMPARE(Rev64(v1.V8B(), v8.V8B()), "rev64 v1.8b, v8.8b");
4900 COMPARE(Rev64(v2.V16B(), v9.V16B()), "rev64 v2.16b, v9.16b");
4901 COMPARE(Rev64(v3.V4H(), v1.V4H()), "rev64 v3.4h, v1.4h");
4902 COMPARE(Rev64(v4.V8H(), v2.V8H()), "rev64 v4.8h, v2.8h");
4903 COMPARE(Rev64(v5.V2S(), v3.V2S()), "rev64 v5.2s, v3.2s");
4904 COMPARE(Rev64(v6.V4S(), v4.V4S()), "rev64 v6.4s, v4.4s");
4905
4906 COMPARE(Rev32(v1.V8B(), v8.V8B()), "rev32 v1.8b, v8.8b");
4907 COMPARE(Rev32(v2.V16B(), v9.V16B()), "rev32 v2.16b, v9.16b");
4908 COMPARE(Rev32(v3.V4H(), v1.V4H()), "rev32 v3.4h, v1.4h");
4909 COMPARE(Rev32(v4.V8H(), v2.V8H()), "rev32 v4.8h, v2.8h");
4910
4911 COMPARE(Rev16(v1.V8B(), v8.V8B()), "rev16 v1.8b, v8.8b");
4912 COMPARE(Rev16(v2.V16B(), v9.V16B()), "rev16 v2.16b, v9.16b");
4913
4914 COMPARE(Rbit(v1.V8B(), v8.V8B()), "rbit v1.8b, v8.8b");
4915 COMPARE(Rbit(v2.V16B(), v9.V16B()), "rbit v2.16b, v9.16b");
4916
4917 COMPARE(Ursqrte(v2.V2S(), v9.V2S()), "ursqrte v2.2s, v9.2s");
4918 COMPARE(Ursqrte(v16.V4S(), v23.V4S()), "ursqrte v16.4s, v23.4s");
4919
4920 COMPARE(Urecpe(v2.V2S(), v9.V2S()), "urecpe v2.2s, v9.2s");
4921 COMPARE(Urecpe(v16.V4S(), v23.V4S()), "urecpe v16.4s, v23.4s");
4922
4923 COMPARE(Frsqrte(v2.V2S(), v9.V2S()), "frsqrte v2.2s, v9.2s");
4924 COMPARE(Frsqrte(v16.V4S(), v23.V4S()), "frsqrte v16.4s, v23.4s");
4925 COMPARE(Frsqrte(v2.V2D(), v9.V2D()), "frsqrte v2.2d, v9.2d");
4926 COMPARE(Frsqrte(v0.S(), v1.S()), "frsqrte s0, s1");
4927 COMPARE(Frsqrte(v0.D(), v1.D()), "frsqrte d0, d1");
4928
4929 COMPARE(Frecpe(v2.V2S(), v9.V2S()), "frecpe v2.2s, v9.2s");
4930 COMPARE(Frecpe(v16.V4S(), v23.V4S()), "frecpe v16.4s, v23.4s");
4931 COMPARE(Frecpe(v2.V2D(), v9.V2D()), "frecpe v2.2d, v9.2d");
4932 COMPARE(Frecpe(v0.S(), v1.S()), "frecpe s0, s1");
4933 COMPARE(Frecpe(v0.D(), v1.D()), "frecpe d0, d1");
4934
4935 COMPARE(Fabs(v2.V2S(), v9.V2S()), "fabs v2.2s, v9.2s");
4936 COMPARE(Fabs(v16.V4S(), v23.V4S()), "fabs v16.4s, v23.4s");
4937 COMPARE(Fabs(v31.V2D(), v30.V2D()), "fabs v31.2d, v30.2d");
4938
4939 COMPARE(Fneg(v2.V2S(), v9.V2S()), "fneg v2.2s, v9.2s");
4940 COMPARE(Fneg(v16.V4S(), v23.V4S()), "fneg v16.4s, v23.4s");
4941 COMPARE(Fneg(v31.V2D(), v30.V2D()), "fneg v31.2d, v30.2d");
4942
4943 COMPARE(Frintn(v2.V2S(), v9.V2S()), "frintn v2.2s, v9.2s");
4944 COMPARE(Frintn(v16.V4S(), v23.V4S()), "frintn v16.4s, v23.4s");
4945 COMPARE(Frintn(v31.V2D(), v30.V2D()), "frintn v31.2d, v30.2d");
4946
4947 COMPARE(Frinta(v2.V2S(), v9.V2S()), "frinta v2.2s, v9.2s");
4948 COMPARE(Frinta(v16.V4S(), v23.V4S()), "frinta v16.4s, v23.4s");
4949 COMPARE(Frinta(v31.V2D(), v30.V2D()), "frinta v31.2d, v30.2d");
4950
4951 COMPARE(Frintp(v2.V2S(), v9.V2S()), "frintp v2.2s, v9.2s");
4952 COMPARE(Frintp(v16.V4S(), v23.V4S()), "frintp v16.4s, v23.4s");
4953 COMPARE(Frintp(v31.V2D(), v30.V2D()), "frintp v31.2d, v30.2d");
4954
4955 COMPARE(Frintm(v2.V2S(), v9.V2S()), "frintm v2.2s, v9.2s");
4956 COMPARE(Frintm(v16.V4S(), v23.V4S()), "frintm v16.4s, v23.4s");
4957 COMPARE(Frintm(v31.V2D(), v30.V2D()), "frintm v31.2d, v30.2d");
4958
4959 COMPARE(Frintx(v2.V2S(), v9.V2S()), "frintx v2.2s, v9.2s");
4960 COMPARE(Frintx(v16.V4S(), v23.V4S()), "frintx v16.4s, v23.4s");
4961 COMPARE(Frintx(v31.V2D(), v30.V2D()), "frintx v31.2d, v30.2d");
4962
4963 COMPARE(Frintz(v2.V2S(), v9.V2S()), "frintz v2.2s, v9.2s");
4964 COMPARE(Frintz(v16.V4S(), v23.V4S()), "frintz v16.4s, v23.4s");
4965 COMPARE(Frintz(v31.V2D(), v30.V2D()), "frintz v31.2d, v30.2d");
4966
4967 COMPARE(Frinti(v2.V2S(), v9.V2S()), "frinti v2.2s, v9.2s");
4968 COMPARE(Frinti(v16.V4S(), v23.V4S()), "frinti v16.4s, v23.4s");
4969 COMPARE(Frinti(v31.V2D(), v30.V2D()), "frinti v31.2d, v30.2d");
4970
4971 COMPARE(Fsqrt(v3.V2S(), v10.V2S()), "fsqrt v3.2s, v10.2s");
4972 COMPARE(Fsqrt(v22.V4S(), v11.V4S()), "fsqrt v22.4s, v11.4s");
4973 COMPARE(Fsqrt(v31.V2D(), v0.V2D()), "fsqrt v31.2d, v0.2d");
4974
4975 COMPARE(Fcvtns(v4.V2S(), v11.V2S()), "fcvtns v4.2s, v11.2s");
4976 COMPARE(Fcvtns(v23.V4S(), v12.V4S()), "fcvtns v23.4s, v12.4s");
4977 COMPARE(Fcvtns(v30.V2D(), v1.V2D()), "fcvtns v30.2d, v1.2d");
4978 COMPARE(Fcvtnu(v4.V2S(), v11.V2S()), "fcvtnu v4.2s, v11.2s");
4979 COMPARE(Fcvtnu(v23.V4S(), v12.V4S()), "fcvtnu v23.4s, v12.4s");
4980 COMPARE(Fcvtnu(v30.V2D(), v1.V2D()), "fcvtnu v30.2d, v1.2d");
4981
4982 COMPARE(Fcvtps(v4.V2S(), v11.V2S()), "fcvtps v4.2s, v11.2s");
4983 COMPARE(Fcvtps(v23.V4S(), v12.V4S()), "fcvtps v23.4s, v12.4s");
4984 COMPARE(Fcvtps(v30.V2D(), v1.V2D()), "fcvtps v30.2d, v1.2d");
4985 COMPARE(Fcvtpu(v4.V2S(), v11.V2S()), "fcvtpu v4.2s, v11.2s");
4986 COMPARE(Fcvtpu(v23.V4S(), v12.V4S()), "fcvtpu v23.4s, v12.4s");
4987 COMPARE(Fcvtpu(v30.V2D(), v1.V2D()), "fcvtpu v30.2d, v1.2d");
4988
4989 COMPARE(Fcvtms(v4.V2S(), v11.V2S()), "fcvtms v4.2s, v11.2s");
4990 COMPARE(Fcvtms(v23.V4S(), v12.V4S()), "fcvtms v23.4s, v12.4s");
4991 COMPARE(Fcvtms(v30.V2D(), v1.V2D()), "fcvtms v30.2d, v1.2d");
4992 COMPARE(Fcvtmu(v4.V2S(), v11.V2S()), "fcvtmu v4.2s, v11.2s");
4993 COMPARE(Fcvtmu(v23.V4S(), v12.V4S()), "fcvtmu v23.4s, v12.4s");
4994 COMPARE(Fcvtmu(v30.V2D(), v1.V2D()), "fcvtmu v30.2d, v1.2d");
4995
4996 COMPARE(Fcvtzs(v4.V2S(), v11.V2S()), "fcvtzs v4.2s, v11.2s");
4997 COMPARE(Fcvtzs(v23.V4S(), v12.V4S()), "fcvtzs v23.4s, v12.4s");
4998 COMPARE(Fcvtzs(v30.V2D(), v1.V2D()), "fcvtzs v30.2d, v1.2d");
4999 COMPARE(Fcvtzu(v4.V2S(), v11.V2S()), "fcvtzu v4.2s, v11.2s");
5000 COMPARE(Fcvtzu(v23.V4S(), v12.V4S()), "fcvtzu v23.4s, v12.4s");
5001 COMPARE(Fcvtzu(v30.V2D(), v1.V2D()), "fcvtzu v30.2d, v1.2d");
5002
5003 COMPARE(Fcvtas(v4.V2S(), v11.V2S()), "fcvtas v4.2s, v11.2s");
5004 COMPARE(Fcvtas(v23.V4S(), v12.V4S()), "fcvtas v23.4s, v12.4s");
5005 COMPARE(Fcvtas(v30.V2D(), v1.V2D()), "fcvtas v30.2d, v1.2d");
5006 COMPARE(Fcvtau(v4.V2S(), v11.V2S()), "fcvtau v4.2s, v11.2s");
5007 COMPARE(Fcvtau(v23.V4S(), v12.V4S()), "fcvtau v23.4s, v12.4s");
5008 COMPARE(Fcvtau(v30.V2D(), v1.V2D()), "fcvtau v30.2d, v1.2d");
5009
5010 COMPARE(Fcvtns(s0, s1), "fcvtns s0, s1");
5011 COMPARE(Fcvtns(d2, d3), "fcvtns d2, d3");
5012 COMPARE(Fcvtnu(s4, s5), "fcvtnu s4, s5");
5013 COMPARE(Fcvtnu(d6, d7), "fcvtnu d6, d7");
5014 COMPARE(Fcvtps(s8, s9), "fcvtps s8, s9");
5015 COMPARE(Fcvtps(d10, d11), "fcvtps d10, d11");
5016 COMPARE(Fcvtpu(s12, s13), "fcvtpu s12, s13");
5017 COMPARE(Fcvtpu(d14, d15), "fcvtpu d14, d15");
5018 COMPARE(Fcvtms(s16, s17), "fcvtms s16, s17");
5019 COMPARE(Fcvtms(d18, d19), "fcvtms d18, d19");
5020 COMPARE(Fcvtmu(s20, s21), "fcvtmu s20, s21");
5021 COMPARE(Fcvtmu(d22, d23), "fcvtmu d22, d23");
5022 COMPARE(Fcvtzs(s24, s25), "fcvtzs s24, s25");
5023 COMPARE(Fcvtzs(d26, d27), "fcvtzs d26, d27");
5024 COMPARE(Fcvtzu(s28, s29), "fcvtzu s28, s29");
5025 COMPARE(Fcvtzu(d30, d31), "fcvtzu d30, d31");
5026 COMPARE(Fcvtas(s0, s1), "fcvtas s0, s1");
5027 COMPARE(Fcvtas(d2, d3), "fcvtas d2, d3");
5028 COMPARE(Fcvtau(s4, s5), "fcvtau s4, s5");
5029 COMPARE(Fcvtau(d6, d7), "fcvtau d6, d7");
5030
5031 COMPARE(Fcvtl(v3.V4S(), v5.V4H()), "fcvtl v3.4s, v5.4h");
5032 COMPARE(Fcvtl(v7.V2D(), v11.V2S()), "fcvtl v7.2d, v11.2s");
5033 COMPARE(Fcvtl2(v13.V4S(), v17.V8H()), "fcvtl2 v13.4s, v17.8h");
5034 COMPARE(Fcvtl2(v23.V2D(), v29.V4S()), "fcvtl2 v23.2d, v29.4s");
5035
5036 COMPARE(Fcvtn(v3.V4H(), v5.V4S()), "fcvtn v3.4h, v5.4s");
5037 COMPARE(Fcvtn(v7.V2S(), v11.V2D()), "fcvtn v7.2s, v11.2d");
5038 COMPARE(Fcvtn2(v13.V8H(), v17.V4S()), "fcvtn2 v13.8h, v17.4s");
5039 COMPARE(Fcvtn2(v23.V4S(), v29.V2D()), "fcvtn2 v23.4s, v29.2d");
5040
5041 COMPARE(Fcvtxn(v5.V2S(), v7.V2D()), "fcvtxn v5.2s, v7.2d");
5042 COMPARE(Fcvtxn2(v8.V4S(), v13.V2D()), "fcvtxn2 v8.4s, v13.2d");
5043 COMPARE(Fcvtxn(s17, d31), "fcvtxn s17, d31");
5044
5045 COMPARE(Frecpx(s0, s1), "frecpx s0, s1");
5046 COMPARE(Frecpx(s31, s30), "frecpx s31, s30");
5047 COMPARE(Frecpx(d2, d3), "frecpx d2, d3");
5048 COMPARE(Frecpx(d31, d30), "frecpx d31, d30");
5049
5050 COMPARE(Scvtf(v5.V2S(), v3.V2S()), "scvtf v5.2s, v3.2s");
5051 COMPARE(Scvtf(v6.V4S(), v4.V4S()), "scvtf v6.4s, v4.4s");
5052 COMPARE(Scvtf(v7.V2D(), v5.V2D()), "scvtf v7.2d, v5.2d");
5053 COMPARE(Scvtf(s8, s6), "scvtf s8, s6");
5054 COMPARE(Scvtf(d8, d6), "scvtf d8, d6");
5055
5056 COMPARE(Ucvtf(v5.V2S(), v3.V2S()), "ucvtf v5.2s, v3.2s");
5057 COMPARE(Ucvtf(v6.V4S(), v4.V4S()), "ucvtf v6.4s, v4.4s");
5058 COMPARE(Ucvtf(v7.V2D(), v5.V2D()), "ucvtf v7.2d, v5.2d");
5059 COMPARE(Ucvtf(s8, s6), "ucvtf s8, s6");
5060 COMPARE(Ucvtf(d8, d6), "ucvtf d8, d6");
5061
5062 #define DISASM_INST(TA, TAS, TB, TBS) \
5063 COMPARE(Saddlp(v0.TA, v1.TB), "saddlp v0." TAS ", v1." TBS);
5064 NEON_FORMAT_LIST_LP(DISASM_INST)
5065 #undef DISASM_INST
5066
5067 #define DISASM_INST(TA, TAS, TB, TBS) \
5068 COMPARE(Uaddlp(v0.TA, v1.TB), "uaddlp v0." TAS ", v1." TBS);
5069 NEON_FORMAT_LIST_LP(DISASM_INST)
5070 #undef DISASM_INST
5071
5072 #define DISASM_INST(TA, TAS, TB, TBS) \
5073 COMPARE(Sadalp(v0.TA, v1.TB), "sadalp v0." TAS ", v1." TBS);
5074 NEON_FORMAT_LIST_LP(DISASM_INST)
5075 #undef DISASM_INST
5076
5077 #define DISASM_INST(TA, TAS, TB, TBS) \
5078 COMPARE(Uadalp(v0.TA, v1.TB), "uadalp v0." TAS ", v1." TBS);
5079 NEON_FORMAT_LIST_LP(DISASM_INST)
5080 #undef DISASM_INST
5081
5082 CLEANUP();
5083}
5084
5085TEST(neon_acrosslanes) {
armvixl684cd2a2015-10-23 13:38:33 +01005086 SETUP_MACRO();
armvixl5289c592015-03-02 13:52:04 +00005087
5088 COMPARE(Smaxv(b4, v5.V8B()), "smaxv b4, v5.8b");
5089 COMPARE(Smaxv(b4, v5.V16B()), "smaxv b4, v5.16b");
5090 COMPARE(Smaxv(h4, v5.V4H()), "smaxv h4, v5.4h");
5091 COMPARE(Smaxv(h4, v5.V8H()), "smaxv h4, v5.8h");
5092 COMPARE(Smaxv(s4, v5.V4S()), "smaxv s4, v5.4s");
5093
5094 COMPARE(Sminv(b4, v5.V8B()), "sminv b4, v5.8b");
5095 COMPARE(Sminv(b4, v5.V16B()), "sminv b4, v5.16b");
5096 COMPARE(Sminv(h4, v5.V4H()), "sminv h4, v5.4h");
5097 COMPARE(Sminv(h4, v5.V8H()), "sminv h4, v5.8h");
5098 COMPARE(Sminv(s4, v5.V4S()), "sminv s4, v5.4s");
5099
5100 COMPARE(Umaxv(b4, v5.V8B()), "umaxv b4, v5.8b");
5101 COMPARE(Umaxv(b4, v5.V16B()), "umaxv b4, v5.16b");
5102 COMPARE(Umaxv(h4, v5.V4H()), "umaxv h4, v5.4h");
5103 COMPARE(Umaxv(h4, v5.V8H()), "umaxv h4, v5.8h");
5104 COMPARE(Umaxv(s4, v5.V4S()), "umaxv s4, v5.4s");
5105
5106 COMPARE(Uminv(b4, v5.V8B()), "uminv b4, v5.8b");
5107 COMPARE(Uminv(b4, v5.V16B()), "uminv b4, v5.16b");
5108 COMPARE(Uminv(h4, v5.V4H()), "uminv h4, v5.4h");
5109 COMPARE(Uminv(h4, v5.V8H()), "uminv h4, v5.8h");
5110 COMPARE(Uminv(s4, v5.V4S()), "uminv s4, v5.4s");
5111
5112 COMPARE(Addv(b4, v5.V8B()), "addv b4, v5.8b");
5113 COMPARE(Addv(b4, v5.V16B()), "addv b4, v5.16b");
5114 COMPARE(Addv(h4, v5.V4H()), "addv h4, v5.4h");
5115 COMPARE(Addv(h4, v5.V8H()), "addv h4, v5.8h");
5116 COMPARE(Addv(s4, v5.V4S()), "addv s4, v5.4s");
5117
5118 COMPARE(Saddlv(h4, v5.V8B()), "saddlv h4, v5.8b");
5119 COMPARE(Saddlv(h4, v5.V16B()), "saddlv h4, v5.16b");
5120 COMPARE(Saddlv(s4, v5.V4H()), "saddlv s4, v5.4h");
5121 COMPARE(Saddlv(s4, v5.V8H()), "saddlv s4, v5.8h");
5122 COMPARE(Saddlv(d4, v5.V4S()), "saddlv d4, v5.4s");
5123
5124 COMPARE(Uaddlv(h4, v5.V8B()), "uaddlv h4, v5.8b");
5125 COMPARE(Uaddlv(h4, v5.V16B()), "uaddlv h4, v5.16b");
5126 COMPARE(Uaddlv(s4, v5.V4H()), "uaddlv s4, v5.4h");
5127 COMPARE(Uaddlv(s4, v5.V8H()), "uaddlv s4, v5.8h");
5128 COMPARE(Uaddlv(d4, v5.V4S()), "uaddlv d4, v5.4s");
5129
5130 COMPARE(Fmaxv(s4, v5.V4S()), "fmaxv s4, v5.4s");
5131 COMPARE(Fminv(s4, v5.V4S()), "fminv s4, v5.4s");
5132 COMPARE(Fmaxnmv(s4, v5.V4S()), "fmaxnmv s4, v5.4s");
5133 COMPARE(Fminnmv(s4, v5.V4S()), "fminnmv s4, v5.4s");
5134
5135 CLEANUP();
5136}
5137
5138TEST(neon_scalar_pairwise) {
armvixl684cd2a2015-10-23 13:38:33 +01005139 SETUP_MACRO();
armvixl5289c592015-03-02 13:52:04 +00005140
5141 COMPARE(Addp(d0, v1.V2D()), "addp d0, v1.2d");
5142 COMPARE(Faddp(s0, v1.V2S()), "faddp s0, v1.2s");
5143 COMPARE(Faddp(d2, v3.V2D()), "faddp d2, v3.2d");
5144 COMPARE(Fmaxp(s4, v5.V2S()), "fmaxp s4, v5.2s");
5145 COMPARE(Fmaxp(d6, v7.V2D()), "fmaxp d6, v7.2d");
5146 COMPARE(Fmaxnmp(s8, v9.V2S()), "fmaxnmp s8, v9.2s");
5147 COMPARE(Fmaxnmp(d10, v11.V2D()), "fmaxnmp d10, v11.2d");
5148 COMPARE(Fminp(s12, v13.V2S()), "fminp s12, v13.2s");
5149 COMPARE(Fminp(d14, v15.V2D()), "fminp d14, v15.2d");
5150 COMPARE(Fminnmp(s16, v17.V2S()), "fminnmp s16, v17.2s");
5151 COMPARE(Fminnmp(d18, v19.V2D()), "fminnmp d18, v19.2d");
5152 CLEANUP();
5153}
5154
5155TEST(neon_shift_immediate) {
armvixl684cd2a2015-10-23 13:38:33 +01005156 SETUP_MACRO();
armvixl5289c592015-03-02 13:52:04 +00005157
5158 COMPARE(Sshr(v0.V8B(), v1.V8B(), 1), "sshr v0.8b, v1.8b, #1");
5159 COMPARE(Sshr(v2.V8B(), v3.V8B(), 8), "sshr v2.8b, v3.8b, #8");
5160 COMPARE(Sshr(v4.V16B(), v5.V16B(), 1), "sshr v4.16b, v5.16b, #1");
5161 COMPARE(Sshr(v6.V16B(), v7.V16B(), 8), "sshr v6.16b, v7.16b, #8");
5162 COMPARE(Sshr(v8.V4H(), v9.V4H(), 1), "sshr v8.4h, v9.4h, #1");
5163 COMPARE(Sshr(v10.V4H(), v11.V4H(), 16), "sshr v10.4h, v11.4h, #16");
5164 COMPARE(Sshr(v12.V8H(), v13.V8H(), 1), "sshr v12.8h, v13.8h, #1");
5165 COMPARE(Sshr(v14.V8H(), v15.V8H(), 16), "sshr v14.8h, v15.8h, #16");
5166 COMPARE(Sshr(v16.V2S(), v17.V2S(), 1), "sshr v16.2s, v17.2s, #1");
5167 COMPARE(Sshr(v18.V2S(), v19.V2S(), 32), "sshr v18.2s, v19.2s, #32");
5168 COMPARE(Sshr(v20.V4S(), v21.V4S(), 1), "sshr v20.4s, v21.4s, #1");
5169 COMPARE(Sshr(v22.V4S(), v23.V4S(), 32), "sshr v22.4s, v23.4s, #32");
5170 COMPARE(Sshr(v28.V2D(), v29.V2D(), 1), "sshr v28.2d, v29.2d, #1");
5171 COMPARE(Sshr(v30.V2D(), v31.V2D(), 64), "sshr v30.2d, v31.2d, #64");
5172 COMPARE(Sshr(d0, d1, 7), "sshr d0, d1, #7");
5173
5174 COMPARE(Ushr(v0.V8B(), v1.V8B(), 1), "ushr v0.8b, v1.8b, #1");
5175 COMPARE(Ushr(v2.V8B(), v3.V8B(), 8), "ushr v2.8b, v3.8b, #8");
5176 COMPARE(Ushr(v4.V16B(), v5.V16B(), 1), "ushr v4.16b, v5.16b, #1");
5177 COMPARE(Ushr(v6.V16B(), v7.V16B(), 8), "ushr v6.16b, v7.16b, #8");
5178 COMPARE(Ushr(v8.V4H(), v9.V4H(), 1), "ushr v8.4h, v9.4h, #1");
5179 COMPARE(Ushr(v10.V4H(), v11.V4H(), 16), "ushr v10.4h, v11.4h, #16");
5180 COMPARE(Ushr(v12.V8H(), v13.V8H(), 1), "ushr v12.8h, v13.8h, #1");
5181 COMPARE(Ushr(v14.V8H(), v15.V8H(), 16), "ushr v14.8h, v15.8h, #16");
5182 COMPARE(Ushr(v16.V2S(), v17.V2S(), 1), "ushr v16.2s, v17.2s, #1");
5183 COMPARE(Ushr(v18.V2S(), v19.V2S(), 32), "ushr v18.2s, v19.2s, #32");
5184 COMPARE(Ushr(v20.V4S(), v21.V4S(), 1), "ushr v20.4s, v21.4s, #1");
5185 COMPARE(Ushr(v22.V4S(), v23.V4S(), 32), "ushr v22.4s, v23.4s, #32");
5186 COMPARE(Ushr(v28.V2D(), v29.V2D(), 1), "ushr v28.2d, v29.2d, #1");
5187 COMPARE(Ushr(v30.V2D(), v31.V2D(), 64), "ushr v30.2d, v31.2d, #64");
5188 COMPARE(Ushr(d0, d1, 7), "ushr d0, d1, #7");
5189
5190 COMPARE(Srshr(v0.V8B(), v1.V8B(), 1), "srshr v0.8b, v1.8b, #1");
5191 COMPARE(Srshr(v2.V8B(), v3.V8B(), 8), "srshr v2.8b, v3.8b, #8");
5192 COMPARE(Srshr(v4.V16B(), v5.V16B(), 1), "srshr v4.16b, v5.16b, #1");
5193 COMPARE(Srshr(v6.V16B(), v7.V16B(), 8), "srshr v6.16b, v7.16b, #8");
5194 COMPARE(Srshr(v8.V4H(), v9.V4H(), 1), "srshr v8.4h, v9.4h, #1");
5195 COMPARE(Srshr(v10.V4H(), v11.V4H(), 16), "srshr v10.4h, v11.4h, #16");
5196 COMPARE(Srshr(v12.V8H(), v13.V8H(), 1), "srshr v12.8h, v13.8h, #1");
5197 COMPARE(Srshr(v14.V8H(), v15.V8H(), 16), "srshr v14.8h, v15.8h, #16");
5198 COMPARE(Srshr(v16.V2S(), v17.V2S(), 1), "srshr v16.2s, v17.2s, #1");
5199 COMPARE(Srshr(v18.V2S(), v19.V2S(), 32), "srshr v18.2s, v19.2s, #32");
5200 COMPARE(Srshr(v20.V4S(), v21.V4S(), 1), "srshr v20.4s, v21.4s, #1");
5201 COMPARE(Srshr(v22.V4S(), v23.V4S(), 32), "srshr v22.4s, v23.4s, #32");
5202 COMPARE(Srshr(v28.V2D(), v29.V2D(), 1), "srshr v28.2d, v29.2d, #1");
5203 COMPARE(Srshr(v30.V2D(), v31.V2D(), 64), "srshr v30.2d, v31.2d, #64");
5204 COMPARE(Srshr(d0, d1, 7), "srshr d0, d1, #7");
5205
5206 COMPARE(Urshr(v0.V8B(), v1.V8B(), 1), "urshr v0.8b, v1.8b, #1");
5207 COMPARE(Urshr(v2.V8B(), v3.V8B(), 8), "urshr v2.8b, v3.8b, #8");
5208 COMPARE(Urshr(v4.V16B(), v5.V16B(), 1), "urshr v4.16b, v5.16b, #1");
5209 COMPARE(Urshr(v6.V16B(), v7.V16B(), 8), "urshr v6.16b, v7.16b, #8");
5210 COMPARE(Urshr(v8.V4H(), v9.V4H(), 1), "urshr v8.4h, v9.4h, #1");
5211 COMPARE(Urshr(v10.V4H(), v11.V4H(), 16), "urshr v10.4h, v11.4h, #16");
5212 COMPARE(Urshr(v12.V8H(), v13.V8H(), 1), "urshr v12.8h, v13.8h, #1");
5213 COMPARE(Urshr(v14.V8H(), v15.V8H(), 16), "urshr v14.8h, v15.8h, #16");
5214 COMPARE(Urshr(v16.V2S(), v17.V2S(), 1), "urshr v16.2s, v17.2s, #1");
5215 COMPARE(Urshr(v18.V2S(), v19.V2S(), 32), "urshr v18.2s, v19.2s, #32");
5216 COMPARE(Urshr(v20.V4S(), v21.V4S(), 1), "urshr v20.4s, v21.4s, #1");
5217 COMPARE(Urshr(v22.V4S(), v23.V4S(), 32), "urshr v22.4s, v23.4s, #32");
5218 COMPARE(Urshr(v28.V2D(), v29.V2D(), 1), "urshr v28.2d, v29.2d, #1");
5219 COMPARE(Urshr(v30.V2D(), v31.V2D(), 64), "urshr v30.2d, v31.2d, #64");
5220 COMPARE(Urshr(d0, d1, 7), "urshr d0, d1, #7");
5221
5222 COMPARE(Srsra(v0.V8B(), v1.V8B(), 1), "srsra v0.8b, v1.8b, #1");
5223 COMPARE(Srsra(v2.V8B(), v3.V8B(), 8), "srsra v2.8b, v3.8b, #8");
5224 COMPARE(Srsra(v4.V16B(), v5.V16B(), 1), "srsra v4.16b, v5.16b, #1");
5225 COMPARE(Srsra(v6.V16B(), v7.V16B(), 8), "srsra v6.16b, v7.16b, #8");
5226 COMPARE(Srsra(v8.V4H(), v9.V4H(), 1), "srsra v8.4h, v9.4h, #1");
5227 COMPARE(Srsra(v10.V4H(), v11.V4H(), 16), "srsra v10.4h, v11.4h, #16");
5228 COMPARE(Srsra(v12.V8H(), v13.V8H(), 1), "srsra v12.8h, v13.8h, #1");
5229 COMPARE(Srsra(v14.V8H(), v15.V8H(), 16), "srsra v14.8h, v15.8h, #16");
5230 COMPARE(Srsra(v16.V2S(), v17.V2S(), 1), "srsra v16.2s, v17.2s, #1");
5231 COMPARE(Srsra(v18.V2S(), v19.V2S(), 32), "srsra v18.2s, v19.2s, #32");
5232 COMPARE(Srsra(v20.V4S(), v21.V4S(), 1), "srsra v20.4s, v21.4s, #1");
5233 COMPARE(Srsra(v22.V4S(), v23.V4S(), 32), "srsra v22.4s, v23.4s, #32");
5234 COMPARE(Srsra(v28.V2D(), v29.V2D(), 1), "srsra v28.2d, v29.2d, #1");
5235 COMPARE(Srsra(v30.V2D(), v31.V2D(), 64), "srsra v30.2d, v31.2d, #64");
5236 COMPARE(Srsra(d0, d1, 7), "srsra d0, d1, #7");
5237
5238 COMPARE(Ssra(v0.V8B(), v1.V8B(), 1), "ssra v0.8b, v1.8b, #1");
5239 COMPARE(Ssra(v2.V8B(), v3.V8B(), 8), "ssra v2.8b, v3.8b, #8");
5240 COMPARE(Ssra(v4.V16B(), v5.V16B(), 1), "ssra v4.16b, v5.16b, #1");
5241 COMPARE(Ssra(v6.V16B(), v7.V16B(), 8), "ssra v6.16b, v7.16b, #8");
5242 COMPARE(Ssra(v8.V4H(), v9.V4H(), 1), "ssra v8.4h, v9.4h, #1");
5243 COMPARE(Ssra(v10.V4H(), v11.V4H(), 16), "ssra v10.4h, v11.4h, #16");
5244 COMPARE(Ssra(v12.V8H(), v13.V8H(), 1), "ssra v12.8h, v13.8h, #1");
5245 COMPARE(Ssra(v14.V8H(), v15.V8H(), 16), "ssra v14.8h, v15.8h, #16");
5246 COMPARE(Ssra(v16.V2S(), v17.V2S(), 1), "ssra v16.2s, v17.2s, #1");
5247 COMPARE(Ssra(v18.V2S(), v19.V2S(), 32), "ssra v18.2s, v19.2s, #32");
5248 COMPARE(Ssra(v20.V4S(), v21.V4S(), 1), "ssra v20.4s, v21.4s, #1");
5249 COMPARE(Ssra(v22.V4S(), v23.V4S(), 32), "ssra v22.4s, v23.4s, #32");
5250 COMPARE(Ssra(v28.V2D(), v29.V2D(), 1), "ssra v28.2d, v29.2d, #1");
5251 COMPARE(Ssra(v30.V2D(), v31.V2D(), 64), "ssra v30.2d, v31.2d, #64");
5252 COMPARE(Ssra(d0, d1, 7), "ssra d0, d1, #7");
5253
5254 COMPARE(Ursra(v0.V8B(), v1.V8B(), 1), "ursra v0.8b, v1.8b, #1");
5255 COMPARE(Ursra(v2.V8B(), v3.V8B(), 8), "ursra v2.8b, v3.8b, #8");
5256 COMPARE(Ursra(v4.V16B(), v5.V16B(), 1), "ursra v4.16b, v5.16b, #1");
5257 COMPARE(Ursra(v6.V16B(), v7.V16B(), 8), "ursra v6.16b, v7.16b, #8");
5258 COMPARE(Ursra(v8.V4H(), v9.V4H(), 1), "ursra v8.4h, v9.4h, #1");
5259 COMPARE(Ursra(v10.V4H(), v11.V4H(), 16), "ursra v10.4h, v11.4h, #16");
5260 COMPARE(Ursra(v12.V8H(), v13.V8H(), 1), "ursra v12.8h, v13.8h, #1");
5261 COMPARE(Ursra(v14.V8H(), v15.V8H(), 16), "ursra v14.8h, v15.8h, #16");
5262 COMPARE(Ursra(v16.V2S(), v17.V2S(), 1), "ursra v16.2s, v17.2s, #1");
5263 COMPARE(Ursra(v18.V2S(), v19.V2S(), 32), "ursra v18.2s, v19.2s, #32");
5264 COMPARE(Ursra(v20.V4S(), v21.V4S(), 1), "ursra v20.4s, v21.4s, #1");
5265 COMPARE(Ursra(v22.V4S(), v23.V4S(), 32), "ursra v22.4s, v23.4s, #32");
5266 COMPARE(Ursra(v28.V2D(), v29.V2D(), 1), "ursra v28.2d, v29.2d, #1");
5267 COMPARE(Ursra(v30.V2D(), v31.V2D(), 64), "ursra v30.2d, v31.2d, #64");
5268 COMPARE(Ursra(d0, d1, 7), "ursra d0, d1, #7");
5269
5270 COMPARE(Usra(v0.V8B(), v1.V8B(), 1), "usra v0.8b, v1.8b, #1");
5271 COMPARE(Usra(v2.V8B(), v3.V8B(), 8), "usra v2.8b, v3.8b, #8");
5272 COMPARE(Usra(v4.V16B(), v5.V16B(), 1), "usra v4.16b, v5.16b, #1");
5273 COMPARE(Usra(v6.V16B(), v7.V16B(), 8), "usra v6.16b, v7.16b, #8");
5274 COMPARE(Usra(v8.V4H(), v9.V4H(), 1), "usra v8.4h, v9.4h, #1");
5275 COMPARE(Usra(v10.V4H(), v11.V4H(), 16), "usra v10.4h, v11.4h, #16");
5276 COMPARE(Usra(v12.V8H(), v13.V8H(), 1), "usra v12.8h, v13.8h, #1");
5277 COMPARE(Usra(v14.V8H(), v15.V8H(), 16), "usra v14.8h, v15.8h, #16");
5278 COMPARE(Usra(v16.V2S(), v17.V2S(), 1), "usra v16.2s, v17.2s, #1");
5279 COMPARE(Usra(v18.V2S(), v19.V2S(), 32), "usra v18.2s, v19.2s, #32");
5280 COMPARE(Usra(v20.V4S(), v21.V4S(), 1), "usra v20.4s, v21.4s, #1");
5281 COMPARE(Usra(v22.V4S(), v23.V4S(), 32), "usra v22.4s, v23.4s, #32");
5282 COMPARE(Usra(v28.V2D(), v29.V2D(), 1), "usra v28.2d, v29.2d, #1");
5283 COMPARE(Usra(v30.V2D(), v31.V2D(), 64), "usra v30.2d, v31.2d, #64");
5284 COMPARE(Usra(d0, d1, 7), "usra d0, d1, #7");
5285
5286 COMPARE(Sli(v1.V8B(), v8.V8B(), 1), "sli v1.8b, v8.8b, #1");
5287 COMPARE(Sli(v2.V16B(), v9.V16B(), 2), "sli v2.16b, v9.16b, #2");
5288 COMPARE(Sli(v3.V4H(), v1.V4H(), 3), "sli v3.4h, v1.4h, #3");
5289 COMPARE(Sli(v4.V8H(), v2.V8H(), 4), "sli v4.8h, v2.8h, #4");
5290 COMPARE(Sli(v5.V2S(), v3.V2S(), 5), "sli v5.2s, v3.2s, #5");
5291 COMPARE(Sli(v6.V4S(), v4.V4S(), 6), "sli v6.4s, v4.4s, #6");
5292 COMPARE(Sli(v7.V2D(), v5.V2D(), 7), "sli v7.2d, v5.2d, #7");
5293 COMPARE(Sli(d8, d6, 8), "sli d8, d6, #8");
5294
5295 COMPARE(Shl(v1.V8B(), v8.V8B(), 1), "shl v1.8b, v8.8b, #1");
5296 COMPARE(Shl(v2.V16B(), v9.V16B(), 2), "shl v2.16b, v9.16b, #2");
5297 COMPARE(Shl(v3.V4H(), v1.V4H(), 3), "shl v3.4h, v1.4h, #3");
5298 COMPARE(Shl(v4.V8H(), v2.V8H(), 4), "shl v4.8h, v2.8h, #4");
5299 COMPARE(Shl(v5.V2S(), v3.V2S(), 5), "shl v5.2s, v3.2s, #5");
5300 COMPARE(Shl(v6.V4S(), v4.V4S(), 6), "shl v6.4s, v4.4s, #6");
5301 COMPARE(Shl(v7.V2D(), v5.V2D(), 7), "shl v7.2d, v5.2d, #7");
5302 COMPARE(Shl(d8, d6, 8), "shl d8, d6, #8");
5303
5304 COMPARE(Sqshl(v1.V8B(), v8.V8B(), 1), "sqshl v1.8b, v8.8b, #1");
5305 COMPARE(Sqshl(v2.V16B(), v9.V16B(), 2), "sqshl v2.16b, v9.16b, #2");
5306 COMPARE(Sqshl(v3.V4H(), v1.V4H(), 3), "sqshl v3.4h, v1.4h, #3");
5307 COMPARE(Sqshl(v4.V8H(), v2.V8H(), 4), "sqshl v4.8h, v2.8h, #4");
5308 COMPARE(Sqshl(v5.V2S(), v3.V2S(), 5), "sqshl v5.2s, v3.2s, #5");
5309 COMPARE(Sqshl(v6.V4S(), v4.V4S(), 6), "sqshl v6.4s, v4.4s, #6");
5310 COMPARE(Sqshl(v7.V2D(), v5.V2D(), 7), "sqshl v7.2d, v5.2d, #7");
5311 COMPARE(Sqshl(b8, b7, 1), "sqshl b8, b7, #1");
5312 COMPARE(Sqshl(h9, h8, 2), "sqshl h9, h8, #2");
5313 COMPARE(Sqshl(s10, s9, 3), "sqshl s10, s9, #3");
5314 COMPARE(Sqshl(d11, d10, 4), "sqshl d11, d10, #4");
5315
5316 COMPARE(Sqshlu(v1.V8B(), v8.V8B(), 1), "sqshlu v1.8b, v8.8b, #1");
5317 COMPARE(Sqshlu(v2.V16B(), v9.V16B(), 2), "sqshlu v2.16b, v9.16b, #2");
5318 COMPARE(Sqshlu(v3.V4H(), v1.V4H(), 3), "sqshlu v3.4h, v1.4h, #3");
5319 COMPARE(Sqshlu(v4.V8H(), v2.V8H(), 4), "sqshlu v4.8h, v2.8h, #4");
5320 COMPARE(Sqshlu(v5.V2S(), v3.V2S(), 5), "sqshlu v5.2s, v3.2s, #5");
5321 COMPARE(Sqshlu(v6.V4S(), v4.V4S(), 6), "sqshlu v6.4s, v4.4s, #6");
5322 COMPARE(Sqshlu(v7.V2D(), v5.V2D(), 7), "sqshlu v7.2d, v5.2d, #7");
5323 COMPARE(Sqshlu(b8, b7, 1), "sqshlu b8, b7, #1");
5324 COMPARE(Sqshlu(h9, h8, 2), "sqshlu h9, h8, #2");
5325 COMPARE(Sqshlu(s10, s9, 3), "sqshlu s10, s9, #3");
5326 COMPARE(Sqshlu(d11, d10, 4), "sqshlu d11, d10, #4");
5327
5328 COMPARE(Uqshl(v1.V8B(), v8.V8B(), 1), "uqshl v1.8b, v8.8b, #1");
5329 COMPARE(Uqshl(v2.V16B(), v9.V16B(), 2), "uqshl v2.16b, v9.16b, #2");
5330 COMPARE(Uqshl(v3.V4H(), v1.V4H(), 3), "uqshl v3.4h, v1.4h, #3");
5331 COMPARE(Uqshl(v4.V8H(), v2.V8H(), 4), "uqshl v4.8h, v2.8h, #4");
5332 COMPARE(Uqshl(v5.V2S(), v3.V2S(), 5), "uqshl v5.2s, v3.2s, #5");
5333 COMPARE(Uqshl(v6.V4S(), v4.V4S(), 6), "uqshl v6.4s, v4.4s, #6");
5334 COMPARE(Uqshl(v7.V2D(), v5.V2D(), 7), "uqshl v7.2d, v5.2d, #7");
5335 COMPARE(Uqshl(b8, b7, 1), "uqshl b8, b7, #1");
5336 COMPARE(Uqshl(h9, h8, 2), "uqshl h9, h8, #2");
5337 COMPARE(Uqshl(s10, s9, 3), "uqshl s10, s9, #3");
5338 COMPARE(Uqshl(d11, d10, 4), "uqshl d11, d10, #4");
5339
5340 COMPARE(Sshll(v1.V8H(), v8.V8B(), 1), "sshll v1.8h, v8.8b, #1");
5341 COMPARE(Sshll(v3.V4S(), v1.V4H(), 3), "sshll v3.4s, v1.4h, #3");
5342 COMPARE(Sshll(v5.V2D(), v3.V2S(), 5), "sshll v5.2d, v3.2s, #5");
5343 COMPARE(Sshll2(v2.V8H(), v9.V16B(), 2), "sshll2 v2.8h, v9.16b, #2");
5344 COMPARE(Sshll2(v4.V4S(), v2.V8H(), 4), "sshll2 v4.4s, v2.8h, #4");
5345 COMPARE(Sshll2(v6.V2D(), v4.V4S(), 6), "sshll2 v6.2d, v4.4s, #6");
5346
5347 COMPARE(Sshll(v1.V8H(), v8.V8B(), 0), "sxtl v1.8h, v8.8b");
5348 COMPARE(Sshll(v3.V4S(), v1.V4H(), 0), "sxtl v3.4s, v1.4h");
5349 COMPARE(Sshll(v5.V2D(), v3.V2S(), 0), "sxtl v5.2d, v3.2s");
5350 COMPARE(Sshll2(v2.V8H(), v9.V16B(), 0), "sxtl2 v2.8h, v9.16b");
5351 COMPARE(Sshll2(v4.V4S(), v2.V8H(), 0), "sxtl2 v4.4s, v2.8h");
5352 COMPARE(Sshll2(v6.V2D(), v4.V4S(), 0), "sxtl2 v6.2d, v4.4s");
5353
5354 COMPARE(Sxtl(v1.V8H(), v8.V8B()), "sxtl v1.8h, v8.8b");
5355 COMPARE(Sxtl(v3.V4S(), v1.V4H()), "sxtl v3.4s, v1.4h");
5356 COMPARE(Sxtl(v5.V2D(), v3.V2S()), "sxtl v5.2d, v3.2s");
5357 COMPARE(Sxtl2(v2.V8H(), v9.V16B()), "sxtl2 v2.8h, v9.16b");
5358 COMPARE(Sxtl2(v4.V4S(), v2.V8H()), "sxtl2 v4.4s, v2.8h");
5359 COMPARE(Sxtl2(v6.V2D(), v4.V4S()), "sxtl2 v6.2d, v4.4s");
5360
5361 COMPARE(Ushll(v1.V8H(), v8.V8B(), 1), "ushll v1.8h, v8.8b, #1");
5362 COMPARE(Ushll(v3.V4S(), v1.V4H(), 3), "ushll v3.4s, v1.4h, #3");
5363 COMPARE(Ushll(v5.V2D(), v3.V2S(), 5), "ushll v5.2d, v3.2s, #5");
5364 COMPARE(Ushll2(v2.V8H(), v9.V16B(), 2), "ushll2 v2.8h, v9.16b, #2");
5365 COMPARE(Ushll2(v4.V4S(), v2.V8H(), 4), "ushll2 v4.4s, v2.8h, #4");
5366 COMPARE(Ushll2(v6.V2D(), v4.V4S(), 6), "ushll2 v6.2d, v4.4s, #6");
5367
5368 COMPARE(Ushll(v1.V8H(), v8.V8B(), 0), "uxtl v1.8h, v8.8b");
5369 COMPARE(Ushll(v3.V4S(), v1.V4H(), 0), "uxtl v3.4s, v1.4h");
5370 COMPARE(Ushll(v5.V2D(), v3.V2S(), 0), "uxtl v5.2d, v3.2s");
5371 COMPARE(Ushll2(v2.V8H(), v9.V16B(), 0), "uxtl2 v2.8h, v9.16b");
5372 COMPARE(Ushll2(v4.V4S(), v2.V8H(), 0), "uxtl2 v4.4s, v2.8h");
5373 COMPARE(Ushll2(v6.V2D(), v4.V4S(), 0), "uxtl2 v6.2d, v4.4s");
5374
5375 COMPARE(Uxtl(v1.V8H(), v8.V8B()), "uxtl v1.8h, v8.8b");
5376 COMPARE(Uxtl(v3.V4S(), v1.V4H()), "uxtl v3.4s, v1.4h");
5377 COMPARE(Uxtl(v5.V2D(), v3.V2S()), "uxtl v5.2d, v3.2s");
5378 COMPARE(Uxtl2(v2.V8H(), v9.V16B()), "uxtl2 v2.8h, v9.16b");
5379 COMPARE(Uxtl2(v4.V4S(), v2.V8H()), "uxtl2 v4.4s, v2.8h");
5380 COMPARE(Uxtl2(v6.V2D(), v4.V4S()), "uxtl2 v6.2d, v4.4s");
5381
5382 COMPARE(Sri(v1.V8B(), v8.V8B(), 1), "sri v1.8b, v8.8b, #1");
5383 COMPARE(Sri(v2.V16B(), v9.V16B(), 2), "sri v2.16b, v9.16b, #2");
5384 COMPARE(Sri(v3.V4H(), v1.V4H(), 3), "sri v3.4h, v1.4h, #3");
5385 COMPARE(Sri(v4.V8H(), v2.V8H(), 4), "sri v4.8h, v2.8h, #4");
5386 COMPARE(Sri(v5.V2S(), v3.V2S(), 5), "sri v5.2s, v3.2s, #5");
5387 COMPARE(Sri(v6.V4S(), v4.V4S(), 6), "sri v6.4s, v4.4s, #6");
5388 COMPARE(Sri(v7.V2D(), v5.V2D(), 7), "sri v7.2d, v5.2d, #7");
5389 COMPARE(Sri(d8, d6, 8), "sri d8, d6, #8");
5390
5391 COMPARE(Shrn(v0.V8B(), v1.V8H(), 1), "shrn v0.8b, v1.8h, #1");
5392 COMPARE(Shrn(v1.V4H(), v2.V4S(), 2), "shrn v1.4h, v2.4s, #2");
5393 COMPARE(Shrn(v2.V2S(), v3.V2D(), 3), "shrn v2.2s, v3.2d, #3");
5394 COMPARE(Shrn2(v0.V16B(), v1.V8H(), 4), "shrn2 v0.16b, v1.8h, #4");
5395 COMPARE(Shrn2(v1.V8H(), v2.V4S(), 5), "shrn2 v1.8h, v2.4s, #5");
5396 COMPARE(Shrn2(v2.V4S(), v3.V2D(), 6), "shrn2 v2.4s, v3.2d, #6");
5397
5398 COMPARE(Rshrn(v0.V8B(), v1.V8H(), 1), "rshrn v0.8b, v1.8h, #1");
5399 COMPARE(Rshrn(v1.V4H(), v2.V4S(), 2), "rshrn v1.4h, v2.4s, #2");
5400 COMPARE(Rshrn(v2.V2S(), v3.V2D(), 3), "rshrn v2.2s, v3.2d, #3");
5401 COMPARE(Rshrn2(v0.V16B(), v1.V8H(), 4), "rshrn2 v0.16b, v1.8h, #4");
5402 COMPARE(Rshrn2(v1.V8H(), v2.V4S(), 5), "rshrn2 v1.8h, v2.4s, #5");
5403 COMPARE(Rshrn2(v2.V4S(), v3.V2D(), 6), "rshrn2 v2.4s, v3.2d, #6");
5404
5405 COMPARE(Uqshrn(v0.V8B(), v1.V8H(), 1), "uqshrn v0.8b, v1.8h, #1");
5406 COMPARE(Uqshrn(v1.V4H(), v2.V4S(), 2), "uqshrn v1.4h, v2.4s, #2");
5407 COMPARE(Uqshrn(v2.V2S(), v3.V2D(), 3), "uqshrn v2.2s, v3.2d, #3");
5408 COMPARE(Uqshrn2(v0.V16B(), v1.V8H(), 4), "uqshrn2 v0.16b, v1.8h, #4");
5409 COMPARE(Uqshrn2(v1.V8H(), v2.V4S(), 5), "uqshrn2 v1.8h, v2.4s, #5");
5410 COMPARE(Uqshrn2(v2.V4S(), v3.V2D(), 6), "uqshrn2 v2.4s, v3.2d, #6");
5411 COMPARE(Uqshrn(b0, h1, 1), "uqshrn b0, h1, #1");
5412 COMPARE(Uqshrn(h1, s2, 2), "uqshrn h1, s2, #2");
5413 COMPARE(Uqshrn(s2, d3, 3), "uqshrn s2, d3, #3");
5414
5415 COMPARE(Uqrshrn(v0.V8B(), v1.V8H(), 1), "uqrshrn v0.8b, v1.8h, #1");
5416 COMPARE(Uqrshrn(v1.V4H(), v2.V4S(), 2), "uqrshrn v1.4h, v2.4s, #2");
5417 COMPARE(Uqrshrn(v2.V2S(), v3.V2D(), 3), "uqrshrn v2.2s, v3.2d, #3");
5418 COMPARE(Uqrshrn2(v0.V16B(), v1.V8H(), 4), "uqrshrn2 v0.16b, v1.8h, #4");
5419 COMPARE(Uqrshrn2(v1.V8H(), v2.V4S(), 5), "uqrshrn2 v1.8h, v2.4s, #5");
5420 COMPARE(Uqrshrn2(v2.V4S(), v3.V2D(), 6), "uqrshrn2 v2.4s, v3.2d, #6");
5421 COMPARE(Uqrshrn(b0, h1, 1), "uqrshrn b0, h1, #1");
5422 COMPARE(Uqrshrn(h1, s2, 2), "uqrshrn h1, s2, #2");
5423 COMPARE(Uqrshrn(s2, d3, 3), "uqrshrn s2, d3, #3");
5424
5425 COMPARE(Sqshrn(v0.V8B(), v1.V8H(), 1), "sqshrn v0.8b, v1.8h, #1");
5426 COMPARE(Sqshrn(v1.V4H(), v2.V4S(), 2), "sqshrn v1.4h, v2.4s, #2");
5427 COMPARE(Sqshrn(v2.V2S(), v3.V2D(), 3), "sqshrn v2.2s, v3.2d, #3");
5428 COMPARE(Sqshrn2(v0.V16B(), v1.V8H(), 4), "sqshrn2 v0.16b, v1.8h, #4");
5429 COMPARE(Sqshrn2(v1.V8H(), v2.V4S(), 5), "sqshrn2 v1.8h, v2.4s, #5");
5430 COMPARE(Sqshrn2(v2.V4S(), v3.V2D(), 6), "sqshrn2 v2.4s, v3.2d, #6");
5431 COMPARE(Sqshrn(b0, h1, 1), "sqshrn b0, h1, #1");
5432 COMPARE(Sqshrn(h1, s2, 2), "sqshrn h1, s2, #2");
5433 COMPARE(Sqshrn(s2, d3, 3), "sqshrn s2, d3, #3");
5434
5435 COMPARE(Sqrshrn(v0.V8B(), v1.V8H(), 1), "sqrshrn v0.8b, v1.8h, #1");
5436 COMPARE(Sqrshrn(v1.V4H(), v2.V4S(), 2), "sqrshrn v1.4h, v2.4s, #2");
5437 COMPARE(Sqrshrn(v2.V2S(), v3.V2D(), 3), "sqrshrn v2.2s, v3.2d, #3");
5438 COMPARE(Sqrshrn2(v0.V16B(), v1.V8H(), 4), "sqrshrn2 v0.16b, v1.8h, #4");
5439 COMPARE(Sqrshrn2(v1.V8H(), v2.V4S(), 5), "sqrshrn2 v1.8h, v2.4s, #5");
5440 COMPARE(Sqrshrn2(v2.V4S(), v3.V2D(), 6), "sqrshrn2 v2.4s, v3.2d, #6");
5441 COMPARE(Sqrshrn(b0, h1, 1), "sqrshrn b0, h1, #1");
5442 COMPARE(Sqrshrn(h1, s2, 2), "sqrshrn h1, s2, #2");
5443 COMPARE(Sqrshrn(s2, d3, 3), "sqrshrn s2, d3, #3");
5444
5445 COMPARE(Sqshrun(v0.V8B(), v1.V8H(), 1), "sqshrun v0.8b, v1.8h, #1");
5446 COMPARE(Sqshrun(v1.V4H(), v2.V4S(), 2), "sqshrun v1.4h, v2.4s, #2");
5447 COMPARE(Sqshrun(v2.V2S(), v3.V2D(), 3), "sqshrun v2.2s, v3.2d, #3");
5448 COMPARE(Sqshrun2(v0.V16B(), v1.V8H(), 4), "sqshrun2 v0.16b, v1.8h, #4");
5449 COMPARE(Sqshrun2(v1.V8H(), v2.V4S(), 5), "sqshrun2 v1.8h, v2.4s, #5");
5450 COMPARE(Sqshrun2(v2.V4S(), v3.V2D(), 6), "sqshrun2 v2.4s, v3.2d, #6");
5451 COMPARE(Sqshrun(b0, h1, 1), "sqshrun b0, h1, #1");
5452 COMPARE(Sqshrun(h1, s2, 2), "sqshrun h1, s2, #2");
5453 COMPARE(Sqshrun(s2, d3, 3), "sqshrun s2, d3, #3");
5454
5455 COMPARE(Sqrshrun(v0.V8B(), v1.V8H(), 1), "sqrshrun v0.8b, v1.8h, #1");
5456 COMPARE(Sqrshrun(v1.V4H(), v2.V4S(), 2), "sqrshrun v1.4h, v2.4s, #2");
5457 COMPARE(Sqrshrun(v2.V2S(), v3.V2D(), 3), "sqrshrun v2.2s, v3.2d, #3");
5458 COMPARE(Sqrshrun2(v0.V16B(), v1.V8H(), 4), "sqrshrun2 v0.16b, v1.8h, #4");
5459 COMPARE(Sqrshrun2(v1.V8H(), v2.V4S(), 5), "sqrshrun2 v1.8h, v2.4s, #5");
5460 COMPARE(Sqrshrun2(v2.V4S(), v3.V2D(), 6), "sqrshrun2 v2.4s, v3.2d, #6");
5461 COMPARE(Sqrshrun(b0, h1, 1), "sqrshrun b0, h1, #1");
5462 COMPARE(Sqrshrun(h1, s2, 2), "sqrshrun h1, s2, #2");
5463 COMPARE(Sqrshrun(s2, d3, 3), "sqrshrun s2, d3, #3");
5464
5465 COMPARE(Scvtf(v5.V2S(), v3.V2S(), 11), "scvtf v5.2s, v3.2s, #11");
5466 COMPARE(Scvtf(v6.V4S(), v4.V4S(), 12), "scvtf v6.4s, v4.4s, #12");
5467 COMPARE(Scvtf(v7.V2D(), v5.V2D(), 33), "scvtf v7.2d, v5.2d, #33");
5468 COMPARE(Scvtf(s8, s6, 13), "scvtf s8, s6, #13");
5469 COMPARE(Scvtf(d8, d6, 34), "scvtf d8, d6, #34");
5470
5471 COMPARE(Ucvtf(v5.V2S(), v3.V2S(), 11), "ucvtf v5.2s, v3.2s, #11");
5472 COMPARE(Ucvtf(v6.V4S(), v4.V4S(), 12), "ucvtf v6.4s, v4.4s, #12");
5473 COMPARE(Ucvtf(v7.V2D(), v5.V2D(), 33), "ucvtf v7.2d, v5.2d, #33");
5474 COMPARE(Ucvtf(s8, s6, 13), "ucvtf s8, s6, #13");
5475 COMPARE(Ucvtf(d8, d6, 34), "ucvtf d8, d6, #34");
5476
5477 COMPARE(Fcvtzs(v5.V2S(), v3.V2S(), 11), "fcvtzs v5.2s, v3.2s, #11");
5478 COMPARE(Fcvtzs(v6.V4S(), v4.V4S(), 12), "fcvtzs v6.4s, v4.4s, #12");
5479 COMPARE(Fcvtzs(v7.V2D(), v5.V2D(), 33), "fcvtzs v7.2d, v5.2d, #33");
5480 COMPARE(Fcvtzs(s8, s6, 13), "fcvtzs s8, s6, #13");
5481 COMPARE(Fcvtzs(d8, d6, 34), "fcvtzs d8, d6, #34");
5482
5483 COMPARE(Fcvtzu(v5.V2S(), v3.V2S(), 11), "fcvtzu v5.2s, v3.2s, #11");
5484 COMPARE(Fcvtzu(v6.V4S(), v4.V4S(), 12), "fcvtzu v6.4s, v4.4s, #12");
5485 COMPARE(Fcvtzu(v7.V2D(), v5.V2D(), 33), "fcvtzu v7.2d, v5.2d, #33");
5486 COMPARE(Fcvtzu(s8, s6, 13), "fcvtzu s8, s6, #13");
5487 COMPARE(Fcvtzu(d8, d6, 34), "fcvtzu d8, d6, #34");
5488
5489 CLEANUP();
5490}
5491
armvixl330dc712014-11-25 10:38:32 +00005492TEST(address_map) {
5493 // Check that we can disassemble from a fake base address.
5494 SETUP();
5495
5496 disasm->MapCodeAddress(0, reinterpret_cast<Instruction*>(buf));
5497 COMPARE(ldr(x0, 0), "ldr x0, pc+0 (addr 0x0)");
5498 COMPARE(ldr(x0, -1), "ldr x0, pc-4 (addr -0x4)");
5499 COMPARE(ldr(x0, 1), "ldr x0, pc+4 (addr 0x4)");
5500 COMPARE(prfm(PLIL1KEEP, 0), "prfm plil1keep, pc+0 (addr 0x0)");
5501 COMPARE(prfm(PLIL1KEEP, -1), "prfm plil1keep, pc-4 (addr -0x4)");
5502 COMPARE(prfm(PLIL1KEEP, 1), "prfm plil1keep, pc+4 (addr 0x4)");
5503 COMPARE(adr(x0, 0), "adr x0, #+0x0 (addr 0x0)");
5504 COMPARE(adr(x0, -1), "adr x0, #-0x1 (addr -0x1)");
5505 COMPARE(adr(x0, 1), "adr x0, #+0x1 (addr 0x1)");
5506 COMPARE(adrp(x0, 0), "adrp x0, #+0x0 (addr 0x0)");
5507 COMPARE(adrp(x0, -1), "adrp x0, #-0x1000 (addr -0x1000)");
5508 COMPARE(adrp(x0, 1), "adrp x0, #+0x1000 (addr 0x1000)");
5509 COMPARE(b(0), "b #+0x0 (addr 0x0)");
5510 COMPARE(b(-1), "b #-0x4 (addr -0x4)");
5511 COMPARE(b(1), "b #+0x4 (addr 0x4)");
5512
5513 disasm->MapCodeAddress(0x1234, reinterpret_cast<Instruction*>(buf));
5514 COMPARE(ldr(x0, 0), "ldr x0, pc+0 (addr 0x1234)");
5515 COMPARE(ldr(x0, -1), "ldr x0, pc-4 (addr 0x1230)");
5516 COMPARE(ldr(x0, 1), "ldr x0, pc+4 (addr 0x1238)");
5517 COMPARE(prfm(PLIL1KEEP, 0), "prfm plil1keep, pc+0 (addr 0x1234)");
5518 COMPARE(prfm(PLIL1KEEP, -1), "prfm plil1keep, pc-4 (addr 0x1230)");
5519 COMPARE(prfm(PLIL1KEEP, 1), "prfm plil1keep, pc+4 (addr 0x1238)");
5520 COMPARE(adr(x0, 0), "adr x0, #+0x0 (addr 0x1234)");
5521 COMPARE(adr(x0, -1), "adr x0, #-0x1 (addr 0x1233)");
5522 COMPARE(adr(x0, 1), "adr x0, #+0x1 (addr 0x1235)");
5523 COMPARE(adrp(x0, 0), "adrp x0, #+0x0 (addr 0x1000)");
5524 COMPARE(adrp(x0, -1), "adrp x0, #-0x1000 (addr 0x0)");
5525 COMPARE(adrp(x0, 1), "adrp x0, #+0x1000 (addr 0x2000)");
5526 COMPARE(b(0), "b #+0x0 (addr 0x1234)");
5527 COMPARE(b(-1), "b #-0x4 (addr 0x1230)");
5528 COMPARE(b(1), "b #+0x4 (addr 0x1238)");
5529
5530 // Check that 64-bit addresses work.
5531 disasm->MapCodeAddress(UINT64_C(0x100000000),
5532 reinterpret_cast<Instruction*>(buf));
5533 COMPARE(ldr(x0, 0), "ldr x0, pc+0 (addr 0x100000000)");
5534 COMPARE(ldr(x0, -1), "ldr x0, pc-4 (addr 0xfffffffc)");
5535 COMPARE(ldr(x0, 1), "ldr x0, pc+4 (addr 0x100000004)");
5536 COMPARE(prfm(PLIL1KEEP, 0), "prfm plil1keep, pc+0 (addr 0x100000000)");
5537 COMPARE(prfm(PLIL1KEEP, -1), "prfm plil1keep, pc-4 (addr 0xfffffffc)");
5538 COMPARE(prfm(PLIL1KEEP, 1), "prfm plil1keep, pc+4 (addr 0x100000004)");
5539 COMPARE(adr(x0, 0), "adr x0, #+0x0 (addr 0x100000000)");
5540 COMPARE(adr(x0, -1), "adr x0, #-0x1 (addr 0xffffffff)");
5541 COMPARE(adr(x0, 1), "adr x0, #+0x1 (addr 0x100000001)");
5542 COMPARE(adrp(x0, 0), "adrp x0, #+0x0 (addr 0x100000000)");
5543 COMPARE(adrp(x0, -1), "adrp x0, #-0x1000 (addr 0xfffff000)");
5544 COMPARE(adrp(x0, 1), "adrp x0, #+0x1000 (addr 0x100001000)");
5545 COMPARE(b(0), "b #+0x0 (addr 0x100000000)");
5546 COMPARE(b(-1), "b #-0x4 (addr 0xfffffffc)");
5547 COMPARE(b(1), "b #+0x4 (addr 0x100000004)");
5548
5549 disasm->MapCodeAddress(0xfffffffc, reinterpret_cast<Instruction*>(buf));
5550 COMPARE(ldr(x0, 1), "ldr x0, pc+4 (addr 0x100000000)");
5551 COMPARE(prfm(PLIL1KEEP, 1), "prfm plil1keep, pc+4 (addr 0x100000000)");
5552 COMPARE(b(1), "b #+0x4 (addr 0x100000000)");
5553 COMPARE(adr(x0, 4), "adr x0, #+0x4 (addr 0x100000000)");
5554 COMPARE(adrp(x0, 1), "adrp x0, #+0x1000 (addr 0x100000000)");
5555
5556 // Check that very large offsets are handled properly. This detects misuse of
5557 // the host's ptrdiff_t type when run on a 32-bit host. Only adrp is capable
5558 // of encoding such offsets.
5559 disasm->MapCodeAddress(0, reinterpret_cast<Instruction*>(buf));
5560 COMPARE(adrp(x0, 0x000fffff), "adrp x0, #+0xfffff000 (addr 0xfffff000)");
5561 COMPARE(adrp(x0, -0x00100000), "adrp x0, #-0x100000000 (addr -0x100000000)");
5562
5563 CLEANUP();
5564}
armvixl5289c592015-03-02 13:52:04 +00005565
armvixlad96eda2013-06-14 11:42:37 +01005566} // namespace vixl