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