OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 <stdarg.h> | 5 #include <stdarg.h> |
6 #include <stdlib.h> | 6 #include <stdlib.h> |
7 #include <cmath> | 7 #include <cmath> |
8 | 8 |
9 #if V8_TARGET_ARCH_ARM | 9 #if V8_TARGET_ARCH_ARM |
10 | 10 |
(...skipping 2868 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2879 // SMMLA (in V8 notation matching ARM ISA format) | 2879 // SMMLA (in V8 notation matching ARM ISA format) |
2880 // Format(instr, "smmla'cond 'rn, 'rm, 'rs, 'rd"); | 2880 // Format(instr, "smmla'cond 'rn, 'rm, 'rs, 'rd"); |
2881 int rd = instr->RdValue(); | 2881 int rd = instr->RdValue(); |
2882 int32_t rd_val = get_register(rd); | 2882 int32_t rd_val = get_register(rd); |
2883 rn_val = base::bits::SignedMulHighAndAdd32(rm_val, rs_val, rd_val); | 2883 rn_val = base::bits::SignedMulHighAndAdd32(rm_val, rs_val, rd_val); |
2884 } | 2884 } |
2885 set_register(rn, rn_val); | 2885 set_register(rn, rn_val); |
2886 return; | 2886 return; |
2887 } | 2887 } |
2888 } | 2888 } |
2889 if (FLAG_enable_sudiv) { | 2889 if (instr->Bits(5, 4) == 0x1) { |
2890 if (instr->Bits(5, 4) == 0x1) { | 2890 if ((instr->Bit(22) == 0x0) && (instr->Bit(20) == 0x1)) { |
2891 if ((instr->Bit(22) == 0x0) && (instr->Bit(20) == 0x1)) { | 2891 // (s/u)div (in V8 notation matching ARM ISA format) rn = rm/rs |
2892 // (s/u)div (in V8 notation matching ARM ISA format) rn = rm/rs | 2892 // Format(instr, "'(s/u)div'cond'b 'rn, 'rm, 'rs); |
2893 // Format(instr, "'(s/u)div'cond'b 'rn, 'rm, 'rs); | 2893 int rm = instr->RmValue(); |
2894 int rm = instr->RmValue(); | 2894 int32_t rm_val = get_register(rm); |
2895 int32_t rm_val = get_register(rm); | 2895 int rs = instr->RsValue(); |
2896 int rs = instr->RsValue(); | 2896 int32_t rs_val = get_register(rs); |
2897 int32_t rs_val = get_register(rs); | 2897 int32_t ret_val = 0; |
2898 int32_t ret_val = 0; | 2898 // udiv |
2899 // udiv | 2899 if (instr->Bit(21) == 0x1) { |
2900 if (instr->Bit(21) == 0x1) { | 2900 ret_val = bit_cast<int32_t>(base::bits::UnsignedDiv32( |
2901 ret_val = bit_cast<int32_t>(base::bits::UnsignedDiv32( | 2901 bit_cast<uint32_t>(rm_val), bit_cast<uint32_t>(rs_val))); |
2902 bit_cast<uint32_t>(rm_val), bit_cast<uint32_t>(rs_val))); | 2902 } else { |
2903 } else { | 2903 ret_val = base::bits::SignedDiv32(rm_val, rs_val); |
2904 ret_val = base::bits::SignedDiv32(rm_val, rs_val); | |
2905 } | |
2906 set_register(rn, ret_val); | |
2907 return; | |
2908 } | 2904 } |
| 2905 set_register(rn, ret_val); |
| 2906 return; |
2909 } | 2907 } |
2910 } | 2908 } |
2911 // Format(instr, "'memop'cond'b 'rd, ['rn, -'shift_rm]'w"); | 2909 // Format(instr, "'memop'cond'b 'rd, ['rn, -'shift_rm]'w"); |
2912 addr = rn_val - shifter_operand; | 2910 addr = rn_val - shifter_operand; |
2913 if (instr->HasW()) { | 2911 if (instr->HasW()) { |
2914 set_register(rn, addr); | 2912 set_register(rn, addr); |
2915 } | 2913 } |
2916 break; | 2914 break; |
2917 } | 2915 } |
2918 case ib_x: { | 2916 case ib_x: { |
(...skipping 1280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4199 set_register(sp, current_sp + sizeof(uintptr_t)); | 4197 set_register(sp, current_sp + sizeof(uintptr_t)); |
4200 return address; | 4198 return address; |
4201 } | 4199 } |
4202 | 4200 |
4203 } // namespace internal | 4201 } // namespace internal |
4204 } // namespace v8 | 4202 } // namespace v8 |
4205 | 4203 |
4206 #endif // USE_SIMULATOR | 4204 #endif // USE_SIMULATOR |
4207 | 4205 |
4208 #endif // V8_TARGET_ARCH_ARM | 4206 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |