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

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

Issue 2620343002: [ARM] Add vand, vorr NEON instructions. (Closed)
Patch Set: 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
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 3814 matching lines...) Expand 10 before | Expand all | Expand 10 after
3825 } else { 3825 } else {
3826 UNIMPLEMENTED(); // Not used by V8. 3826 UNIMPLEMENTED(); // Not used by V8.
3827 } 3827 }
3828 } 3828 }
3829 3829
3830 void Simulator::DecodeSpecialCondition(Instruction* instr) { 3830 void Simulator::DecodeSpecialCondition(Instruction* instr) {
3831 switch (instr->SpecialValue()) { 3831 switch (instr->SpecialValue()) {
3832 case 4: 3832 case 4:
3833 if (instr->Bits(21, 20) == 2 && instr->Bits(11, 8) == 1 && 3833 if (instr->Bits(21, 20) == 2 && instr->Bits(11, 8) == 1 &&
3834 instr->Bit(4) == 1) { 3834 instr->Bit(4) == 1) {
3835 // vmov Qd, Qm 3835 // vmov Qd, Qm.
3836 // vorr, Qd, Qm, Qn.
3836 int Vd = instr->VFPDRegValue(kSimd128Precision); 3837 int Vd = instr->VFPDRegValue(kSimd128Precision);
3837 int Vm = instr->VFPMRegValue(kSimd128Precision); 3838 int Vm = instr->VFPMRegValue(kSimd128Precision);
3838 uint32_t data[4]; 3839 int Vn = instr->VFPNRegValue(kSimd128Precision);
3839 get_q_register(Vm, data); 3840 uint32_t src1[4];
3840 set_q_register(Vd, data); 3841 get_q_register(Vm, src1);
3842 if (Vm != Vn) {
3843 uint32_t src2[4];
3844 get_q_register(Vn, src2);
3845 for (int i = 0; i < 4; i++) {
3846 src1[i] = src1[i] | src2[i];
3847 }
3848 }
3849 set_q_register(Vd, src1);
3841 } else if (instr->Bits(11, 8) == 8) { 3850 } else if (instr->Bits(11, 8) == 8) {
3842 // vadd/vtst 3851 // vadd/vtst
3843 int size = static_cast<NeonSize>(instr->Bits(21, 20)); 3852 int size = static_cast<NeonSize>(instr->Bits(21, 20));
3844 int Vd = instr->VFPDRegValue(kSimd128Precision); 3853 int Vd = instr->VFPDRegValue(kSimd128Precision);
3845 int Vm = instr->VFPMRegValue(kSimd128Precision); 3854 int Vm = instr->VFPMRegValue(kSimd128Precision);
3846 int Vn = instr->VFPNRegValue(kSimd128Precision); 3855 int Vn = instr->VFPNRegValue(kSimd128Precision);
3847 if (instr->Bit(4) == 0) { 3856 if (instr->Bit(4) == 0) {
3848 // vadd.i<size> Qd, Qm, Qn. 3857 // vadd.i<size> Qd, Qm, Qn.
3849 switch (size) { 3858 switch (size) {
3850 case Neon8: { 3859 case Neon8: {
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
3986 int Vm = instr->VFPMRegValue(kSimd128Precision); 3995 int Vm = instr->VFPMRegValue(kSimd128Precision);
3987 int Vn = instr->VFPNRegValue(kSimd128Precision); 3996 int Vn = instr->VFPNRegValue(kSimd128Precision);
3988 float src1[4], src2[4]; 3997 float src1[4], src2[4];
3989 get_q_register(Vn, src1); 3998 get_q_register(Vn, src1);
3990 get_q_register(Vm, src2); 3999 get_q_register(Vm, src2);
3991 uint32_t dst[4]; 4000 uint32_t dst[4];
3992 for (int i = 0; i < 4; i++) { 4001 for (int i = 0; i < 4; i++) {
3993 dst[i] = (src1[i] == src2[i]) ? 0xFFFFFFFF : 0; 4002 dst[i] = (src1[i] == src2[i]) ? 0xFFFFFFFF : 0;
3994 } 4003 }
3995 set_q_register(Vd, dst); 4004 set_q_register(Vd, dst);
4005 } else if (instr->Bits(11, 8) == 1 && instr->Bits(21, 20) == 0 &&
4006 instr->Bit(6) == 1 && instr->Bit(4) == 1) {
4007 int Vd = instr->VFPDRegValue(kSimd128Precision);
4008 int Vm = instr->VFPMRegValue(kSimd128Precision);
4009 int Vn = instr->VFPNRegValue(kSimd128Precision);
4010 // vand Qd, Qm, Qn.
4011 uint32_t src1[4], src2[4];
4012 get_q_register(Vn, src1);
4013 get_q_register(Vm, src2);
4014 for (int i = 0; i < 4; i++) {
4015 src1[i] = src1[i] & src2[i];
4016 }
4017 set_q_register(Vd, src1);
3996 } else if (instr->Bit(20) == 0 && instr->Bits(11, 8) == 0xf && 4018 } else if (instr->Bit(20) == 0 && instr->Bits(11, 8) == 0xf &&
3997 instr->Bit(6) == 1 && instr->Bit(4) == 1) { 4019 instr->Bit(6) == 1 && instr->Bit(4) == 1) {
3998 int Vd = instr->VFPDRegValue(kSimd128Precision); 4020 int Vd = instr->VFPDRegValue(kSimd128Precision);
3999 int Vm = instr->VFPMRegValue(kSimd128Precision); 4021 int Vm = instr->VFPMRegValue(kSimd128Precision);
4000 int Vn = instr->VFPNRegValue(kSimd128Precision); 4022 int Vn = instr->VFPNRegValue(kSimd128Precision);
4001 float src1[4], src2[4]; 4023 float src1[4], src2[4];
4002 get_q_register(Vn, src1); 4024 get_q_register(Vn, src1);
4003 get_q_register(Vm, src2); 4025 get_q_register(Vm, src2);
4004 if (instr->Bit(21) == 0) { 4026 if (instr->Bit(21) == 0) {
4005 // vrecps.f32 Qd, Qm, Qn. 4027 // vrecps.f32 Qd, Qm, Qn.
(...skipping 1079 matching lines...) Expand 10 before | Expand all | Expand 10 after
5085 set_register(sp, current_sp + sizeof(uintptr_t)); 5107 set_register(sp, current_sp + sizeof(uintptr_t));
5086 return address; 5108 return address;
5087 } 5109 }
5088 5110
5089 } // namespace internal 5111 } // namespace internal
5090 } // namespace v8 5112 } // namespace v8
5091 5113
5092 #endif // USE_SIMULATOR 5114 #endif // USE_SIMULATOR
5093 5115
5094 #endif // V8_TARGET_ARCH_ARM 5116 #endif // V8_TARGET_ARCH_ARM
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698