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

Unified Diff: src/compiler/mips64/code-generator-mips64.cc

Issue 1508423002: MIPS: [turbofan] Use RINT instruction for Float64|32Round ops. on r6. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years 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 side-by-side diff with in-line comments
Download patch
Index: src/compiler/mips64/code-generator-mips64.cc
diff --git a/src/compiler/mips64/code-generator-mips64.cc b/src/compiler/mips64/code-generator-mips64.cc
index 56c6fe19615c38b5df3c1db4b3a9f86351d57c00..2d27db0fd47b576f784dc16065eec0d466fb4822 100644
--- a/src/compiler/mips64/code-generator-mips64.cc
+++ b/src/compiler/mips64/code-generator-mips64.cc
@@ -423,8 +423,14 @@ FPUCondition FlagsConditionToConditionCmpFPU(bool& predicate,
} while (0)
-#define ASSEMBLE_ROUND_DOUBLE_TO_DOUBLE(asm_instr) \
- do { \
+#define ASSEMBLE_ROUND_DOUBLE_TO_DOUBLE(mode) \
+ if (kArchVariant == kMips64r6) { \
+ __ 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)); \
@@ -433,16 +439,22 @@ 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)); \
__ dmfc1(at, i.OutputDoubleRegister()); \
__ 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 (kArchVariant == kMips64r6) { \
+ __ 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; \
@@ -453,13 +465,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);
@@ -929,35 +941,35 @@ void CodeGenerator::AssembleArchInstruction(Instruction* instr) {
i.InputDoubleRegister(1));
break;
case kMips64Float64RoundDown: {
- ASSEMBLE_ROUND_DOUBLE_TO_DOUBLE(floor_l_d);
+ ASSEMBLE_ROUND_DOUBLE_TO_DOUBLE(floor);
break;
}
case kMips64Float32RoundDown: {
- ASSEMBLE_ROUND_FLOAT_TO_FLOAT(floor_w_s);
+ ASSEMBLE_ROUND_FLOAT_TO_FLOAT(floor);
break;
}
case kMips64Float64RoundTruncate: {
- ASSEMBLE_ROUND_DOUBLE_TO_DOUBLE(trunc_l_d);
+ ASSEMBLE_ROUND_DOUBLE_TO_DOUBLE(trunc);
break;
}
case kMips64Float32RoundTruncate: {
- ASSEMBLE_ROUND_FLOAT_TO_FLOAT(trunc_w_s);
+ ASSEMBLE_ROUND_FLOAT_TO_FLOAT(trunc);
break;
}
case kMips64Float64RoundUp: {
- ASSEMBLE_ROUND_DOUBLE_TO_DOUBLE(ceil_l_d);
+ ASSEMBLE_ROUND_DOUBLE_TO_DOUBLE(ceil);
break;
}
case kMips64Float32RoundUp: {
- ASSEMBLE_ROUND_FLOAT_TO_FLOAT(ceil_w_s);
+ ASSEMBLE_ROUND_FLOAT_TO_FLOAT(ceil);
break;
}
case kMips64Float64RoundTiesEven: {
- ASSEMBLE_ROUND_DOUBLE_TO_DOUBLE(round_l_d);
+ ASSEMBLE_ROUND_DOUBLE_TO_DOUBLE(round);
break;
}
case kMips64Float32RoundTiesEven: {
- ASSEMBLE_ROUND_FLOAT_TO_FLOAT(round_w_s);
+ ASSEMBLE_ROUND_FLOAT_TO_FLOAT(round);
break;
}
case kMips64Float64Max: {

Powered by Google App Engine
This is Rietveld 408576698