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

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

Issue 2620343002: [ARM] Add vand, vorr NEON instructions. (Closed)
Patch Set: Rebase. 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/assembler-arm.h ('k') | src/arm/disasm-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 (c) 1994-2006 Sun Microsystems Inc. 1 // Copyright (c) 1994-2006 Sun Microsystems Inc.
2 // All Rights Reserved. 2 // All Rights Reserved.
3 // 3 //
4 // Redistribution and use in source and binary forms, with or without 4 // Redistribution and use in source and binary forms, with or without
5 // modification, are permitted provided that the following conditions 5 // modification, are permitted provided that the following conditions
6 // are met: 6 // are met:
7 // 7 //
8 // - Redistributions of source code must retain the above copyright notice, 8 // - Redistributions of source code must retain the above copyright notice,
9 // this list of conditions and the following disclaimer. 9 // this list of conditions and the following disclaimer.
10 // 10 //
(...skipping 3916 matching lines...) Expand 10 before | Expand all | Expand 10 after
3927 DCHECK(dt == NeonS32 || dt == NeonU32 || IsEnabled(NEON)); 3927 DCHECK(dt == NeonS32 || dt == NeonU32 || IsEnabled(NEON));
3928 int vn, n; 3928 int vn, n;
3929 src.split_code(&vn, &n); 3929 src.split_code(&vn, &n);
3930 int opc1_opc2 = EncodeScalar(dt, index); 3930 int opc1_opc2 = EncodeScalar(dt, index);
3931 int u = (dt & NeonDataTypeUMask) != 0 ? 1 : 0; 3931 int u = (dt & NeonDataTypeUMask) != 0 ? 1 : 0;
3932 emit(0xEEu * B24 | u * B23 | B20 | vn * B16 | dst.code() * B12 | 0xB * B8 | 3932 emit(0xEEu * B24 | u * B23 | B20 | vn * B16 | dst.code() * B12 | 0xB * B8 |
3933 n * B7 | B4 | opc1_opc2); 3933 n * B7 | B4 | opc1_opc2);
3934 } 3934 }
3935 3935
3936 void Assembler::vmov(const QwNeonRegister dst, const QwNeonRegister src) { 3936 void Assembler::vmov(const QwNeonRegister dst, const QwNeonRegister src) {
3937 DCHECK(IsEnabled(NEON));
3938 // Instruction details available in ARM DDI 0406C.b, A8-938. 3937 // Instruction details available in ARM DDI 0406C.b, A8-938.
3939 DCHECK(VfpRegisterIsAvailable(dst)); 3938 // vmov is encoded as vorr.
3940 DCHECK(VfpRegisterIsAvailable(src)); 3939 vorr(dst, src, src);
3941 int vd, d;
3942 dst.split_code(&vd, &d);
3943 int vm, m;
3944 src.split_code(&vm, &m);
3945 emit(0x1E4U * B23 | d * B22 | 2 * B20 | vm * B16 | vd * B12 | B8 | m * B7 |
3946 B6 | m * B5 | B4 | vm);
3947 } 3940 }
3948 3941
3949 void Assembler::vmvn(const QwNeonRegister dst, const QwNeonRegister src) { 3942 void Assembler::vmvn(const QwNeonRegister dst, const QwNeonRegister src) {
3950 DCHECK(IsEnabled(NEON)); 3943 DCHECK(IsEnabled(NEON));
3951 // Instruction details available in ARM DDI 0406C.b, A8-966. 3944 // Instruction details available in ARM DDI 0406C.b, A8-966.
3952 DCHECK(VfpRegisterIsAvailable(dst)); 3945 DCHECK(VfpRegisterIsAvailable(dst));
3953 DCHECK(VfpRegisterIsAvailable(src)); 3946 DCHECK(VfpRegisterIsAvailable(src));
3954 int vd, d; 3947 int vd, d;
3955 dst.split_code(&vd, &d); 3948 dst.split_code(&vd, &d);
3956 int vm, m; 3949 int vm, m;
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
4131 int vd, d; 4124 int vd, d;
4132 dst.split_code(&vd, &d); 4125 dst.split_code(&vd, &d);
4133 int vn, n; 4126 int vn, n;
4134 src1.split_code(&vn, &n); 4127 src1.split_code(&vn, &n);
4135 int vm, m; 4128 int vm, m;
4136 src2.split_code(&vm, &m); 4129 src2.split_code(&vm, &m);
4137 emit(0x1E6U * B23 | d * B22 | vn * B16 | vd * B12 | B8 | n * B7 | m * B5 | 4130 emit(0x1E6U * B23 | d * B22 | vn * B16 | vd * B12 | B8 | n * B7 | m * B5 |
4138 B4 | vm); 4131 B4 | vm);
4139 } 4132 }
4140 4133
4141 void Assembler::veor(QwNeonRegister dst, QwNeonRegister src1, 4134 enum BinaryBitwiseOp { VAND, VBIC, VBIF, VBIT, VBSL, VEOR, VORR, VORN };
4142 QwNeonRegister src2) { 4135
4143 // Qd = veor(Qn, Qm) SIMD integer exclusive OR. 4136 static Instr EncodeNeonBinaryBitwiseOp(BinaryBitwiseOp op,
4144 // Instruction details available in ARM DDI 0406C.b, A8.8.888. 4137 const QwNeonRegister dst,
4145 DCHECK(IsEnabled(NEON)); 4138 const QwNeonRegister src1,
4139 const QwNeonRegister src2) {
4140 int op_encoding = 0;
4141 switch (op) {
4142 case VBIC:
4143 op_encoding = 0x1 * B20;
4144 break;
4145 case VBIF:
4146 op_encoding = B24 | 0x3 * B20;
4147 break;
4148 case VBIT:
4149 op_encoding = B24 | 0x2 * B20;
4150 break;
4151 case VBSL:
4152 op_encoding = B24 | 0x1 * B20;
4153 break;
4154 case VEOR:
4155 op_encoding = B24;
4156 break;
4157 case VORR:
4158 op_encoding = 0x2 * B20;
4159 break;
4160 case VORN:
4161 op_encoding = 0x3 * B20;
4162 break;
4163 case VAND:
4164 // op_encoding is 0.
4165 break;
4166 default:
4167 UNREACHABLE();
4168 break;
4169 }
4146 int vd, d; 4170 int vd, d;
4147 dst.split_code(&vd, &d); 4171 dst.split_code(&vd, &d);
4148 int vn, n; 4172 int vn, n;
4149 src1.split_code(&vn, &n); 4173 src1.split_code(&vn, &n);
4150 int vm, m; 4174 int vm, m;
4151 src2.split_code(&vm, &m); 4175 src2.split_code(&vm, &m);
4152 emit(0x1E6U * B23 | d * B22 | vn * B16 | vd * B12 | B8 | n * B7 | B6 | 4176 return 0x1E4U * B23 | op_encoding | d * B22 | vn * B16 | vd * B12 | B8 |
4153 m * B5 | B4 | vm); 4177 n * B7 | B6 | m * B5 | B4 | vm;
4178 }
4179
4180 void Assembler::vand(QwNeonRegister dst, QwNeonRegister src1,
4181 QwNeonRegister src2) {
4182 // Qd = vand(Qn, Qm) SIMD AND.
4183 // Instruction details available in ARM DDI 0406C.b, A8.8.836.
4184 DCHECK(IsEnabled(NEON));
4185 emit(EncodeNeonBinaryBitwiseOp(VAND, dst, src1, src2));
4186 }
4187
4188 void Assembler::vbsl(QwNeonRegister dst, const QwNeonRegister src1,
4189 const QwNeonRegister src2) {
4190 DCHECK(IsEnabled(NEON));
4191 // Qd = vbsl(Qn, Qm) SIMD bitwise select.
4192 // Instruction details available in ARM DDI 0406C.b, A8-844.
4193 emit(EncodeNeonBinaryBitwiseOp(VBSL, dst, src1, src2));
4194 }
4195
4196 void Assembler::veor(QwNeonRegister dst, QwNeonRegister src1,
4197 QwNeonRegister src2) {
4198 // Qd = veor(Qn, Qm) SIMD exclusive OR.
4199 // Instruction details available in ARM DDI 0406C.b, A8.8.888.
4200 DCHECK(IsEnabled(NEON));
4201 emit(EncodeNeonBinaryBitwiseOp(VEOR, dst, src1, src2));
4202 }
4203
4204 void Assembler::vorr(QwNeonRegister dst, QwNeonRegister src1,
4205 QwNeonRegister src2) {
4206 // Qd = vorr(Qn, Qm) SIMD OR.
4207 // Instruction details available in ARM DDI 0406C.b, A8.8.976.
4208 DCHECK(IsEnabled(NEON));
4209 emit(EncodeNeonBinaryBitwiseOp(VORR, dst, src1, src2));
4154 } 4210 }
4155 4211
4156 void Assembler::vadd(QwNeonRegister dst, const QwNeonRegister src1, 4212 void Assembler::vadd(QwNeonRegister dst, const QwNeonRegister src1,
4157 const QwNeonRegister src2) { 4213 const QwNeonRegister src2) {
4158 DCHECK(IsEnabled(NEON)); 4214 DCHECK(IsEnabled(NEON));
4159 // Qd = vadd(Qn, Qm) SIMD floating point addition. 4215 // Qd = vadd(Qn, Qm) SIMD floating point addition.
4160 // Instruction details available in ARM DDI 0406C.b, A8-830. 4216 // Instruction details available in ARM DDI 0406C.b, A8-830.
4161 int vd, d; 4217 int vd, d;
4162 dst.split_code(&vd, &d); 4218 dst.split_code(&vd, &d);
4163 int vn, n; 4219 int vn, n;
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
4404 } 4460 }
4405 4461
4406 void Assembler::vcgt(NeonDataType dt, QwNeonRegister dst, 4462 void Assembler::vcgt(NeonDataType dt, QwNeonRegister dst,
4407 const QwNeonRegister src1, const QwNeonRegister src2) { 4463 const QwNeonRegister src1, const QwNeonRegister src2) {
4408 DCHECK(IsEnabled(NEON)); 4464 DCHECK(IsEnabled(NEON));
4409 // Qd = vcgt(Qn, Qm) SIMD integer compare greater than. 4465 // Qd = vcgt(Qn, Qm) SIMD integer compare greater than.
4410 // Instruction details available in ARM DDI 0406C.b, A8-852. 4466 // Instruction details available in ARM DDI 0406C.b, A8-852.
4411 emit(EncodeNeonCompareOp(dt, dst, src1, src2, gt)); 4467 emit(EncodeNeonCompareOp(dt, dst, src1, src2, gt));
4412 } 4468 }
4413 4469
4414 void Assembler::vbsl(QwNeonRegister dst, const QwNeonRegister src1,
4415 const QwNeonRegister src2) {
4416 DCHECK(IsEnabled(NEON));
4417 // Qd = vbsl(Qn, Qm) SIMD bitwise select.
4418 // Instruction details available in ARM DDI 0406C.b, A8-844.
4419 int vd, d;
4420 dst.split_code(&vd, &d);
4421 int vn, n;
4422 src1.split_code(&vn, &n);
4423 int vm, m;
4424 src2.split_code(&vm, &m);
4425 int op = 1; // vbsl
4426 emit(0x1E6U * B23 | d * B22 | op * B20 | vn * B16 | vd * B12 | 0x1 * B8 |
4427 n * B7 | B6 | m * B5 | B4 | vm);
4428 }
4429
4430 void Assembler::vext(QwNeonRegister dst, const QwNeonRegister src1, 4470 void Assembler::vext(QwNeonRegister dst, const QwNeonRegister src1,
4431 const QwNeonRegister src2, int bytes) { 4471 const QwNeonRegister src2, int bytes) {
4432 DCHECK(IsEnabled(NEON)); 4472 DCHECK(IsEnabled(NEON));
4433 // Qd = vext(Qn, Qm) SIMD byte extract. 4473 // Qd = vext(Qn, Qm) SIMD byte extract.
4434 // Instruction details available in ARM DDI 0406C.b, A8-890. 4474 // Instruction details available in ARM DDI 0406C.b, A8-890.
4435 int vd, d; 4475 int vd, d;
4436 dst.split_code(&vd, &d); 4476 dst.split_code(&vd, &d);
4437 int vn, n; 4477 int vn, n;
4438 src1.split_code(&vn, &n); 4478 src1.split_code(&vn, &n);
4439 int vm, m; 4479 int vm, m;
(...skipping 627 matching lines...) Expand 10 before | Expand all | Expand 10 after
5067 DCHECK(is_uint12(offset)); 5107 DCHECK(is_uint12(offset));
5068 instr_at_put(pc, SetLdrRegisterImmediateOffset(instr, offset)); 5108 instr_at_put(pc, SetLdrRegisterImmediateOffset(instr, offset));
5069 } 5109 }
5070 } 5110 }
5071 5111
5072 5112
5073 } // namespace internal 5113 } // namespace internal
5074 } // namespace v8 5114 } // namespace v8
5075 5115
5076 #endif // V8_TARGET_ARCH_ARM 5116 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « src/arm/assembler-arm.h ('k') | src/arm/disasm-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698