Chromium Code Reviews| Index: src/compiler/mips/code-generator-mips.cc |
| diff --git a/src/compiler/mips/code-generator-mips.cc b/src/compiler/mips/code-generator-mips.cc |
| index c2b444aee09f9f7912d4aa6ffbdca3b20aab800c..2a46c3d8c1796eb67b0076abc2c79babfba601e1 100644 |
| --- a/src/compiler/mips/code-generator-mips.cc |
| +++ b/src/compiler/mips/code-generator-mips.cc |
| @@ -1602,6 +1602,113 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction( |
| case kAtomicCompareExchangeWord32: |
| UNREACHABLE(); |
| break; |
| + case kMipsFloat32x4Abs: { |
| + CpuFeatureScope msa_scope(masm(), MIPS_SIMD); |
| + __ bclri_w(i.OutputSimd128Register(), i.InputSimd128Register(0), 31); |
| + break; |
| + } |
| + case kMipsFloat32x4Neg: { |
| + CpuFeatureScope msa_scope(masm(), MIPS_SIMD); |
| + __ bnegi_w(i.OutputSimd128Register(), i.InputSimd128Register(0), 31); |
| + break; |
| + } |
| + case kMipsFloat32x4RecipApprox: { |
| + CpuFeatureScope msa_scope(masm(), MIPS_SIMD); |
| + __ frcp_w(i.OutputSimd128Register(), i.InputSimd128Register(0)); |
| + break; |
| + } |
| + case kMipsFloat32x4RecipRefine: { |
| + CpuFeatureScope msa_scope(masm(), MIPS_SIMD); |
| + Simd128Register dst = i.OutputSimd128Register(); |
| + // Emulate with 2.0f - a * b |
| + __ ldi_w(kSimd128ScratchReg, 2); |
| + __ ffint_u_w(kSimd128ScratchReg, kSimd128ScratchReg); |
| + __ fmul_w(dst, i.InputSimd128Register(0), i.InputSimd128Register(1)); |
| + __ fsub_w(dst, kSimd128ScratchReg, dst); |
|
bbudge
2017/03/28 17:21:40
I didn't realize until now that only ARM has refin
dusan.simicic
2017/03/29 12:19:33
From MIPS perspective, it is better not to impleme
|
| + break; |
| + } |
| + case kMipsFloat32x4RecipSqrtApprox: { |
| + CpuFeatureScope msa_scope(masm(), MIPS_SIMD); |
| + __ frsqrt_w(i.OutputSimd128Register(), i.InputSimd128Register(0)); |
| + break; |
| + } |
| + case kMipsFloat32x4RecipSqrtRefine: { |
| + CpuFeatureScope msa_scope(masm(), MIPS_SIMD); |
| + Simd128Register dst = i.OutputSimd128Register(); |
| + // Emulate with (3.0f - a * b) * 0.5f; |
| + __ ldi_w(kSimd128ScratchReg, 3); |
| + __ ffint_u_w(kSimd128ScratchReg, kSimd128ScratchReg); |
| + __ fmul_w(dst, i.InputSimd128Register(0), i.InputSimd128Register(1)); |
| + __ fsub_w(dst, kSimd128ScratchReg, dst); |
| + __ ldi_w(kSimd128ScratchReg, 0x3f); |
| + __ slli_w(kSimd128ScratchReg, kSimd128ScratchReg, 24); |
| + __ fmul_w(dst, dst, kSimd128ScratchReg); |
|
bbudge
2017/03/28 17:21:40
Same comment here, and for MIPS64.
|
| + break; |
| + } |
| + case kMipsFloat32x4Add: { |
| + CpuFeatureScope msa_scope(masm(), MIPS_SIMD); |
| + __ fadd_w(i.OutputSimd128Register(), i.InputSimd128Register(0), |
| + i.InputSimd128Register(1)); |
| + break; |
| + } |
| + case kMipsFloat32x4Sub: { |
| + CpuFeatureScope msa_scope(masm(), MIPS_SIMD); |
| + __ fsub_w(i.OutputSimd128Register(), i.InputSimd128Register(0), |
| + i.InputSimd128Register(1)); |
| + break; |
| + } |
| + case kMipsFloat32x4Mul: { |
| + CpuFeatureScope msa_scope(masm(), MIPS_SIMD); |
| + __ fmul_w(i.OutputSimd128Register(), i.InputSimd128Register(0), |
| + i.InputSimd128Register(1)); |
| + break; |
| + } |
| + case kMipsFloat32x4Max: { |
| + CpuFeatureScope msa_scope(masm(), MIPS_SIMD); |
| + __ fmax_w(i.OutputSimd128Register(), i.InputSimd128Register(0), |
| + i.InputSimd128Register(1)); |
| + break; |
| + } |
| + case kMipsFloat32x4Min: { |
| + CpuFeatureScope msa_scope(masm(), MIPS_SIMD); |
| + __ fmin_w(i.OutputSimd128Register(), i.InputSimd128Register(0), |
| + i.InputSimd128Register(1)); |
| + break; |
| + } |
| + case kMipsFloat32xEqual: { |
| + CpuFeatureScope msa_scope(masm(), MIPS_SIMD); |
| + __ fceq_w(i.OutputSimd128Register(), i.InputSimd128Register(0), |
| + i.InputSimd128Register(1)); |
| + break; |
| + } |
| + case kMipsFloat32x4NotEqual: { |
| + CpuFeatureScope msa_scope(masm(), MIPS_SIMD); |
| + __ fcne_w(i.OutputSimd128Register(), i.InputSimd128Register(0), |
| + i.InputSimd128Register(1)); |
| + break; |
| + } |
| + case kMipsFloat32xLessThan: { |
| + CpuFeatureScope msa_scope(masm(), MIPS_SIMD); |
| + __ fclt_w(i.OutputSimd128Register(), i.InputSimd128Register(0), |
| + i.InputSimd128Register(1)); |
| + break; |
| + } |
| + case kMipsFloat32xLessThanOrEqual: { |
| + CpuFeatureScope msa_scope(masm(), MIPS_SIMD); |
| + __ fcle_w(i.OutputSimd128Register(), i.InputSimd128Register(0), |
| + i.InputSimd128Register(1)); |
| + break; |
| + } |
| + case kMipsInt32x4FromFloat32x4: { |
| + CpuFeatureScope msa_scope(masm(), MIPS_SIMD); |
| + __ ftrunc_s_w(i.OutputSimd128Register(), i.InputSimd128Register(0)); |
| + break; |
| + } |
| + case kMipsUint32x4FromFloat32x4: { |
| + CpuFeatureScope msa_scope(masm(), MIPS_SIMD); |
| + __ ftrunc_u_w(i.OutputSimd128Register(), i.InputSimd128Register(0)); |
| + break; |
| + } |
| } |
| return kSuccess; |
| } // NOLINT(readability/fn_size) |