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_MIPS64 | 10 #if V8_TARGET_ARCH_MIPS64 |
(...skipping 3413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3424 // Logical right-rotate of a word by a fixed number of bits. This | 3424 // Logical right-rotate of a word by a fixed number of bits. This |
3425 // is special case of SRL instruction, added in MIPS32 Release 2. | 3425 // is special case of SRL instruction, added in MIPS32 Release 2. |
3426 // RS field is equal to 00001. | 3426 // RS field is equal to 00001. |
3427 alu_out = static_cast<int32_t>( | 3427 alu_out = static_cast<int32_t>( |
3428 base::bits::RotateRight32(static_cast<const uint32_t>(rt_u()), | 3428 base::bits::RotateRight32(static_cast<const uint32_t>(rt_u()), |
3429 static_cast<const uint32_t>(sa()))); | 3429 static_cast<const uint32_t>(sa()))); |
3430 } | 3430 } |
3431 SetResult(rd_reg(), alu_out); | 3431 SetResult(rd_reg(), alu_out); |
3432 break; | 3432 break; |
3433 case DSRL: | 3433 case DSRL: |
3434 SetResult(rd_reg(), rt_u() >> sa()); | 3434 if (rs_reg() == 0) { |
3435 // Regular logical right shift of a word by a fixed number of | |
3436 // bits instruction. RS field is always equal to 0. | |
3437 // Sign-extend the 64-bit result. | |
balazs.kilvady
2016/04/12 10:18:00
Is it realy necessary to use double conversion in
Marija Antic
2016/04/12 12:59:16
Done.
| |
3438 alu_out = static_cast<int64_t>(static_cast<uint64_t>(rt_u()) >> sa()); | |
Ilija.Pavlovic1
2016/04/12 12:31:32
rt_u() already returns uint64_t.
| |
3439 } else { | |
3440 // Logical right-rotate of a word by a fixed number of bits. This | |
3441 // is special case of SRL instruction, added in MIPS32 Release 2. | |
3442 // RS field is equal to 00001. | |
3443 alu_out = static_cast<int64_t>( | |
3444 base::bits::RotateRight64(static_cast<const uint64_t>(rt_u()), | |
3445 static_cast<const uint64_t>(sa()))); | |
balazs.kilvady
2016/04/12 10:18:00
RotateRight64() gets its inputs by value so conver
Marija Antic
2016/04/12 12:59:16
Done.
| |
3446 } | |
3447 SetResult(rd_reg(), alu_out); | |
3435 break; | 3448 break; |
Ilija.Pavlovic1
2016/04/12 12:31:32
Rs field has defined values 0 and 1. Other values
Marija Antic
2016/04/12 12:59:16
Done.
| |
3436 case DSRL32: | 3449 case DSRL32: |
3437 SetResult(rd_reg(), rt_u() >> sa() >> 32); | 3450 if (rs_reg() == 0) { |
3451 // Regular logical right shift of a word by a fixed number of | |
3452 // bits instruction. RS field is always equal to 0. | |
3453 // Sign-extend the 64-bit result. | |
3454 alu_out = | |
3455 static_cast<int64_t>(static_cast<uint64_t>(rt_u()) >> sa() >> 32); | |
3456 } else { | |
3457 // Logical right-rotate of a word by a fixed number of bits. This | |
3458 // is special case of SRL instruction, added in MIPS32 Release 2. | |
3459 // RS field is equal to 00001. | |
3460 alu_out = static_cast<int64_t>( | |
3461 base::bits::RotateRight64(static_cast<const uint64_t>(rt_u()), | |
3462 static_cast<const uint64_t>(sa()) + 32)); | |
3463 } | |
balazs.kilvady
2016/04/12 10:18:00
Same conversion notes like above.
| |
3464 SetResult(rd_reg(), alu_out); | |
3438 break; | 3465 break; |
Ilija.Pavlovic1
2016/04/12 12:31:32
To use "switch-case" as for DSRL.
Marija Antic
2016/04/12 12:59:16
Keeping it with rs_reg() (it does the same), in or
| |
3439 case SRA: | 3466 case SRA: |
3440 SetResult(rd_reg(), (int32_t)rt() >> sa()); | 3467 SetResult(rd_reg(), (int32_t)rt() >> sa()); |
3441 break; | 3468 break; |
3442 case DSRA: | 3469 case DSRA: |
3443 SetResult(rd_reg(), rt() >> sa()); | 3470 SetResult(rd_reg(), rt() >> sa()); |
3444 break; | 3471 break; |
3445 case DSRA32: | 3472 case DSRA32: |
3446 SetResult(rd_reg(), rt() >> sa() >> 32); | 3473 SetResult(rd_reg(), rt() >> sa() >> 32); |
3447 break; | 3474 break; |
3448 case SLLV: | 3475 case SLLV: |
(...skipping 1397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4846 } | 4873 } |
4847 | 4874 |
4848 | 4875 |
4849 #undef UNSUPPORTED | 4876 #undef UNSUPPORTED |
4850 } // namespace internal | 4877 } // namespace internal |
4851 } // namespace v8 | 4878 } // namespace v8 |
4852 | 4879 |
4853 #endif // USE_SIMULATOR | 4880 #endif // USE_SIMULATOR |
4854 | 4881 |
4855 #endif // V8_TARGET_ARCH_MIPS64 | 4882 #endif // V8_TARGET_ARCH_MIPS64 |
OLD | NEW |