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

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

Issue 2629223005: [ARM] Add Neon shift instructions vshl, vshr. (Closed)
Patch Set: Fix DCHECK in ArithmeticShiftRight. 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 4394 matching lines...) Expand 10 before | Expand all | Expand 10 after
4405 } 4405 }
4406 4406
4407 void Assembler::vmax(NeonDataType dt, QwNeonRegister dst, QwNeonRegister src1, 4407 void Assembler::vmax(NeonDataType dt, QwNeonRegister dst, QwNeonRegister src1,
4408 QwNeonRegister src2) { 4408 QwNeonRegister src2) {
4409 DCHECK(IsEnabled(NEON)); 4409 DCHECK(IsEnabled(NEON));
4410 // Qd = vmax(Qn, Qm) SIMD integer MAX. 4410 // Qd = vmax(Qn, Qm) SIMD integer MAX.
4411 // Instruction details available in ARM DDI 0406C.b, A8-926. 4411 // Instruction details available in ARM DDI 0406C.b, A8-926.
4412 emit(EncodeNeonBinOp(VMAX, dt, dst, src1, src2)); 4412 emit(EncodeNeonBinOp(VMAX, dt, dst, src1, src2));
4413 } 4413 }
4414 4414
4415 enum NeonShiftOp { VSHL, VSHR };
4416
4417 static Instr EncodeNeonShiftOp(NeonShiftOp op, NeonDataType dt,
4418 QwNeonRegister dst, QwNeonRegister src,
4419 int shift) {
4420 int vd, d;
4421 dst.split_code(&vd, &d);
4422 int vm, m;
4423 src.split_code(&vm, &m);
4424 int size_in_bits = kBitsPerByte << NeonSz(dt);
4425 int op_encoding = 0;
4426 int imm6 = 0;
4427 if (op == VSHL) {
4428 DCHECK(shift >= 0 && size_in_bits > shift);
4429 imm6 = size_in_bits + shift;
4430 op_encoding = 0x5 * B8;
4431 } else {
4432 DCHECK_EQ(VSHR, op);
4433 DCHECK(shift > 0 && size_in_bits >= shift);
4434 imm6 = 2 * size_in_bits - shift;
4435 op_encoding = NeonU(dt) * B24;
4436 }
4437 return 0x1E5U * B23 | d * B22 | imm6 * B16 | vd * B12 | B6 | m * B5 | B4 |
4438 vm | op_encoding;
4439 }
4440
4441 void Assembler::vshl(NeonDataType dt, QwNeonRegister dst, QwNeonRegister src,
4442 int shift) {
4443 DCHECK(IsEnabled(NEON));
4444 // Qd = vshl(Qm, bits) SIMD shift left immediate.
4445 // Instruction details available in ARM DDI 0406C.b, A8-1046.
4446 emit(EncodeNeonShiftOp(VSHL, dt, dst, src, shift));
4447 }
4448
4449 void Assembler::vshr(NeonDataType dt, QwNeonRegister dst, QwNeonRegister src,
4450 int shift) {
4451 DCHECK(IsEnabled(NEON));
4452 // Qd = vshl(Qm, bits) SIMD shift right immediate.
4453 // Instruction details available in ARM DDI 0406C.b, A8-1052.
4454 emit(EncodeNeonShiftOp(VSHR, dt, dst, src, shift));
4455 }
4456
4415 static Instr EncodeNeonEstimateOp(bool is_rsqrt, QwNeonRegister dst, 4457 static Instr EncodeNeonEstimateOp(bool is_rsqrt, QwNeonRegister dst,
4416 QwNeonRegister src) { 4458 QwNeonRegister src) {
4417 int vd, d; 4459 int vd, d;
4418 dst.split_code(&vd, &d); 4460 dst.split_code(&vd, &d);
4419 int vm, m; 4461 int vm, m;
4420 src.split_code(&vm, &m); 4462 src.split_code(&vm, &m);
4421 int rsqrt = is_rsqrt ? 1 : 0; 4463 int rsqrt = is_rsqrt ? 1 : 0;
4422 return 0x1E7U * B23 | d * B22 | 0x3B * B16 | vd * B12 | 0x5 * B8 | 4464 return 0x1E7U * B23 | d * B22 | 0x3B * B16 | vd * B12 | 0x5 * B8 |
4423 rsqrt * B7 | B6 | m * B5 | vm; 4465 rsqrt * B7 | B6 | m * B5 | vm;
4424 } 4466 }
(...skipping 724 matching lines...) Expand 10 before | Expand all | Expand 10 after
5149 DCHECK(is_uint12(offset)); 5191 DCHECK(is_uint12(offset));
5150 instr_at_put(pc, SetLdrRegisterImmediateOffset(instr, offset)); 5192 instr_at_put(pc, SetLdrRegisterImmediateOffset(instr, offset));
5151 } 5193 }
5152 } 5194 }
5153 5195
5154 5196
5155 } // namespace internal 5197 } // namespace internal
5156 } // namespace v8 5198 } // namespace v8
5157 5199
5158 #endif // V8_TARGET_ARCH_ARM 5200 #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