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 70fd567693644775a7735e519365bd6f33c94f79..157b1a3ec52c668ee189a19f70cf2a22ad98ce22 100644 |
--- a/src/compiler/mips/code-generator-mips.cc |
+++ b/src/compiler/mips/code-generator-mips.cc |
@@ -409,8 +409,14 @@ FPUCondition FlagsConditionToConditionCmpFPU(bool& predicate, |
} while (0) |
-#define ASSEMBLE_ROUND_DOUBLE_TO_DOUBLE(asm_instr) \ |
- do { \ |
+#define ASSEMBLE_ROUND_DOUBLE_TO_DOUBLE(mode) \ |
+ if (IsMipsArchVariant(kMips32r6)) { \ |
+ __ cfc1(kScratchReg, FCSR); \ |
+ __ li(at, Operand(mode_##mode)); \ |
+ __ ctc1(at, FCSR); \ |
+ __ rint_d(i.OutputDoubleRegister(), i.InputDoubleRegister(0)); \ |
+ __ ctc1(kScratchReg, FCSR); \ |
+ } else { \ |
auto ool = new (zone()) OutOfLineRound(this, i.OutputDoubleRegister()); \ |
Label done; \ |
__ Mfhc1(kScratchReg, i.InputDoubleRegister(0)); \ |
@@ -419,18 +425,24 @@ FPUCondition FlagsConditionToConditionCmpFPU(bool& predicate, |
__ Branch(USE_DELAY_SLOT, &done, hs, at, \ |
Operand(HeapNumber::kExponentBias + HeapNumber::kMantissaBits)); \ |
__ mov_d(i.OutputDoubleRegister(), i.InputDoubleRegister(0)); \ |
- __ asm_instr(i.OutputDoubleRegister(), i.InputDoubleRegister(0)); \ |
+ __ mode##_l_d(i.OutputDoubleRegister(), i.InputDoubleRegister(0)); \ |
__ Move(at, kScratchReg2, i.OutputDoubleRegister()); \ |
__ or_(at, at, kScratchReg2); \ |
__ Branch(USE_DELAY_SLOT, ool->entry(), eq, at, Operand(zero_reg)); \ |
__ cvt_d_l(i.OutputDoubleRegister(), i.OutputDoubleRegister()); \ |
__ bind(ool->exit()); \ |
__ bind(&done); \ |
- } while (0) |
+ } |
-#define ASSEMBLE_ROUND_FLOAT_TO_FLOAT(asm_instr) \ |
- do { \ |
+#define ASSEMBLE_ROUND_FLOAT_TO_FLOAT(mode) \ |
+ if (IsMipsArchVariant(kMips32r6)) { \ |
+ __ cfc1(kScratchReg, FCSR); \ |
+ __ li(at, Operand(mode_##mode)); \ |
+ __ ctc1(at, FCSR); \ |
+ __ rint_s(i.OutputDoubleRegister(), i.InputDoubleRegister(0)); \ |
+ __ ctc1(kScratchReg, FCSR); \ |
+ } else { \ |
int32_t kFloat32ExponentBias = 127; \ |
int32_t kFloat32MantissaBits = 23; \ |
int32_t kFloat32ExponentBits = 8; \ |
@@ -441,13 +453,13 @@ FPUCondition FlagsConditionToConditionCmpFPU(bool& predicate, |
__ Branch(USE_DELAY_SLOT, &done, hs, at, \ |
Operand(kFloat32ExponentBias + kFloat32MantissaBits)); \ |
__ mov_s(i.OutputDoubleRegister(), i.InputDoubleRegister(0)); \ |
- __ asm_instr(i.OutputDoubleRegister(), i.InputDoubleRegister(0)); \ |
+ __ mode##_w_s(i.OutputDoubleRegister(), i.InputDoubleRegister(0)); \ |
__ mfc1(at, i.OutputDoubleRegister()); \ |
__ Branch(USE_DELAY_SLOT, ool->entry(), eq, at, Operand(zero_reg)); \ |
__ cvt_s_w(i.OutputDoubleRegister(), i.OutputDoubleRegister()); \ |
__ bind(ool->exit()); \ |
__ bind(&done); \ |
- } while (0) |
+ } |
void CodeGenerator::AssembleDeconstructActivationRecord(int stack_param_delta) { |
int sp_slot_delta = TailCallFrameStackSlotDelta(stack_param_delta); |
@@ -830,35 +842,35 @@ void CodeGenerator::AssembleArchInstruction(Instruction* instr) { |
i.InputDoubleRegister(1)); |
break; |
case kMipsFloat64RoundDown: { |
- ASSEMBLE_ROUND_DOUBLE_TO_DOUBLE(floor_l_d); |
+ ASSEMBLE_ROUND_DOUBLE_TO_DOUBLE(floor); |
break; |
} |
case kMipsFloat32RoundDown: { |
- ASSEMBLE_ROUND_FLOAT_TO_FLOAT(floor_w_s); |
+ ASSEMBLE_ROUND_FLOAT_TO_FLOAT(floor); |
break; |
} |
case kMipsFloat64RoundTruncate: { |
- ASSEMBLE_ROUND_DOUBLE_TO_DOUBLE(trunc_l_d); |
+ ASSEMBLE_ROUND_DOUBLE_TO_DOUBLE(trunc); |
break; |
} |
case kMipsFloat32RoundTruncate: { |
- ASSEMBLE_ROUND_FLOAT_TO_FLOAT(trunc_w_s); |
+ ASSEMBLE_ROUND_FLOAT_TO_FLOAT(trunc); |
break; |
} |
case kMipsFloat64RoundUp: { |
- ASSEMBLE_ROUND_DOUBLE_TO_DOUBLE(ceil_l_d); |
+ ASSEMBLE_ROUND_DOUBLE_TO_DOUBLE(ceil); |
break; |
} |
case kMipsFloat32RoundUp: { |
- ASSEMBLE_ROUND_FLOAT_TO_FLOAT(ceil_w_s); |
+ ASSEMBLE_ROUND_FLOAT_TO_FLOAT(ceil); |
break; |
} |
case kMipsFloat64RoundTiesEven: { |
- ASSEMBLE_ROUND_DOUBLE_TO_DOUBLE(round_l_d); |
+ ASSEMBLE_ROUND_DOUBLE_TO_DOUBLE(round); |
break; |
} |
case kMipsFloat32RoundTiesEven: { |
- ASSEMBLE_ROUND_FLOAT_TO_FLOAT(round_w_s); |
+ ASSEMBLE_ROUND_FLOAT_TO_FLOAT(round); |
break; |
} |
case kMipsFloat64Max: { |