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 3979 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3990 int Vn = instr->VFPNRegValue(kSimd128Precision); | 3990 int Vn = instr->VFPNRegValue(kSimd128Precision); |
3991 uint32_t src1[4], src2[4]; | 3991 uint32_t src1[4], src2[4]; |
3992 get_q_register(Vn, src1); | 3992 get_q_register(Vn, src1); |
3993 get_q_register(Vm, src2); | 3993 get_q_register(Vm, src2); |
3994 for (int i = 0; i < 4; i++) { | 3994 for (int i = 0; i < 4; i++) { |
3995 src1[i] = bit_cast<float>(src1[i]) == bit_cast<float>(src2[i]) | 3995 src1[i] = bit_cast<float>(src1[i]) == bit_cast<float>(src2[i]) |
3996 ? 0xFFFFFFFF | 3996 ? 0xFFFFFFFF |
3997 : 0; | 3997 : 0; |
3998 } | 3998 } |
3999 set_q_register(Vd, src1); | 3999 set_q_register(Vd, src1); |
4000 | 4000 } else if (instr->Bit(20) == 0 && instr->Bits(11, 8) == 0xf && |
| 4001 instr->Bit(6) == 1 && instr->Bit(4) == 1) { |
| 4002 int Vd = instr->VFPDRegValue(kSimd128Precision); |
| 4003 int Vm = instr->VFPMRegValue(kSimd128Precision); |
| 4004 int Vn = instr->VFPNRegValue(kSimd128Precision); |
| 4005 uint32_t src1[4], src2[4]; |
| 4006 get_q_register(Vn, src1); |
| 4007 get_q_register(Vm, src2); |
| 4008 if (instr->Bit(21) == 0) { |
| 4009 // vrecps.f32 Qd, Qm, Qn. |
| 4010 for (int i = 0; i < 4; i++) { |
| 4011 src1[i] = bit_cast<uint32_t>( |
| 4012 2.0f - bit_cast<float>(src1[i]) * bit_cast<float>(src2[i])); |
| 4013 } |
| 4014 } else { |
| 4015 // vrsqrts.f32 Qd, Qm, Qn. |
| 4016 for (int i = 0; i < 4; i++) { |
| 4017 src1[i] = bit_cast<uint32_t>( |
| 4018 (3.0f - bit_cast<float>(src1[i]) * bit_cast<float>(src2[i])) / |
| 4019 2); |
| 4020 } |
| 4021 } |
| 4022 set_q_register(Vd, src1); |
4001 } else { | 4023 } else { |
4002 UNIMPLEMENTED(); | 4024 UNIMPLEMENTED(); |
4003 } | 4025 } |
4004 break; | 4026 break; |
4005 case 5: | 4027 case 5: |
4006 if ((instr->Bits(18, 16) == 0) && (instr->Bits(11, 6) == 0x28) && | 4028 if ((instr->Bits(18, 16) == 0) && (instr->Bits(11, 6) == 0x28) && |
4007 (instr->Bit(4) == 1)) { | 4029 (instr->Bit(4) == 1)) { |
4008 // vmovl signed | 4030 // vmovl signed |
4009 if ((instr->VdValue() & 1) != 0) UNIMPLEMENTED(); | 4031 if ((instr->VdValue() & 1) != 0) UNIMPLEMENTED(); |
4010 int Vd = (instr->Bit(22) << 3) | (instr->VdValue() >> 1); | 4032 int Vd = (instr->Bit(22) << 3) | (instr->VdValue() >> 1); |
(...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4500 } | 4522 } |
4501 default: | 4523 default: |
4502 UNIMPLEMENTED(); | 4524 UNIMPLEMENTED(); |
4503 break; | 4525 break; |
4504 } | 4526 } |
4505 } | 4527 } |
4506 } else { | 4528 } else { |
4507 UNIMPLEMENTED(); | 4529 UNIMPLEMENTED(); |
4508 } | 4530 } |
4509 set_q_register(Vd, src); | 4531 set_q_register(Vd, src); |
| 4532 } else if (instr->Bits(19, 18) == 0x2 && instr->Bits(11, 8) == 0x5) { |
| 4533 // vrecpe/vrsqrte.f32 Qd, Qm. |
| 4534 int Vd = instr->VFPDRegValue(kSimd128Precision); |
| 4535 int Vm = instr->VFPMRegValue(kSimd128Precision); |
| 4536 uint32_t src[4]; |
| 4537 get_q_register(Vm, src); |
| 4538 if (instr->Bit(7) == 0) { |
| 4539 for (int i = 0; i < 4; i++) { |
| 4540 float denom = bit_cast<float>(src[i]); |
| 4541 div_zero_vfp_flag_ = (denom == 0); |
| 4542 float result = 1.0f / denom; |
| 4543 result = canonicalizeNaN(result); |
| 4544 src[i] = bit_cast<uint32_t>(result); |
| 4545 } |
| 4546 } else { |
| 4547 lazily_initialize_fast_sqrt(isolate_); |
| 4548 for (int i = 0; i < 4; i++) { |
| 4549 float radicand = bit_cast<float>(src[i]); |
| 4550 float result = 1.0f / fast_sqrt(radicand, isolate_); |
| 4551 result = canonicalizeNaN(result); |
| 4552 src[i] = bit_cast<uint32_t>(result); |
| 4553 } |
| 4554 } |
| 4555 set_q_register(Vd, src); |
4510 } else { | 4556 } else { |
4511 UNIMPLEMENTED(); | 4557 UNIMPLEMENTED(); |
4512 } | 4558 } |
4513 } else { | 4559 } else { |
4514 UNIMPLEMENTED(); | 4560 UNIMPLEMENTED(); |
4515 } | 4561 } |
4516 break; | 4562 break; |
4517 case 8: | 4563 case 8: |
4518 if (instr->Bits(21, 20) == 0) { | 4564 if (instr->Bits(21, 20) == 0) { |
4519 // vst1 | 4565 // vst1 |
(...skipping 503 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5023 set_register(sp, current_sp + sizeof(uintptr_t)); | 5069 set_register(sp, current_sp + sizeof(uintptr_t)); |
5024 return address; | 5070 return address; |
5025 } | 5071 } |
5026 | 5072 |
5027 } // namespace internal | 5073 } // namespace internal |
5028 } // namespace v8 | 5074 } // namespace v8 |
5029 | 5075 |
5030 #endif // USE_SIMULATOR | 5076 #endif // USE_SIMULATOR |
5031 | 5077 |
5032 #endif // V8_TARGET_ARCH_ARM | 5078 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |