OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 30 matching lines...) Expand all Loading... |
41 #include "src/arm64/disasm-arm64.h" | 41 #include "src/arm64/disasm-arm64.h" |
42 #include "src/arm64/macro-assembler-arm64.h" | 42 #include "src/arm64/macro-assembler-arm64.h" |
43 #include "src/arm64/utils-arm64.h" | 43 #include "src/arm64/utils-arm64.h" |
44 | 44 |
45 using namespace v8::internal; | 45 using namespace v8::internal; |
46 | 46 |
47 #define TEST_(name) TEST(DISASM_##name) | 47 #define TEST_(name) TEST(DISASM_##name) |
48 | 48 |
49 #define EXP_SIZE (256) | 49 #define EXP_SIZE (256) |
50 #define INSTR_SIZE (1024) | 50 #define INSTR_SIZE (1024) |
51 #define SET_UP_CLASS(ASMCLASS) \ | 51 #define SET_UP_MASM() \ |
| 52 InitializeVM(); \ |
| 53 Isolate* isolate = CcTest::i_isolate(); \ |
| 54 HandleScope scope(isolate); \ |
| 55 byte* buf = static_cast<byte*>(malloc(INSTR_SIZE)); \ |
| 56 uint32_t encoding = 0; \ |
| 57 MacroAssembler* assm = new MacroAssembler( \ |
| 58 isolate, buf, INSTR_SIZE, v8::internal::CodeObjectRequired::kYes); \ |
| 59 Decoder<DispatchingDecoderVisitor>* decoder = \ |
| 60 new Decoder<DispatchingDecoderVisitor>(); \ |
| 61 DisassemblingDecoder* disasm = new DisassemblingDecoder(); \ |
| 62 decoder->AppendVisitor(disasm) |
| 63 |
| 64 #define SET_UP_ASM() \ |
52 InitializeVM(); \ | 65 InitializeVM(); \ |
53 Isolate* isolate = CcTest::i_isolate(); \ | 66 Isolate* isolate = CcTest::i_isolate(); \ |
54 HandleScope scope(isolate); \ | 67 HandleScope scope(isolate); \ |
55 byte* buf = static_cast<byte*>(malloc(INSTR_SIZE)); \ | 68 byte* buf = static_cast<byte*>(malloc(INSTR_SIZE)); \ |
56 uint32_t encoding = 0; \ | 69 uint32_t encoding = 0; \ |
57 ASMCLASS* assm = new ASMCLASS(isolate, buf, INSTR_SIZE); \ | 70 Assembler* assm = new Assembler(isolate, buf, INSTR_SIZE); \ |
58 Decoder<DispatchingDecoderVisitor>* decoder = \ | 71 Decoder<DispatchingDecoderVisitor>* decoder = \ |
59 new Decoder<DispatchingDecoderVisitor>(); \ | 72 new Decoder<DispatchingDecoderVisitor>(); \ |
60 DisassemblingDecoder* disasm = new DisassemblingDecoder(); \ | 73 DisassemblingDecoder* disasm = new DisassemblingDecoder(); \ |
61 decoder->AppendVisitor(disasm) | 74 decoder->AppendVisitor(disasm) |
62 | 75 |
63 #define SET_UP() SET_UP_CLASS(Assembler) | |
64 | |
65 #define COMPARE(ASM, EXP) \ | 76 #define COMPARE(ASM, EXP) \ |
66 assm->Reset(); \ | 77 assm->Reset(); \ |
67 assm->ASM; \ | 78 assm->ASM; \ |
68 assm->GetCode(NULL); \ | 79 assm->GetCode(NULL); \ |
69 decoder->Decode(reinterpret_cast<Instruction*>(buf)); \ | 80 decoder->Decode(reinterpret_cast<Instruction*>(buf)); \ |
70 encoding = *reinterpret_cast<uint32_t*>(buf); \ | 81 encoding = *reinterpret_cast<uint32_t*>(buf); \ |
71 if (strcmp(disasm->GetOutput(), EXP) != 0) { \ | 82 if (strcmp(disasm->GetOutput(), EXP) != 0) { \ |
72 printf("%u : Encoding: %08" PRIx32 "\nExpected: %s\nFound: %s\n", \ | 83 printf("%u : Encoding: %08" PRIx32 "\nExpected: %s\nFound: %s\n", \ |
73 __LINE__, encoding, EXP, disasm->GetOutput()); \ | 84 __LINE__, encoding, EXP, disasm->GetOutput()); \ |
74 abort(); \ | 85 abort(); \ |
(...skipping 23 matching lines...) Expand all Loading... |
98 | 109 |
99 static void InitializeVM() { | 110 static void InitializeVM() { |
100 if (!vm_initialized) { | 111 if (!vm_initialized) { |
101 CcTest::InitializeVM(); | 112 CcTest::InitializeVM(); |
102 vm_initialized = true; | 113 vm_initialized = true; |
103 } | 114 } |
104 } | 115 } |
105 | 116 |
106 | 117 |
107 TEST_(bootstrap) { | 118 TEST_(bootstrap) { |
108 SET_UP(); | 119 SET_UP_ASM(); |
109 | 120 |
110 // Instructions generated by C compiler, disassembled by objdump, and | 121 // Instructions generated by C compiler, disassembled by objdump, and |
111 // reformatted to suit our disassembly style. | 122 // reformatted to suit our disassembly style. |
112 COMPARE(dci(0xa9ba7bfd), "stp fp, lr, [csp, #-96]!"); | 123 COMPARE(dci(0xa9ba7bfd), "stp fp, lr, [csp, #-96]!"); |
113 COMPARE(dci(0x910003fd), "mov fp, csp"); | 124 COMPARE(dci(0x910003fd), "mov fp, csp"); |
114 COMPARE(dci(0x9100e3a0), "add x0, fp, #0x38 (56)"); | 125 COMPARE(dci(0x9100e3a0), "add x0, fp, #0x38 (56)"); |
115 COMPARE(dci(0xb900001f), "str wzr, [x0]"); | 126 COMPARE(dci(0xb900001f), "str wzr, [x0]"); |
116 COMPARE(dci(0x528000e1), "movz w1, #0x7"); | 127 COMPARE(dci(0x528000e1), "movz w1, #0x7"); |
117 COMPARE(dci(0xb9001c01), "str w1, [x0, #28]"); | 128 COMPARE(dci(0xb9001c01), "str w1, [x0, #28]"); |
118 COMPARE(dci(0x390043a0), "strb w0, [fp, #16]"); | 129 COMPARE(dci(0x390043a0), "strb w0, [fp, #16]"); |
119 COMPARE(dci(0x790027a0), "strh w0, [fp, #18]"); | 130 COMPARE(dci(0x790027a0), "strh w0, [fp, #18]"); |
120 COMPARE(dci(0xb9400400), "ldr w0, [x0, #4]"); | 131 COMPARE(dci(0xb9400400), "ldr w0, [x0, #4]"); |
121 COMPARE(dci(0x0b000021), "add w1, w1, w0"); | 132 COMPARE(dci(0x0b000021), "add w1, w1, w0"); |
122 COMPARE(dci(0x531b6800), "lsl w0, w0, #5"); | 133 COMPARE(dci(0x531b6800), "lsl w0, w0, #5"); |
123 COMPARE(dci(0x521e0400), "eor w0, w0, #0xc"); | 134 COMPARE(dci(0x521e0400), "eor w0, w0, #0xc"); |
124 COMPARE(dci(0x72af0f00), "movk w0, #0x7878, lsl #16"); | 135 COMPARE(dci(0x72af0f00), "movk w0, #0x7878, lsl #16"); |
125 COMPARE(dci(0xd360fc00), "lsr x0, x0, #32"); | 136 COMPARE(dci(0xd360fc00), "lsr x0, x0, #32"); |
126 COMPARE(dci(0x13037c01), "asr w1, w0, #3"); | 137 COMPARE(dci(0x13037c01), "asr w1, w0, #3"); |
127 COMPARE(dci(0x4b000021), "sub w1, w1, w0"); | 138 COMPARE(dci(0x4b000021), "sub w1, w1, w0"); |
128 COMPARE(dci(0x2a0103e0), "mov w0, w1"); | 139 COMPARE(dci(0x2a0103e0), "mov w0, w1"); |
129 COMPARE(dci(0x93407c00), "sxtw x0, w0"); | 140 COMPARE(dci(0x93407c00), "sxtw x0, w0"); |
130 COMPARE(dci(0x2a000020), "orr w0, w1, w0"); | 141 COMPARE(dci(0x2a000020), "orr w0, w1, w0"); |
131 COMPARE(dci(0xa8c67bfd), "ldp fp, lr, [csp], #96"); | 142 COMPARE(dci(0xa8c67bfd), "ldp fp, lr, [csp], #96"); |
132 | 143 |
133 CLEANUP(); | 144 CLEANUP(); |
134 } | 145 } |
135 | 146 |
136 | 147 |
137 TEST_(mov_mvn) { | 148 TEST_(mov_mvn) { |
138 SET_UP_CLASS(MacroAssembler); | 149 SET_UP_MASM(); |
139 | 150 |
140 COMPARE(Mov(w0, Operand(0x1234)), "movz w0, #0x1234"); | 151 COMPARE(Mov(w0, Operand(0x1234)), "movz w0, #0x1234"); |
141 COMPARE(Mov(x1, Operand(0x1234)), "movz x1, #0x1234"); | 152 COMPARE(Mov(x1, Operand(0x1234)), "movz x1, #0x1234"); |
142 COMPARE(Mov(w2, Operand(w3)), "mov w2, w3"); | 153 COMPARE(Mov(w2, Operand(w3)), "mov w2, w3"); |
143 COMPARE(Mov(x4, Operand(x5)), "mov x4, x5"); | 154 COMPARE(Mov(x4, Operand(x5)), "mov x4, x5"); |
144 COMPARE(Mov(w6, Operand(w7, LSL, 5)), "lsl w6, w7, #5"); | 155 COMPARE(Mov(w6, Operand(w7, LSL, 5)), "lsl w6, w7, #5"); |
145 COMPARE(Mov(x8, Operand(x9, ASR, 42)), "asr x8, x9, #42"); | 156 COMPARE(Mov(x8, Operand(x9, ASR, 42)), "asr x8, x9, #42"); |
146 COMPARE(Mov(w10, Operand(w11, UXTB)), "uxtb w10, w11"); | 157 COMPARE(Mov(w10, Operand(w11, UXTB)), "uxtb w10, w11"); |
147 COMPARE(Mov(x12, Operand(x13, UXTB, 1)), "ubfiz x12, x13, #1, #8"); | 158 COMPARE(Mov(x12, Operand(x13, UXTB, 1)), "ubfiz x12, x13, #1, #8"); |
148 COMPARE(Mov(w14, Operand(w15, SXTH, 2)), "sbfiz w14, w15, #2, #16"); | 159 COMPARE(Mov(w14, Operand(w15, SXTH, 2)), "sbfiz w14, w15, #2, #16"); |
(...skipping 13 matching lines...) Expand all Loading... |
162 COMPARE(Mvn(w2, Operand(w3)), "mvn w2, w3"); | 173 COMPARE(Mvn(w2, Operand(w3)), "mvn w2, w3"); |
163 COMPARE(Mvn(x4, Operand(x5)), "mvn x4, x5"); | 174 COMPARE(Mvn(x4, Operand(x5)), "mvn x4, x5"); |
164 COMPARE(Mvn(w6, Operand(w7, LSL, 12)), "mvn w6, w7, lsl #12"); | 175 COMPARE(Mvn(w6, Operand(w7, LSL, 12)), "mvn w6, w7, lsl #12"); |
165 COMPARE(Mvn(x8, Operand(x9, ASR, 63)), "mvn x8, x9, asr #63"); | 176 COMPARE(Mvn(x8, Operand(x9, ASR, 63)), "mvn x8, x9, asr #63"); |
166 | 177 |
167 CLEANUP(); | 178 CLEANUP(); |
168 } | 179 } |
169 | 180 |
170 | 181 |
171 TEST_(move_immediate) { | 182 TEST_(move_immediate) { |
172 SET_UP(); | 183 SET_UP_ASM(); |
173 | 184 |
174 COMPARE(movz(w0, 0x1234), "movz w0, #0x1234"); | 185 COMPARE(movz(w0, 0x1234), "movz w0, #0x1234"); |
175 COMPARE(movz(x1, 0xabcd0000), "movz x1, #0xabcd0000"); | 186 COMPARE(movz(x1, 0xabcd0000), "movz x1, #0xabcd0000"); |
176 COMPARE(movz(x2, 0x555500000000), "movz x2, #0x555500000000"); | 187 COMPARE(movz(x2, 0x555500000000), "movz x2, #0x555500000000"); |
177 COMPARE(movz(x3, 0xaaaa000000000000), "movz x3, #0xaaaa000000000000"); | 188 COMPARE(movz(x3, 0xaaaa000000000000), "movz x3, #0xaaaa000000000000"); |
178 COMPARE(movz(x4, 0xabcd, 16), "movz x4, #0xabcd0000"); | 189 COMPARE(movz(x4, 0xabcd, 16), "movz x4, #0xabcd0000"); |
179 COMPARE(movz(x5, 0x5555, 32), "movz x5, #0x555500000000"); | 190 COMPARE(movz(x5, 0x5555, 32), "movz x5, #0x555500000000"); |
180 COMPARE(movz(x6, 0xaaaa, 48), "movz x6, #0xaaaa000000000000"); | 191 COMPARE(movz(x6, 0xaaaa, 48), "movz x6, #0xaaaa000000000000"); |
181 | 192 |
182 COMPARE(movk(w7, 0x1234), "movk w7, #0x1234"); | 193 COMPARE(movk(w7, 0x1234), "movk w7, #0x1234"); |
(...skipping 16 matching lines...) Expand all Loading... |
199 COMPARE(movk(x22, 0, 0), "movk x22, #0x0"); | 210 COMPARE(movk(x22, 0, 0), "movk x22, #0x0"); |
200 COMPARE(movk(w23, 0, 16), "movk w23, #0x0, lsl #16"); | 211 COMPARE(movk(w23, 0, 16), "movk w23, #0x0, lsl #16"); |
201 COMPARE(movk(x24, 0, 32), "movk x24, #0x0, lsl #32"); | 212 COMPARE(movk(x24, 0, 32), "movk x24, #0x0, lsl #32"); |
202 COMPARE(movk(x25, 0, 48), "movk x25, #0x0, lsl #48"); | 213 COMPARE(movk(x25, 0, 48), "movk x25, #0x0, lsl #48"); |
203 | 214 |
204 CLEANUP(); | 215 CLEANUP(); |
205 } | 216 } |
206 | 217 |
207 | 218 |
208 TEST(move_immediate_2) { | 219 TEST(move_immediate_2) { |
209 SET_UP_CLASS(MacroAssembler); | 220 SET_UP_MASM(); |
210 | 221 |
211 // Move instructions expected for certain immediates. This is really a macro | 222 // Move instructions expected for certain immediates. This is really a macro |
212 // assembler test, to ensure it generates immediates efficiently. | 223 // assembler test, to ensure it generates immediates efficiently. |
213 COMPARE(Mov(w0, 0), "movz w0, #0x0"); | 224 COMPARE(Mov(w0, 0), "movz w0, #0x0"); |
214 COMPARE(Mov(w0, 0x0000ffff), "movz w0, #0xffff"); | 225 COMPARE(Mov(w0, 0x0000ffff), "movz w0, #0xffff"); |
215 COMPARE(Mov(w0, 0x00010000), "movz w0, #0x10000"); | 226 COMPARE(Mov(w0, 0x00010000), "movz w0, #0x10000"); |
216 COMPARE(Mov(w0, 0xffff0000), "movz w0, #0xffff0000"); | 227 COMPARE(Mov(w0, 0xffff0000), "movz w0, #0xffff0000"); |
217 COMPARE(Mov(w0, 0x0001ffff), "movn w0, #0xfffe0000"); | 228 COMPARE(Mov(w0, 0x0001ffff), "movn w0, #0xfffe0000"); |
218 COMPARE(Mov(w0, 0xffff8000), "movn w0, #0x7fff"); | 229 COMPARE(Mov(w0, 0xffff8000), "movn w0, #0x7fff"); |
219 COMPARE(Mov(w0, 0xfffffffe), "movn w0, #0x1"); | 230 COMPARE(Mov(w0, 0xfffffffe), "movn w0, #0x1"); |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
255 COMPARE(Movk(w2, 0x3456, 16), "movk w2, #0x3456, lsl #16"); | 266 COMPARE(Movk(w2, 0x3456, 16), "movk w2, #0x3456, lsl #16"); |
256 COMPARE(Movk(x3, 0x4567, 16), "movk x3, #0x4567, lsl #16"); | 267 COMPARE(Movk(x3, 0x4567, 16), "movk x3, #0x4567, lsl #16"); |
257 COMPARE(Movk(x4, 0x5678, 32), "movk x4, #0x5678, lsl #32"); | 268 COMPARE(Movk(x4, 0x5678, 32), "movk x4, #0x5678, lsl #32"); |
258 COMPARE(Movk(x5, 0x6789, 48), "movk x5, #0x6789, lsl #48"); | 269 COMPARE(Movk(x5, 0x6789, 48), "movk x5, #0x6789, lsl #48"); |
259 | 270 |
260 CLEANUP(); | 271 CLEANUP(); |
261 } | 272 } |
262 | 273 |
263 | 274 |
264 TEST_(add_immediate) { | 275 TEST_(add_immediate) { |
265 SET_UP(); | 276 SET_UP_ASM(); |
266 | 277 |
267 COMPARE(add(w0, w1, Operand(0xff)), "add w0, w1, #0xff (255)"); | 278 COMPARE(add(w0, w1, Operand(0xff)), "add w0, w1, #0xff (255)"); |
268 COMPARE(add(x2, x3, Operand(0x3ff)), "add x2, x3, #0x3ff (1023)"); | 279 COMPARE(add(x2, x3, Operand(0x3ff)), "add x2, x3, #0x3ff (1023)"); |
269 COMPARE(add(w4, w5, Operand(0xfff)), "add w4, w5, #0xfff (4095)"); | 280 COMPARE(add(w4, w5, Operand(0xfff)), "add w4, w5, #0xfff (4095)"); |
270 COMPARE(add(x6, x7, Operand(0x1000)), "add x6, x7, #0x1000 (4096)"); | 281 COMPARE(add(x6, x7, Operand(0x1000)), "add x6, x7, #0x1000 (4096)"); |
271 COMPARE(add(w8, w9, Operand(0xff000)), "add w8, w9, #0xff000 (1044480)"); | 282 COMPARE(add(w8, w9, Operand(0xff000)), "add w8, w9, #0xff000 (1044480)"); |
272 COMPARE(add(x10, x11, Operand(0x3ff000)), | 283 COMPARE(add(x10, x11, Operand(0x3ff000)), |
273 "add x10, x11, #0x3ff000 (4190208)"); | 284 "add x10, x11, #0x3ff000 (4190208)"); |
274 COMPARE(add(w12, w13, Operand(0xfff000)), | 285 COMPARE(add(w12, w13, Operand(0xfff000)), |
275 "add w12, w13, #0xfff000 (16773120)"); | 286 "add w12, w13, #0xfff000 (16773120)"); |
276 COMPARE(adds(w14, w15, Operand(0xff)), "adds w14, w15, #0xff (255)"); | 287 COMPARE(adds(w14, w15, Operand(0xff)), "adds w14, w15, #0xff (255)"); |
277 COMPARE(adds(x16, x17, Operand(0xaa000)), | 288 COMPARE(adds(x16, x17, Operand(0xaa000)), |
278 "adds x16, x17, #0xaa000 (696320)"); | 289 "adds x16, x17, #0xaa000 (696320)"); |
279 COMPARE(cmn(w18, Operand(0xff)), "cmn w18, #0xff (255)"); | 290 COMPARE(cmn(w18, Operand(0xff)), "cmn w18, #0xff (255)"); |
280 COMPARE(cmn(x19, Operand(0xff000)), "cmn x19, #0xff000 (1044480)"); | 291 COMPARE(cmn(x19, Operand(0xff000)), "cmn x19, #0xff000 (1044480)"); |
281 COMPARE(add(w0, wcsp, Operand(0)), "mov w0, wcsp"); | 292 COMPARE(add(w0, wcsp, Operand(0)), "mov w0, wcsp"); |
282 COMPARE(add(csp, x0, Operand(0)), "mov csp, x0"); | 293 COMPARE(add(csp, x0, Operand(0)), "mov csp, x0"); |
283 | 294 |
284 COMPARE(add(w1, wcsp, Operand(8)), "add w1, wcsp, #0x8 (8)"); | 295 COMPARE(add(w1, wcsp, Operand(8)), "add w1, wcsp, #0x8 (8)"); |
285 COMPARE(add(x2, csp, Operand(16)), "add x2, csp, #0x10 (16)"); | 296 COMPARE(add(x2, csp, Operand(16)), "add x2, csp, #0x10 (16)"); |
286 COMPARE(add(wcsp, wcsp, Operand(42)), "add wcsp, wcsp, #0x2a (42)"); | 297 COMPARE(add(wcsp, wcsp, Operand(42)), "add wcsp, wcsp, #0x2a (42)"); |
287 COMPARE(cmn(csp, Operand(24)), "cmn csp, #0x18 (24)"); | 298 COMPARE(cmn(csp, Operand(24)), "cmn csp, #0x18 (24)"); |
288 COMPARE(adds(wzr, wcsp, Operand(9)), "cmn wcsp, #0x9 (9)"); | 299 COMPARE(adds(wzr, wcsp, Operand(9)), "cmn wcsp, #0x9 (9)"); |
289 | 300 |
290 CLEANUP(); | 301 CLEANUP(); |
291 } | 302 } |
292 | 303 |
293 | 304 |
294 TEST_(sub_immediate) { | 305 TEST_(sub_immediate) { |
295 SET_UP(); | 306 SET_UP_ASM(); |
296 | 307 |
297 COMPARE(sub(w0, w1, Operand(0xff)), "sub w0, w1, #0xff (255)"); | 308 COMPARE(sub(w0, w1, Operand(0xff)), "sub w0, w1, #0xff (255)"); |
298 COMPARE(sub(x2, x3, Operand(0x3ff)), "sub x2, x3, #0x3ff (1023)"); | 309 COMPARE(sub(x2, x3, Operand(0x3ff)), "sub x2, x3, #0x3ff (1023)"); |
299 COMPARE(sub(w4, w5, Operand(0xfff)), "sub w4, w5, #0xfff (4095)"); | 310 COMPARE(sub(w4, w5, Operand(0xfff)), "sub w4, w5, #0xfff (4095)"); |
300 COMPARE(sub(x6, x7, Operand(0x1000)), "sub x6, x7, #0x1000 (4096)"); | 311 COMPARE(sub(x6, x7, Operand(0x1000)), "sub x6, x7, #0x1000 (4096)"); |
301 COMPARE(sub(w8, w9, Operand(0xff000)), "sub w8, w9, #0xff000 (1044480)"); | 312 COMPARE(sub(w8, w9, Operand(0xff000)), "sub w8, w9, #0xff000 (1044480)"); |
302 COMPARE(sub(x10, x11, Operand(0x3ff000)), | 313 COMPARE(sub(x10, x11, Operand(0x3ff000)), |
303 "sub x10, x11, #0x3ff000 (4190208)"); | 314 "sub x10, x11, #0x3ff000 (4190208)"); |
304 COMPARE(sub(w12, w13, Operand(0xfff000)), | 315 COMPARE(sub(w12, w13, Operand(0xfff000)), |
305 "sub w12, w13, #0xfff000 (16773120)"); | 316 "sub w12, w13, #0xfff000 (16773120)"); |
306 COMPARE(subs(w14, w15, Operand(0xff)), "subs w14, w15, #0xff (255)"); | 317 COMPARE(subs(w14, w15, Operand(0xff)), "subs w14, w15, #0xff (255)"); |
307 COMPARE(subs(x16, x17, Operand(0xaa000)), | 318 COMPARE(subs(x16, x17, Operand(0xaa000)), |
308 "subs x16, x17, #0xaa000 (696320)"); | 319 "subs x16, x17, #0xaa000 (696320)"); |
309 COMPARE(cmp(w18, Operand(0xff)), "cmp w18, #0xff (255)"); | 320 COMPARE(cmp(w18, Operand(0xff)), "cmp w18, #0xff (255)"); |
310 COMPARE(cmp(x19, Operand(0xff000)), "cmp x19, #0xff000 (1044480)"); | 321 COMPARE(cmp(x19, Operand(0xff000)), "cmp x19, #0xff000 (1044480)"); |
311 | 322 |
312 COMPARE(add(w1, wcsp, Operand(8)), "add w1, wcsp, #0x8 (8)"); | 323 COMPARE(add(w1, wcsp, Operand(8)), "add w1, wcsp, #0x8 (8)"); |
313 COMPARE(add(x2, csp, Operand(16)), "add x2, csp, #0x10 (16)"); | 324 COMPARE(add(x2, csp, Operand(16)), "add x2, csp, #0x10 (16)"); |
314 COMPARE(add(wcsp, wcsp, Operand(42)), "add wcsp, wcsp, #0x2a (42)"); | 325 COMPARE(add(wcsp, wcsp, Operand(42)), "add wcsp, wcsp, #0x2a (42)"); |
315 COMPARE(cmn(csp, Operand(24)), "cmn csp, #0x18 (24)"); | 326 COMPARE(cmn(csp, Operand(24)), "cmn csp, #0x18 (24)"); |
316 COMPARE(adds(wzr, wcsp, Operand(9)), "cmn wcsp, #0x9 (9)"); | 327 COMPARE(adds(wzr, wcsp, Operand(9)), "cmn wcsp, #0x9 (9)"); |
317 | 328 |
318 CLEANUP(); | 329 CLEANUP(); |
319 } | 330 } |
320 | 331 |
321 | 332 |
322 TEST_(add_shifted) { | 333 TEST_(add_shifted) { |
323 SET_UP(); | 334 SET_UP_ASM(); |
324 | 335 |
325 COMPARE(add(w0, w1, Operand(w2)), "add w0, w1, w2"); | 336 COMPARE(add(w0, w1, Operand(w2)), "add w0, w1, w2"); |
326 COMPARE(add(x3, x4, Operand(x5)), "add x3, x4, x5"); | 337 COMPARE(add(x3, x4, Operand(x5)), "add x3, x4, x5"); |
327 COMPARE(add(w6, w7, Operand(w8, LSL, 1)), "add w6, w7, w8, lsl #1"); | 338 COMPARE(add(w6, w7, Operand(w8, LSL, 1)), "add w6, w7, w8, lsl #1"); |
328 COMPARE(add(x9, x10, Operand(x11, LSL, 2)), "add x9, x10, x11, lsl #2"); | 339 COMPARE(add(x9, x10, Operand(x11, LSL, 2)), "add x9, x10, x11, lsl #2"); |
329 COMPARE(add(w12, w13, Operand(w14, LSR, 3)), "add w12, w13, w14, lsr #3"); | 340 COMPARE(add(w12, w13, Operand(w14, LSR, 3)), "add w12, w13, w14, lsr #3"); |
330 COMPARE(add(x15, x16, Operand(x17, LSR, 4)), "add x15, x16, x17, lsr #4"); | 341 COMPARE(add(x15, x16, Operand(x17, LSR, 4)), "add x15, x16, x17, lsr #4"); |
331 COMPARE(add(w18, w19, Operand(w20, ASR, 5)), "add w18, w19, w20, asr #5"); | 342 COMPARE(add(w18, w19, Operand(w20, ASR, 5)), "add w18, w19, w20, asr #5"); |
332 COMPARE(add(x21, x22, Operand(x23, ASR, 6)), "add x21, x22, x23, asr #6"); | 343 COMPARE(add(x21, x22, Operand(x23, ASR, 6)), "add x21, x22, x23, asr #6"); |
333 COMPARE(cmn(w24, Operand(w25)), "cmn w24, w25"); | 344 COMPARE(cmn(w24, Operand(w25)), "cmn w24, w25"); |
334 COMPARE(cmn(x26, Operand(cp, LSL, 63)), "cmn x26, cp, lsl #63"); | 345 COMPARE(cmn(x26, Operand(cp, LSL, 63)), "cmn x26, cp, lsl #63"); |
335 | 346 |
336 COMPARE(add(x0, csp, Operand(x1)), "add x0, csp, x1"); | 347 COMPARE(add(x0, csp, Operand(x1)), "add x0, csp, x1"); |
337 COMPARE(add(w2, wcsp, Operand(w3)), "add w2, wcsp, w3"); | 348 COMPARE(add(w2, wcsp, Operand(w3)), "add w2, wcsp, w3"); |
338 COMPARE(add(x4, csp, Operand(x5, LSL, 1)), "add x4, csp, x5, lsl #1"); | 349 COMPARE(add(x4, csp, Operand(x5, LSL, 1)), "add x4, csp, x5, lsl #1"); |
339 COMPARE(add(x4, xzr, Operand(x5, LSL, 1)), "add x4, xzr, x5, lsl #1"); | 350 COMPARE(add(x4, xzr, Operand(x5, LSL, 1)), "add x4, xzr, x5, lsl #1"); |
340 COMPARE(add(w6, wcsp, Operand(w7, LSL, 3)), "add w6, wcsp, w7, lsl #3"); | 351 COMPARE(add(w6, wcsp, Operand(w7, LSL, 3)), "add w6, wcsp, w7, lsl #3"); |
341 COMPARE(adds(xzr, csp, Operand(x8, LSL, 4)), "cmn csp, x8, lsl #4"); | 352 COMPARE(adds(xzr, csp, Operand(x8, LSL, 4)), "cmn csp, x8, lsl #4"); |
342 COMPARE(adds(xzr, xzr, Operand(x8, LSL, 5)), "cmn xzr, x8, lsl #5"); | 353 COMPARE(adds(xzr, xzr, Operand(x8, LSL, 5)), "cmn xzr, x8, lsl #5"); |
343 | 354 |
344 CLEANUP(); | 355 CLEANUP(); |
345 } | 356 } |
346 | 357 |
347 | 358 |
348 TEST_(sub_shifted) { | 359 TEST_(sub_shifted) { |
349 SET_UP(); | 360 SET_UP_ASM(); |
350 | 361 |
351 COMPARE(sub(w0, w1, Operand(w2)), "sub w0, w1, w2"); | 362 COMPARE(sub(w0, w1, Operand(w2)), "sub w0, w1, w2"); |
352 COMPARE(sub(x3, x4, Operand(x5)), "sub x3, x4, x5"); | 363 COMPARE(sub(x3, x4, Operand(x5)), "sub x3, x4, x5"); |
353 COMPARE(sub(w6, w7, Operand(w8, LSL, 1)), "sub w6, w7, w8, lsl #1"); | 364 COMPARE(sub(w6, w7, Operand(w8, LSL, 1)), "sub w6, w7, w8, lsl #1"); |
354 COMPARE(sub(x9, x10, Operand(x11, LSL, 2)), "sub x9, x10, x11, lsl #2"); | 365 COMPARE(sub(x9, x10, Operand(x11, LSL, 2)), "sub x9, x10, x11, lsl #2"); |
355 COMPARE(sub(w12, w13, Operand(w14, LSR, 3)), "sub w12, w13, w14, lsr #3"); | 366 COMPARE(sub(w12, w13, Operand(w14, LSR, 3)), "sub w12, w13, w14, lsr #3"); |
356 COMPARE(sub(x15, x16, Operand(x17, LSR, 4)), "sub x15, x16, x17, lsr #4"); | 367 COMPARE(sub(x15, x16, Operand(x17, LSR, 4)), "sub x15, x16, x17, lsr #4"); |
357 COMPARE(sub(w18, w19, Operand(w20, ASR, 5)), "sub w18, w19, w20, asr #5"); | 368 COMPARE(sub(w18, w19, Operand(w20, ASR, 5)), "sub w18, w19, w20, asr #5"); |
358 COMPARE(sub(x21, x22, Operand(x23, ASR, 6)), "sub x21, x22, x23, asr #6"); | 369 COMPARE(sub(x21, x22, Operand(x23, ASR, 6)), "sub x21, x22, x23, asr #6"); |
359 COMPARE(cmp(w24, Operand(w25)), "cmp w24, w25"); | 370 COMPARE(cmp(w24, Operand(w25)), "cmp w24, w25"); |
360 COMPARE(cmp(x26, Operand(cp, LSL, 63)), "cmp x26, cp, lsl #63"); | 371 COMPARE(cmp(x26, Operand(cp, LSL, 63)), "cmp x26, cp, lsl #63"); |
361 COMPARE(neg(w28, Operand(w29)), "neg w28, w29"); | 372 COMPARE(neg(w28, Operand(w29)), "neg w28, w29"); |
362 COMPARE(neg(lr, Operand(x0, LSR, 62)), "neg lr, x0, lsr #62"); | 373 COMPARE(neg(lr, Operand(x0, LSR, 62)), "neg lr, x0, lsr #62"); |
363 COMPARE(negs(w1, Operand(w2)), "negs w1, w2"); | 374 COMPARE(negs(w1, Operand(w2)), "negs w1, w2"); |
364 COMPARE(negs(x3, Operand(x4, ASR, 61)), "negs x3, x4, asr #61"); | 375 COMPARE(negs(x3, Operand(x4, ASR, 61)), "negs x3, x4, asr #61"); |
365 | 376 |
366 COMPARE(sub(x0, csp, Operand(x1)), "sub x0, csp, x1"); | 377 COMPARE(sub(x0, csp, Operand(x1)), "sub x0, csp, x1"); |
367 COMPARE(sub(w2, wcsp, Operand(w3)), "sub w2, wcsp, w3"); | 378 COMPARE(sub(w2, wcsp, Operand(w3)), "sub w2, wcsp, w3"); |
368 COMPARE(sub(x4, csp, Operand(x5, LSL, 1)), "sub x4, csp, x5, lsl #1"); | 379 COMPARE(sub(x4, csp, Operand(x5, LSL, 1)), "sub x4, csp, x5, lsl #1"); |
369 COMPARE(sub(x4, xzr, Operand(x5, LSL, 1)), "neg x4, x5, lsl #1"); | 380 COMPARE(sub(x4, xzr, Operand(x5, LSL, 1)), "neg x4, x5, lsl #1"); |
370 COMPARE(sub(w6, wcsp, Operand(w7, LSL, 3)), "sub w6, wcsp, w7, lsl #3"); | 381 COMPARE(sub(w6, wcsp, Operand(w7, LSL, 3)), "sub w6, wcsp, w7, lsl #3"); |
371 COMPARE(subs(xzr, csp, Operand(x8, LSL, 4)), "cmp csp, x8, lsl #4"); | 382 COMPARE(subs(xzr, csp, Operand(x8, LSL, 4)), "cmp csp, x8, lsl #4"); |
372 COMPARE(subs(xzr, xzr, Operand(x8, LSL, 5)), "cmp xzr, x8, lsl #5"); | 383 COMPARE(subs(xzr, xzr, Operand(x8, LSL, 5)), "cmp xzr, x8, lsl #5"); |
373 | 384 |
374 CLEANUP(); | 385 CLEANUP(); |
375 } | 386 } |
376 | 387 |
377 | 388 |
378 TEST_(add_extended) { | 389 TEST_(add_extended) { |
379 SET_UP(); | 390 SET_UP_ASM(); |
380 | 391 |
381 COMPARE(add(w0, w1, Operand(w2, UXTB)), "add w0, w1, w2, uxtb"); | 392 COMPARE(add(w0, w1, Operand(w2, UXTB)), "add w0, w1, w2, uxtb"); |
382 COMPARE(adds(x3, x4, Operand(w5, UXTB, 1)), "adds x3, x4, w5, uxtb #1"); | 393 COMPARE(adds(x3, x4, Operand(w5, UXTB, 1)), "adds x3, x4, w5, uxtb #1"); |
383 COMPARE(add(w6, w7, Operand(w8, UXTH, 2)), "add w6, w7, w8, uxth #2"); | 394 COMPARE(add(w6, w7, Operand(w8, UXTH, 2)), "add w6, w7, w8, uxth #2"); |
384 COMPARE(adds(x9, x10, Operand(x11, UXTW, 3)), "adds x9, x10, w11, uxtw #3"); | 395 COMPARE(adds(x9, x10, Operand(x11, UXTW, 3)), "adds x9, x10, w11, uxtw #3"); |
385 COMPARE(add(x12, x13, Operand(x14, UXTX, 4)), "add x12, x13, x14, uxtx #4"); | 396 COMPARE(add(x12, x13, Operand(x14, UXTX, 4)), "add x12, x13, x14, uxtx #4"); |
386 COMPARE(adds(w15, w16, Operand(w17, SXTB, 4)), "adds w15, w16, w17, sxtb #4"); | 397 COMPARE(adds(w15, w16, Operand(w17, SXTB, 4)), "adds w15, w16, w17, sxtb #4"); |
387 COMPARE(add(x18, x19, Operand(x20, SXTB, 3)), "add x18, x19, w20, sxtb #3"); | 398 COMPARE(add(x18, x19, Operand(x20, SXTB, 3)), "add x18, x19, w20, sxtb #3"); |
388 COMPARE(adds(w21, w22, Operand(w23, SXTH, 2)), "adds w21, w22, w23, sxth #2"); | 399 COMPARE(adds(w21, w22, Operand(w23, SXTH, 2)), "adds w21, w22, w23, sxth #2"); |
389 COMPARE(add(x24, x25, Operand(x26, SXTW, 1)), "add x24, x25, w26, sxtw #1"); | 400 COMPARE(add(x24, x25, Operand(x26, SXTW, 1)), "add x24, x25, w26, sxtw #1"); |
390 COMPARE(adds(cp, jssp, Operand(fp, SXTX)), "adds cp, jssp, fp, sxtx"); | 401 COMPARE(adds(cp, jssp, Operand(fp, SXTX)), "adds cp, jssp, fp, sxtx"); |
391 COMPARE(cmn(w0, Operand(w1, UXTB, 2)), "cmn w0, w1, uxtb #2"); | 402 COMPARE(cmn(w0, Operand(w1, UXTB, 2)), "cmn w0, w1, uxtb #2"); |
392 COMPARE(cmn(x2, Operand(x3, SXTH, 4)), "cmn x2, w3, sxth #4"); | 403 COMPARE(cmn(x2, Operand(x3, SXTH, 4)), "cmn x2, w3, sxth #4"); |
393 | 404 |
394 COMPARE(add(w0, wcsp, Operand(w1, UXTB)), "add w0, wcsp, w1, uxtb"); | 405 COMPARE(add(w0, wcsp, Operand(w1, UXTB)), "add w0, wcsp, w1, uxtb"); |
395 COMPARE(add(x2, csp, Operand(x3, UXTH, 1)), "add x2, csp, w3, uxth #1"); | 406 COMPARE(add(x2, csp, Operand(x3, UXTH, 1)), "add x2, csp, w3, uxth #1"); |
396 COMPARE(add(wcsp, wcsp, Operand(w4, UXTW, 2)), "add wcsp, wcsp, w4, lsl #2"); | 407 COMPARE(add(wcsp, wcsp, Operand(w4, UXTW, 2)), "add wcsp, wcsp, w4, lsl #2"); |
397 COMPARE(cmn(csp, Operand(xzr, UXTX, 3)), "cmn csp, xzr, lsl #3"); | 408 COMPARE(cmn(csp, Operand(xzr, UXTX, 3)), "cmn csp, xzr, lsl #3"); |
398 COMPARE(cmn(csp, Operand(xzr, LSL, 4)), "cmn csp, xzr, lsl #4"); | 409 COMPARE(cmn(csp, Operand(xzr, LSL, 4)), "cmn csp, xzr, lsl #4"); |
399 | 410 |
400 CLEANUP(); | 411 CLEANUP(); |
401 } | 412 } |
402 | 413 |
403 | 414 |
404 TEST_(sub_extended) { | 415 TEST_(sub_extended) { |
405 SET_UP(); | 416 SET_UP_ASM(); |
406 | 417 |
407 COMPARE(sub(w0, w1, Operand(w2, UXTB)), "sub w0, w1, w2, uxtb"); | 418 COMPARE(sub(w0, w1, Operand(w2, UXTB)), "sub w0, w1, w2, uxtb"); |
408 COMPARE(subs(x3, x4, Operand(w5, UXTB, 1)), "subs x3, x4, w5, uxtb #1"); | 419 COMPARE(subs(x3, x4, Operand(w5, UXTB, 1)), "subs x3, x4, w5, uxtb #1"); |
409 COMPARE(sub(w6, w7, Operand(w8, UXTH, 2)), "sub w6, w7, w8, uxth #2"); | 420 COMPARE(sub(w6, w7, Operand(w8, UXTH, 2)), "sub w6, w7, w8, uxth #2"); |
410 COMPARE(subs(x9, x10, Operand(x11, UXTW, 3)), "subs x9, x10, w11, uxtw #3"); | 421 COMPARE(subs(x9, x10, Operand(x11, UXTW, 3)), "subs x9, x10, w11, uxtw #3"); |
411 COMPARE(sub(x12, x13, Operand(x14, UXTX, 4)), "sub x12, x13, x14, uxtx #4"); | 422 COMPARE(sub(x12, x13, Operand(x14, UXTX, 4)), "sub x12, x13, x14, uxtx #4"); |
412 COMPARE(subs(w15, w16, Operand(w17, SXTB, 4)), "subs w15, w16, w17, sxtb #4"); | 423 COMPARE(subs(w15, w16, Operand(w17, SXTB, 4)), "subs w15, w16, w17, sxtb #4"); |
413 COMPARE(sub(x18, x19, Operand(x20, SXTB, 3)), "sub x18, x19, w20, sxtb #3"); | 424 COMPARE(sub(x18, x19, Operand(x20, SXTB, 3)), "sub x18, x19, w20, sxtb #3"); |
414 COMPARE(subs(w21, w22, Operand(w23, SXTH, 2)), "subs w21, w22, w23, sxth #2"); | 425 COMPARE(subs(w21, w22, Operand(w23, SXTH, 2)), "subs w21, w22, w23, sxth #2"); |
415 COMPARE(sub(x24, x25, Operand(x26, SXTW, 1)), "sub x24, x25, w26, sxtw #1"); | 426 COMPARE(sub(x24, x25, Operand(x26, SXTW, 1)), "sub x24, x25, w26, sxtw #1"); |
416 COMPARE(subs(cp, jssp, Operand(fp, SXTX)), "subs cp, jssp, fp, sxtx"); | 427 COMPARE(subs(cp, jssp, Operand(fp, SXTX)), "subs cp, jssp, fp, sxtx"); |
417 COMPARE(cmp(w0, Operand(w1, SXTB, 1)), "cmp w0, w1, sxtb #1"); | 428 COMPARE(cmp(w0, Operand(w1, SXTB, 1)), "cmp w0, w1, sxtb #1"); |
418 COMPARE(cmp(x2, Operand(x3, UXTH, 3)), "cmp x2, w3, uxth #3"); | 429 COMPARE(cmp(x2, Operand(x3, UXTH, 3)), "cmp x2, w3, uxth #3"); |
419 | 430 |
420 COMPARE(sub(w0, wcsp, Operand(w1, UXTB)), "sub w0, wcsp, w1, uxtb"); | 431 COMPARE(sub(w0, wcsp, Operand(w1, UXTB)), "sub w0, wcsp, w1, uxtb"); |
421 COMPARE(sub(x2, csp, Operand(x3, UXTH, 1)), "sub x2, csp, w3, uxth #1"); | 432 COMPARE(sub(x2, csp, Operand(x3, UXTH, 1)), "sub x2, csp, w3, uxth #1"); |
422 COMPARE(sub(wcsp, wcsp, Operand(w4, UXTW, 2)), "sub wcsp, wcsp, w4, lsl #2"); | 433 COMPARE(sub(wcsp, wcsp, Operand(w4, UXTW, 2)), "sub wcsp, wcsp, w4, lsl #2"); |
423 COMPARE(cmp(csp, Operand(xzr, UXTX, 3)), "cmp csp, xzr, lsl #3"); | 434 COMPARE(cmp(csp, Operand(xzr, UXTX, 3)), "cmp csp, xzr, lsl #3"); |
424 COMPARE(cmp(csp, Operand(xzr, LSL, 4)), "cmp csp, xzr, lsl #4"); | 435 COMPARE(cmp(csp, Operand(xzr, LSL, 4)), "cmp csp, xzr, lsl #4"); |
425 | 436 |
426 CLEANUP(); | 437 CLEANUP(); |
427 } | 438 } |
428 | 439 |
429 | 440 |
430 TEST_(adc_subc_ngc) { | 441 TEST_(adc_subc_ngc) { |
431 SET_UP(); | 442 SET_UP_ASM(); |
432 | 443 |
433 COMPARE(adc(w0, w1, Operand(w2)), "adc w0, w1, w2"); | 444 COMPARE(adc(w0, w1, Operand(w2)), "adc w0, w1, w2"); |
434 COMPARE(adc(x3, x4, Operand(x5)), "adc x3, x4, x5"); | 445 COMPARE(adc(x3, x4, Operand(x5)), "adc x3, x4, x5"); |
435 COMPARE(adcs(w6, w7, Operand(w8)), "adcs w6, w7, w8"); | 446 COMPARE(adcs(w6, w7, Operand(w8)), "adcs w6, w7, w8"); |
436 COMPARE(adcs(x9, x10, Operand(x11)), "adcs x9, x10, x11"); | 447 COMPARE(adcs(x9, x10, Operand(x11)), "adcs x9, x10, x11"); |
437 COMPARE(sbc(w12, w13, Operand(w14)), "sbc w12, w13, w14"); | 448 COMPARE(sbc(w12, w13, Operand(w14)), "sbc w12, w13, w14"); |
438 COMPARE(sbc(x15, x16, Operand(x17)), "sbc x15, x16, x17"); | 449 COMPARE(sbc(x15, x16, Operand(x17)), "sbc x15, x16, x17"); |
439 COMPARE(sbcs(w18, w19, Operand(w20)), "sbcs w18, w19, w20"); | 450 COMPARE(sbcs(w18, w19, Operand(w20)), "sbcs w18, w19, w20"); |
440 COMPARE(sbcs(x21, x22, Operand(x23)), "sbcs x21, x22, x23"); | 451 COMPARE(sbcs(x21, x22, Operand(x23)), "sbcs x21, x22, x23"); |
441 COMPARE(ngc(w24, Operand(w25)), "ngc w24, w25"); | 452 COMPARE(ngc(w24, Operand(w25)), "ngc w24, w25"); |
442 COMPARE(ngc(x26, Operand(cp)), "ngc x26, cp"); | 453 COMPARE(ngc(x26, Operand(cp)), "ngc x26, cp"); |
443 COMPARE(ngcs(w28, Operand(w29)), "ngcs w28, w29"); | 454 COMPARE(ngcs(w28, Operand(w29)), "ngcs w28, w29"); |
444 COMPARE(ngcs(lr, Operand(x0)), "ngcs lr, x0"); | 455 COMPARE(ngcs(lr, Operand(x0)), "ngcs lr, x0"); |
445 | 456 |
446 CLEANUP(); | 457 CLEANUP(); |
447 } | 458 } |
448 | 459 |
449 | 460 |
450 TEST_(mul_and_div) { | 461 TEST_(mul_and_div) { |
451 SET_UP(); | 462 SET_UP_ASM(); |
452 | 463 |
453 COMPARE(mul(w0, w1, w2), "mul w0, w1, w2"); | 464 COMPARE(mul(w0, w1, w2), "mul w0, w1, w2"); |
454 COMPARE(mul(x3, x4, x5), "mul x3, x4, x5"); | 465 COMPARE(mul(x3, x4, x5), "mul x3, x4, x5"); |
455 COMPARE(mul(w30, w0, w1), "mul w30, w0, w1"); | 466 COMPARE(mul(w30, w0, w1), "mul w30, w0, w1"); |
456 COMPARE(mul(lr, x0, x1), "mul lr, x0, x1"); | 467 COMPARE(mul(lr, x0, x1), "mul lr, x0, x1"); |
457 COMPARE(mneg(w0, w1, w2), "mneg w0, w1, w2"); | 468 COMPARE(mneg(w0, w1, w2), "mneg w0, w1, w2"); |
458 COMPARE(mneg(x3, x4, x5), "mneg x3, x4, x5"); | 469 COMPARE(mneg(x3, x4, x5), "mneg x3, x4, x5"); |
459 COMPARE(mneg(w30, w0, w1), "mneg w30, w0, w1"); | 470 COMPARE(mneg(w30, w0, w1), "mneg w30, w0, w1"); |
460 COMPARE(mneg(lr, x0, x1), "mneg lr, x0, x1"); | 471 COMPARE(mneg(lr, x0, x1), "mneg lr, x0, x1"); |
461 COMPARE(smull(x0, w0, w1), "smull x0, w0, w1"); | 472 COMPARE(smull(x0, w0, w1), "smull x0, w0, w1"); |
(...skipping 12 matching lines...) Expand all Loading... |
474 COMPARE(sdiv(w0, w1, w2), "sdiv w0, w1, w2"); | 485 COMPARE(sdiv(w0, w1, w2), "sdiv w0, w1, w2"); |
475 COMPARE(sdiv(x3, x4, x5), "sdiv x3, x4, x5"); | 486 COMPARE(sdiv(x3, x4, x5), "sdiv x3, x4, x5"); |
476 COMPARE(udiv(w6, w7, w8), "udiv w6, w7, w8"); | 487 COMPARE(udiv(w6, w7, w8), "udiv w6, w7, w8"); |
477 COMPARE(udiv(x9, x10, x11), "udiv x9, x10, x11"); | 488 COMPARE(udiv(x9, x10, x11), "udiv x9, x10, x11"); |
478 | 489 |
479 CLEANUP(); | 490 CLEANUP(); |
480 } | 491 } |
481 | 492 |
482 | 493 |
483 TEST(maddl_msubl) { | 494 TEST(maddl_msubl) { |
484 SET_UP(); | 495 SET_UP_ASM(); |
485 | 496 |
486 COMPARE(smaddl(x0, w1, w2, x3), "smaddl x0, w1, w2, x3"); | 497 COMPARE(smaddl(x0, w1, w2, x3), "smaddl x0, w1, w2, x3"); |
487 COMPARE(smaddl(x25, w21, w22, x16), "smaddl x25, w21, w22, x16"); | 498 COMPARE(smaddl(x25, w21, w22, x16), "smaddl x25, w21, w22, x16"); |
488 COMPARE(umaddl(x0, w1, w2, x3), "umaddl x0, w1, w2, x3"); | 499 COMPARE(umaddl(x0, w1, w2, x3), "umaddl x0, w1, w2, x3"); |
489 COMPARE(umaddl(x25, w21, w22, x16), "umaddl x25, w21, w22, x16"); | 500 COMPARE(umaddl(x25, w21, w22, x16), "umaddl x25, w21, w22, x16"); |
490 | 501 |
491 COMPARE(smsubl(x0, w1, w2, x3), "smsubl x0, w1, w2, x3"); | 502 COMPARE(smsubl(x0, w1, w2, x3), "smsubl x0, w1, w2, x3"); |
492 COMPARE(smsubl(x25, w21, w22, x16), "smsubl x25, w21, w22, x16"); | 503 COMPARE(smsubl(x25, w21, w22, x16), "smsubl x25, w21, w22, x16"); |
493 COMPARE(umsubl(x0, w1, w2, x3), "umsubl x0, w1, w2, x3"); | 504 COMPARE(umsubl(x0, w1, w2, x3), "umsubl x0, w1, w2, x3"); |
494 COMPARE(umsubl(x25, w21, w22, x16), "umsubl x25, w21, w22, x16"); | 505 COMPARE(umsubl(x25, w21, w22, x16), "umsubl x25, w21, w22, x16"); |
495 | 506 |
496 CLEANUP(); | 507 CLEANUP(); |
497 } | 508 } |
498 | 509 |
499 | 510 |
500 TEST_(dp_1_source) { | 511 TEST_(dp_1_source) { |
501 SET_UP(); | 512 SET_UP_ASM(); |
502 | 513 |
503 COMPARE(rbit(w0, w1), "rbit w0, w1"); | 514 COMPARE(rbit(w0, w1), "rbit w0, w1"); |
504 COMPARE(rbit(x2, x3), "rbit x2, x3"); | 515 COMPARE(rbit(x2, x3), "rbit x2, x3"); |
505 COMPARE(rev16(w4, w5), "rev16 w4, w5"); | 516 COMPARE(rev16(w4, w5), "rev16 w4, w5"); |
506 COMPARE(rev16(x6, x7), "rev16 x6, x7"); | 517 COMPARE(rev16(x6, x7), "rev16 x6, x7"); |
507 COMPARE(rev32(x8, x9), "rev32 x8, x9"); | 518 COMPARE(rev32(x8, x9), "rev32 x8, x9"); |
508 COMPARE(rev(w10, w11), "rev w10, w11"); | 519 COMPARE(rev(w10, w11), "rev w10, w11"); |
509 COMPARE(rev(x12, x13), "rev x12, x13"); | 520 COMPARE(rev(x12, x13), "rev x12, x13"); |
510 COMPARE(clz(w14, w15), "clz w14, w15"); | 521 COMPARE(clz(w14, w15), "clz w14, w15"); |
511 COMPARE(clz(x16, x17), "clz x16, x17"); | 522 COMPARE(clz(x16, x17), "clz x16, x17"); |
512 COMPARE(cls(w18, w19), "cls w18, w19"); | 523 COMPARE(cls(w18, w19), "cls w18, w19"); |
513 COMPARE(cls(x20, x21), "cls x20, x21"); | 524 COMPARE(cls(x20, x21), "cls x20, x21"); |
514 | 525 |
515 CLEANUP(); | 526 CLEANUP(); |
516 } | 527 } |
517 | 528 |
518 | 529 |
519 TEST_(bitfield) { | 530 TEST_(bitfield) { |
520 SET_UP(); | 531 SET_UP_ASM(); |
521 | 532 |
522 COMPARE(sxtb(w0, w1), "sxtb w0, w1"); | 533 COMPARE(sxtb(w0, w1), "sxtb w0, w1"); |
523 COMPARE(sxtb(x2, x3), "sxtb x2, w3"); | 534 COMPARE(sxtb(x2, x3), "sxtb x2, w3"); |
524 COMPARE(sxth(w4, w5), "sxth w4, w5"); | 535 COMPARE(sxth(w4, w5), "sxth w4, w5"); |
525 COMPARE(sxth(x6, x7), "sxth x6, w7"); | 536 COMPARE(sxth(x6, x7), "sxth x6, w7"); |
526 COMPARE(sxtw(x8, x9), "sxtw x8, w9"); | 537 COMPARE(sxtw(x8, x9), "sxtw x8, w9"); |
527 COMPARE(sxtb(x0, w1), "sxtb x0, w1"); | 538 COMPARE(sxtb(x0, w1), "sxtb x0, w1"); |
528 COMPARE(sxth(x2, w3), "sxth x2, w3"); | 539 COMPARE(sxth(x2, w3), "sxth x2, w3"); |
529 COMPARE(sxtw(x4, w5), "sxtw x4, w5"); | 540 COMPARE(sxtw(x4, w5), "sxtw x4, w5"); |
530 | 541 |
(...skipping 21 matching lines...) Expand all Loading... |
552 COMPARE(ubfiz(w17, w18, 9, 12), "ubfiz w17, w18, #9, #12"); | 563 COMPARE(ubfiz(w17, w18, 9, 12), "ubfiz w17, w18, #9, #12"); |
553 COMPARE(ubfiz(x19, x20, 10, 11), "ubfiz x19, x20, #10, #11"); | 564 COMPARE(ubfiz(x19, x20, 10, 11), "ubfiz x19, x20, #10, #11"); |
554 COMPARE(ubfx(w21, w22, 11, 10), "ubfx w21, w22, #11, #10"); | 565 COMPARE(ubfx(w21, w22, 11, 10), "ubfx w21, w22, #11, #10"); |
555 COMPARE(ubfx(x23, x24, 12, 9), "ubfx x23, x24, #12, #9"); | 566 COMPARE(ubfx(x23, x24, 12, 9), "ubfx x23, x24, #12, #9"); |
556 | 567 |
557 CLEANUP(); | 568 CLEANUP(); |
558 } | 569 } |
559 | 570 |
560 | 571 |
561 TEST_(extract) { | 572 TEST_(extract) { |
562 SET_UP(); | 573 SET_UP_ASM(); |
563 | 574 |
564 COMPARE(extr(w0, w1, w2, 0), "extr w0, w1, w2, #0"); | 575 COMPARE(extr(w0, w1, w2, 0), "extr w0, w1, w2, #0"); |
565 COMPARE(extr(x3, x4, x5, 1), "extr x3, x4, x5, #1"); | 576 COMPARE(extr(x3, x4, x5, 1), "extr x3, x4, x5, #1"); |
566 COMPARE(extr(w6, w7, w8, 31), "extr w6, w7, w8, #31"); | 577 COMPARE(extr(w6, w7, w8, 31), "extr w6, w7, w8, #31"); |
567 COMPARE(extr(x9, x10, x11, 63), "extr x9, x10, x11, #63"); | 578 COMPARE(extr(x9, x10, x11, 63), "extr x9, x10, x11, #63"); |
568 COMPARE(extr(w12, w13, w13, 10), "ror w12, w13, #10"); | 579 COMPARE(extr(w12, w13, w13, 10), "ror w12, w13, #10"); |
569 COMPARE(extr(x14, x15, x15, 42), "ror x14, x15, #42"); | 580 COMPARE(extr(x14, x15, x15, 42), "ror x14, x15, #42"); |
570 | 581 |
571 CLEANUP(); | 582 CLEANUP(); |
572 } | 583 } |
573 | 584 |
574 | 585 |
575 TEST_(logical_immediate) { | 586 TEST_(logical_immediate) { |
576 SET_UP(); | 587 SET_UP_ASM(); |
577 #define RESULT_SIZE (256) | 588 #define RESULT_SIZE (256) |
578 | 589 |
579 char result[RESULT_SIZE]; | 590 char result[RESULT_SIZE]; |
580 | 591 |
581 // Test immediate encoding - 64-bit destination. | 592 // Test immediate encoding - 64-bit destination. |
582 // 64-bit patterns. | 593 // 64-bit patterns. |
583 uint64_t value = 0x7fffffff; | 594 uint64_t value = 0x7fffffff; |
584 for (int i = 0; i < 64; i++) { | 595 for (int i = 0; i < 64; i++) { |
585 snprintf(result, RESULT_SIZE, "and x0, x0, #0x%" PRIx64, value); | 596 snprintf(result, RESULT_SIZE, "and x0, x0, #0x%" PRIx64, value); |
586 COMPARE(and_(x0, x0, Operand(value)), result); | 597 COMPARE(and_(x0, x0, Operand(value)), result); |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
692 COMPARE(orr(x8, xzr, Operand(0xfffffffffc001fffUL)), | 703 COMPARE(orr(x8, xzr, Operand(0xfffffffffc001fffUL)), |
693 "mov x8, #0xfffffffffc001fff"); | 704 "mov x8, #0xfffffffffc001fff"); |
694 COMPARE(orr(x9, xzr, Operand(0xffffffffc001ffffUL)), | 705 COMPARE(orr(x9, xzr, Operand(0xffffffffc001ffffUL)), |
695 "orr x9, xzr, #0xffffffffc001ffff"); | 706 "orr x9, xzr, #0xffffffffc001ffff"); |
696 | 707 |
697 CLEANUP(); | 708 CLEANUP(); |
698 } | 709 } |
699 | 710 |
700 | 711 |
701 TEST_(logical_shifted) { | 712 TEST_(logical_shifted) { |
702 SET_UP(); | 713 SET_UP_ASM(); |
703 | 714 |
704 COMPARE(and_(w0, w1, Operand(w2)), "and w0, w1, w2"); | 715 COMPARE(and_(w0, w1, Operand(w2)), "and w0, w1, w2"); |
705 COMPARE(and_(x3, x4, Operand(x5, LSL, 1)), "and x3, x4, x5, lsl #1"); | 716 COMPARE(and_(x3, x4, Operand(x5, LSL, 1)), "and x3, x4, x5, lsl #1"); |
706 COMPARE(and_(w6, w7, Operand(w8, LSR, 2)), "and w6, w7, w8, lsr #2"); | 717 COMPARE(and_(w6, w7, Operand(w8, LSR, 2)), "and w6, w7, w8, lsr #2"); |
707 COMPARE(and_(x9, x10, Operand(x11, ASR, 3)), "and x9, x10, x11, asr #3"); | 718 COMPARE(and_(x9, x10, Operand(x11, ASR, 3)), "and x9, x10, x11, asr #3"); |
708 COMPARE(and_(w12, w13, Operand(w14, ROR, 4)), "and w12, w13, w14, ror #4"); | 719 COMPARE(and_(w12, w13, Operand(w14, ROR, 4)), "and w12, w13, w14, ror #4"); |
709 | 720 |
710 COMPARE(bic(w15, w16, Operand(w17)), "bic w15, w16, w17"); | 721 COMPARE(bic(w15, w16, Operand(w17)), "bic w15, w16, w17"); |
711 COMPARE(bic(x18, x19, Operand(x20, LSL, 5)), "bic x18, x19, x20, lsl #5"); | 722 COMPARE(bic(x18, x19, Operand(x20, LSL, 5)), "bic x18, x19, x20, lsl #5"); |
712 COMPARE(bic(w21, w22, Operand(w23, LSR, 6)), "bic w21, w22, w23, lsr #6"); | 723 COMPARE(bic(w21, w22, Operand(w23, LSR, 6)), "bic w21, w22, w23, lsr #6"); |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
762 COMPARE(orr(w0, wzr, Operand(w1)), "mov w0, w1"); | 773 COMPARE(orr(w0, wzr, Operand(w1)), "mov w0, w1"); |
763 COMPARE(orr(x0, xzr, Operand(x1)), "mov x0, x1"); | 774 COMPARE(orr(x0, xzr, Operand(x1)), "mov x0, x1"); |
764 COMPARE(orr(w16, wzr, Operand(w17, LSL, 1)), "orr w16, wzr, w17, lsl #1"); | 775 COMPARE(orr(w16, wzr, Operand(w17, LSL, 1)), "orr w16, wzr, w17, lsl #1"); |
765 COMPARE(orr(x16, xzr, Operand(x17, ASR, 2)), "orr x16, xzr, x17, asr #2"); | 776 COMPARE(orr(x16, xzr, Operand(x17, ASR, 2)), "orr x16, xzr, x17, asr #2"); |
766 | 777 |
767 CLEANUP(); | 778 CLEANUP(); |
768 } | 779 } |
769 | 780 |
770 | 781 |
771 TEST_(dp_2_source) { | 782 TEST_(dp_2_source) { |
772 SET_UP(); | 783 SET_UP_ASM(); |
773 | 784 |
774 COMPARE(lslv(w0, w1, w2), "lsl w0, w1, w2"); | 785 COMPARE(lslv(w0, w1, w2), "lsl w0, w1, w2"); |
775 COMPARE(lslv(x3, x4, x5), "lsl x3, x4, x5"); | 786 COMPARE(lslv(x3, x4, x5), "lsl x3, x4, x5"); |
776 COMPARE(lsrv(w6, w7, w8), "lsr w6, w7, w8"); | 787 COMPARE(lsrv(w6, w7, w8), "lsr w6, w7, w8"); |
777 COMPARE(lsrv(x9, x10, x11), "lsr x9, x10, x11"); | 788 COMPARE(lsrv(x9, x10, x11), "lsr x9, x10, x11"); |
778 COMPARE(asrv(w12, w13, w14), "asr w12, w13, w14"); | 789 COMPARE(asrv(w12, w13, w14), "asr w12, w13, w14"); |
779 COMPARE(asrv(x15, x16, x17), "asr x15, x16, x17"); | 790 COMPARE(asrv(x15, x16, x17), "asr x15, x16, x17"); |
780 COMPARE(rorv(w18, w19, w20), "ror w18, w19, w20"); | 791 COMPARE(rorv(w18, w19, w20), "ror w18, w19, w20"); |
781 COMPARE(rorv(x21, x22, x23), "ror x21, x22, x23"); | 792 COMPARE(rorv(x21, x22, x23), "ror x21, x22, x23"); |
782 | 793 |
783 CLEANUP(); | 794 CLEANUP(); |
784 } | 795 } |
785 | 796 |
786 | 797 |
787 TEST_(adr) { | 798 TEST_(adr) { |
788 SET_UP(); | 799 SET_UP_ASM(); |
789 | 800 |
790 COMPARE_PREFIX(adr(x0, 0), "adr x0, #+0x0"); | 801 COMPARE_PREFIX(adr(x0, 0), "adr x0, #+0x0"); |
791 COMPARE_PREFIX(adr(x1, 1), "adr x1, #+0x1"); | 802 COMPARE_PREFIX(adr(x1, 1), "adr x1, #+0x1"); |
792 COMPARE_PREFIX(adr(x2, -1), "adr x2, #-0x1"); | 803 COMPARE_PREFIX(adr(x2, -1), "adr x2, #-0x1"); |
793 COMPARE_PREFIX(adr(x3, 4), "adr x3, #+0x4"); | 804 COMPARE_PREFIX(adr(x3, 4), "adr x3, #+0x4"); |
794 COMPARE_PREFIX(adr(x4, -4), "adr x4, #-0x4"); | 805 COMPARE_PREFIX(adr(x4, -4), "adr x4, #-0x4"); |
795 COMPARE_PREFIX(adr(x5, 0x000fffff), "adr x5, #+0xfffff"); | 806 COMPARE_PREFIX(adr(x5, 0x000fffff), "adr x5, #+0xfffff"); |
796 COMPARE_PREFIX(adr(x6, -0x00100000), "adr x6, #-0x100000"); | 807 COMPARE_PREFIX(adr(x6, -0x00100000), "adr x6, #-0x100000"); |
797 COMPARE_PREFIX(adr(xzr, 0), "adr xzr, #+0x0"); | 808 COMPARE_PREFIX(adr(xzr, 0), "adr xzr, #+0x0"); |
798 | 809 |
799 CLEANUP(); | 810 CLEANUP(); |
800 } | 811 } |
801 | 812 |
802 | 813 |
803 TEST_(branch) { | 814 TEST_(branch) { |
804 SET_UP(); | 815 SET_UP_ASM(); |
805 | 816 |
806 #define INST_OFF(x) ((x) >> kInstructionSizeLog2) | 817 #define INST_OFF(x) ((x) >> kInstructionSizeLog2) |
807 COMPARE_PREFIX(b(INST_OFF(0x4)), "b #+0x4"); | 818 COMPARE_PREFIX(b(INST_OFF(0x4)), "b #+0x4"); |
808 COMPARE_PREFIX(b(INST_OFF(-0x4)), "b #-0x4"); | 819 COMPARE_PREFIX(b(INST_OFF(-0x4)), "b #-0x4"); |
809 COMPARE_PREFIX(b(INST_OFF(0x7fffffc)), "b #+0x7fffffc"); | 820 COMPARE_PREFIX(b(INST_OFF(0x7fffffc)), "b #+0x7fffffc"); |
810 COMPARE_PREFIX(b(INST_OFF(-0x8000000)), "b #-0x8000000"); | 821 COMPARE_PREFIX(b(INST_OFF(-0x8000000)), "b #-0x8000000"); |
811 COMPARE_PREFIX(b(INST_OFF(0xffffc), eq), "b.eq #+0xffffc"); | 822 COMPARE_PREFIX(b(INST_OFF(0xffffc), eq), "b.eq #+0xffffc"); |
812 COMPARE_PREFIX(b(INST_OFF(-0x100000), mi), "b.mi #-0x100000"); | 823 COMPARE_PREFIX(b(INST_OFF(-0x100000), mi), "b.mi #-0x100000"); |
813 COMPARE_PREFIX(bl(INST_OFF(0x4)), "bl #+0x4"); | 824 COMPARE_PREFIX(bl(INST_OFF(0x4)), "bl #+0x4"); |
814 COMPARE_PREFIX(bl(INST_OFF(-0x4)), "bl #-0x4"); | 825 COMPARE_PREFIX(bl(INST_OFF(-0x4)), "bl #-0x4"); |
(...skipping 16 matching lines...) Expand all Loading... |
831 COMPARE(br(x0), "br x0"); | 842 COMPARE(br(x0), "br x0"); |
832 COMPARE(blr(x1), "blr x1"); | 843 COMPARE(blr(x1), "blr x1"); |
833 COMPARE(ret(x2), "ret x2"); | 844 COMPARE(ret(x2), "ret x2"); |
834 COMPARE(ret(lr), "ret") | 845 COMPARE(ret(lr), "ret") |
835 | 846 |
836 CLEANUP(); | 847 CLEANUP(); |
837 } | 848 } |
838 | 849 |
839 | 850 |
840 TEST_(load_store) { | 851 TEST_(load_store) { |
841 SET_UP(); | 852 SET_UP_ASM(); |
842 | 853 |
843 COMPARE(ldr(w0, MemOperand(x1)), "ldr w0, [x1]"); | 854 COMPARE(ldr(w0, MemOperand(x1)), "ldr w0, [x1]"); |
844 COMPARE(ldr(w2, MemOperand(x3, 4)), "ldr w2, [x3, #4]"); | 855 COMPARE(ldr(w2, MemOperand(x3, 4)), "ldr w2, [x3, #4]"); |
845 COMPARE(ldr(w4, MemOperand(x5, 16380)), "ldr w4, [x5, #16380]"); | 856 COMPARE(ldr(w4, MemOperand(x5, 16380)), "ldr w4, [x5, #16380]"); |
846 COMPARE(ldr(x6, MemOperand(x7)), "ldr x6, [x7]"); | 857 COMPARE(ldr(x6, MemOperand(x7)), "ldr x6, [x7]"); |
847 COMPARE(ldr(x8, MemOperand(x9, 8)), "ldr x8, [x9, #8]"); | 858 COMPARE(ldr(x8, MemOperand(x9, 8)), "ldr x8, [x9, #8]"); |
848 COMPARE(ldr(x10, MemOperand(x11, 32760)), "ldr x10, [x11, #32760]"); | 859 COMPARE(ldr(x10, MemOperand(x11, 32760)), "ldr x10, [x11, #32760]"); |
849 COMPARE(str(w12, MemOperand(x13)), "str w12, [x13]"); | 860 COMPARE(str(w12, MemOperand(x13)), "str w12, [x13]"); |
850 COMPARE(str(w14, MemOperand(x15, 4)), "str w14, [x15, #4]"); | 861 COMPARE(str(w14, MemOperand(x15, 4)), "str w14, [x15, #4]"); |
851 COMPARE(str(w16, MemOperand(x17, 16380)), "str w16, [x17, #16380]"); | 862 COMPARE(str(w16, MemOperand(x17, 16380)), "str w16, [x17, #16380]"); |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
888 COMPARE(ldrsw(x0, MemOperand(x1)), "ldrsw x0, [x1]"); | 899 COMPARE(ldrsw(x0, MemOperand(x1)), "ldrsw x0, [x1]"); |
889 COMPARE(ldrsw(x2, MemOperand(x3, 8)), "ldrsw x2, [x3, #8]"); | 900 COMPARE(ldrsw(x2, MemOperand(x3, 8)), "ldrsw x2, [x3, #8]"); |
890 COMPARE(ldrsw(x4, MemOperand(x5, 42, PreIndex)), "ldrsw x4, [x5, #42]!"); | 901 COMPARE(ldrsw(x4, MemOperand(x5, 42, PreIndex)), "ldrsw x4, [x5, #42]!"); |
891 COMPARE(ldrsw(x6, MemOperand(x7, -11, PostIndex)), "ldrsw x6, [x7], #-11"); | 902 COMPARE(ldrsw(x6, MemOperand(x7, -11, PostIndex)), "ldrsw x6, [x7], #-11"); |
892 | 903 |
893 CLEANUP(); | 904 CLEANUP(); |
894 } | 905 } |
895 | 906 |
896 | 907 |
897 TEST_(load_store_regoffset) { | 908 TEST_(load_store_regoffset) { |
898 SET_UP(); | 909 SET_UP_ASM(); |
899 | 910 |
900 COMPARE(ldr(w0, MemOperand(x1, w2, UXTW)), "ldr w0, [x1, w2, uxtw]"); | 911 COMPARE(ldr(w0, MemOperand(x1, w2, UXTW)), "ldr w0, [x1, w2, uxtw]"); |
901 COMPARE(ldr(w3, MemOperand(x4, w5, UXTW, 2)), "ldr w3, [x4, w5, uxtw #2]"); | 912 COMPARE(ldr(w3, MemOperand(x4, w5, UXTW, 2)), "ldr w3, [x4, w5, uxtw #2]"); |
902 COMPARE(ldr(w6, MemOperand(x7, x8)), "ldr w6, [x7, x8]"); | 913 COMPARE(ldr(w6, MemOperand(x7, x8)), "ldr w6, [x7, x8]"); |
903 COMPARE(ldr(w9, MemOperand(x10, x11, LSL, 2)), "ldr w9, [x10, x11, lsl #2]"); | 914 COMPARE(ldr(w9, MemOperand(x10, x11, LSL, 2)), "ldr w9, [x10, x11, lsl #2]"); |
904 COMPARE(ldr(w12, MemOperand(x13, w14, SXTW)), "ldr w12, [x13, w14, sxtw]"); | 915 COMPARE(ldr(w12, MemOperand(x13, w14, SXTW)), "ldr w12, [x13, w14, sxtw]"); |
905 COMPARE(ldr(w15, MemOperand(x16, w17, SXTW, 2)), | 916 COMPARE(ldr(w15, MemOperand(x16, w17, SXTW, 2)), |
906 "ldr w15, [x16, w17, sxtw #2]"); | 917 "ldr w15, [x16, w17, sxtw #2]"); |
907 COMPARE(ldr(w18, MemOperand(x19, x20, SXTX)), "ldr w18, [x19, x20, sxtx]"); | 918 COMPARE(ldr(w18, MemOperand(x19, x20, SXTX)), "ldr w18, [x19, x20, sxtx]"); |
908 COMPARE(ldr(w21, MemOperand(x22, x23, SXTX, 2)), | 919 COMPARE(ldr(w21, MemOperand(x22, x23, SXTX, 2)), |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
973 | 984 |
974 // TODO(all): Fix this for jssp. | 985 // TODO(all): Fix this for jssp. |
975 COMPARE(ldr(x0, MemOperand(jssp, wzr, SXTW)), "ldr x0, [jssp, wzr, sxtw]"); | 986 COMPARE(ldr(x0, MemOperand(jssp, wzr, SXTW)), "ldr x0, [jssp, wzr, sxtw]"); |
976 COMPARE(str(x1, MemOperand(jssp, xzr)), "str x1, [jssp, xzr]"); | 987 COMPARE(str(x1, MemOperand(jssp, xzr)), "str x1, [jssp, xzr]"); |
977 | 988 |
978 CLEANUP(); | 989 CLEANUP(); |
979 } | 990 } |
980 | 991 |
981 | 992 |
982 TEST_(load_store_byte) { | 993 TEST_(load_store_byte) { |
983 SET_UP(); | 994 SET_UP_ASM(); |
984 | 995 |
985 COMPARE(ldrb(w0, MemOperand(x1)), "ldrb w0, [x1]"); | 996 COMPARE(ldrb(w0, MemOperand(x1)), "ldrb w0, [x1]"); |
986 COMPARE(ldrb(x2, MemOperand(x3)), "ldrb w2, [x3]"); | 997 COMPARE(ldrb(x2, MemOperand(x3)), "ldrb w2, [x3]"); |
987 COMPARE(ldrb(w4, MemOperand(x5, 4095)), "ldrb w4, [x5, #4095]"); | 998 COMPARE(ldrb(w4, MemOperand(x5, 4095)), "ldrb w4, [x5, #4095]"); |
988 COMPARE(ldrb(w6, MemOperand(x7, 255, PreIndex)), "ldrb w6, [x7, #255]!"); | 999 COMPARE(ldrb(w6, MemOperand(x7, 255, PreIndex)), "ldrb w6, [x7, #255]!"); |
989 COMPARE(ldrb(w8, MemOperand(x9, -256, PreIndex)), "ldrb w8, [x9, #-256]!"); | 1000 COMPARE(ldrb(w8, MemOperand(x9, -256, PreIndex)), "ldrb w8, [x9, #-256]!"); |
990 COMPARE(ldrb(w10, MemOperand(x11, 255, PostIndex)), "ldrb w10, [x11], #255"); | 1001 COMPARE(ldrb(w10, MemOperand(x11, 255, PostIndex)), "ldrb w10, [x11], #255"); |
991 COMPARE(ldrb(w12, MemOperand(x13, -256, PostIndex)), | 1002 COMPARE(ldrb(w12, MemOperand(x13, -256, PostIndex)), |
992 "ldrb w12, [x13], #-256"); | 1003 "ldrb w12, [x13], #-256"); |
993 COMPARE(strb(w14, MemOperand(x15)), "strb w14, [x15]"); | 1004 COMPARE(strb(w14, MemOperand(x15)), "strb w14, [x15]"); |
(...skipping 11 matching lines...) Expand all Loading... |
1005 COMPARE(ldrsb(w0, MemOperand(x1)), "ldrsb w0, [x1]"); | 1016 COMPARE(ldrsb(w0, MemOperand(x1)), "ldrsb w0, [x1]"); |
1006 COMPARE(ldrsb(x2, MemOperand(x3, 8)), "ldrsb x2, [x3, #8]"); | 1017 COMPARE(ldrsb(x2, MemOperand(x3, 8)), "ldrsb x2, [x3, #8]"); |
1007 COMPARE(ldrsb(w4, MemOperand(x5, 42, PreIndex)), "ldrsb w4, [x5, #42]!"); | 1018 COMPARE(ldrsb(w4, MemOperand(x5, 42, PreIndex)), "ldrsb w4, [x5, #42]!"); |
1008 COMPARE(ldrsb(x6, MemOperand(x7, -11, PostIndex)), "ldrsb x6, [x7], #-11"); | 1019 COMPARE(ldrsb(x6, MemOperand(x7, -11, PostIndex)), "ldrsb x6, [x7], #-11"); |
1009 | 1020 |
1010 CLEANUP(); | 1021 CLEANUP(); |
1011 } | 1022 } |
1012 | 1023 |
1013 | 1024 |
1014 TEST_(load_store_half) { | 1025 TEST_(load_store_half) { |
1015 SET_UP(); | 1026 SET_UP_ASM(); |
1016 | 1027 |
1017 COMPARE(ldrh(w0, MemOperand(x1)), "ldrh w0, [x1]"); | 1028 COMPARE(ldrh(w0, MemOperand(x1)), "ldrh w0, [x1]"); |
1018 COMPARE(ldrh(x2, MemOperand(x3)), "ldrh w2, [x3]"); | 1029 COMPARE(ldrh(x2, MemOperand(x3)), "ldrh w2, [x3]"); |
1019 COMPARE(ldrh(w4, MemOperand(x5, 8190)), "ldrh w4, [x5, #8190]"); | 1030 COMPARE(ldrh(w4, MemOperand(x5, 8190)), "ldrh w4, [x5, #8190]"); |
1020 COMPARE(ldrh(w6, MemOperand(x7, 255, PreIndex)), "ldrh w6, [x7, #255]!"); | 1031 COMPARE(ldrh(w6, MemOperand(x7, 255, PreIndex)), "ldrh w6, [x7, #255]!"); |
1021 COMPARE(ldrh(w8, MemOperand(x9, -256, PreIndex)), "ldrh w8, [x9, #-256]!"); | 1032 COMPARE(ldrh(w8, MemOperand(x9, -256, PreIndex)), "ldrh w8, [x9, #-256]!"); |
1022 COMPARE(ldrh(w10, MemOperand(x11, 255, PostIndex)), "ldrh w10, [x11], #255"); | 1033 COMPARE(ldrh(w10, MemOperand(x11, 255, PostIndex)), "ldrh w10, [x11], #255"); |
1023 COMPARE(ldrh(w12, MemOperand(x13, -256, PostIndex)), | 1034 COMPARE(ldrh(w12, MemOperand(x13, -256, PostIndex)), |
1024 "ldrh w12, [x13], #-256"); | 1035 "ldrh w12, [x13], #-256"); |
1025 COMPARE(strh(w14, MemOperand(x15)), "strh w14, [x15]"); | 1036 COMPARE(strh(w14, MemOperand(x15)), "strh w14, [x15]"); |
(...skipping 15 matching lines...) Expand all Loading... |
1041 COMPARE(ldrsh(w0, MemOperand(x1)), "ldrsh w0, [x1]"); | 1052 COMPARE(ldrsh(w0, MemOperand(x1)), "ldrsh w0, [x1]"); |
1042 COMPARE(ldrsh(w2, MemOperand(x3, 8)), "ldrsh w2, [x3, #8]"); | 1053 COMPARE(ldrsh(w2, MemOperand(x3, 8)), "ldrsh w2, [x3, #8]"); |
1043 COMPARE(ldrsh(w4, MemOperand(x5, 42, PreIndex)), "ldrsh w4, [x5, #42]!"); | 1054 COMPARE(ldrsh(w4, MemOperand(x5, 42, PreIndex)), "ldrsh w4, [x5, #42]!"); |
1044 COMPARE(ldrsh(x6, MemOperand(x7, -11, PostIndex)), "ldrsh x6, [x7], #-11"); | 1055 COMPARE(ldrsh(x6, MemOperand(x7, -11, PostIndex)), "ldrsh x6, [x7], #-11"); |
1045 | 1056 |
1046 CLEANUP(); | 1057 CLEANUP(); |
1047 } | 1058 } |
1048 | 1059 |
1049 | 1060 |
1050 TEST_(load_store_fp) { | 1061 TEST_(load_store_fp) { |
1051 SET_UP(); | 1062 SET_UP_ASM(); |
1052 | 1063 |
1053 COMPARE(ldr(s0, MemOperand(x1)), "ldr s0, [x1]"); | 1064 COMPARE(ldr(s0, MemOperand(x1)), "ldr s0, [x1]"); |
1054 COMPARE(ldr(s2, MemOperand(x3, 4)), "ldr s2, [x3, #4]"); | 1065 COMPARE(ldr(s2, MemOperand(x3, 4)), "ldr s2, [x3, #4]"); |
1055 COMPARE(ldr(s4, MemOperand(x5, 16380)), "ldr s4, [x5, #16380]"); | 1066 COMPARE(ldr(s4, MemOperand(x5, 16380)), "ldr s4, [x5, #16380]"); |
1056 COMPARE(ldr(d6, MemOperand(x7)), "ldr d6, [x7]"); | 1067 COMPARE(ldr(d6, MemOperand(x7)), "ldr d6, [x7]"); |
1057 COMPARE(ldr(d8, MemOperand(x9, 8)), "ldr d8, [x9, #8]"); | 1068 COMPARE(ldr(d8, MemOperand(x9, 8)), "ldr d8, [x9, #8]"); |
1058 COMPARE(ldr(d10, MemOperand(x11, 32760)), "ldr d10, [x11, #32760]"); | 1069 COMPARE(ldr(d10, MemOperand(x11, 32760)), "ldr d10, [x11, #32760]"); |
1059 COMPARE(str(s12, MemOperand(x13)), "str s12, [x13]"); | 1070 COMPARE(str(s12, MemOperand(x13)), "str s12, [x13]"); |
1060 COMPARE(str(s14, MemOperand(x15, 4)), "str s14, [x15, #4]"); | 1071 COMPARE(str(s14, MemOperand(x15, 4)), "str s14, [x15, #4]"); |
1061 COMPARE(str(s16, MemOperand(x17, 16380)), "str s16, [x17, #16380]"); | 1072 COMPARE(str(s16, MemOperand(x17, 16380)), "str s16, [x17, #16380]"); |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1093 COMPARE(ldr(s24, MemOperand(jssp)), "ldr s24, [jssp]"); | 1104 COMPARE(ldr(s24, MemOperand(jssp)), "ldr s24, [jssp]"); |
1094 COMPARE(ldr(d25, MemOperand(jssp, 8)), "ldr d25, [jssp, #8]"); | 1105 COMPARE(ldr(d25, MemOperand(jssp, 8)), "ldr d25, [jssp, #8]"); |
1095 COMPARE(str(s26, MemOperand(jssp, 4, PreIndex)), "str s26, [jssp, #4]!"); | 1106 COMPARE(str(s26, MemOperand(jssp, 4, PreIndex)), "str s26, [jssp, #4]!"); |
1096 COMPARE(str(d27, MemOperand(jssp, -8, PostIndex)), "str d27, [jssp], #-8"); | 1107 COMPARE(str(d27, MemOperand(jssp, -8, PostIndex)), "str d27, [jssp], #-8"); |
1097 | 1108 |
1098 CLEANUP(); | 1109 CLEANUP(); |
1099 } | 1110 } |
1100 | 1111 |
1101 | 1112 |
1102 TEST_(load_store_unscaled) { | 1113 TEST_(load_store_unscaled) { |
1103 SET_UP(); | 1114 SET_UP_ASM(); |
1104 | 1115 |
1105 COMPARE(ldr(w0, MemOperand(x1, 1)), "ldur w0, [x1, #1]"); | 1116 COMPARE(ldr(w0, MemOperand(x1, 1)), "ldur w0, [x1, #1]"); |
1106 COMPARE(ldr(w2, MemOperand(x3, -1)), "ldur w2, [x3, #-1]"); | 1117 COMPARE(ldr(w2, MemOperand(x3, -1)), "ldur w2, [x3, #-1]"); |
1107 COMPARE(ldr(w4, MemOperand(x5, 255)), "ldur w4, [x5, #255]"); | 1118 COMPARE(ldr(w4, MemOperand(x5, 255)), "ldur w4, [x5, #255]"); |
1108 COMPARE(ldr(w6, MemOperand(x7, -256)), "ldur w6, [x7, #-256]"); | 1119 COMPARE(ldr(w6, MemOperand(x7, -256)), "ldur w6, [x7, #-256]"); |
1109 COMPARE(ldr(x8, MemOperand(x9, 1)), "ldur x8, [x9, #1]"); | 1120 COMPARE(ldr(x8, MemOperand(x9, 1)), "ldur x8, [x9, #1]"); |
1110 COMPARE(ldr(x10, MemOperand(x11, -1)), "ldur x10, [x11, #-1]"); | 1121 COMPARE(ldr(x10, MemOperand(x11, -1)), "ldur x10, [x11, #-1]"); |
1111 COMPARE(ldr(x12, MemOperand(x13, 255)), "ldur x12, [x13, #255]"); | 1122 COMPARE(ldr(x12, MemOperand(x13, 255)), "ldur x12, [x13, #255]"); |
1112 COMPARE(ldr(x14, MemOperand(x15, -256)), "ldur x14, [x15, #-256]"); | 1123 COMPARE(ldr(x14, MemOperand(x15, -256)), "ldur x14, [x15, #-256]"); |
1113 COMPARE(str(w16, MemOperand(x17, 1)), "stur w16, [x17, #1]"); | 1124 COMPARE(str(w16, MemOperand(x17, 1)), "stur w16, [x17, #1]"); |
(...skipping 12 matching lines...) Expand all Loading... |
1126 COMPARE(ldrh(w8, MemOperand(x9, -5)), "ldurh w8, [x9, #-5]"); | 1137 COMPARE(ldrh(w8, MemOperand(x9, -5)), "ldurh w8, [x9, #-5]"); |
1127 COMPARE(ldrsh(w10, MemOperand(x11, -6)), "ldursh w10, [x11, #-6]"); | 1138 COMPARE(ldrsh(w10, MemOperand(x11, -6)), "ldursh w10, [x11, #-6]"); |
1128 COMPARE(ldrsh(x12, MemOperand(x13, -7)), "ldursh x12, [x13, #-7]"); | 1139 COMPARE(ldrsh(x12, MemOperand(x13, -7)), "ldursh x12, [x13, #-7]"); |
1129 COMPARE(ldrsw(x14, MemOperand(x15, -8)), "ldursw x14, [x15, #-8]"); | 1140 COMPARE(ldrsw(x14, MemOperand(x15, -8)), "ldursw x14, [x15, #-8]"); |
1130 | 1141 |
1131 CLEANUP(); | 1142 CLEANUP(); |
1132 } | 1143 } |
1133 | 1144 |
1134 | 1145 |
1135 TEST_(load_store_pair) { | 1146 TEST_(load_store_pair) { |
1136 SET_UP(); | 1147 SET_UP_ASM(); |
1137 | 1148 |
1138 COMPARE(ldp(w0, w1, MemOperand(x2)), "ldp w0, w1, [x2]"); | 1149 COMPARE(ldp(w0, w1, MemOperand(x2)), "ldp w0, w1, [x2]"); |
1139 COMPARE(ldp(x3, x4, MemOperand(x5)), "ldp x3, x4, [x5]"); | 1150 COMPARE(ldp(x3, x4, MemOperand(x5)), "ldp x3, x4, [x5]"); |
1140 COMPARE(ldp(w6, w7, MemOperand(x8, 4)), "ldp w6, w7, [x8, #4]"); | 1151 COMPARE(ldp(w6, w7, MemOperand(x8, 4)), "ldp w6, w7, [x8, #4]"); |
1141 COMPARE(ldp(x9, x10, MemOperand(x11, 8)), "ldp x9, x10, [x11, #8]"); | 1152 COMPARE(ldp(x9, x10, MemOperand(x11, 8)), "ldp x9, x10, [x11, #8]"); |
1142 COMPARE(ldp(w12, w13, MemOperand(x14, 252)), "ldp w12, w13, [x14, #252]"); | 1153 COMPARE(ldp(w12, w13, MemOperand(x14, 252)), "ldp w12, w13, [x14, #252]"); |
1143 COMPARE(ldp(x15, x16, MemOperand(x17, 504)), "ldp x15, x16, [x17, #504]"); | 1154 COMPARE(ldp(x15, x16, MemOperand(x17, 504)), "ldp x15, x16, [x17, #504]"); |
1144 COMPARE(ldp(w18, w19, MemOperand(x20, -256)), "ldp w18, w19, [x20, #-256]"); | 1155 COMPARE(ldp(w18, w19, MemOperand(x20, -256)), "ldp w18, w19, [x20, #-256]"); |
1145 COMPARE(ldp(x21, x22, MemOperand(x23, -512)), "ldp x21, x22, [x23, #-512]"); | 1156 COMPARE(ldp(x21, x22, MemOperand(x23, -512)), "ldp x21, x22, [x23, #-512]"); |
1146 COMPARE(ldp(w24, w25, MemOperand(x26, 252, PreIndex)), | 1157 COMPARE(ldp(w24, w25, MemOperand(x26, 252, PreIndex)), |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1247 "ldpsw x6, x7, [x8, #-32]!"); | 1258 "ldpsw x6, x7, [x8, #-32]!"); |
1248 COMPARE(ldpsw(x9, x10, MemOperand(x11, 128, PostIndex)), | 1259 COMPARE(ldpsw(x9, x10, MemOperand(x11, 128, PostIndex)), |
1249 "ldpsw x9, x10, [x11], #128"); | 1260 "ldpsw x9, x10, [x11], #128"); |
1250 | 1261 |
1251 CLEANUP(); | 1262 CLEANUP(); |
1252 } | 1263 } |
1253 | 1264 |
1254 | 1265 |
1255 #if 0 // TODO(all): enable. | 1266 #if 0 // TODO(all): enable. |
1256 TEST_(load_literal) { | 1267 TEST_(load_literal) { |
1257 SET_UP(); | 1268 SET_UP_ASM(); |
1258 | 1269 |
1259 COMPARE_PREFIX(ldr(x10, 0x1234567890abcdefUL), "ldr x10, pc+8"); | 1270 COMPARE_PREFIX(ldr(x10, 0x1234567890abcdefUL), "ldr x10, pc+8"); |
1260 COMPARE_PREFIX(ldr(w20, 0xfedcba09), "ldr w20, pc+8"); | 1271 COMPARE_PREFIX(ldr(w20, 0xfedcba09), "ldr w20, pc+8"); |
1261 COMPARE_PREFIX(ldr(d11, 1.234), "ldr d11, pc+8"); | 1272 COMPARE_PREFIX(ldr(d11, 1.234), "ldr d11, pc+8"); |
1262 COMPARE_PREFIX(ldr(s22, 2.5f), "ldr s22, pc+8"); | 1273 COMPARE_PREFIX(ldr(s22, 2.5f), "ldr s22, pc+8"); |
1263 | 1274 |
1264 CLEANUP(); | 1275 CLEANUP(); |
1265 } | 1276 } |
1266 #endif | 1277 #endif |
1267 | 1278 |
1268 TEST_(cond_select) { | 1279 TEST_(cond_select) { |
1269 SET_UP(); | 1280 SET_UP_ASM(); |
1270 | 1281 |
1271 COMPARE(csel(w0, w1, w2, eq), "csel w0, w1, w2, eq"); | 1282 COMPARE(csel(w0, w1, w2, eq), "csel w0, w1, w2, eq"); |
1272 COMPARE(csel(x3, x4, x5, ne), "csel x3, x4, x5, ne"); | 1283 COMPARE(csel(x3, x4, x5, ne), "csel x3, x4, x5, ne"); |
1273 COMPARE(csinc(w6, w7, w8, hs), "csinc w6, w7, w8, hs"); | 1284 COMPARE(csinc(w6, w7, w8, hs), "csinc w6, w7, w8, hs"); |
1274 COMPARE(csinc(x9, x10, x11, lo), "csinc x9, x10, x11, lo"); | 1285 COMPARE(csinc(x9, x10, x11, lo), "csinc x9, x10, x11, lo"); |
1275 COMPARE(csinv(w12, w13, w14, mi), "csinv w12, w13, w14, mi"); | 1286 COMPARE(csinv(w12, w13, w14, mi), "csinv w12, w13, w14, mi"); |
1276 COMPARE(csinv(x15, x16, x17, pl), "csinv x15, x16, x17, pl"); | 1287 COMPARE(csinv(x15, x16, x17, pl), "csinv x15, x16, x17, pl"); |
1277 COMPARE(csneg(w18, w19, w20, vs), "csneg w18, w19, w20, vs"); | 1288 COMPARE(csneg(w18, w19, w20, vs), "csneg w18, w19, w20, vs"); |
1278 COMPARE(csneg(x21, x22, x23, vc), "csneg x21, x22, x23, vc"); | 1289 COMPARE(csneg(x21, x22, x23, vc), "csneg x21, x22, x23, vc"); |
1279 COMPARE(cset(w24, hi), "cset w24, hi"); | 1290 COMPARE(cset(w24, hi), "cset w24, hi"); |
(...skipping 14 matching lines...) Expand all Loading... |
1294 COMPARE(csinv(x4, x5, x6, al), "csinv x4, x5, x6, al"); | 1305 COMPARE(csinv(x4, x5, x6, al), "csinv x4, x5, x6, al"); |
1295 COMPARE(csinv(x5, x6, x7, nv), "csinv x5, x6, x7, nv"); | 1306 COMPARE(csinv(x5, x6, x7, nv), "csinv x5, x6, x7, nv"); |
1296 COMPARE(csneg(x6, x7, x8, al), "csneg x6, x7, x8, al"); | 1307 COMPARE(csneg(x6, x7, x8, al), "csneg x6, x7, x8, al"); |
1297 COMPARE(csneg(x7, x8, x9, nv), "csneg x7, x8, x9, nv"); | 1308 COMPARE(csneg(x7, x8, x9, nv), "csneg x7, x8, x9, nv"); |
1298 | 1309 |
1299 CLEANUP(); | 1310 CLEANUP(); |
1300 } | 1311 } |
1301 | 1312 |
1302 | 1313 |
1303 TEST(cond_select_macro) { | 1314 TEST(cond_select_macro) { |
1304 SET_UP_CLASS(MacroAssembler); | 1315 SET_UP_MASM(); |
1305 | 1316 |
1306 COMPARE(Csel(w0, w1, -1, eq), "csinv w0, w1, wzr, eq"); | 1317 COMPARE(Csel(w0, w1, -1, eq), "csinv w0, w1, wzr, eq"); |
1307 COMPARE(Csel(w2, w3, 0, ne), "csel w2, w3, wzr, ne"); | 1318 COMPARE(Csel(w2, w3, 0, ne), "csel w2, w3, wzr, ne"); |
1308 COMPARE(Csel(w4, w5, 1, hs), "csinc w4, w5, wzr, hs"); | 1319 COMPARE(Csel(w4, w5, 1, hs), "csinc w4, w5, wzr, hs"); |
1309 COMPARE(Csel(x6, x7, -1, lo), "csinv x6, x7, xzr, lo"); | 1320 COMPARE(Csel(x6, x7, -1, lo), "csinv x6, x7, xzr, lo"); |
1310 COMPARE(Csel(x8, x9, 0, mi), "csel x8, x9, xzr, mi"); | 1321 COMPARE(Csel(x8, x9, 0, mi), "csel x8, x9, xzr, mi"); |
1311 COMPARE(Csel(x10, x11, 1, pl), "csinc x10, x11, xzr, pl"); | 1322 COMPARE(Csel(x10, x11, 1, pl), "csinc x10, x11, xzr, pl"); |
1312 | 1323 |
1313 CLEANUP(); | 1324 CLEANUP(); |
1314 } | 1325 } |
1315 | 1326 |
1316 | 1327 |
1317 TEST_(cond_cmp) { | 1328 TEST_(cond_cmp) { |
1318 SET_UP(); | 1329 SET_UP_ASM(); |
1319 | 1330 |
1320 COMPARE(ccmn(w0, w1, NZCVFlag, eq), "ccmn w0, w1, #NZCV, eq"); | 1331 COMPARE(ccmn(w0, w1, NZCVFlag, eq), "ccmn w0, w1, #NZCV, eq"); |
1321 COMPARE(ccmn(x2, x3, NZCFlag, ne), "ccmn x2, x3, #NZCv, ne"); | 1332 COMPARE(ccmn(x2, x3, NZCFlag, ne), "ccmn x2, x3, #NZCv, ne"); |
1322 COMPARE(ccmp(w4, w5, NZVFlag, hs), "ccmp w4, w5, #NZcV, hs"); | 1333 COMPARE(ccmp(w4, w5, NZVFlag, hs), "ccmp w4, w5, #NZcV, hs"); |
1323 COMPARE(ccmp(x6, x7, NZFlag, lo), "ccmp x6, x7, #NZcv, lo"); | 1334 COMPARE(ccmp(x6, x7, NZFlag, lo), "ccmp x6, x7, #NZcv, lo"); |
1324 COMPARE(ccmn(w8, 31, NFlag, mi), "ccmn w8, #31, #Nzcv, mi"); | 1335 COMPARE(ccmn(w8, 31, NFlag, mi), "ccmn w8, #31, #Nzcv, mi"); |
1325 COMPARE(ccmn(x9, 30, NCFlag, pl), "ccmn x9, #30, #NzCv, pl"); | 1336 COMPARE(ccmn(x9, 30, NCFlag, pl), "ccmn x9, #30, #NzCv, pl"); |
1326 COMPARE(ccmp(w10, 29, NVFlag, vs), "ccmp w10, #29, #NzcV, vs"); | 1337 COMPARE(ccmp(w10, 29, NVFlag, vs), "ccmp w10, #29, #NzcV, vs"); |
1327 COMPARE(ccmp(x11, 28, NFlag, vc), "ccmp x11, #28, #Nzcv, vc"); | 1338 COMPARE(ccmp(x11, 28, NFlag, vc), "ccmp x11, #28, #Nzcv, vc"); |
1328 COMPARE(ccmn(w12, w13, NoFlag, al), "ccmn w12, w13, #nzcv, al"); | 1339 COMPARE(ccmn(w12, w13, NoFlag, al), "ccmn w12, w13, #nzcv, al"); |
1329 COMPARE(ccmp(x14, 27, ZVFlag, nv), "ccmp x14, #27, #nZcV, nv"); | 1340 COMPARE(ccmp(x14, 27, ZVFlag, nv), "ccmp x14, #27, #nZcV, nv"); |
1330 | 1341 |
1331 CLEANUP(); | 1342 CLEANUP(); |
1332 } | 1343 } |
1333 | 1344 |
1334 | 1345 |
1335 TEST_(cond_cmp_macro) { | 1346 TEST_(cond_cmp_macro) { |
1336 SET_UP_CLASS(MacroAssembler); | 1347 SET_UP_MASM(); |
1337 | 1348 |
1338 COMPARE(Ccmp(w0, -1, VFlag, hi), "ccmn w0, #1, #nzcV, hi"); | 1349 COMPARE(Ccmp(w0, -1, VFlag, hi), "ccmn w0, #1, #nzcV, hi"); |
1339 COMPARE(Ccmp(x1, -31, CFlag, ge), "ccmn x1, #31, #nzCv, ge"); | 1350 COMPARE(Ccmp(x1, -31, CFlag, ge), "ccmn x1, #31, #nzCv, ge"); |
1340 COMPARE(Ccmn(w2, -1, CVFlag, gt), "ccmp w2, #1, #nzCV, gt"); | 1351 COMPARE(Ccmn(w2, -1, CVFlag, gt), "ccmp w2, #1, #nzCV, gt"); |
1341 COMPARE(Ccmn(x3, -31, ZCVFlag, ls), "ccmp x3, #31, #nZCV, ls"); | 1352 COMPARE(Ccmn(x3, -31, ZCVFlag, ls), "ccmp x3, #31, #nZCV, ls"); |
1342 | 1353 |
1343 CLEANUP(); | 1354 CLEANUP(); |
1344 } | 1355 } |
1345 | 1356 |
1346 | 1357 |
1347 TEST_(fmov_imm) { | 1358 TEST_(fmov_imm) { |
1348 SET_UP(); | 1359 SET_UP_ASM(); |
1349 | 1360 |
1350 COMPARE(fmov(s0, 1.0f), "fmov s0, #0x70 (1.0000)"); | 1361 COMPARE(fmov(s0, 1.0f), "fmov s0, #0x70 (1.0000)"); |
1351 COMPARE(fmov(s31, -13.0f), "fmov s31, #0xaa (-13.0000)"); | 1362 COMPARE(fmov(s31, -13.0f), "fmov s31, #0xaa (-13.0000)"); |
1352 COMPARE(fmov(d1, 1.0), "fmov d1, #0x70 (1.0000)"); | 1363 COMPARE(fmov(d1, 1.0), "fmov d1, #0x70 (1.0000)"); |
1353 COMPARE(fmov(d29, -13.0), "fmov d29, #0xaa (-13.0000)"); | 1364 COMPARE(fmov(d29, -13.0), "fmov d29, #0xaa (-13.0000)"); |
1354 | 1365 |
1355 CLEANUP(); | 1366 CLEANUP(); |
1356 } | 1367 } |
1357 | 1368 |
1358 | 1369 |
1359 TEST_(fmov_reg) { | 1370 TEST_(fmov_reg) { |
1360 SET_UP(); | 1371 SET_UP_ASM(); |
1361 | 1372 |
1362 COMPARE(fmov(w3, s13), "fmov w3, s13"); | 1373 COMPARE(fmov(w3, s13), "fmov w3, s13"); |
1363 COMPARE(fmov(x6, d26), "fmov x6, d26"); | 1374 COMPARE(fmov(x6, d26), "fmov x6, d26"); |
1364 COMPARE(fmov(s11, w30), "fmov s11, w30"); | 1375 COMPARE(fmov(s11, w30), "fmov s11, w30"); |
1365 COMPARE(fmov(d31, x2), "fmov d31, x2"); | 1376 COMPARE(fmov(d31, x2), "fmov d31, x2"); |
1366 COMPARE(fmov(s12, s13), "fmov s12, s13"); | 1377 COMPARE(fmov(s12, s13), "fmov s12, s13"); |
1367 COMPARE(fmov(d22, d23), "fmov d22, d23"); | 1378 COMPARE(fmov(d22, d23), "fmov d22, d23"); |
1368 | 1379 |
1369 CLEANUP(); | 1380 CLEANUP(); |
1370 } | 1381 } |
1371 | 1382 |
1372 | 1383 |
1373 TEST_(fp_dp1) { | 1384 TEST_(fp_dp1) { |
1374 SET_UP(); | 1385 SET_UP_ASM(); |
1375 | 1386 |
1376 COMPARE(fabs(s0, s1), "fabs s0, s1"); | 1387 COMPARE(fabs(s0, s1), "fabs s0, s1"); |
1377 COMPARE(fabs(s31, s30), "fabs s31, s30"); | 1388 COMPARE(fabs(s31, s30), "fabs s31, s30"); |
1378 COMPARE(fabs(d2, d3), "fabs d2, d3"); | 1389 COMPARE(fabs(d2, d3), "fabs d2, d3"); |
1379 COMPARE(fabs(d31, d30), "fabs d31, d30"); | 1390 COMPARE(fabs(d31, d30), "fabs d31, d30"); |
1380 COMPARE(fneg(s4, s5), "fneg s4, s5"); | 1391 COMPARE(fneg(s4, s5), "fneg s4, s5"); |
1381 COMPARE(fneg(s31, s30), "fneg s31, s30"); | 1392 COMPARE(fneg(s31, s30), "fneg s31, s30"); |
1382 COMPARE(fneg(d6, d7), "fneg d6, d7"); | 1393 COMPARE(fneg(d6, d7), "fneg d6, d7"); |
1383 COMPARE(fneg(d31, d30), "fneg d31, d30"); | 1394 COMPARE(fneg(d31, d30), "fneg d31, d30"); |
1384 COMPARE(fsqrt(s8, s9), "fsqrt s8, s9"); | 1395 COMPARE(fsqrt(s8, s9), "fsqrt s8, s9"); |
(...skipping 17 matching lines...) Expand all Loading... |
1402 COMPARE(frintz(d12, d13), "frintz d12, d13"); | 1413 COMPARE(frintz(d12, d13), "frintz d12, d13"); |
1403 COMPARE(frintz(d31, d30), "frintz d31, d30"); | 1414 COMPARE(frintz(d31, d30), "frintz d31, d30"); |
1404 COMPARE(fcvt(d14, s15), "fcvt d14, s15"); | 1415 COMPARE(fcvt(d14, s15), "fcvt d14, s15"); |
1405 COMPARE(fcvt(d31, s31), "fcvt d31, s31"); | 1416 COMPARE(fcvt(d31, s31), "fcvt d31, s31"); |
1406 | 1417 |
1407 CLEANUP(); | 1418 CLEANUP(); |
1408 } | 1419 } |
1409 | 1420 |
1410 | 1421 |
1411 TEST_(fp_dp2) { | 1422 TEST_(fp_dp2) { |
1412 SET_UP(); | 1423 SET_UP_ASM(); |
1413 | 1424 |
1414 COMPARE(fadd(s0, s1, s2), "fadd s0, s1, s2"); | 1425 COMPARE(fadd(s0, s1, s2), "fadd s0, s1, s2"); |
1415 COMPARE(fadd(d3, d4, d5), "fadd d3, d4, d5"); | 1426 COMPARE(fadd(d3, d4, d5), "fadd d3, d4, d5"); |
1416 COMPARE(fsub(s31, s30, s29), "fsub s31, s30, s29"); | 1427 COMPARE(fsub(s31, s30, s29), "fsub s31, s30, s29"); |
1417 COMPARE(fsub(d31, d30, d29), "fsub d31, d30, d29"); | 1428 COMPARE(fsub(d31, d30, d29), "fsub d31, d30, d29"); |
1418 COMPARE(fmul(s7, s8, s9), "fmul s7, s8, s9"); | 1429 COMPARE(fmul(s7, s8, s9), "fmul s7, s8, s9"); |
1419 COMPARE(fmul(d10, d11, d12), "fmul d10, d11, d12"); | 1430 COMPARE(fmul(d10, d11, d12), "fmul d10, d11, d12"); |
1420 COMPARE(fdiv(s13, s14, s15), "fdiv s13, s14, s15"); | 1431 COMPARE(fdiv(s13, s14, s15), "fdiv s13, s14, s15"); |
1421 COMPARE(fdiv(d16, d17, d18), "fdiv d16, d17, d18"); | 1432 COMPARE(fdiv(d16, d17, d18), "fdiv d16, d17, d18"); |
1422 COMPARE(fmax(s19, s20, s21), "fmax s19, s20, s21"); | 1433 COMPARE(fmax(s19, s20, s21), "fmax s19, s20, s21"); |
1423 COMPARE(fmax(d22, d23, d24), "fmax d22, d23, d24"); | 1434 COMPARE(fmax(d22, d23, d24), "fmax d22, d23, d24"); |
1424 COMPARE(fmin(s25, s26, s27), "fmin s25, s26, s27"); | 1435 COMPARE(fmin(s25, s26, s27), "fmin s25, s26, s27"); |
1425 COMPARE(fmin(d28, d29, d30), "fmin d28, d29, d30"); | 1436 COMPARE(fmin(d28, d29, d30), "fmin d28, d29, d30"); |
1426 COMPARE(fmaxnm(s31, s0, s1), "fmaxnm s31, s0, s1"); | 1437 COMPARE(fmaxnm(s31, s0, s1), "fmaxnm s31, s0, s1"); |
1427 COMPARE(fmaxnm(d2, d3, d4), "fmaxnm d2, d3, d4"); | 1438 COMPARE(fmaxnm(d2, d3, d4), "fmaxnm d2, d3, d4"); |
1428 COMPARE(fminnm(s5, s6, s7), "fminnm s5, s6, s7"); | 1439 COMPARE(fminnm(s5, s6, s7), "fminnm s5, s6, s7"); |
1429 COMPARE(fminnm(d8, d9, d10), "fminnm d8, d9, d10"); | 1440 COMPARE(fminnm(d8, d9, d10), "fminnm d8, d9, d10"); |
1430 | 1441 |
1431 CLEANUP(); | 1442 CLEANUP(); |
1432 } | 1443 } |
1433 | 1444 |
1434 | 1445 |
1435 TEST(fp_dp3) { | 1446 TEST(fp_dp3) { |
1436 SET_UP(); | 1447 SET_UP_ASM(); |
1437 | 1448 |
1438 COMPARE(fmadd(s7, s8, s9, s10), "fmadd s7, s8, s9, s10"); | 1449 COMPARE(fmadd(s7, s8, s9, s10), "fmadd s7, s8, s9, s10"); |
1439 COMPARE(fmadd(d10, d11, d12, d10), "fmadd d10, d11, d12, d10"); | 1450 COMPARE(fmadd(d10, d11, d12, d10), "fmadd d10, d11, d12, d10"); |
1440 COMPARE(fmsub(s7, s8, s9, s10), "fmsub s7, s8, s9, s10"); | 1451 COMPARE(fmsub(s7, s8, s9, s10), "fmsub s7, s8, s9, s10"); |
1441 COMPARE(fmsub(d10, d11, d12, d10), "fmsub d10, d11, d12, d10"); | 1452 COMPARE(fmsub(d10, d11, d12, d10), "fmsub d10, d11, d12, d10"); |
1442 | 1453 |
1443 COMPARE(fnmadd(s7, s8, s9, s10), "fnmadd s7, s8, s9, s10"); | 1454 COMPARE(fnmadd(s7, s8, s9, s10), "fnmadd s7, s8, s9, s10"); |
1444 COMPARE(fnmadd(d10, d11, d12, d10), "fnmadd d10, d11, d12, d10"); | 1455 COMPARE(fnmadd(d10, d11, d12, d10), "fnmadd d10, d11, d12, d10"); |
1445 COMPARE(fnmsub(s7, s8, s9, s10), "fnmsub s7, s8, s9, s10"); | 1456 COMPARE(fnmsub(s7, s8, s9, s10), "fnmsub s7, s8, s9, s10"); |
1446 COMPARE(fnmsub(d10, d11, d12, d10), "fnmsub d10, d11, d12, d10"); | 1457 COMPARE(fnmsub(d10, d11, d12, d10), "fnmsub d10, d11, d12, d10"); |
1447 | 1458 |
1448 CLEANUP(); | 1459 CLEANUP(); |
1449 } | 1460 } |
1450 | 1461 |
1451 | 1462 |
1452 TEST_(fp_compare) { | 1463 TEST_(fp_compare) { |
1453 SET_UP(); | 1464 SET_UP_ASM(); |
1454 | 1465 |
1455 COMPARE(fcmp(s0, s1), "fcmp s0, s1"); | 1466 COMPARE(fcmp(s0, s1), "fcmp s0, s1"); |
1456 COMPARE(fcmp(s31, s30), "fcmp s31, s30"); | 1467 COMPARE(fcmp(s31, s30), "fcmp s31, s30"); |
1457 COMPARE(fcmp(d0, d1), "fcmp d0, d1"); | 1468 COMPARE(fcmp(d0, d1), "fcmp d0, d1"); |
1458 COMPARE(fcmp(d31, d30), "fcmp d31, d30"); | 1469 COMPARE(fcmp(d31, d30), "fcmp d31, d30"); |
1459 COMPARE(fcmp(s12, 0), "fcmp s12, #0.0"); | 1470 COMPARE(fcmp(s12, 0), "fcmp s12, #0.0"); |
1460 COMPARE(fcmp(d12, 0), "fcmp d12, #0.0"); | 1471 COMPARE(fcmp(d12, 0), "fcmp d12, #0.0"); |
1461 | 1472 |
1462 CLEANUP(); | 1473 CLEANUP(); |
1463 } | 1474 } |
1464 | 1475 |
1465 | 1476 |
1466 TEST_(fp_cond_compare) { | 1477 TEST_(fp_cond_compare) { |
1467 SET_UP(); | 1478 SET_UP_ASM(); |
1468 | 1479 |
1469 COMPARE(fccmp(s0, s1, NoFlag, eq), "fccmp s0, s1, #nzcv, eq"); | 1480 COMPARE(fccmp(s0, s1, NoFlag, eq), "fccmp s0, s1, #nzcv, eq"); |
1470 COMPARE(fccmp(s2, s3, ZVFlag, ne), "fccmp s2, s3, #nZcV, ne"); | 1481 COMPARE(fccmp(s2, s3, ZVFlag, ne), "fccmp s2, s3, #nZcV, ne"); |
1471 COMPARE(fccmp(s30, s16, NCFlag, pl), "fccmp s30, s16, #NzCv, pl"); | 1482 COMPARE(fccmp(s30, s16, NCFlag, pl), "fccmp s30, s16, #NzCv, pl"); |
1472 COMPARE(fccmp(s31, s31, NZCVFlag, le), "fccmp s31, s31, #NZCV, le"); | 1483 COMPARE(fccmp(s31, s31, NZCVFlag, le), "fccmp s31, s31, #NZCV, le"); |
1473 COMPARE(fccmp(d4, d5, VFlag, gt), "fccmp d4, d5, #nzcV, gt"); | 1484 COMPARE(fccmp(d4, d5, VFlag, gt), "fccmp d4, d5, #nzcV, gt"); |
1474 COMPARE(fccmp(d6, d7, NFlag, vs), "fccmp d6, d7, #Nzcv, vs"); | 1485 COMPARE(fccmp(d6, d7, NFlag, vs), "fccmp d6, d7, #Nzcv, vs"); |
1475 COMPARE(fccmp(d30, d0, NZFlag, vc), "fccmp d30, d0, #NZcv, vc"); | 1486 COMPARE(fccmp(d30, d0, NZFlag, vc), "fccmp d30, d0, #NZcv, vc"); |
1476 COMPARE(fccmp(d31, d31, ZFlag, hs), "fccmp d31, d31, #nZcv, hs"); | 1487 COMPARE(fccmp(d31, d31, ZFlag, hs), "fccmp d31, d31, #nZcv, hs"); |
1477 COMPARE(fccmp(s14, s15, CVFlag, al), "fccmp s14, s15, #nzCV, al"); | 1488 COMPARE(fccmp(s14, s15, CVFlag, al), "fccmp s14, s15, #nzCV, al"); |
1478 COMPARE(fccmp(d16, d17, CFlag, nv), "fccmp d16, d17, #nzCv, nv"); | 1489 COMPARE(fccmp(d16, d17, CFlag, nv), "fccmp d16, d17, #nzCv, nv"); |
1479 | 1490 |
1480 CLEANUP(); | 1491 CLEANUP(); |
1481 } | 1492 } |
1482 | 1493 |
1483 | 1494 |
1484 TEST_(fp_select) { | 1495 TEST_(fp_select) { |
1485 SET_UP(); | 1496 SET_UP_ASM(); |
1486 | 1497 |
1487 COMPARE(fcsel(s0, s1, s2, eq), "fcsel s0, s1, s2, eq") | 1498 COMPARE(fcsel(s0, s1, s2, eq), "fcsel s0, s1, s2, eq") |
1488 COMPARE(fcsel(s31, s31, s30, ne), "fcsel s31, s31, s30, ne"); | 1499 COMPARE(fcsel(s31, s31, s30, ne), "fcsel s31, s31, s30, ne"); |
1489 COMPARE(fcsel(d0, d1, d2, mi), "fcsel d0, d1, d2, mi"); | 1500 COMPARE(fcsel(d0, d1, d2, mi), "fcsel d0, d1, d2, mi"); |
1490 COMPARE(fcsel(d31, d30, d31, pl), "fcsel d31, d30, d31, pl"); | 1501 COMPARE(fcsel(d31, d30, d31, pl), "fcsel d31, d30, d31, pl"); |
1491 COMPARE(fcsel(s14, s15, s16, al), "fcsel s14, s15, s16, al"); | 1502 COMPARE(fcsel(s14, s15, s16, al), "fcsel s14, s15, s16, al"); |
1492 COMPARE(fcsel(d17, d18, d19, nv), "fcsel d17, d18, d19, nv"); | 1503 COMPARE(fcsel(d17, d18, d19, nv), "fcsel d17, d18, d19, nv"); |
1493 | 1504 |
1494 CLEANUP(); | 1505 CLEANUP(); |
1495 } | 1506 } |
1496 | 1507 |
1497 | 1508 |
1498 TEST_(fcvt_scvtf_ucvtf) { | 1509 TEST_(fcvt_scvtf_ucvtf) { |
1499 SET_UP(); | 1510 SET_UP_ASM(); |
1500 | 1511 |
1501 COMPARE(fcvtas(w0, s1), "fcvtas w0, s1"); | 1512 COMPARE(fcvtas(w0, s1), "fcvtas w0, s1"); |
1502 COMPARE(fcvtas(x2, s3), "fcvtas x2, s3"); | 1513 COMPARE(fcvtas(x2, s3), "fcvtas x2, s3"); |
1503 COMPARE(fcvtas(w4, d5), "fcvtas w4, d5"); | 1514 COMPARE(fcvtas(w4, d5), "fcvtas w4, d5"); |
1504 COMPARE(fcvtas(x6, d7), "fcvtas x6, d7"); | 1515 COMPARE(fcvtas(x6, d7), "fcvtas x6, d7"); |
1505 COMPARE(fcvtau(w8, s9), "fcvtau w8, s9"); | 1516 COMPARE(fcvtau(w8, s9), "fcvtau w8, s9"); |
1506 COMPARE(fcvtau(x10, s11), "fcvtau x10, s11"); | 1517 COMPARE(fcvtau(x10, s11), "fcvtau x10, s11"); |
1507 COMPARE(fcvtau(w12, d13), "fcvtau w12, d13"); | 1518 COMPARE(fcvtau(w12, d13), "fcvtau w12, d13"); |
1508 COMPARE(fcvtau(x14, d15), "fcvtau x14, d15"); | 1519 COMPARE(fcvtau(x14, d15), "fcvtau x14, d15"); |
1509 COMPARE(fcvtns(w0, s1), "fcvtns w0, s1"); | 1520 COMPARE(fcvtns(w0, s1), "fcvtns w0, s1"); |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1551 COMPARE(fcvtmu(w8, s9), "fcvtmu w8, s9"); | 1562 COMPARE(fcvtmu(w8, s9), "fcvtmu w8, s9"); |
1552 COMPARE(fcvtmu(x10, s11), "fcvtmu x10, s11"); | 1563 COMPARE(fcvtmu(x10, s11), "fcvtmu x10, s11"); |
1553 COMPARE(fcvtmu(w12, d13), "fcvtmu w12, d13"); | 1564 COMPARE(fcvtmu(w12, d13), "fcvtmu w12, d13"); |
1554 COMPARE(fcvtmu(x14, d15), "fcvtmu x14, d15"); | 1565 COMPARE(fcvtmu(x14, d15), "fcvtmu x14, d15"); |
1555 | 1566 |
1556 CLEANUP(); | 1567 CLEANUP(); |
1557 } | 1568 } |
1558 | 1569 |
1559 | 1570 |
1560 TEST_(system_mrs) { | 1571 TEST_(system_mrs) { |
1561 SET_UP(); | 1572 SET_UP_ASM(); |
1562 | 1573 |
1563 COMPARE(mrs(x0, NZCV), "mrs x0, nzcv"); | 1574 COMPARE(mrs(x0, NZCV), "mrs x0, nzcv"); |
1564 COMPARE(mrs(lr, NZCV), "mrs lr, nzcv"); | 1575 COMPARE(mrs(lr, NZCV), "mrs lr, nzcv"); |
1565 COMPARE(mrs(x15, FPCR), "mrs x15, fpcr"); | 1576 COMPARE(mrs(x15, FPCR), "mrs x15, fpcr"); |
1566 | 1577 |
1567 CLEANUP(); | 1578 CLEANUP(); |
1568 } | 1579 } |
1569 | 1580 |
1570 | 1581 |
1571 TEST_(system_msr) { | 1582 TEST_(system_msr) { |
1572 SET_UP(); | 1583 SET_UP_ASM(); |
1573 | 1584 |
1574 COMPARE(msr(NZCV, x0), "msr nzcv, x0"); | 1585 COMPARE(msr(NZCV, x0), "msr nzcv, x0"); |
1575 COMPARE(msr(NZCV, x30), "msr nzcv, lr"); | 1586 COMPARE(msr(NZCV, x30), "msr nzcv, lr"); |
1576 COMPARE(msr(FPCR, x15), "msr fpcr, x15"); | 1587 COMPARE(msr(FPCR, x15), "msr fpcr, x15"); |
1577 | 1588 |
1578 CLEANUP(); | 1589 CLEANUP(); |
1579 } | 1590 } |
1580 | 1591 |
1581 | 1592 |
1582 TEST_(system_nop) { | 1593 TEST_(system_nop) { |
1583 SET_UP(); | 1594 SET_UP_ASM(); |
1584 | 1595 |
1585 COMPARE(nop(), "nop"); | 1596 COMPARE(nop(), "nop"); |
1586 | 1597 |
1587 CLEANUP(); | 1598 CLEANUP(); |
1588 } | 1599 } |
1589 | 1600 |
1590 | 1601 |
1591 TEST_(debug) { | 1602 TEST_(debug) { |
1592 SET_UP(); | 1603 SET_UP_ASM(); |
1593 | 1604 |
1594 DCHECK(kImmExceptionIsDebug == 0xdeb0); | 1605 DCHECK(kImmExceptionIsDebug == 0xdeb0); |
1595 | 1606 |
1596 // All debug codes should produce the same instruction, and the debug code | 1607 // All debug codes should produce the same instruction, and the debug code |
1597 // can be any uint32_t. | 1608 // can be any uint32_t. |
1598 COMPARE(debug("message", 0, BREAK), "hlt #0xdeb0"); | 1609 COMPARE(debug("message", 0, BREAK), "hlt #0xdeb0"); |
1599 COMPARE(debug("message", 1, BREAK), "hlt #0xdeb0"); | 1610 COMPARE(debug("message", 1, BREAK), "hlt #0xdeb0"); |
1600 COMPARE(debug("message", 0xffff, BREAK), "hlt #0xdeb0"); | 1611 COMPARE(debug("message", 0xffff, BREAK), "hlt #0xdeb0"); |
1601 COMPARE(debug("message", 0x10000, BREAK), "hlt #0xdeb0"); | 1612 COMPARE(debug("message", 0x10000, BREAK), "hlt #0xdeb0"); |
1602 COMPARE(debug("message", 0x7fffffff, BREAK), "hlt #0xdeb0"); | 1613 COMPARE(debug("message", 0x7fffffff, BREAK), "hlt #0xdeb0"); |
1603 COMPARE(debug("message", 0x80000000u, BREAK), "hlt #0xdeb0"); | 1614 COMPARE(debug("message", 0x80000000u, BREAK), "hlt #0xdeb0"); |
1604 COMPARE(debug("message", 0xffffffffu, BREAK), "hlt #0xdeb0"); | 1615 COMPARE(debug("message", 0xffffffffu, BREAK), "hlt #0xdeb0"); |
1605 | 1616 |
1606 CLEANUP(); | 1617 CLEANUP(); |
1607 } | 1618 } |
1608 | 1619 |
1609 | 1620 |
1610 TEST_(hlt) { | 1621 TEST_(hlt) { |
1611 SET_UP(); | 1622 SET_UP_ASM(); |
1612 | 1623 |
1613 COMPARE(hlt(0), "hlt #0x0"); | 1624 COMPARE(hlt(0), "hlt #0x0"); |
1614 COMPARE(hlt(1), "hlt #0x1"); | 1625 COMPARE(hlt(1), "hlt #0x1"); |
1615 COMPARE(hlt(65535), "hlt #0xffff"); | 1626 COMPARE(hlt(65535), "hlt #0xffff"); |
1616 | 1627 |
1617 CLEANUP(); | 1628 CLEANUP(); |
1618 } | 1629 } |
1619 | 1630 |
1620 | 1631 |
1621 TEST_(brk) { | 1632 TEST_(brk) { |
1622 SET_UP(); | 1633 SET_UP_ASM(); |
1623 | 1634 |
1624 COMPARE(brk(0), "brk #0x0"); | 1635 COMPARE(brk(0), "brk #0x0"); |
1625 COMPARE(brk(1), "brk #0x1"); | 1636 COMPARE(brk(1), "brk #0x1"); |
1626 COMPARE(brk(65535), "brk #0xffff"); | 1637 COMPARE(brk(65535), "brk #0xffff"); |
1627 | 1638 |
1628 CLEANUP(); | 1639 CLEANUP(); |
1629 } | 1640 } |
1630 | 1641 |
1631 | 1642 |
1632 TEST_(add_sub_negative) { | 1643 TEST_(add_sub_negative) { |
1633 SET_UP_CLASS(MacroAssembler); | 1644 SET_UP_MASM(); |
1634 | 1645 |
1635 COMPARE(Add(x10, x0, -42), "sub x10, x0, #0x2a (42)"); | 1646 COMPARE(Add(x10, x0, -42), "sub x10, x0, #0x2a (42)"); |
1636 COMPARE(Add(x11, x1, -687), "sub x11, x1, #0x2af (687)"); | 1647 COMPARE(Add(x11, x1, -687), "sub x11, x1, #0x2af (687)"); |
1637 COMPARE(Add(x12, x2, -0x88), "sub x12, x2, #0x88 (136)"); | 1648 COMPARE(Add(x12, x2, -0x88), "sub x12, x2, #0x88 (136)"); |
1638 | 1649 |
1639 COMPARE(Sub(x13, x0, -600), "add x13, x0, #0x258 (600)"); | 1650 COMPARE(Sub(x13, x0, -600), "add x13, x0, #0x258 (600)"); |
1640 COMPARE(Sub(x14, x1, -313), "add x14, x1, #0x139 (313)"); | 1651 COMPARE(Sub(x14, x1, -313), "add x14, x1, #0x139 (313)"); |
1641 COMPARE(Sub(x15, x2, -0x555), "add x15, x2, #0x555 (1365)"); | 1652 COMPARE(Sub(x15, x2, -0x555), "add x15, x2, #0x555 (1365)"); |
1642 | 1653 |
1643 COMPARE(Add(w19, w3, -0x344), "sub w19, w3, #0x344 (836)"); | 1654 COMPARE(Add(w19, w3, -0x344), "sub w19, w3, #0x344 (836)"); |
(...skipping 10 matching lines...) Expand all Loading... |
1654 COMPARE(Cmn(w0, -1), "cmp w0, #0x1 (1)"); | 1665 COMPARE(Cmn(w0, -1), "cmp w0, #0x1 (1)"); |
1655 COMPARE(Cmn(x1, -1), "cmp x1, #0x1 (1)"); | 1666 COMPARE(Cmn(x1, -1), "cmp x1, #0x1 (1)"); |
1656 COMPARE(Cmn(w2, -4095), "cmp w2, #0xfff (4095)"); | 1667 COMPARE(Cmn(w2, -4095), "cmp w2, #0xfff (4095)"); |
1657 COMPARE(Cmn(x3, -4095), "cmp x3, #0xfff (4095)"); | 1668 COMPARE(Cmn(x3, -4095), "cmp x3, #0xfff (4095)"); |
1658 | 1669 |
1659 CLEANUP(); | 1670 CLEANUP(); |
1660 } | 1671 } |
1661 | 1672 |
1662 | 1673 |
1663 TEST_(logical_immediate_move) { | 1674 TEST_(logical_immediate_move) { |
1664 SET_UP_CLASS(MacroAssembler); | 1675 SET_UP_MASM(); |
1665 | 1676 |
1666 COMPARE(And(w0, w1, 0), "movz w0, #0x0"); | 1677 COMPARE(And(w0, w1, 0), "movz w0, #0x0"); |
1667 COMPARE(And(x0, x1, 0), "movz x0, #0x0"); | 1678 COMPARE(And(x0, x1, 0), "movz x0, #0x0"); |
1668 COMPARE(Orr(w2, w3, 0), "mov w2, w3"); | 1679 COMPARE(Orr(w2, w3, 0), "mov w2, w3"); |
1669 COMPARE(Orr(x2, x3, 0), "mov x2, x3"); | 1680 COMPARE(Orr(x2, x3, 0), "mov x2, x3"); |
1670 COMPARE(Eor(w4, w5, 0), "mov w4, w5"); | 1681 COMPARE(Eor(w4, w5, 0), "mov w4, w5"); |
1671 COMPARE(Eor(x4, x5, 0), "mov x4, x5"); | 1682 COMPARE(Eor(x4, x5, 0), "mov x4, x5"); |
1672 COMPARE(Bic(w6, w7, 0), "mov w6, w7"); | 1683 COMPARE(Bic(w6, w7, 0), "mov w6, w7"); |
1673 COMPARE(Bic(x6, x7, 0), "mov x6, x7"); | 1684 COMPARE(Bic(x6, x7, 0), "mov x6, x7"); |
1674 COMPARE(Orn(w8, w9, 0), "movn w8, #0x0"); | 1685 COMPARE(Orn(w8, w9, 0), "movn w8, #0x0"); |
(...skipping 18 matching lines...) Expand all Loading... |
1693 COMPARE(Orn(x20, x21, 0xffffffffffffffff), "mov x20, x21"); | 1704 COMPARE(Orn(x20, x21, 0xffffffffffffffff), "mov x20, x21"); |
1694 COMPARE(Eon(w22, w23, 0xffffffff), "mov w22, w23"); | 1705 COMPARE(Eon(w22, w23, 0xffffffff), "mov w22, w23"); |
1695 COMPARE(Eon(x22, x23, 0xffffffff), "eor x22, x23, #0xffffffff00000000"); | 1706 COMPARE(Eon(x22, x23, 0xffffffff), "eor x22, x23, #0xffffffff00000000"); |
1696 COMPARE(Eon(x22, x23, 0xffffffffffffffff), "mov x22, x23"); | 1707 COMPARE(Eon(x22, x23, 0xffffffffffffffff), "mov x22, x23"); |
1697 | 1708 |
1698 CLEANUP(); | 1709 CLEANUP(); |
1699 } | 1710 } |
1700 | 1711 |
1701 | 1712 |
1702 TEST_(barriers) { | 1713 TEST_(barriers) { |
1703 SET_UP_CLASS(MacroAssembler); | 1714 SET_UP_MASM(); |
1704 | 1715 |
1705 // DMB | 1716 // DMB |
1706 COMPARE(Dmb(FullSystem, BarrierAll), "dmb sy"); | 1717 COMPARE(Dmb(FullSystem, BarrierAll), "dmb sy"); |
1707 COMPARE(Dmb(FullSystem, BarrierReads), "dmb ld"); | 1718 COMPARE(Dmb(FullSystem, BarrierReads), "dmb ld"); |
1708 COMPARE(Dmb(FullSystem, BarrierWrites), "dmb st"); | 1719 COMPARE(Dmb(FullSystem, BarrierWrites), "dmb st"); |
1709 | 1720 |
1710 COMPARE(Dmb(InnerShareable, BarrierAll), "dmb ish"); | 1721 COMPARE(Dmb(InnerShareable, BarrierAll), "dmb ish"); |
1711 COMPARE(Dmb(InnerShareable, BarrierReads), "dmb ishld"); | 1722 COMPARE(Dmb(InnerShareable, BarrierReads), "dmb ishld"); |
1712 COMPARE(Dmb(InnerShareable, BarrierWrites), "dmb ishst"); | 1723 COMPARE(Dmb(InnerShareable, BarrierWrites), "dmb ishst"); |
1713 | 1724 |
(...skipping 30 matching lines...) Expand all Loading... |
1744 COMPARE(Dsb(FullSystem, BarrierOther), "dsb sy (0b1100)"); | 1755 COMPARE(Dsb(FullSystem, BarrierOther), "dsb sy (0b1100)"); |
1745 COMPARE(Dsb(InnerShareable, BarrierOther), "dsb sy (0b1000)"); | 1756 COMPARE(Dsb(InnerShareable, BarrierOther), "dsb sy (0b1000)"); |
1746 COMPARE(Dsb(NonShareable, BarrierOther), "dsb sy (0b0100)"); | 1757 COMPARE(Dsb(NonShareable, BarrierOther), "dsb sy (0b0100)"); |
1747 COMPARE(Dsb(OuterShareable, BarrierOther), "dsb sy (0b0000)"); | 1758 COMPARE(Dsb(OuterShareable, BarrierOther), "dsb sy (0b0000)"); |
1748 | 1759 |
1749 // ISB | 1760 // ISB |
1750 COMPARE(Isb(), "isb"); | 1761 COMPARE(Isb(), "isb"); |
1751 | 1762 |
1752 CLEANUP(); | 1763 CLEANUP(); |
1753 } | 1764 } |
OLD | NEW |