095c63679c5ba893c319100db87c54bb53ff4c9f
[platform/upstream/nodejs.git] / deps / v8 / test / cctest / test-disasm-arm.cc
1 // Copyright 2011 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are
4 // met:
5 //
6 //     * Redistributions of source code must retain the above copyright
7 //       notice, this list of conditions and the following disclaimer.
8 //     * Redistributions in binary form must reproduce the above
9 //       copyright notice, this list of conditions and the following
10 //       disclaimer in the documentation and/or other materials provided
11 //       with the distribution.
12 //     * Neither the name of Google Inc. nor the names of its
13 //       contributors may be used to endorse or promote products derived
14 //       from this software without specific prior written permission.
15 //
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 //
28
29 #include <stdlib.h>
30
31 #include "src/v8.h"
32
33 #include "src/debug.h"
34 #include "src/disasm.h"
35 #include "src/disassembler.h"
36 #include "src/macro-assembler.h"
37 #include "src/serialize.h"
38 #include "test/cctest/cctest.h"
39
40 using namespace v8::internal;
41
42
43 bool DisassembleAndCompare(byte* pc, const char* compare_string) {
44   disasm::NameConverter converter;
45   disasm::Disassembler disasm(converter);
46   EmbeddedVector<char, 128> disasm_buffer;
47
48   disasm.InstructionDecode(disasm_buffer, pc);
49
50   if (strcmp(compare_string, disasm_buffer.start()) != 0) {
51     fprintf(stderr,
52             "expected: \n"
53             "%s\n"
54             "disassembled: \n"
55             "%s\n\n",
56             compare_string, disasm_buffer.start());
57     return false;
58   }
59   return true;
60 }
61
62
63 // Set up V8 to a state where we can at least run the assembler and
64 // disassembler. Declare the variables and allocate the data structures used
65 // in the rest of the macros.
66 #define SET_UP()                                          \
67   CcTest::InitializeVM();                                 \
68   Isolate* isolate = CcTest::i_isolate();                  \
69   HandleScope scope(isolate);                             \
70   byte *buffer = reinterpret_cast<byte*>(malloc(4*1024)); \
71   Assembler assm(isolate, buffer, 4*1024);                \
72   bool failure = false;
73
74
75 // This macro assembles one instruction using the preallocated assembler and
76 // disassembles the generated instruction, comparing the output to the expected
77 // value. If the comparison fails an error message is printed, but the test
78 // continues to run until the end.
79 #define COMPARE(asm_, compare_string) \
80   { \
81     int pc_offset = assm.pc_offset(); \
82     byte *progcounter = &buffer[pc_offset]; \
83     assm.asm_; \
84     if (!DisassembleAndCompare(progcounter, compare_string)) failure = true; \
85   }
86
87 // Force emission of any pending literals into a pool.
88 #define EMIT_PENDING_LITERALS() \
89   assm.CheckConstPool(true, false)
90
91
92 // Verify that all invocations of the COMPARE macro passed successfully.
93 // Exit with a failure if at least one of the tests failed.
94 #define VERIFY_RUN() \
95 if (failure) { \
96     V8_Fatal(__FILE__, __LINE__, "ARM Disassembler tests failed.\n"); \
97   }
98
99
100 TEST(Type0) {
101   SET_UP();
102
103   COMPARE(and_(r0, r1, Operand(r2)),
104           "e0010002       and r0, r1, r2");
105   COMPARE(and_(r1, r2, Operand(r3), LeaveCC),
106           "e0021003       and r1, r2, r3");
107   COMPARE(and_(r2, r3, Operand(r4), SetCC),
108           "e0132004       ands r2, r3, r4");
109   COMPARE(and_(r3, r4, Operand(r5), LeaveCC, eq),
110           "00043005       andeq r3, r4, r5");
111
112   COMPARE(eor(r4, r5, Operand(r6, LSL, 0)),
113           "e0254006       eor r4, r5, r6");
114   COMPARE(eor(r4, r5, Operand(r7, LSL, 1), SetCC),
115           "e0354087       eors r4, r5, r7, lsl #1");
116   COMPARE(eor(r4, r5, Operand(r8, LSL, 2), LeaveCC, ne),
117           "10254108       eorne r4, r5, r8, lsl #2");
118   COMPARE(eor(r4, r5, Operand(r9, LSL, 3), SetCC, cs),
119           "20354189       eorcss r4, r5, r9, lsl #3");
120
121   COMPARE(sub(r5, r6, Operand(r10, LSL, 31), LeaveCC, hs),
122           "20465f8a       subcs r5, r6, r10, lsl #31");
123   COMPARE(sub(r5, r6, Operand(r10, LSL, 30), SetCC, cc),
124           "30565f0a       subccs r5, r6, r10, lsl #30");
125   COMPARE(sub(r5, r6, Operand(r10, LSL, 24), LeaveCC, lo),
126           "30465c0a       subcc r5, r6, r10, lsl #24");
127   COMPARE(sub(r5, r6, Operand(r10, LSL, 16), SetCC, mi),
128           "4056580a       submis r5, r6, r10, lsl #16");
129
130   COMPARE(rsb(r6, r7, Operand(fp)),
131           "e067600b       rsb r6, r7, fp");
132   COMPARE(rsb(r6, r7, Operand(fp, LSR, 1)),
133           "e06760ab       rsb r6, r7, fp, lsr #1");
134   COMPARE(rsb(r6, r7, Operand(fp, LSR, 0), SetCC),
135           "e077602b       rsbs r6, r7, fp, lsr #32");
136   COMPARE(rsb(r6, r7, Operand(fp, LSR, 31), LeaveCC, pl),
137           "50676fab       rsbpl r6, r7, fp, lsr #31");
138
139   COMPARE(add(r7, r8, Operand(ip, ASR, 1)),
140           "e08870cc       add r7, r8, ip, asr #1");
141   COMPARE(add(r7, r8, Operand(ip, ASR, 0)),
142           "e088704c       add r7, r8, ip, asr #32");
143   COMPARE(add(r7, r8, Operand(ip), SetCC),
144           "e098700c       adds r7, r8, ip");
145   COMPARE(add(r7, r8, Operand(ip, ASR, 31), SetCC, vs),
146           "60987fcc       addvss r7, r8, ip, asr #31");
147
148   COMPARE(adc(r7, fp, Operand(ip, ASR, 5)),
149           "e0ab72cc       adc r7, fp, ip, asr #5");
150   COMPARE(adc(r4, ip, Operand(ip, ASR, 1), LeaveCC, vc),
151           "70ac40cc       adcvc r4, ip, ip, asr #1");
152   COMPARE(adc(r5, sp, Operand(ip), SetCC),
153           "e0bd500c       adcs r5, sp, ip");
154   COMPARE(adc(r8, lr, Operand(ip, ASR, 31), SetCC, vc),
155           "70be8fcc       adcvcs r8, lr, ip, asr #31");
156
157   COMPARE(sbc(r7, r1, Operand(ip, ROR, 1), LeaveCC, hi),
158           "80c170ec       sbchi r7, r1, ip, ror #1");
159   COMPARE(sbc(r7, r9, Operand(ip, ROR, 4)),
160           "e0c9726c       sbc r7, r9, ip, ror #4");
161   COMPARE(sbc(r7, r10, Operand(ip), SetCC),
162           "e0da700c       sbcs r7, r10, ip");
163   COMPARE(sbc(r7, ip, Operand(ip, ROR, 31), SetCC, hi),
164           "80dc7fec       sbchis r7, ip, ip, ror #31");
165
166   COMPARE(rsc(r7, r8, Operand(ip, LSL, r0)),
167           "e0e8701c       rsc r7, r8, ip, lsl r0");
168   COMPARE(rsc(r7, r8, Operand(ip, LSL, r1)),
169           "e0e8711c       rsc r7, r8, ip, lsl r1");
170   COMPARE(rsc(r7, r8, Operand(ip), SetCC),
171           "e0f8700c       rscs r7, r8, ip");
172   COMPARE(rsc(r7, r8, Operand(ip, LSL, r3), SetCC, ls),
173           "90f8731c       rsclss r7, r8, ip, lsl r3");
174
175   COMPARE(tst(r7, Operand(r5, ASR, ip), ge),
176           "a1170c55       tstge r7, r5, asr ip");
177   COMPARE(tst(r7, Operand(r6, ASR, sp)),
178           "e1170d56       tst r7, r6, asr sp");
179   COMPARE(tst(r7, Operand(r7), ge),
180           "a1170007       tstge r7, r7");
181   COMPARE(tst(r7, Operand(r8, ASR, fp), ge),
182           "a1170b58       tstge r7, r8, asr fp");
183
184   COMPARE(teq(r7, Operand(r5, ROR, r0), lt),
185           "b1370075       teqlt r7, r5, ror r0");
186   COMPARE(teq(r7, Operand(r6, ROR, lr)),
187           "e1370e76       teq r7, r6, ror lr");
188   COMPARE(teq(r7, Operand(r7), lt),
189           "b1370007       teqlt r7, r7");
190   COMPARE(teq(r7, Operand(r8, ROR, r1)),
191           "e1370178       teq r7, r8, ror r1");
192
193   COMPARE(cmp(r7, Operand(r4)),
194           "e1570004       cmp r7, r4");
195   COMPARE(cmp(r7, Operand(r6, LSL, 1), gt),
196           "c1570086       cmpgt r7, r6, lsl #1");
197   COMPARE(cmp(r7, Operand(r8, LSR, 3), gt),
198           "c15701a8       cmpgt r7, r8, lsr #3");
199   COMPARE(cmp(r7, Operand(r8, ASR, 19)),
200           "e15709c8       cmp r7, r8, asr #19");
201
202   COMPARE(cmn(r0, Operand(r4)),
203           "e1700004       cmn r0, r4");
204   COMPARE(cmn(r1, Operand(r6, ROR, 1)),
205           "e17100e6       cmn r1, r6, ror #1");
206   COMPARE(cmn(r2, Operand(r8)),
207           "e1720008       cmn r2, r8");
208   COMPARE(cmn(r3, Operand(fp), le),
209           "d173000b       cmnle r3, fp");
210
211   COMPARE(orr(r7, r8, Operand(lr), LeaveCC, al),
212           "e188700e       orr r7, r8, lr");
213   COMPARE(orr(r7, r8, Operand(fp)),
214           "e188700b       orr r7, r8, fp");
215   COMPARE(orr(r7, r8, Operand(sp), SetCC),
216           "e198700d       orrs r7, r8, sp");
217   COMPARE(orr(r7, r8, Operand(ip), SetCC, al),
218           "e198700c       orrs r7, r8, ip");
219
220   COMPARE(mov(r0, Operand(r1), LeaveCC, eq),
221           "01a00001       moveq r0, r1");
222   COMPARE(mov(r0, Operand(r2)),
223           "e1a00002       mov r0, r2");
224   COMPARE(mov(r0, Operand(r3), SetCC),
225           "e1b00003       movs r0, r3");
226   COMPARE(mov(r0, Operand(r4), SetCC, pl),
227           "51b00004       movpls r0, r4");
228
229   COMPARE(bic(r0, lr, Operand(r1), LeaveCC, vs),
230           "61ce0001       bicvs r0, lr, r1");
231   COMPARE(bic(r0, r9, Operand(r2), LeaveCC, vc),
232           "71c90002       bicvc r0, r9, r2");
233   COMPARE(bic(r0, r5, Operand(r3), SetCC),
234           "e1d50003       bics r0, r5, r3");
235   COMPARE(bic(r0, r1, Operand(r4), SetCC, pl),
236           "51d10004       bicpls r0, r1, r4");
237
238   COMPARE(mvn(r10, Operand(r1)),
239           "e1e0a001       mvn r10, r1");
240   COMPARE(mvn(r9, Operand(r2)),
241           "e1e09002       mvn r9, r2");
242   COMPARE(mvn(r0, Operand(r3), SetCC),
243           "e1f00003       mvns r0, r3");
244   COMPARE(mvn(r5, Operand(r4), SetCC, cc),
245           "31f05004       mvnccs r5, r4");
246
247   // Instructions autotransformed by the assembler.
248   // mov -> mvn.
249   COMPARE(mov(r3, Operand(-1), LeaveCC, al),
250           "e3e03000       mvn r3, #0");
251   COMPARE(mov(r4, Operand(-2), SetCC, al),
252           "e3f04001       mvns r4, #1");
253   COMPARE(mov(r5, Operand(0x0ffffff0), SetCC, ne),
254           "13f052ff       mvnnes r5, #-268435441");
255   COMPARE(mov(r6, Operand(-1), LeaveCC, ne),
256           "13e06000       mvnne r6, #0");
257
258   // mvn -> mov.
259   COMPARE(mvn(r3, Operand(-1), LeaveCC, al),
260           "e3a03000       mov r3, #0");
261   COMPARE(mvn(r4, Operand(-2), SetCC, al),
262           "e3b04001       movs r4, #1");
263   COMPARE(mvn(r5, Operand(0x0ffffff0), SetCC, ne),
264           "13b052ff       movnes r5, #-268435441");
265   COMPARE(mvn(r6, Operand(-1), LeaveCC, ne),
266           "13a06000       movne r6, #0");
267
268   // mov -> movw.
269   if (CpuFeatures::IsSupported(ARMv7)) {
270     COMPARE(mov(r5, Operand(0x01234), LeaveCC, ne),
271             "13015234       movwne r5, #4660");
272     // We only disassemble one instruction so the eor instruction is not here.
273     COMPARE(eor(r5, r4, Operand(0x1234), LeaveCC, ne),
274             "1301c234       movwne ip, #4660");
275     // Movw can't do setcc, so first move to ip, then the following instruction
276     // moves to r5.  Mov immediate with setcc is pretty strange anyway.
277     COMPARE(mov(r5, Operand(0x01234), SetCC, ne),
278             "1301c234       movwne ip, #4660");
279     // Emit a literal pool now, otherwise this could be dumped later, in the
280     // middle of a different test.
281     EMIT_PENDING_LITERALS();
282
283     // We only disassemble one instruction so the eor instruction is not here.
284     // The eor does the setcc so we get a movw here.
285     COMPARE(eor(r5, r4, Operand(0x1234), SetCC, ne),
286             "1301c234       movwne ip, #4660");
287
288     COMPARE(movt(r5, 0x4321, ne),
289             "13445321       movtne r5, #17185");
290     COMPARE(movw(r5, 0xabcd, eq),
291             "030a5bcd       movweq r5, #43981");
292   }
293
294   // Eor doesn't have an eor-negative variant, but we can do an mvn followed by
295   // an eor to get the same effect.
296   COMPARE(eor(r5, r4, Operand(0xffffff34), SetCC, ne),
297           "13e0c0cb       mvnne ip, #203");
298
299   // and <-> bic.
300   COMPARE(and_(r3, r5, Operand(0xfc03ffff)),
301           "e3c537ff       bic r3, r5, #66846720");
302   COMPARE(bic(r3, r5, Operand(0xfc03ffff)),
303           "e20537ff       and r3, r5, #66846720");
304
305   // sub <-> add.
306   COMPARE(add(r3, r5, Operand(-1024)),
307           "e2453b01       sub r3, r5, #1024");
308   COMPARE(sub(r3, r5, Operand(-1024)),
309           "e2853b01       add r3, r5, #1024");
310
311   // cmp <-> cmn.
312   COMPARE(cmp(r3, Operand(-1024)),
313           "e3730b01       cmn r3, #1024");
314   COMPARE(cmn(r3, Operand(-1024)),
315           "e3530b01       cmp r3, #1024");
316
317   // Miscellaneous instructions encoded as type 0.
318   COMPARE(blx(ip),
319           "e12fff3c       blx ip");
320   COMPARE(bkpt(0),
321           "e1200070       bkpt 0");
322   COMPARE(bkpt(0xffff),
323           "e12fff7f       bkpt 65535");
324   COMPARE(clz(r6, r7),
325           "e16f6f17       clz r6, r7");
326
327   VERIFY_RUN();
328 }
329
330
331 TEST(Type1) {
332   SET_UP();
333
334   COMPARE(and_(r0, r1, Operand(0x00000000)),
335           "e2010000       and r0, r1, #0");
336   COMPARE(and_(r1, r2, Operand(0x00000001), LeaveCC),
337           "e2021001       and r1, r2, #1");
338   COMPARE(and_(r2, r3, Operand(0x00000010), SetCC),
339           "e2132010       ands r2, r3, #16");
340   COMPARE(and_(r3, r4, Operand(0x00000100), LeaveCC, eq),
341           "02043c01       andeq r3, r4, #256");
342   COMPARE(and_(r4, r5, Operand(0x00001000), SetCC, ne),
343           "12154a01       andnes r4, r5, #4096");
344
345   COMPARE(eor(r4, r5, Operand(0x00001000)),
346           "e2254a01       eor r4, r5, #4096");
347   COMPARE(eor(r4, r4, Operand(0x00010000), LeaveCC),
348           "e2244801       eor r4, r4, #65536");
349   COMPARE(eor(r4, r3, Operand(0x00100000), SetCC),
350           "e2334601       eors r4, r3, #1048576");
351   COMPARE(eor(r4, r2, Operand(0x01000000), LeaveCC, cs),
352           "22224401       eorcs r4, r2, #16777216");
353   COMPARE(eor(r4, r1, Operand(0x10000000), SetCC, cc),
354           "32314201       eorccs r4, r1, #268435456");
355
356   VERIFY_RUN();
357 }
358
359
360 TEST(Type3) {
361   SET_UP();
362
363   if (CpuFeatures::IsSupported(ARMv7)) {
364     COMPARE(ubfx(r0, r1, 5, 10),
365             "e7e902d1       ubfx r0, r1, #5, #10");
366     COMPARE(ubfx(r1, r0, 5, 10),
367             "e7e912d0       ubfx r1, r0, #5, #10");
368     COMPARE(ubfx(r0, r1, 31, 1),
369             "e7e00fd1       ubfx r0, r1, #31, #1");
370     COMPARE(ubfx(r1, r0, 31, 1),
371             "e7e01fd0       ubfx r1, r0, #31, #1");
372
373     COMPARE(sbfx(r0, r1, 5, 10),
374             "e7a902d1       sbfx r0, r1, #5, #10");
375     COMPARE(sbfx(r1, r0, 5, 10),
376             "e7a912d0       sbfx r1, r0, #5, #10");
377     COMPARE(sbfx(r0, r1, 31, 1),
378             "e7a00fd1       sbfx r0, r1, #31, #1");
379     COMPARE(sbfx(r1, r0, 31, 1),
380             "e7a01fd0       sbfx r1, r0, #31, #1");
381
382     COMPARE(bfc(r0, 5, 10),
383             "e7ce029f       bfc r0, #5, #10");
384     COMPARE(bfc(r1, 5, 10),
385             "e7ce129f       bfc r1, #5, #10");
386     COMPARE(bfc(r0, 31, 1),
387             "e7df0f9f       bfc r0, #31, #1");
388     COMPARE(bfc(r1, 31, 1),
389             "e7df1f9f       bfc r1, #31, #1");
390
391     COMPARE(bfi(r0, r1, 5, 10),
392             "e7ce0291       bfi r0, r1, #5, #10");
393     COMPARE(bfi(r1, r0, 5, 10),
394             "e7ce1290       bfi r1, r0, #5, #10");
395     COMPARE(bfi(r0, r1, 31, 1),
396             "e7df0f91       bfi r0, r1, #31, #1");
397     COMPARE(bfi(r1, r0, 31, 1),
398             "e7df1f90       bfi r1, r0, #31, #1");
399
400     COMPARE(usat(r0, 1, Operand(r1)),
401             "e6e10011       usat r0, #1, r1");
402     COMPARE(usat(r2, 7, Operand(lr)),
403             "e6e7201e       usat r2, #7, lr");
404     COMPARE(usat(r3, 31, Operand(r4, LSL, 31)),
405             "e6ff3f94       usat r3, #31, r4, lsl #31");
406     COMPARE(usat(r8, 0, Operand(r5, ASR, 17)),
407             "e6e088d5       usat r8, #0, r5, asr #17");
408
409     COMPARE(pkhbt(r3, r4, Operand(r5, LSL, 17)),
410             "e6843895       pkhbt r3, r4, r5, lsl #17");
411     COMPARE(pkhtb(r3, r4, Operand(r5, ASR, 17)),
412             "e68438d5       pkhtb r3, r4, r5, asr #17");
413
414     COMPARE(sxtb(r1, r7, 0, eq), "06af1077       sxtbeq r1, r7");
415     COMPARE(sxtb(r0, r0, 8, ne), "16af0470       sxtbne r0, r0, ror #8");
416     COMPARE(sxtb(r9, r10, 16), "e6af987a       sxtb r9, r10, ror #16");
417     COMPARE(sxtb(r4, r3, 24), "e6af4c73       sxtb r4, r3, ror #24");
418
419     COMPARE(sxtab(r3, r4, r5), "e6a43075       sxtab r3, r4, r5");
420
421     COMPARE(sxth(r5, r0), "e6bf5070       sxth r5, r0");
422     COMPARE(sxth(r5, r9, 8), "e6bf5479       sxth r5, r9, ror #8");
423     COMPARE(sxth(r5, r9, 16, hi), "86bf5879       sxthhi r5, r9, ror #16");
424     COMPARE(sxth(r8, r9, 24, cc), "36bf8c79       sxthcc r8, r9, ror #24");
425
426     COMPARE(sxtah(r3, r4, r5, 16), "e6b43875       sxtah r3, r4, r5, ror #16");
427
428     COMPARE(uxtb(r9, r10), "e6ef907a       uxtb r9, r10");
429     COMPARE(uxtb(r3, r4, 8), "e6ef3474       uxtb r3, r4, ror #8");
430
431     COMPARE(uxtab(r3, r4, r5, 8), "e6e43475       uxtab r3, r4, r5, ror #8");
432
433     COMPARE(uxtb16(r3, r4, 8), "e6cf3474       uxtb16 r3, r4, ror #8");
434
435     COMPARE(uxth(r9, r10), "e6ff907a       uxth r9, r10");
436     COMPARE(uxth(r3, r4, 8), "e6ff3474       uxth r3, r4, ror #8");
437
438     COMPARE(uxtah(r3, r4, r5, 24), "e6f43c75       uxtah r3, r4, r5, ror #24");
439   }
440
441   COMPARE(smmla(r0, r1, r2, r3), "e7503211       smmla r0, r1, r2, r3");
442   COMPARE(smmla(r10, r9, r8, r7), "e75a7819       smmla r10, r9, r8, r7");
443
444   COMPARE(smmul(r0, r1, r2), "e750f211       smmul r0, r1, r2");
445   COMPARE(smmul(r8, r9, r10), "e758fa19       smmul r8, r9, r10");
446
447   VERIFY_RUN();
448 }
449
450
451
452 TEST(Vfp) {
453   SET_UP();
454
455   if (CpuFeatures::IsSupported(VFP3)) {
456     CpuFeatureScope scope(&assm, VFP3);
457     COMPARE(vmov(d0, r2, r3),
458             "ec432b10       vmov d0, r2, r3");
459     COMPARE(vmov(r2, r3, d0),
460             "ec532b10       vmov r2, r3, d0");
461     COMPARE(vmov(d0, d1),
462             "eeb00b41       vmov.f64 d0, d1");
463     COMPARE(vmov(d3, d3, eq),
464             "0eb03b43       vmoveq.f64 d3, d3");
465
466     COMPARE(vmov(s0, s31),
467             "eeb00a6f       vmov.f32 s0, s31");
468     COMPARE(vmov(s31, s0),
469             "eef0fa40       vmov.f32 s31, s0");
470     COMPARE(vmov(r0, s0),
471             "ee100a10       vmov r0, s0");
472     COMPARE(vmov(r10, s31),
473             "ee1faa90       vmov r10, s31");
474     COMPARE(vmov(s0, r0),
475             "ee000a10       vmov s0, r0");
476     COMPARE(vmov(s31, r10),
477             "ee0faa90       vmov s31, r10");
478
479     COMPARE(vabs(d0, d1),
480             "eeb00bc1       vabs.f64 d0, d1");
481     COMPARE(vabs(d3, d4, mi),
482             "4eb03bc4       vabsmi.f64 d3, d4");
483
484     COMPARE(vneg(d0, d1),
485             "eeb10b41       vneg.f64 d0, d1");
486     COMPARE(vneg(d3, d4, mi),
487             "4eb13b44       vnegmi.f64 d3, d4");
488
489     COMPARE(vadd(d0, d1, d2),
490             "ee310b02       vadd.f64 d0, d1, d2");
491     COMPARE(vadd(d3, d4, d5, mi),
492             "4e343b05       vaddmi.f64 d3, d4, d5");
493
494     COMPARE(vsub(d0, d1, d2),
495             "ee310b42       vsub.f64 d0, d1, d2");
496     COMPARE(vsub(d3, d4, d5, ne),
497             "1e343b45       vsubne.f64 d3, d4, d5");
498
499     COMPARE(vmul(d2, d1, d0),
500             "ee212b00       vmul.f64 d2, d1, d0");
501     COMPARE(vmul(d6, d4, d5, cc),
502             "3e246b05       vmulcc.f64 d6, d4, d5");
503
504     COMPARE(vdiv(d2, d2, d2),
505             "ee822b02       vdiv.f64 d2, d2, d2");
506     COMPARE(vdiv(d6, d7, d7, hi),
507             "8e876b07       vdivhi.f64 d6, d7, d7");
508
509     COMPARE(vcmp(d0, d1),
510             "eeb40b41       vcmp.f64 d0, d1");
511     COMPARE(vcmp(d0, 0.0),
512             "eeb50b40       vcmp.f64 d0, #0.0");
513
514     COMPARE(vsqrt(d0, d0),
515             "eeb10bc0       vsqrt.f64 d0, d0");
516     COMPARE(vsqrt(d2, d3, ne),
517             "1eb12bc3       vsqrtne.f64 d2, d3");
518
519     COMPARE(vmov(d0, 1.0),
520             "eeb70b00       vmov.f64 d0, #1");
521     COMPARE(vmov(d2, -13.0),
522             "eeba2b0a       vmov.f64 d2, #-13");
523
524     COMPARE(vmov(d0, VmovIndexLo, r0),
525             "ee000b10       vmov.32 d0[0], r0");
526     COMPARE(vmov(d0, VmovIndexHi, r0),
527             "ee200b10       vmov.32 d0[1], r0");
528
529     COMPARE(vmov(r2, VmovIndexLo, d15),
530             "ee1f2b10       vmov.32 r2, d15[0]");
531     COMPARE(vmov(r3, VmovIndexHi, d14),
532             "ee3e3b10       vmov.32 r3, d14[1]");
533
534     COMPARE(vldr(s0, r0, 0),
535             "ed900a00       vldr s0, [r0 + 4*0]");
536     COMPARE(vldr(s1, r1, 4),
537             "edd10a01       vldr s1, [r1 + 4*1]");
538     COMPARE(vldr(s15, r4, 16),
539             "edd47a04       vldr s15, [r4 + 4*4]");
540     COMPARE(vldr(s16, r5, 20),
541             "ed958a05       vldr s16, [r5 + 4*5]");
542     COMPARE(vldr(s31, r10, 1020),
543             "eddafaff       vldr s31, [r10 + 4*255]");
544
545     COMPARE(vstr(s0, r0, 0),
546             "ed800a00       vstr s0, [r0 + 4*0]");
547     COMPARE(vstr(s1, r1, 4),
548             "edc10a01       vstr s1, [r1 + 4*1]");
549     COMPARE(vstr(s15, r8, 8),
550             "edc87a02       vstr s15, [r8 + 4*2]");
551     COMPARE(vstr(s16, r9, 12),
552             "ed898a03       vstr s16, [r9 + 4*3]");
553     COMPARE(vstr(s31, r10, 1020),
554             "edcafaff       vstr s31, [r10 + 4*255]");
555
556     COMPARE(vldr(d0, r0, 0),
557             "ed900b00       vldr d0, [r0 + 4*0]");
558     COMPARE(vldr(d1, r1, 4),
559             "ed911b01       vldr d1, [r1 + 4*1]");
560     COMPARE(vldr(d15, r10, 1020),
561             "ed9afbff       vldr d15, [r10 + 4*255]");
562     COMPARE(vstr(d0, r0, 0),
563             "ed800b00       vstr d0, [r0 + 4*0]");
564     COMPARE(vstr(d1, r1, 4),
565             "ed811b01       vstr d1, [r1 + 4*1]");
566     COMPARE(vstr(d15, r10, 1020),
567             "ed8afbff       vstr d15, [r10 + 4*255]");
568
569     COMPARE(vmsr(r5),
570             "eee15a10       vmsr FPSCR, r5");
571     COMPARE(vmsr(r10, pl),
572             "5ee1aa10       vmsrpl FPSCR, r10");
573     COMPARE(vmsr(pc),
574             "eee1fa10       vmsr FPSCR, APSR");
575     COMPARE(vmrs(r5),
576             "eef15a10       vmrs r5, FPSCR");
577     COMPARE(vmrs(r10, ge),
578             "aef1aa10       vmrsge r10, FPSCR");
579     COMPARE(vmrs(pc),
580             "eef1fa10       vmrs APSR, FPSCR");
581
582     COMPARE(vstm(ia, r0, d1, d3),
583             "ec801b06       vstmia r0, {d1-d3}");
584     COMPARE(vldm(ia, r1, d2, d5),
585             "ec912b08       vldmia r1, {d2-d5}");
586     COMPARE(vstm(ia, r2, d0, d15),
587             "ec820b20       vstmia r2, {d0-d15}");
588     COMPARE(vldm(ia, r3, d0, d15),
589             "ec930b20       vldmia r3, {d0-d15}");
590     COMPARE(vstm(ia, r4, s1, s3),
591             "ecc40a03       vstmia r4, {s1-s3}");
592     COMPARE(vldm(ia, r5, s2, s5),
593             "ec951a04       vldmia r5, {s2-s5}");
594     COMPARE(vstm(ia, r6, s0, s31),
595             "ec860a20       vstmia r6, {s0-s31}");
596     COMPARE(vldm(ia, r7, s0, s31),
597             "ec970a20       vldmia r7, {s0-s31}");
598
599     COMPARE(vmla(d2, d1, d0),
600             "ee012b00       vmla.f64 d2, d1, d0");
601     COMPARE(vmla(d6, d4, d5, cc),
602             "3e046b05       vmlacc.f64 d6, d4, d5");
603
604     COMPARE(vmls(d2, d1, d0),
605             "ee012b40       vmls.f64 d2, d1, d0");
606     COMPARE(vmls(d6, d4, d5, cc),
607             "3e046b45       vmlscc.f64 d6, d4, d5");
608
609     COMPARE(vcvt_u32_f64(s0, d0),
610             "eebc0bc0       vcvt.u32.f64 s0, d0");
611     COMPARE(vcvt_s32_f64(s0, d0),
612             "eebd0bc0       vcvt.s32.f64 s0, d0");
613     COMPARE(vcvt_f64_u32(d0, s1),
614             "eeb80b60       vcvt.f64.u32 d0, s1");
615     COMPARE(vcvt_f64_s32(d0, s1),
616             "eeb80be0       vcvt.f64.s32 d0, s1");
617     COMPARE(vcvt_f32_s32(s0, s2),
618             "eeb80ac1       vcvt.f32.s32 s0, s2");
619     COMPARE(vcvt_f64_s32(d0, 2),
620             "eeba0bcf       vcvt.f64.s32 d0, d0, #2");
621
622     if (CpuFeatures::IsSupported(VFP32DREGS)) {
623       COMPARE(vmov(d3, d27),
624               "eeb03b6b       vmov.f64 d3, d27");
625       COMPARE(vmov(d18, d7),
626               "eef02b47       vmov.f64 d18, d7");
627       COMPARE(vmov(d18, r2, r3),
628               "ec432b32       vmov d18, r2, r3");
629       COMPARE(vmov(r2, r3, d18),
630               "ec532b32       vmov r2, r3, d18");
631       COMPARE(vmov(d20, d31),
632               "eef04b6f       vmov.f64 d20, d31");
633
634       COMPARE(vabs(d16, d31),
635               "eef00bef       vabs.f64 d16, d31");
636
637       COMPARE(vneg(d16, d31),
638               "eef10b6f       vneg.f64 d16, d31");
639
640       COMPARE(vadd(d16, d17, d18),
641               "ee710ba2       vadd.f64 d16, d17, d18");
642
643       COMPARE(vsub(d16, d17, d18),
644               "ee710be2       vsub.f64 d16, d17, d18");
645
646       COMPARE(vmul(d16, d17, d18),
647               "ee610ba2       vmul.f64 d16, d17, d18");
648
649       COMPARE(vdiv(d16, d17, d18),
650               "eec10ba2       vdiv.f64 d16, d17, d18");
651
652       COMPARE(vcmp(d16, d17),
653               "eef40b61       vcmp.f64 d16, d17");
654       COMPARE(vcmp(d16, 0.0),
655               "eef50b40       vcmp.f64 d16, #0.0");
656
657       COMPARE(vsqrt(d16, d17),
658               "eef10be1       vsqrt.f64 d16, d17");
659
660       COMPARE(vmov(d30, 16.0),
661               "eef3eb00       vmov.f64 d30, #16");
662
663       COMPARE(vmov(d31, VmovIndexLo, r7),
664               "ee0f7b90       vmov.32 d31[0], r7");
665       COMPARE(vmov(d31, VmovIndexHi, r7),
666               "ee2f7b90       vmov.32 d31[1], r7");
667
668       COMPARE(vldr(d25, r0, 0),
669               "edd09b00       vldr d25, [r0 + 4*0]");
670       COMPARE(vldr(d26, r1, 4),
671               "edd1ab01       vldr d26, [r1 + 4*1]");
672       COMPARE(vldr(d31, r10, 1020),
673               "eddafbff       vldr d31, [r10 + 4*255]");
674
675       COMPARE(vstr(d16, r0, 0),
676               "edc00b00       vstr d16, [r0 + 4*0]");
677       COMPARE(vstr(d17, r1, 4),
678               "edc11b01       vstr d17, [r1 + 4*1]");
679       COMPARE(vstr(d31, r10, 1020),
680               "edcafbff       vstr d31, [r10 + 4*255]");
681
682       COMPARE(vstm(ia, r0, d16, d31),
683               "ecc00b20       vstmia r0, {d16-d31}");
684       COMPARE(vldm(ia, r3, d16, d31),
685               "ecd30b20       vldmia r3, {d16-d31}");
686       COMPARE(vstm(ia, r0, d23, d27),
687               "ecc07b0a       vstmia r0, {d23-d27}");
688       COMPARE(vldm(ia, r3, d23, d27),
689               "ecd37b0a       vldmia r3, {d23-d27}");
690
691       COMPARE(vmla(d16, d17, d18),
692               "ee410ba2       vmla.f64 d16, d17, d18");
693
694       COMPARE(vcvt_u32_f64(s0, d16),
695               "eebc0be0       vcvt.u32.f64 s0, d16");
696       COMPARE(vcvt_s32_f64(s0, d16),
697               "eebd0be0       vcvt.s32.f64 s0, d16");
698       COMPARE(vcvt_f64_u32(d16, s1),
699               "eef80b60       vcvt.f64.u32 d16, s1");
700     }
701   }
702
703   VERIFY_RUN();
704 }
705
706
707 TEST(ARMv8_vrintX_disasm) {
708   SET_UP();
709
710   if (CpuFeatures::IsSupported(ARMv8)) {
711     COMPARE(vrinta(d0, d0), "feb80b40       vrinta.f64.f64 d0, d0");
712     COMPARE(vrinta(d2, d3), "feb82b43       vrinta.f64.f64 d2, d3");
713
714     COMPARE(vrintp(d0, d0), "feba0b40       vrintp.f64.f64 d0, d0");
715     COMPARE(vrintp(d2, d3), "feba2b43       vrintp.f64.f64 d2, d3");
716
717     COMPARE(vrintn(d0, d0), "feb90b40       vrintn.f64.f64 d0, d0");
718     COMPARE(vrintn(d2, d3), "feb92b43       vrintn.f64.f64 d2, d3");
719
720     COMPARE(vrintm(d0, d0), "febb0b40       vrintm.f64.f64 d0, d0");
721     COMPARE(vrintm(d2, d3), "febb2b43       vrintm.f64.f64 d2, d3");
722
723     COMPARE(vrintz(d0, d0), "eeb60bc0       vrintz.f64.f64 d0, d0");
724     COMPARE(vrintz(d2, d3, ne), "1eb62bc3       vrintzne.f64.f64 d2, d3");
725   }
726
727   VERIFY_RUN();
728 }
729
730
731 TEST(Neon) {
732   SET_UP();
733
734   if (CpuFeatures::IsSupported(NEON)) {
735     CpuFeatureScope scope(&assm, NEON);
736       COMPARE(vld1(Neon8, NeonListOperand(d4, 4), NeonMemOperand(r1)),
737               "f421420f       vld1.8 {d4, d5, d6, d7}, [r1]");
738       COMPARE(vst1(Neon16, NeonListOperand(d17, 4), NeonMemOperand(r9)),
739               "f449124f       vst1.16 {d17, d18, d19, d20}, [r9]");
740       COMPARE(vmovl(NeonU8, q3, d1),
741               "f3886a11       vmovl.u8 q3, d1");
742       COMPARE(vmovl(NeonU8, q4, d2),
743               "f3888a12       vmovl.u8 q4, d2");
744   }
745
746   VERIFY_RUN();
747 }
748
749
750 TEST(LoadStore) {
751   SET_UP();
752
753   COMPARE(ldrb(r0, MemOperand(r1)),
754           "e5d10000       ldrb r0, [r1, #+0]");
755   COMPARE(ldrb(r2, MemOperand(r3, 42)),
756           "e5d3202a       ldrb r2, [r3, #+42]");
757   COMPARE(ldrb(r4, MemOperand(r5, -42)),
758           "e555402a       ldrb r4, [r5, #-42]");
759   COMPARE(ldrb(r6, MemOperand(r7, 42, PostIndex)),
760           "e4d7602a       ldrb r6, [r7], #+42");
761   COMPARE(ldrb(r8, MemOperand(r9, -42, PostIndex)),
762           "e459802a       ldrb r8, [r9], #-42");
763   COMPARE(ldrb(r10, MemOperand(fp, 42, PreIndex)),
764           "e5fba02a       ldrb r10, [fp, #+42]!");
765   COMPARE(ldrb(ip, MemOperand(sp, -42, PreIndex)),
766           "e57dc02a       ldrb ip, [sp, #-42]!");
767   COMPARE(ldrb(r0, MemOperand(r1, r2)),
768           "e7d10002       ldrb r0, [r1, +r2]");
769   COMPARE(ldrb(r0, MemOperand(r1, r2, NegOffset)),
770           "e7510002       ldrb r0, [r1, -r2]");
771   COMPARE(ldrb(r0, MemOperand(r1, r2, PostIndex)),
772           "e6d10002       ldrb r0, [r1], +r2");
773   COMPARE(ldrb(r0, MemOperand(r1, r2, NegPostIndex)),
774           "e6510002       ldrb r0, [r1], -r2");
775   COMPARE(ldrb(r0, MemOperand(r1, r2, PreIndex)),
776           "e7f10002       ldrb r0, [r1, +r2]!");
777   COMPARE(ldrb(r0, MemOperand(r1, r2, NegPreIndex)),
778           "e7710002       ldrb r0, [r1, -r2]!");
779
780   COMPARE(strb(r0, MemOperand(r1)),
781           "e5c10000       strb r0, [r1, #+0]");
782   COMPARE(strb(r2, MemOperand(r3, 42)),
783           "e5c3202a       strb r2, [r3, #+42]");
784   COMPARE(strb(r4, MemOperand(r5, -42)),
785           "e545402a       strb r4, [r5, #-42]");
786   COMPARE(strb(r6, MemOperand(r7, 42, PostIndex)),
787           "e4c7602a       strb r6, [r7], #+42");
788   COMPARE(strb(r8, MemOperand(r9, -42, PostIndex)),
789           "e449802a       strb r8, [r9], #-42");
790   COMPARE(strb(r10, MemOperand(fp, 42, PreIndex)),
791           "e5eba02a       strb r10, [fp, #+42]!");
792   COMPARE(strb(ip, MemOperand(sp, -42, PreIndex)),
793           "e56dc02a       strb ip, [sp, #-42]!");
794   COMPARE(strb(r0, MemOperand(r1, r2)),
795           "e7c10002       strb r0, [r1, +r2]");
796   COMPARE(strb(r0, MemOperand(r1, r2, NegOffset)),
797           "e7410002       strb r0, [r1, -r2]");
798   COMPARE(strb(r0, MemOperand(r1, r2, PostIndex)),
799           "e6c10002       strb r0, [r1], +r2");
800   COMPARE(strb(r0, MemOperand(r1, r2, NegPostIndex)),
801           "e6410002       strb r0, [r1], -r2");
802   COMPARE(strb(r0, MemOperand(r1, r2, PreIndex)),
803           "e7e10002       strb r0, [r1, +r2]!");
804   COMPARE(strb(r0, MemOperand(r1, r2, NegPreIndex)),
805           "e7610002       strb r0, [r1, -r2]!");
806
807   COMPARE(ldrh(r0, MemOperand(r1)),
808           "e1d100b0       ldrh r0, [r1, #+0]");
809   COMPARE(ldrh(r2, MemOperand(r3, 42)),
810           "e1d322ba       ldrh r2, [r3, #+42]");
811   COMPARE(ldrh(r4, MemOperand(r5, -42)),
812           "e15542ba       ldrh r4, [r5, #-42]");
813   COMPARE(ldrh(r6, MemOperand(r7, 42, PostIndex)),
814           "e0d762ba       ldrh r6, [r7], #+42");
815   COMPARE(ldrh(r8, MemOperand(r9, -42, PostIndex)),
816           "e05982ba       ldrh r8, [r9], #-42");
817   COMPARE(ldrh(r10, MemOperand(fp, 42, PreIndex)),
818           "e1fba2ba       ldrh r10, [fp, #+42]!");
819   COMPARE(ldrh(ip, MemOperand(sp, -42, PreIndex)),
820           "e17dc2ba       ldrh ip, [sp, #-42]!");
821   COMPARE(ldrh(r0, MemOperand(r1, r2)),
822           "e19100b2       ldrh r0, [r1, +r2]");
823   COMPARE(ldrh(r0, MemOperand(r1, r2, NegOffset)),
824           "e11100b2       ldrh r0, [r1, -r2]");
825   COMPARE(ldrh(r0, MemOperand(r1, r2, PostIndex)),
826           "e09100b2       ldrh r0, [r1], +r2");
827   COMPARE(ldrh(r0, MemOperand(r1, r2, NegPostIndex)),
828           "e01100b2       ldrh r0, [r1], -r2");
829   COMPARE(ldrh(r0, MemOperand(r1, r2, PreIndex)),
830           "e1b100b2       ldrh r0, [r1, +r2]!");
831   COMPARE(ldrh(r0, MemOperand(r1, r2, NegPreIndex)),
832           "e13100b2       ldrh r0, [r1, -r2]!");
833
834   COMPARE(strh(r0, MemOperand(r1)),
835           "e1c100b0       strh r0, [r1, #+0]");
836   COMPARE(strh(r2, MemOperand(r3, 42)),
837           "e1c322ba       strh r2, [r3, #+42]");
838   COMPARE(strh(r4, MemOperand(r5, -42)),
839           "e14542ba       strh r4, [r5, #-42]");
840   COMPARE(strh(r6, MemOperand(r7, 42, PostIndex)),
841           "e0c762ba       strh r6, [r7], #+42");
842   COMPARE(strh(r8, MemOperand(r9, -42, PostIndex)),
843           "e04982ba       strh r8, [r9], #-42");
844   COMPARE(strh(r10, MemOperand(fp, 42, PreIndex)),
845           "e1eba2ba       strh r10, [fp, #+42]!");
846   COMPARE(strh(ip, MemOperand(sp, -42, PreIndex)),
847           "e16dc2ba       strh ip, [sp, #-42]!");
848   COMPARE(strh(r0, MemOperand(r1, r2)),
849           "e18100b2       strh r0, [r1, +r2]");
850   COMPARE(strh(r0, MemOperand(r1, r2, NegOffset)),
851           "e10100b2       strh r0, [r1, -r2]");
852   COMPARE(strh(r0, MemOperand(r1, r2, PostIndex)),
853           "e08100b2       strh r0, [r1], +r2");
854   COMPARE(strh(r0, MemOperand(r1, r2, NegPostIndex)),
855           "e00100b2       strh r0, [r1], -r2");
856   COMPARE(strh(r0, MemOperand(r1, r2, PreIndex)),
857           "e1a100b2       strh r0, [r1, +r2]!");
858   COMPARE(strh(r0, MemOperand(r1, r2, NegPreIndex)),
859           "e12100b2       strh r0, [r1, -r2]!");
860
861   COMPARE(ldr(r0, MemOperand(r1)),
862           "e5910000       ldr r0, [r1, #+0]");
863   COMPARE(ldr(r2, MemOperand(r3, 42)),
864           "e593202a       ldr r2, [r3, #+42]");
865   COMPARE(ldr(r4, MemOperand(r5, -42)),
866           "e515402a       ldr r4, [r5, #-42]");
867   COMPARE(ldr(r6, MemOperand(r7, 42, PostIndex)),
868           "e497602a       ldr r6, [r7], #+42");
869   COMPARE(ldr(r8, MemOperand(r9, -42, PostIndex)),
870           "e419802a       ldr r8, [r9], #-42");
871   COMPARE(ldr(r10, MemOperand(fp, 42, PreIndex)),
872           "e5bba02a       ldr r10, [fp, #+42]!");
873   COMPARE(ldr(ip, MemOperand(sp, -42, PreIndex)),
874           "e53dc02a       ldr ip, [sp, #-42]!");
875   COMPARE(ldr(r0, MemOperand(r1, r2)),
876           "e7910002       ldr r0, [r1, +r2]");
877   COMPARE(ldr(r0, MemOperand(r1, r2, NegOffset)),
878           "e7110002       ldr r0, [r1, -r2]");
879   COMPARE(ldr(r0, MemOperand(r1, r2, PostIndex)),
880           "e6910002       ldr r0, [r1], +r2");
881   COMPARE(ldr(r0, MemOperand(r1, r2, NegPostIndex)),
882           "e6110002       ldr r0, [r1], -r2");
883   COMPARE(ldr(r0, MemOperand(r1, r2, PreIndex)),
884           "e7b10002       ldr r0, [r1, +r2]!");
885   COMPARE(ldr(r0, MemOperand(r1, r2, NegPreIndex)),
886           "e7310002       ldr r0, [r1, -r2]!");
887
888   COMPARE(str(r0, MemOperand(r1)),
889           "e5810000       str r0, [r1, #+0]");
890   COMPARE(str(r2, MemOperand(r3, 42)),
891           "e583202a       str r2, [r3, #+42]");
892   COMPARE(str(r4, MemOperand(r5, -42)),
893           "e505402a       str r4, [r5, #-42]");
894   COMPARE(str(r6, MemOperand(r7, 42, PostIndex)),
895           "e487602a       str r6, [r7], #+42");
896   COMPARE(str(r8, MemOperand(r9, -42, PostIndex)),
897           "e409802a       str r8, [r9], #-42");
898   COMPARE(str(r10, MemOperand(fp, 42, PreIndex)),
899           "e5aba02a       str r10, [fp, #+42]!");
900   COMPARE(str(ip, MemOperand(sp, -42, PreIndex)),
901           "e52dc02a       str ip, [sp, #-42]!");
902   COMPARE(str(r0, MemOperand(r1, r2)),
903           "e7810002       str r0, [r1, +r2]");
904   COMPARE(str(r0, MemOperand(r1, r2, NegOffset)),
905           "e7010002       str r0, [r1, -r2]");
906   COMPARE(str(r0, MemOperand(r1, r2, PostIndex)),
907           "e6810002       str r0, [r1], +r2");
908   COMPARE(str(r0, MemOperand(r1, r2, NegPostIndex)),
909           "e6010002       str r0, [r1], -r2");
910   COMPARE(str(r0, MemOperand(r1, r2, PreIndex)),
911           "e7a10002       str r0, [r1, +r2]!");
912   COMPARE(str(r0, MemOperand(r1, r2, NegPreIndex)),
913           "e7210002       str r0, [r1, -r2]!");
914
915   if (CpuFeatures::IsSupported(ARMv7)) {
916     CpuFeatureScope scope(&assm, ARMv7);
917     COMPARE(ldrd(r0, r1, MemOperand(r1)),
918             "e1c100d0       ldrd r0, [r1, #+0]");
919     COMPARE(ldrd(r2, r3, MemOperand(r3, 127)),
920             "e1c327df       ldrd r2, [r3, #+127]");
921     COMPARE(ldrd(r4, r5, MemOperand(r5, -127)),
922             "e14547df       ldrd r4, [r5, #-127]");
923     COMPARE(ldrd(r6, r7, MemOperand(r7, 127, PostIndex)),
924             "e0c767df       ldrd r6, [r7], #+127");
925     COMPARE(ldrd(r8, r9, MemOperand(r9, -127, PostIndex)),
926             "e04987df       ldrd r8, [r9], #-127");
927     COMPARE(ldrd(r10, fp, MemOperand(fp, 127, PreIndex)),
928             "e1eba7df       ldrd r10, [fp, #+127]!");
929     COMPARE(ldrd(ip, sp, MemOperand(sp, -127, PreIndex)),
930             "e16dc7df       ldrd ip, [sp, #-127]!");
931
932     COMPARE(strd(r0, r1, MemOperand(r1)),
933             "e1c100f0       strd r0, [r1, #+0]");
934     COMPARE(strd(r2, r3, MemOperand(r3, 127)),
935             "e1c327ff       strd r2, [r3, #+127]");
936     COMPARE(strd(r4, r5, MemOperand(r5, -127)),
937             "e14547ff       strd r4, [r5, #-127]");
938     COMPARE(strd(r6, r7, MemOperand(r7, 127, PostIndex)),
939             "e0c767ff       strd r6, [r7], #+127");
940     COMPARE(strd(r8, r9, MemOperand(r9, -127, PostIndex)),
941             "e04987ff       strd r8, [r9], #-127");
942     COMPARE(strd(r10, fp, MemOperand(fp, 127, PreIndex)),
943             "e1eba7ff       strd r10, [fp, #+127]!");
944     COMPARE(strd(ip, sp, MemOperand(sp, -127, PreIndex)),
945             "e16dc7ff       strd ip, [sp, #-127]!");
946
947     COMPARE(pld(MemOperand(r1, 0)),
948             "f5d1f000       pld [r1]");
949     COMPARE(pld(MemOperand(r2, 128)),
950             "f5d2f080       pld [r2, #+128]");
951   }
952
953   VERIFY_RUN();
954 }