| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include <limits.h> | 5 #include <limits.h> |
| 6 #include <stdarg.h> | 6 #include <stdarg.h> |
| 7 #include <stdlib.h> | 7 #include <stdlib.h> |
| 8 #include <cmath> | 8 #include <cmath> |
| 9 | 9 |
| 10 #if V8_TARGET_ARCH_MIPS | 10 #if V8_TARGET_ARCH_MIPS |
| (...skipping 3496 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3507 alu_out = rt_u() >> rs(); | 3507 alu_out = rt_u() >> rs(); |
| 3508 } else { | 3508 } else { |
| 3509 // Logical right-rotate of a word by a variable number of bits. | 3509 // Logical right-rotate of a word by a variable number of bits. |
| 3510 // This is special case od SRLV instruction, added in MIPS32 | 3510 // This is special case od SRLV instruction, added in MIPS32 |
| 3511 // Release 2. SA field is equal to 00001. | 3511 // Release 2. SA field is equal to 00001. |
| 3512 alu_out = base::bits::RotateRight32(rt_u(), rs_u()); | 3512 alu_out = base::bits::RotateRight32(rt_u(), rs_u()); |
| 3513 } | 3513 } |
| 3514 SetResult(rd_reg(), static_cast<int32_t>(alu_out)); | 3514 SetResult(rd_reg(), static_cast<int32_t>(alu_out)); |
| 3515 break; | 3515 break; |
| 3516 case SRAV: | 3516 case SRAV: |
| 3517 alu_out = rt() >> rs(); | 3517 SetResult(rd_reg(), rt() >> rs()); |
| 3518 SetResult(rd_reg(), static_cast<int32_t>(alu_out)); | |
| 3519 break; | 3518 break; |
| 3519 case LSA: { |
| 3520 DCHECK(IsMipsArchVariant(kMips32r6)); |
| 3521 int8_t sa = lsa_sa() + 1; |
| 3522 int32_t _rt = rt(); |
| 3523 int32_t _rs = rs(); |
| 3524 int32_t res = _rs << sa; |
| 3525 res += _rt; |
| 3526 DCHECK_EQ(res, (rs() << (lsa_sa() + 1)) + rt()); |
| 3527 SetResult(rd_reg(), (rs() << (lsa_sa() + 1)) + rt()); |
| 3528 break; |
| 3529 } |
| 3520 case MFHI: // MFHI == CLZ on R6. | 3530 case MFHI: // MFHI == CLZ on R6. |
| 3521 if (!IsMipsArchVariant(kMips32r6)) { | 3531 if (!IsMipsArchVariant(kMips32r6)) { |
| 3522 DCHECK(sa() == 0); | 3532 DCHECK(sa() == 0); |
| 3523 alu_out = get_register(HI); | 3533 alu_out = get_register(HI); |
| 3524 } else { | 3534 } else { |
| 3525 // MIPS spec: If no bits were set in GPR rs, the result written to | 3535 // MIPS spec: If no bits were set in GPR rs, the result written to |
| 3526 // GPR rd is 32. | 3536 // GPR rd is 32. |
| 3527 DCHECK(sa() == 1); | 3537 DCHECK(sa() == 1); |
| 3528 alu_out = base::bits::CountLeadingZeros32(rs_u()); | 3538 alu_out = base::bits::CountLeadingZeros32(rs_u()); |
| 3529 } | 3539 } |
| (...skipping 1051 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4581 | 4591 |
| 4582 | 4592 |
| 4583 #undef UNSUPPORTED | 4593 #undef UNSUPPORTED |
| 4584 | 4594 |
| 4585 } // namespace internal | 4595 } // namespace internal |
| 4586 } // namespace v8 | 4596 } // namespace v8 |
| 4587 | 4597 |
| 4588 #endif // USE_SIMULATOR | 4598 #endif // USE_SIMULATOR |
| 4589 | 4599 |
| 4590 #endif // V8_TARGET_ARCH_MIPS | 4600 #endif // V8_TARGET_ARCH_MIPS |
| OLD | NEW |