| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2013 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 #include "v8.h" |
| 29 |
| 30 #if defined(V8_TARGET_ARCH_A64) |
| 31 |
| 32 #include "globals.h" |
| 33 #include "utils.h" |
| 34 #include "a64/decoder-a64.h" |
| 35 |
| 36 |
| 37 namespace v8 { |
| 38 namespace internal { |
| 39 |
| 40 // Top-level instruction decode function. |
| 41 void Decoder::Decode(Instruction *instr) { |
| 42 if (instr->Bits(28, 27) == 0) { |
| 43 VisitUnallocated(instr); |
| 44 } else { |
| 45 switch (instr->Bits(27, 24)) { |
| 46 // 0: PC relative addressing. |
| 47 case 0x0: DecodePCRelAddressing(instr); break; |
| 48 |
| 49 // 1: Add/sub immediate. |
| 50 case 0x1: DecodeAddSubImmediate(instr); break; |
| 51 |
| 52 // A: Logical shifted register. |
| 53 // Add/sub with carry. |
| 54 // Conditional compare register. |
| 55 // Conditional compare immediate. |
| 56 // Conditional select. |
| 57 // Data processing 1 source. |
| 58 // Data processing 2 source. |
| 59 // B: Add/sub shifted register. |
| 60 // Add/sub extended register. |
| 61 // Data processing 3 source. |
| 62 case 0xA: |
| 63 case 0xB: DecodeDataProcessing(instr); break; |
| 64 |
| 65 // 2: Logical immediate. |
| 66 // Move wide immediate. |
| 67 case 0x2: DecodeLogical(instr); break; |
| 68 |
| 69 // 3: Bitfield. |
| 70 // Extract. |
| 71 case 0x3: DecodeBitfieldExtract(instr); break; |
| 72 |
| 73 // 4: Unconditional branch immediate. |
| 74 // Exception generation. |
| 75 // Compare and branch immediate. |
| 76 // 5: Compare and branch immediate. |
| 77 // Conditional branch. |
| 78 // System. |
| 79 // 6,7: Unconditional branch. |
| 80 // Test and branch immediate. |
| 81 case 0x4: |
| 82 case 0x5: |
| 83 case 0x6: |
| 84 case 0x7: DecodeBranchSystemException(instr); break; |
| 85 |
| 86 // 8,9: Load/store register pair post-index. |
| 87 // Load register literal. |
| 88 // Load/store register unscaled immediate. |
| 89 // Load/store register immediate post-index. |
| 90 // Load/store register immediate pre-index. |
| 91 // Load/store register offset. |
| 92 // C,D: Load/store register pair offset. |
| 93 // Load/store register pair pre-index. |
| 94 // Load/store register unsigned immediate. |
| 95 // Advanced SIMD. |
| 96 case 0x8: |
| 97 case 0x9: |
| 98 case 0xC: |
| 99 case 0xD: DecodeLoadStore(instr); break; |
| 100 |
| 101 // E: FP fixed point conversion. |
| 102 // FP integer conversion. |
| 103 // FP data processing 1 source. |
| 104 // FP compare. |
| 105 // FP immediate. |
| 106 // FP data processing 2 source. |
| 107 // FP conditional compare. |
| 108 // FP conditional select. |
| 109 // Advanced SIMD. |
| 110 // F: FP data processing 3 source. |
| 111 // Advanced SIMD. |
| 112 case 0xE: |
| 113 case 0xF: DecodeFP(instr); break; |
| 114 } |
| 115 } |
| 116 } |
| 117 |
| 118 void Decoder::AppendVisitor(DecoderVisitor* new_visitor) { |
| 119 visitors_.remove(new_visitor); |
| 120 visitors_.push_front(new_visitor); |
| 121 } |
| 122 |
| 123 |
| 124 void Decoder::PrependVisitor(DecoderVisitor* new_visitor) { |
| 125 visitors_.remove(new_visitor); |
| 126 visitors_.push_back(new_visitor); |
| 127 } |
| 128 |
| 129 |
| 130 void Decoder::InsertVisitorBefore(DecoderVisitor* new_visitor, |
| 131 DecoderVisitor* registered_visitor) { |
| 132 visitors_.remove(new_visitor); |
| 133 std::list<DecoderVisitor*>::iterator it; |
| 134 for (it = visitors_.begin(); it != visitors_.end(); it++) { |
| 135 if (*it == registered_visitor) { |
| 136 visitors_.insert(it, new_visitor); |
| 137 return; |
| 138 } |
| 139 } |
| 140 // We reached the end of the list. The last element must be |
| 141 // registered_visitor. |
| 142 ASSERT(*it == registered_visitor); |
| 143 visitors_.insert(it, new_visitor); |
| 144 } |
| 145 |
| 146 |
| 147 void Decoder::InsertVisitorAfter(DecoderVisitor* new_visitor, |
| 148 DecoderVisitor* registered_visitor) { |
| 149 visitors_.remove(new_visitor); |
| 150 std::list<DecoderVisitor*>::iterator it; |
| 151 for (it = visitors_.begin(); it != visitors_.end(); it++) { |
| 152 if (*it == registered_visitor) { |
| 153 it++; |
| 154 visitors_.insert(it, new_visitor); |
| 155 return; |
| 156 } |
| 157 } |
| 158 // We reached the end of the list. The last element must be |
| 159 // registered_visitor. |
| 160 ASSERT(*it == registered_visitor); |
| 161 visitors_.push_back(new_visitor); |
| 162 } |
| 163 |
| 164 |
| 165 void Decoder::RemoveVisitor(DecoderVisitor* visitor) { |
| 166 visitors_.remove(visitor); |
| 167 } |
| 168 |
| 169 |
| 170 void Decoder::DecodePCRelAddressing(Instruction* instr) { |
| 171 ASSERT(instr->Bits(27, 24) == 0x0); |
| 172 // We know bit 28 is set, as <b28:b27> = 0 is filtered out at the top level |
| 173 // decode. |
| 174 ASSERT(instr->Bit(28) == 0x1); |
| 175 VisitPCRelAddressing(instr); |
| 176 } |
| 177 |
| 178 |
| 179 void Decoder::DecodeBranchSystemException(Instruction* instr) { |
| 180 ASSERT((instr->Bits(27, 24) == 0x4) || |
| 181 (instr->Bits(27, 24) == 0x5) || |
| 182 (instr->Bits(27, 24) == 0x6) || |
| 183 (instr->Bits(27, 24) == 0x7) ); |
| 184 |
| 185 switch (instr->Bits(31, 29)) { |
| 186 case 0: |
| 187 case 4: { |
| 188 VisitUnconditionalBranch(instr); |
| 189 break; |
| 190 } |
| 191 case 1: |
| 192 case 5: { |
| 193 if (instr->Bit(25) == 0) { |
| 194 VisitCompareBranch(instr); |
| 195 } else { |
| 196 VisitTestBranch(instr); |
| 197 } |
| 198 break; |
| 199 } |
| 200 case 2: { |
| 201 if (instr->Bit(25) == 0) { |
| 202 if ((instr->Bit(24) == 0x1) || |
| 203 (instr->Mask(0x01000010) == 0x00000010)) { |
| 204 VisitUnallocated(instr); |
| 205 } else { |
| 206 VisitConditionalBranch(instr); |
| 207 } |
| 208 } else { |
| 209 VisitUnallocated(instr); |
| 210 } |
| 211 break; |
| 212 } |
| 213 case 6: { |
| 214 if (instr->Bit(25) == 0) { |
| 215 if (instr->Bit(24) == 0) { |
| 216 if ((instr->Bits(4, 2) != 0) || |
| 217 (instr->Mask(0x00E0001D) == 0x00200001) || |
| 218 (instr->Mask(0x00E0001D) == 0x00400001) || |
| 219 (instr->Mask(0x00E0001E) == 0x00200002) || |
| 220 (instr->Mask(0x00E0001E) == 0x00400002) || |
| 221 (instr->Mask(0x00E0001C) == 0x00600000) || |
| 222 (instr->Mask(0x00E0001C) == 0x00800000) || |
| 223 (instr->Mask(0x00E0001F) == 0x00A00000) || |
| 224 (instr->Mask(0x00C0001C) == 0x00C00000)) { |
| 225 VisitUnallocated(instr); |
| 226 } else { |
| 227 VisitException(instr); |
| 228 } |
| 229 } else { |
| 230 if (instr->Bits(23, 22) == 0) { |
| 231 const Instr masked_003FF0E0 = instr->Mask(0x003FF0E0); |
| 232 if ((instr->Bits(21, 19) == 0x4) || |
| 233 (masked_003FF0E0 == 0x00033000) || |
| 234 (masked_003FF0E0 == 0x003FF020) || |
| 235 (masked_003FF0E0 == 0x003FF060) || |
| 236 (masked_003FF0E0 == 0x003FF0E0) || |
| 237 (instr->Mask(0x00388000) == 0x00008000) || |
| 238 (instr->Mask(0x0038E000) == 0x00000000) || |
| 239 (instr->Mask(0x0039E000) == 0x00002000) || |
| 240 (instr->Mask(0x003AE000) == 0x00002000) || |
| 241 (instr->Mask(0x003CE000) == 0x00042000) || |
| 242 (instr->Mask(0x003FFFC0) == 0x000320C0) || |
| 243 (instr->Mask(0x003FF100) == 0x00032100) || |
| 244 (instr->Mask(0x003FF200) == 0x00032200) || |
| 245 (instr->Mask(0x003FF400) == 0x00032400) || |
| 246 (instr->Mask(0x003FF800) == 0x00032800) || |
| 247 (instr->Mask(0x0038F000) == 0x00005000) || |
| 248 (instr->Mask(0x0038E000) == 0x00006000)) { |
| 249 VisitUnallocated(instr); |
| 250 } else { |
| 251 VisitSystem(instr); |
| 252 } |
| 253 } else { |
| 254 VisitUnallocated(instr); |
| 255 } |
| 256 } |
| 257 } else { |
| 258 if ((instr->Bit(24) == 0x1) || |
| 259 (instr->Bits(20, 16) != 0x1F) || |
| 260 (instr->Bits(15, 10) != 0) || |
| 261 (instr->Bits(4, 0) != 0) || |
| 262 (instr->Bits(24, 21) == 0x3) || |
| 263 (instr->Bits(24, 22) == 0x3)) { |
| 264 VisitUnallocated(instr); |
| 265 } else { |
| 266 VisitUnconditionalBranchToRegister(instr); |
| 267 } |
| 268 } |
| 269 break; |
| 270 } |
| 271 case 3: |
| 272 case 7: { |
| 273 VisitUnallocated(instr); |
| 274 break; |
| 275 } |
| 276 } |
| 277 } |
| 278 |
| 279 |
| 280 void Decoder::DecodeLoadStore(Instruction* instr) { |
| 281 ASSERT((instr->Bits(27, 24) == 0x8) || |
| 282 (instr->Bits(27, 24) == 0x9) || |
| 283 (instr->Bits(27, 24) == 0xC) || |
| 284 (instr->Bits(27, 24) == 0xD) ); |
| 285 |
| 286 if (instr->Bit(24) == 0) { |
| 287 if (instr->Bit(28) == 0) { |
| 288 if (instr->Bit(29) == 0) { |
| 289 if (instr->Bit(26) == 0) { |
| 290 // TODO(all): VisitLoadStoreExclusive. |
| 291 VisitUnimplemented(instr); |
| 292 } else { |
| 293 DecodeAdvSIMDLoadStore(instr); |
| 294 } |
| 295 } else { |
| 296 if ((instr->Bits(31, 30) == 0x3) || |
| 297 (instr->Mask(0xC4400000) == 0x40000000)) { |
| 298 VisitUnallocated(instr); |
| 299 } else { |
| 300 if (instr->Bit(23) == 0) { |
| 301 if (instr->Mask(0xC4400000) == 0xC0400000) { |
| 302 VisitUnallocated(instr); |
| 303 } else { |
| 304 VisitLoadStorePairNonTemporal(instr); |
| 305 } |
| 306 } else { |
| 307 VisitLoadStorePairPostIndex(instr); |
| 308 } |
| 309 } |
| 310 } |
| 311 } else { |
| 312 if (instr->Bit(29) == 0) { |
| 313 if (instr->Mask(0xC4000000) == 0xC4000000) { |
| 314 VisitUnallocated(instr); |
| 315 } else { |
| 316 VisitLoadLiteral(instr); |
| 317 } |
| 318 } else { |
| 319 if ((instr->Mask(0x84C00000) == 0x80C00000) || |
| 320 (instr->Mask(0x44800000) == 0x44800000) || |
| 321 (instr->Mask(0x84800000) == 0x84800000)) { |
| 322 VisitUnallocated(instr); |
| 323 } else { |
| 324 if (instr->Bit(21) == 0) { |
| 325 switch (instr->Bits(11, 10)) { |
| 326 case 0: { |
| 327 VisitLoadStoreUnscaledOffset(instr); |
| 328 break; |
| 329 } |
| 330 case 1: { |
| 331 if (instr->Mask(0xC4C00000) == 0xC0800000) { |
| 332 VisitUnallocated(instr); |
| 333 } else { |
| 334 VisitLoadStorePostIndex(instr); |
| 335 } |
| 336 break; |
| 337 } |
| 338 case 2: { |
| 339 // TODO(all): VisitLoadStoreRegisterOffsetUnpriv. |
| 340 VisitUnimplemented(instr); |
| 341 break; |
| 342 } |
| 343 case 3: { |
| 344 if (instr->Mask(0xC4C00000) == 0xC0800000) { |
| 345 VisitUnallocated(instr); |
| 346 } else { |
| 347 VisitLoadStorePreIndex(instr); |
| 348 } |
| 349 break; |
| 350 } |
| 351 } |
| 352 } else { |
| 353 if (instr->Bits(11, 10) == 0x2) { |
| 354 if (instr->Bit(14) == 0) { |
| 355 VisitUnallocated(instr); |
| 356 } else { |
| 357 VisitLoadStoreRegisterOffset(instr); |
| 358 } |
| 359 } else { |
| 360 VisitUnallocated(instr); |
| 361 } |
| 362 } |
| 363 } |
| 364 } |
| 365 } |
| 366 } else { |
| 367 if (instr->Bit(28) == 0) { |
| 368 if (instr->Bit(29) == 0) { |
| 369 VisitUnallocated(instr); |
| 370 } else { |
| 371 if ((instr->Bits(31, 30) == 0x3) || |
| 372 (instr->Mask(0xC4400000) == 0x40000000)) { |
| 373 VisitUnallocated(instr); |
| 374 } else { |
| 375 if (instr->Bit(23) == 0) { |
| 376 VisitLoadStorePairOffset(instr); |
| 377 } else { |
| 378 VisitLoadStorePairPreIndex(instr); |
| 379 } |
| 380 } |
| 381 } |
| 382 } else { |
| 383 if (instr->Bit(29) == 0) { |
| 384 VisitUnallocated(instr); |
| 385 } else { |
| 386 if ((instr->Mask(0x84C00000) == 0x80C00000) || |
| 387 (instr->Mask(0x44800000) == 0x44800000) || |
| 388 (instr->Mask(0x84800000) == 0x84800000)) { |
| 389 VisitUnallocated(instr); |
| 390 } else { |
| 391 VisitLoadStoreUnsignedOffset(instr); |
| 392 } |
| 393 } |
| 394 } |
| 395 } |
| 396 } |
| 397 |
| 398 |
| 399 void Decoder::DecodeLogical(Instruction* instr) { |
| 400 ASSERT(instr->Bits(27, 24) == 0x2); |
| 401 |
| 402 if (instr->Mask(0x80400000) == 0x00400000) { |
| 403 VisitUnallocated(instr); |
| 404 } else { |
| 405 if (instr->Bit(23) == 0) { |
| 406 VisitLogicalImmediate(instr); |
| 407 } else { |
| 408 if (instr->Bits(30, 29) == 0x1) { |
| 409 VisitUnallocated(instr); |
| 410 } else { |
| 411 VisitMoveWideImmediate(instr); |
| 412 } |
| 413 } |
| 414 } |
| 415 } |
| 416 |
| 417 |
| 418 void Decoder::DecodeBitfieldExtract(Instruction* instr) { |
| 419 ASSERT(instr->Bits(27, 24) == 0x3); |
| 420 |
| 421 if ((instr->Mask(0x80400000) == 0x80000000) || |
| 422 (instr->Mask(0x80400000) == 0x00400000) || |
| 423 (instr->Mask(0x80008000) == 0x00008000)) { |
| 424 VisitUnallocated(instr); |
| 425 } else if (instr->Bit(23) == 0) { |
| 426 if ((instr->Mask(0x80200000) == 0x00200000) || |
| 427 (instr->Mask(0x60000000) == 0x60000000)) { |
| 428 VisitUnallocated(instr); |
| 429 } else { |
| 430 VisitBitfield(instr); |
| 431 } |
| 432 } else { |
| 433 if ((instr->Mask(0x60200000) == 0x00200000) || |
| 434 (instr->Mask(0x60000000) != 0x00000000)) { |
| 435 VisitUnallocated(instr); |
| 436 } else { |
| 437 VisitExtract(instr); |
| 438 } |
| 439 } |
| 440 } |
| 441 |
| 442 |
| 443 void Decoder::DecodeAddSubImmediate(Instruction* instr) { |
| 444 ASSERT(instr->Bits(27, 24) == 0x1); |
| 445 if (instr->Bit(23) == 1) { |
| 446 VisitUnallocated(instr); |
| 447 } else { |
| 448 VisitAddSubImmediate(instr); |
| 449 } |
| 450 } |
| 451 |
| 452 |
| 453 void Decoder::DecodeDataProcessing(Instruction* instr) { |
| 454 ASSERT((instr->Bits(27, 24) == 0xA) || |
| 455 (instr->Bits(27, 24) == 0xB) ); |
| 456 |
| 457 if (instr->Bit(24) == 0) { |
| 458 if (instr->Bit(28) == 0) { |
| 459 if (instr->Mask(0x80008000) == 0x00008000) { |
| 460 VisitUnallocated(instr); |
| 461 } else { |
| 462 VisitLogicalShifted(instr); |
| 463 } |
| 464 } else { |
| 465 switch (instr->Bits(23, 21)) { |
| 466 case 0: { |
| 467 if (instr->Mask(0x0000FC00) != 0) { |
| 468 VisitUnallocated(instr); |
| 469 } else { |
| 470 VisitAddSubWithCarry(instr); |
| 471 } |
| 472 break; |
| 473 } |
| 474 case 2: { |
| 475 if ((instr->Bit(29) == 0) || |
| 476 (instr->Mask(0x00000410) != 0)) { |
| 477 VisitUnallocated(instr); |
| 478 } else { |
| 479 if (instr->Bit(11) == 0) { |
| 480 VisitConditionalCompareRegister(instr); |
| 481 } else { |
| 482 VisitConditionalCompareImmediate(instr); |
| 483 } |
| 484 } |
| 485 break; |
| 486 } |
| 487 case 4: { |
| 488 if (instr->Mask(0x20000800) != 0x00000000) { |
| 489 VisitUnallocated(instr); |
| 490 } else { |
| 491 VisitConditionalSelect(instr); |
| 492 } |
| 493 break; |
| 494 } |
| 495 case 6: { |
| 496 if (instr->Bit(29) == 0x1) { |
| 497 VisitUnallocated(instr); |
| 498 } else { |
| 499 if (instr->Bit(30) == 0) { |
| 500 if ((instr->Bit(15) == 0x1) || |
| 501 (instr->Bits(15, 11) == 0) || |
| 502 (instr->Bits(15, 12) == 0x1) || |
| 503 (instr->Bits(15, 12) == 0x3) || |
| 504 (instr->Bits(15, 13) == 0x3) || |
| 505 (instr->Mask(0x8000EC00) == 0x00004C00) || |
| 506 (instr->Mask(0x8000E800) == 0x80004000) || |
| 507 (instr->Mask(0x8000E400) == 0x80004000)) { |
| 508 VisitUnallocated(instr); |
| 509 } else { |
| 510 VisitDataProcessing2Source(instr); |
| 511 } |
| 512 } else { |
| 513 if ((instr->Bit(13) == 1) || |
| 514 (instr->Bits(20, 16) != 0) || |
| 515 (instr->Bits(15, 14) != 0) || |
| 516 (instr->Mask(0xA01FFC00) == 0x00000C00) || |
| 517 (instr->Mask(0x201FF800) == 0x00001800)) { |
| 518 VisitUnallocated(instr); |
| 519 } else { |
| 520 VisitDataProcessing1Source(instr); |
| 521 } |
| 522 } |
| 523 break; |
| 524 } |
| 525 } |
| 526 case 1: |
| 527 case 3: |
| 528 case 5: |
| 529 case 7: VisitUnallocated(instr); break; |
| 530 } |
| 531 } |
| 532 } else { |
| 533 if (instr->Bit(28) == 0) { |
| 534 if (instr->Bit(21) == 0) { |
| 535 if ((instr->Bits(23, 22) == 0x3) || |
| 536 (instr->Mask(0x80008000) == 0x00008000)) { |
| 537 VisitUnallocated(instr); |
| 538 } else { |
| 539 VisitAddSubShifted(instr); |
| 540 } |
| 541 } else { |
| 542 if ((instr->Mask(0x00C00000) != 0x00000000) || |
| 543 (instr->Mask(0x00001400) == 0x00001400) || |
| 544 (instr->Mask(0x00001800) == 0x00001800)) { |
| 545 VisitUnallocated(instr); |
| 546 } else { |
| 547 VisitAddSubExtended(instr); |
| 548 } |
| 549 } |
| 550 } else { |
| 551 if ((instr->Bit(30) == 0x1) || |
| 552 (instr->Bits(30, 29) == 0x1) || |
| 553 (instr->Mask(0xE0600000) == 0x00200000) || |
| 554 (instr->Mask(0xE0608000) == 0x00400000) || |
| 555 (instr->Mask(0x60608000) == 0x00408000) || |
| 556 (instr->Mask(0x60E00000) == 0x00E00000) || |
| 557 (instr->Mask(0x60E00000) == 0x00800000) || |
| 558 (instr->Mask(0x60E00000) == 0x00600000)) { |
| 559 VisitUnallocated(instr); |
| 560 } else { |
| 561 VisitDataProcessing3Source(instr); |
| 562 } |
| 563 } |
| 564 } |
| 565 } |
| 566 |
| 567 |
| 568 void Decoder::DecodeFP(Instruction* instr) { |
| 569 ASSERT((instr->Bits(27, 24) == 0xE) || |
| 570 (instr->Bits(27, 24) == 0xF) ); |
| 571 |
| 572 if (instr->Bit(28) == 0) { |
| 573 DecodeAdvSIMDDataProcessing(instr); |
| 574 } else { |
| 575 if (instr->Bit(29) == 1) { |
| 576 VisitUnallocated(instr); |
| 577 } else { |
| 578 if (instr->Bits(31, 30) == 0x3) { |
| 579 VisitUnallocated(instr); |
| 580 } else if (instr->Bits(31, 30) == 0x1) { |
| 581 DecodeAdvSIMDDataProcessing(instr); |
| 582 } else { |
| 583 if (instr->Bit(24) == 0) { |
| 584 if (instr->Bit(21) == 0) { |
| 585 if ((instr->Bit(23) == 1) || |
| 586 (instr->Bit(18) == 1) || |
| 587 (instr->Mask(0x80008000) == 0x00000000) || |
| 588 (instr->Mask(0x000E0000) == 0x00000000) || |
| 589 (instr->Mask(0x000E0000) == 0x000A0000) || |
| 590 (instr->Mask(0x00160000) == 0x00000000) || |
| 591 (instr->Mask(0x00160000) == 0x00120000)) { |
| 592 VisitUnallocated(instr); |
| 593 } else { |
| 594 VisitFPFixedPointConvert(instr); |
| 595 } |
| 596 } else { |
| 597 if (instr->Bits(15, 10) == 32) { |
| 598 VisitUnallocated(instr); |
| 599 } else if (instr->Bits(15, 10) == 0) { |
| 600 if ((instr->Bits(23, 22) == 0x3) || |
| 601 (instr->Mask(0x000E0000) == 0x000A0000) || |
| 602 (instr->Mask(0x000E0000) == 0x000C0000) || |
| 603 (instr->Mask(0x00160000) == 0x00120000) || |
| 604 (instr->Mask(0x00160000) == 0x00140000) || |
| 605 (instr->Mask(0x20C40000) == 0x00800000) || |
| 606 (instr->Mask(0x20C60000) == 0x00840000) || |
| 607 (instr->Mask(0xA0C60000) == 0x80060000) || |
| 608 (instr->Mask(0xA0C60000) == 0x00860000) || |
| 609 (instr->Mask(0xA0C60000) == 0x00460000) || |
| 610 (instr->Mask(0xA0CE0000) == 0x80860000) || |
| 611 (instr->Mask(0xA0CE0000) == 0x804E0000) || |
| 612 (instr->Mask(0xA0CE0000) == 0x000E0000) || |
| 613 (instr->Mask(0xA0D60000) == 0x00160000) || |
| 614 (instr->Mask(0xA0D60000) == 0x80560000) || |
| 615 (instr->Mask(0xA0D60000) == 0x80960000)) { |
| 616 VisitUnallocated(instr); |
| 617 } else { |
| 618 VisitFPIntegerConvert(instr); |
| 619 } |
| 620 } else if (instr->Bits(14, 10) == 16) { |
| 621 const Instr masked_A0DF8000 = instr->Mask(0xA0DF8000); |
| 622 if ((instr->Mask(0x80180000) != 0) || |
| 623 (masked_A0DF8000 == 0x00020000) || |
| 624 (masked_A0DF8000 == 0x00030000) || |
| 625 (masked_A0DF8000 == 0x00068000) || |
| 626 (masked_A0DF8000 == 0x00428000) || |
| 627 (masked_A0DF8000 == 0x00430000) || |
| 628 (masked_A0DF8000 == 0x00468000) || |
| 629 (instr->Mask(0xA0D80000) == 0x00800000) || |
| 630 (instr->Mask(0xA0DE0000) == 0x00C00000) || |
| 631 (instr->Mask(0xA0DF0000) == 0x00C30000) || |
| 632 (instr->Mask(0xA0DC0000) == 0x00C40000)) { |
| 633 VisitUnallocated(instr); |
| 634 } else { |
| 635 VisitFPDataProcessing1Source(instr); |
| 636 } |
| 637 } else if (instr->Bits(13, 10) == 8) { |
| 638 if ((instr->Bits(15, 14) != 0) || |
| 639 (instr->Bits(2, 0) != 0) || |
| 640 (instr->Mask(0x80800000) != 0x00000000)) { |
| 641 VisitUnallocated(instr); |
| 642 } else { |
| 643 VisitFPCompare(instr); |
| 644 } |
| 645 } else if (instr->Bits(12, 10) == 4) { |
| 646 if ((instr->Bits(9, 5) != 0) || |
| 647 (instr->Mask(0x80800000) != 0x00000000)) { |
| 648 VisitUnallocated(instr); |
| 649 } else { |
| 650 VisitFPImmediate(instr); |
| 651 } |
| 652 } else { |
| 653 if (instr->Mask(0x80800000) != 0x00000000) { |
| 654 VisitUnallocated(instr); |
| 655 } else { |
| 656 switch (instr->Bits(11, 10)) { |
| 657 case 1: { |
| 658 VisitFPConditionalCompare(instr); |
| 659 break; |
| 660 } |
| 661 case 2: { |
| 662 if ((instr->Bits(15, 14) == 0x3) || |
| 663 (instr->Mask(0x00009000) == 0x00009000) || |
| 664 (instr->Mask(0x0000A000) == 0x0000A000)) { |
| 665 VisitUnallocated(instr); |
| 666 } else { |
| 667 VisitFPDataProcessing2Source(instr); |
| 668 } |
| 669 break; |
| 670 } |
| 671 case 3: { |
| 672 VisitFPConditionalSelect(instr); |
| 673 break; |
| 674 } |
| 675 default: UNREACHABLE(); |
| 676 } |
| 677 } |
| 678 } |
| 679 } |
| 680 } else { |
| 681 // Bit 30 == 1 has been handled earlier. |
| 682 ASSERT(instr->Bit(30) == 0); |
| 683 if (instr->Mask(0xA0800000) != 0) { |
| 684 VisitUnallocated(instr); |
| 685 } else { |
| 686 VisitFPDataProcessing3Source(instr); |
| 687 } |
| 688 } |
| 689 } |
| 690 } |
| 691 } |
| 692 } |
| 693 |
| 694 |
| 695 void Decoder::DecodeAdvSIMDLoadStore(Instruction* instr) { |
| 696 // TODO(all): Implement Advanced SIMD load/store instruction decode. |
| 697 ASSERT(instr->Bits(29, 25) == 0x6); |
| 698 VisitUnimplemented(instr); |
| 699 } |
| 700 |
| 701 |
| 702 void Decoder::DecodeAdvSIMDDataProcessing(Instruction* instr) { |
| 703 // TODO(all): Implement Advanced SIMD data processing instruction decode. |
| 704 ASSERT(instr->Bits(27, 25) == 0x7); |
| 705 VisitUnimplemented(instr); |
| 706 } |
| 707 |
| 708 |
| 709 #define DEFINE_VISITOR_CALLERS(A) \ |
| 710 void Decoder::Visit##A(Instruction *instr) { \ |
| 711 if (!(instr->Mask(A##FMask) == A##Fixed)) { \ |
| 712 ASSERT(instr->Mask(A##FMask) == A##Fixed); \ |
| 713 } \ |
| 714 std::list<DecoderVisitor*>::iterator it; \ |
| 715 for (it = visitors_.begin(); it != visitors_.end(); it++) { \ |
| 716 (*it)->Visit##A(instr); \ |
| 717 } \ |
| 718 } |
| 719 VISITOR_LIST(DEFINE_VISITOR_CALLERS) |
| 720 #undef DEFINE_VISITOR_CALLERS |
| 721 |
| 722 |
| 723 } } // namespace v8::internal |
| 724 |
| 725 #endif // V8_TARGET_ARCH_A64 |
| OLD | NEW |