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

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

Issue 2649323012: [ARM] Add Neon saturating add and subtract instructions. (Closed)
Patch Set: Add static_asserts on Widen, Clamp. Created 3 years, 10 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 4254 matching lines...) Expand 10 before | Expand all | Expand 10 after
4265 int vd, d; 4265 int vd, d;
4266 dst.split_code(&vd, &d); 4266 dst.split_code(&vd, &d);
4267 int vn, n; 4267 int vn, n;
4268 src1.split_code(&vn, &n); 4268 src1.split_code(&vn, &n);
4269 int vm, m; 4269 int vm, m;
4270 src2.split_code(&vm, &m); 4270 src2.split_code(&vm, &m);
4271 return 0x1E4U * B23 | d * B22 | vn * B16 | vd * B12 | n * B7 | B6 | m * B5 | 4271 return 0x1E4U * B23 | d * B22 | vn * B16 | vd * B12 | n * B7 | B6 | m * B5 |
4272 vm | op_encoding; 4272 vm | op_encoding;
4273 } 4273 }
4274 4274
4275 enum IntegerBinOp { VADD, VSUB, VMUL, VMIN, VMAX, VTST, VCEQ, VCGE, VCGT }; 4275 enum IntegerBinOp {
4276 VADD,
4277 VQADD,
4278 VSUB,
4279 VQSUB,
4280 VMUL,
4281 VMIN,
4282 VMAX,
4283 VTST,
4284 VCEQ,
4285 VCGE,
4286 VCGT
4287 };
4276 4288
4277 static Instr EncodeNeonBinOp(IntegerBinOp op, NeonDataType dt, 4289 static Instr EncodeNeonBinOp(IntegerBinOp op, NeonDataType dt,
4278 const QwNeonRegister dst, 4290 const QwNeonRegister dst,
4279 const QwNeonRegister src1, 4291 const QwNeonRegister src1,
4280 const QwNeonRegister src2) { 4292 const QwNeonRegister src2) {
4281 int op_encoding = 0; 4293 int op_encoding = 0;
4282 switch (op) { 4294 switch (op) {
4283 case VADD: 4295 case VADD:
4284 op_encoding = 0x8 * B8; 4296 op_encoding = 0x8 * B8;
4285 break; 4297 break;
4298 case VQADD:
4299 op_encoding = B4;
4300 break;
4286 case VSUB: 4301 case VSUB:
4287 op_encoding = B24 | 0x8 * B8; 4302 op_encoding = B24 | 0x8 * B8;
4288 break; 4303 break;
4304 case VQSUB:
4305 op_encoding = 0x2 * B8 | B4;
4306 break;
4289 case VMUL: 4307 case VMUL:
4290 op_encoding = 0x9 * B8 | B4; 4308 op_encoding = 0x9 * B8 | B4;
4291 break; 4309 break;
4292 case VMIN: 4310 case VMIN:
4293 op_encoding = 0x6 * B8 | B4; 4311 op_encoding = 0x6 * B8 | B4;
4294 break; 4312 break;
4295 case VMAX: 4313 case VMAX:
4296 op_encoding = 0x6 * B8; 4314 op_encoding = 0x6 * B8;
4297 break; 4315 break;
4298 case VTST: 4316 case VTST:
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
4341 } 4359 }
4342 4360
4343 void Assembler::vadd(NeonSize size, QwNeonRegister dst, QwNeonRegister src1, 4361 void Assembler::vadd(NeonSize size, QwNeonRegister dst, QwNeonRegister src1,
4344 QwNeonRegister src2) { 4362 QwNeonRegister src2) {
4345 DCHECK(IsEnabled(NEON)); 4363 DCHECK(IsEnabled(NEON));
4346 // Qd = vadd(Qn, Qm) SIMD integer addition. 4364 // Qd = vadd(Qn, Qm) SIMD integer addition.
4347 // Instruction details available in ARM DDI 0406C.b, A8-828. 4365 // Instruction details available in ARM DDI 0406C.b, A8-828.
4348 emit(EncodeNeonBinOp(VADD, size, dst, src1, src2)); 4366 emit(EncodeNeonBinOp(VADD, size, dst, src1, src2));
4349 } 4367 }
4350 4368
4369 void Assembler::vqadd(NeonDataType dt, QwNeonRegister dst, QwNeonRegister src1,
4370 QwNeonRegister src2) {
4371 DCHECK(IsEnabled(NEON));
4372 // Qd = vqadd(Qn, Qm) SIMD integer saturating addition.
4373 // Instruction details available in ARM DDI 0406C.b, A8-996.
4374 emit(EncodeNeonBinOp(VQADD, dt, dst, src1, src2));
4375 }
4376
4351 void Assembler::vsub(QwNeonRegister dst, QwNeonRegister src1, 4377 void Assembler::vsub(QwNeonRegister dst, QwNeonRegister src1,
4352 QwNeonRegister src2) { 4378 QwNeonRegister src2) {
4353 DCHECK(IsEnabled(NEON)); 4379 DCHECK(IsEnabled(NEON));
4354 // Qd = vsub(Qn, Qm) SIMD floating point subtraction. 4380 // Qd = vsub(Qn, Qm) SIMD floating point subtraction.
4355 // Instruction details available in ARM DDI 0406C.b, A8-1086. 4381 // Instruction details available in ARM DDI 0406C.b, A8-1086.
4356 emit(EncodeNeonBinOp(VSUBF, dst, src1, src2)); 4382 emit(EncodeNeonBinOp(VSUBF, dst, src1, src2));
4357 } 4383 }
4358 4384
4359 void Assembler::vsub(NeonSize size, QwNeonRegister dst, QwNeonRegister src1, 4385 void Assembler::vsub(NeonSize size, QwNeonRegister dst, QwNeonRegister src1,
4360 QwNeonRegister src2) { 4386 QwNeonRegister src2) {
4361 DCHECK(IsEnabled(NEON)); 4387 DCHECK(IsEnabled(NEON));
4362 // Qd = vsub(Qn, Qm) SIMD integer subtraction. 4388 // Qd = vsub(Qn, Qm) SIMD integer subtraction.
4363 // Instruction details available in ARM DDI 0406C.b, A8-1084. 4389 // Instruction details available in ARM DDI 0406C.b, A8-1084.
4364 emit(EncodeNeonBinOp(VSUB, size, dst, src1, src2)); 4390 emit(EncodeNeonBinOp(VSUB, size, dst, src1, src2));
4365 } 4391 }
4366 4392
4393 void Assembler::vqsub(NeonDataType dt, QwNeonRegister dst, QwNeonRegister src1,
4394 QwNeonRegister src2) {
4395 DCHECK(IsEnabled(NEON));
4396 // Qd = vqsub(Qn, Qm) SIMD integer saturating subtraction.
4397 // Instruction details available in ARM DDI 0406C.b, A8-1020.
4398 emit(EncodeNeonBinOp(VQSUB, dt, dst, src1, src2));
4399 }
4400
4367 void Assembler::vmul(QwNeonRegister dst, QwNeonRegister src1, 4401 void Assembler::vmul(QwNeonRegister dst, QwNeonRegister src1,
4368 QwNeonRegister src2) { 4402 QwNeonRegister src2) {
4369 DCHECK(IsEnabled(NEON)); 4403 DCHECK(IsEnabled(NEON));
4370 // Qd = vadd(Qn, Qm) SIMD floating point multiply. 4404 // Qd = vadd(Qn, Qm) SIMD floating point multiply.
4371 // Instruction details available in ARM DDI 0406C.b, A8-958. 4405 // Instruction details available in ARM DDI 0406C.b, A8-958.
4372 emit(EncodeNeonBinOp(VMULF, dst, src1, src2)); 4406 emit(EncodeNeonBinOp(VMULF, dst, src1, src2));
4373 } 4407 }
4374 4408
4375 void Assembler::vmul(NeonSize size, QwNeonRegister dst, 4409 void Assembler::vmul(NeonSize size, QwNeonRegister dst,
4376 const QwNeonRegister src1, const QwNeonRegister src2) { 4410 const QwNeonRegister src1, const QwNeonRegister src2) {
(...skipping 814 matching lines...) Expand 10 before | Expand all | Expand 10 after
5191 DCHECK(is_uint12(offset)); 5225 DCHECK(is_uint12(offset));
5192 instr_at_put(pc, SetLdrRegisterImmediateOffset(instr, offset)); 5226 instr_at_put(pc, SetLdrRegisterImmediateOffset(instr, offset));
5193 } 5227 }
5194 } 5228 }
5195 5229
5196 5230
5197 } // namespace internal 5231 } // namespace internal
5198 } // namespace v8 5232 } // namespace v8
5199 5233
5200 #endif // V8_TARGET_ARCH_ARM 5234 #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