Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(34)

Side by Side Diff: src/arm/simulator-arm.cc

Issue 2600153002: [ARM] Add vrecpe, vrecps, vrsqrte, vrsqrts instructions to assembler. (Closed)
Patch Set: Add a comment for vrecpe, vrsqrte. Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/arm/disasm-arm.cc ('k') | test/cctest/test-assembler-arm.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 3975 matching lines...) Expand 10 before | Expand all | Expand 10 after
3986 int Vm = instr->VFPMRegValue(kSimd128Precision); 3986 int Vm = instr->VFPMRegValue(kSimd128Precision);
3987 int Vn = instr->VFPNRegValue(kSimd128Precision); 3987 int Vn = instr->VFPNRegValue(kSimd128Precision);
3988 float src1[4], src2[4]; 3988 float src1[4], src2[4];
3989 get_q_register(Vn, src1); 3989 get_q_register(Vn, src1);
3990 get_q_register(Vm, src2); 3990 get_q_register(Vm, src2);
3991 uint32_t dst[4]; 3991 uint32_t dst[4];
3992 for (int i = 0; i < 4; i++) { 3992 for (int i = 0; i < 4; i++) {
3993 dst[i] = (src1[i] == src2[i]) ? 0xFFFFFFFF : 0; 3993 dst[i] = (src1[i] == src2[i]) ? 0xFFFFFFFF : 0;
3994 } 3994 }
3995 set_q_register(Vd, dst); 3995 set_q_register(Vd, dst);
3996 3996 } else if (instr->Bit(20) == 0 && instr->Bits(11, 8) == 0xf &&
3997 instr->Bit(6) == 1 && instr->Bit(4) == 1) {
3998 int Vd = instr->VFPDRegValue(kSimd128Precision);
3999 int Vm = instr->VFPMRegValue(kSimd128Precision);
4000 int Vn = instr->VFPNRegValue(kSimd128Precision);
4001 float src1[4], src2[4];
4002 get_q_register(Vn, src1);
4003 get_q_register(Vm, src2);
4004 if (instr->Bit(21) == 0) {
4005 // vrecps.f32 Qd, Qm, Qn.
4006 for (int i = 0; i < 4; i++) {
4007 src1[i] = 2.0f - src1[i] * src2[i];
4008 }
4009 } else {
4010 // vrsqrts.f32 Qd, Qm, Qn.
4011 for (int i = 0; i < 4; i++) {
4012 src1[i] = (3.0f - src1[i] * src2[i]) * 0.5f;
4013 }
4014 }
4015 set_q_register(Vd, src1);
3997 } else { 4016 } else {
3998 UNIMPLEMENTED(); 4017 UNIMPLEMENTED();
3999 } 4018 }
4000 break; 4019 break;
4001 case 5: 4020 case 5:
4002 if ((instr->Bits(18, 16) == 0) && (instr->Bits(11, 6) == 0x28) && 4021 if ((instr->Bits(18, 16) == 0) && (instr->Bits(11, 6) == 0x28) &&
4003 (instr->Bit(4) == 1)) { 4022 (instr->Bit(4) == 1)) {
4004 // vmovl signed 4023 // vmovl signed
4005 if ((instr->VdValue() & 1) != 0) UNIMPLEMENTED(); 4024 if ((instr->VdValue() & 1) != 0) UNIMPLEMENTED();
4006 int Vd = (instr->Bit(22) << 3) | (instr->VdValue() >> 1); 4025 int Vd = (instr->Bit(22) << 3) | (instr->VdValue() >> 1);
(...skipping 512 matching lines...) Expand 10 before | Expand all | Expand 10 after
4519 break; 4538 break;
4520 } 4539 }
4521 default: 4540 default:
4522 UNIMPLEMENTED(); 4541 UNIMPLEMENTED();
4523 break; 4542 break;
4524 } 4543 }
4525 } 4544 }
4526 } else { 4545 } else {
4527 UNIMPLEMENTED(); 4546 UNIMPLEMENTED();
4528 } 4547 }
4548 } else if (instr->Bits(19, 18) == 0x2 && instr->Bits(11, 8) == 0x5) {
4549 // vrecpe/vrsqrte.f32 Qd, Qm.
4550 int Vd = instr->VFPDRegValue(kSimd128Precision);
4551 int Vm = instr->VFPMRegValue(kSimd128Precision);
4552 uint32_t src[4];
4553 get_q_register(Vm, src);
4554 if (instr->Bit(7) == 0) {
4555 for (int i = 0; i < 4; i++) {
4556 float denom = bit_cast<float>(src[i]);
4557 div_zero_vfp_flag_ = (denom == 0);
4558 float result = 1.0f / denom;
4559 result = canonicalizeNaN(result);
4560 src[i] = bit_cast<uint32_t>(result);
4561 }
4562 } else {
4563 lazily_initialize_fast_sqrt(isolate_);
4564 for (int i = 0; i < 4; i++) {
4565 float radicand = bit_cast<float>(src[i]);
4566 float result = 1.0f / fast_sqrt(radicand, isolate_);
4567 result = canonicalizeNaN(result);
4568 src[i] = bit_cast<uint32_t>(result);
4569 }
4570 }
4571 set_q_register(Vd, src);
4529 } else { 4572 } else {
4530 UNIMPLEMENTED(); 4573 UNIMPLEMENTED();
4531 } 4574 }
4532 } else { 4575 } else {
4533 UNIMPLEMENTED(); 4576 UNIMPLEMENTED();
4534 } 4577 }
4535 break; 4578 break;
4536 case 8: 4579 case 8:
4537 if (instr->Bits(21, 20) == 0) { 4580 if (instr->Bits(21, 20) == 0) {
4538 // vst1 4581 // vst1
(...skipping 503 matching lines...) Expand 10 before | Expand all | Expand 10 after
5042 set_register(sp, current_sp + sizeof(uintptr_t)); 5085 set_register(sp, current_sp + sizeof(uintptr_t));
5043 return address; 5086 return address;
5044 } 5087 }
5045 5088
5046 } // namespace internal 5089 } // namespace internal
5047 } // namespace v8 5090 } // namespace v8
5048 5091
5049 #endif // USE_SIMULATOR 5092 #endif // USE_SIMULATOR
5050 5093
5051 #endif // V8_TARGET_ARCH_ARM 5094 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « src/arm/disasm-arm.cc ('k') | test/cctest/test-assembler-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698