| 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 de20ffd84d764169ea4719aad7227347a5f410b2..d03338652ca35536f5364e7f405f8d567eb3cd34 100644
|
| --- a/src/compiler/mips/code-generator-mips.cc
|
| +++ b/src/compiler/mips/code-generator-mips.cc
|
| @@ -192,6 +192,24 @@ class OutOfLineRound : public OutOfLineCode {
|
| };
|
|
|
|
|
| +class OutOfLineRound32 : public OutOfLineCode {
|
| + public:
|
| + OutOfLineRound32(CodeGenerator* gen, DoubleRegister result)
|
| + : OutOfLineCode(gen), result_(result) {}
|
| +
|
| + void Generate() final {
|
| + // Handle rounding to zero case where sign has to be preserved.
|
| + // High bits of float input already in kScratchReg.
|
| + __ srl(at, kScratchReg, 31);
|
| + __ sll(at, at, 31);
|
| + __ mtc1(at, result_);
|
| + }
|
| +
|
| + private:
|
| + DoubleRegister const result_;
|
| +};
|
| +
|
| +
|
| class OutOfLineTruncate final : public OutOfLineRound {
|
| public:
|
| OutOfLineTruncate(CodeGenerator* gen, DoubleRegister result)
|
| @@ -220,6 +238,34 @@ class OutOfLineTiesEven final : public OutOfLineRound {
|
| };
|
|
|
|
|
| +class OutOfLineTruncate32 final : public OutOfLineRound32 {
|
| + public:
|
| + OutOfLineTruncate32(CodeGenerator* gen, DoubleRegister result)
|
| + : OutOfLineRound32(gen, result) {}
|
| +};
|
| +
|
| +
|
| +class OutOfLineFloor32 final : public OutOfLineRound32 {
|
| + public:
|
| + OutOfLineFloor32(CodeGenerator* gen, DoubleRegister result)
|
| + : OutOfLineRound32(gen, result) {}
|
| +};
|
| +
|
| +
|
| +class OutOfLineCeil32 final : public OutOfLineRound32 {
|
| + public:
|
| + OutOfLineCeil32(CodeGenerator* gen, DoubleRegister result)
|
| + : OutOfLineRound32(gen, result) {}
|
| +};
|
| +
|
| +
|
| +class OutOfLineTiesEven32 final : public OutOfLineRound32 {
|
| + public:
|
| + OutOfLineTiesEven32(CodeGenerator* gen, DoubleRegister result)
|
| + : OutOfLineRound32(gen, result) {}
|
| +};
|
| +
|
| +
|
| class OutOfLineRecordWrite final : public OutOfLineCode {
|
| public:
|
| OutOfLineRecordWrite(CodeGenerator* gen, Register object, Register index,
|
| @@ -453,6 +499,27 @@ FPUCondition FlagsConditionToConditionCmpFPU(bool& predicate,
|
| } while (0)
|
|
|
|
|
| +#define ASSEMBLE_ROUND_FLOAT_TO_FLOAT(asm_instr, operation) \
|
| + do { \
|
| + int32_t kFloat32ExponentBias = 127; \
|
| + int32_t kFloat32MantissaBits = 23; \
|
| + int32_t kFloat32ExponentBits = 8; \
|
| + auto ool = \
|
| + new (zone()) OutOfLine##operation##32(this, i.OutputDoubleRegister()); \
|
| + Label done; \
|
| + __ mtc1(kScratchReg, i.InputDoubleRegister(0)); \
|
| + __ Ext(at, kScratchReg, kFloat32MantissaBits, kFloat32ExponentBits); \
|
| + __ Branch(USE_DELAY_SLOT, &done, hs, at, \
|
| + Operand(kFloat32ExponentBias + kFloat32MantissaBits)); \
|
| + __ mov_s(i.OutputDoubleRegister(), i.InputDoubleRegister(0)); \
|
| + __ asm_instr(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);
|
| if (sp_slot_delta > 0) {
|
| @@ -813,18 +880,34 @@ void CodeGenerator::AssembleArchInstruction(Instruction* instr) {
|
| ASSEMBLE_ROUND_DOUBLE_TO_DOUBLE(floor_l_d, Floor);
|
| break;
|
| }
|
| + case kMipsFloat32RoundDown: {
|
| + ASSEMBLE_ROUND_FLOAT_TO_FLOAT(floor_w_s, Floor);
|
| + break;
|
| + }
|
| case kMipsFloat64RoundTruncate: {
|
| ASSEMBLE_ROUND_DOUBLE_TO_DOUBLE(trunc_l_d, Truncate);
|
| break;
|
| }
|
| + case kMipsFloat32RoundTruncate: {
|
| + ASSEMBLE_ROUND_FLOAT_TO_FLOAT(trunc_w_s, Truncate);
|
| + break;
|
| + }
|
| case kMipsFloat64RoundUp: {
|
| ASSEMBLE_ROUND_DOUBLE_TO_DOUBLE(ceil_l_d, Ceil);
|
| break;
|
| }
|
| + case kMipsFloat32RoundUp: {
|
| + ASSEMBLE_ROUND_FLOAT_TO_FLOAT(ceil_w_s, Ceil);
|
| + break;
|
| + }
|
| case kMipsFloat64RoundTiesEven: {
|
| ASSEMBLE_ROUND_DOUBLE_TO_DOUBLE(round_l_d, TiesEven);
|
| break;
|
| }
|
| + case kMipsFloat32RoundTiesEven: {
|
| + ASSEMBLE_ROUND_FLOAT_TO_FLOAT(round_w_s, TiesEven);
|
| + break;
|
| + }
|
| case kMipsFloat64Max: {
|
| // (b < a) ? a : b
|
| if (IsMipsArchVariant(kMips32r6)) {
|
|
|