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 09e54bf5f15727ed799430312f01b675bcd56b29..ba02093ce6737a07aacdeec07dd08691d1fc7094 100644 |
--- a/src/compiler/mips/code-generator-mips.cc |
+++ b/src/compiler/mips/code-generator-mips.cc |
@@ -1198,59 +1198,25 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction( |
break; |
} |
case kMipsFloat64Max: { |
- // (b < a) ? a : b |
- if (IsMipsArchVariant(kMips32r6)) { |
- __ cmp_d(OLT, i.OutputDoubleRegister(), i.InputDoubleRegister(1), |
- i.InputDoubleRegister(0)); |
- __ sel_d(i.OutputDoubleRegister(), i.InputDoubleRegister(1), |
- i.InputDoubleRegister(0)); |
- } else { |
- __ c_d(OLT, i.InputDoubleRegister(0), i.InputDoubleRegister(1)); |
- // Left operand is result, passthrough if false. |
- __ movt_d(i.OutputDoubleRegister(), i.InputDoubleRegister(1)); |
- } |
+ Label compare_nan, done_compare; |
+ __ MaxNaNCheck_d(i.OutputDoubleRegister(), i.InputDoubleRegister(0), |
+ i.InputDoubleRegister(1), &compare_nan); |
+ __ Branch(&done_compare); |
+ __ bind(&compare_nan); |
+ __ Move(i.OutputDoubleRegister(), |
+ std::numeric_limits<double>::quiet_NaN()); |
+ __ bind(&done_compare); |
break; |
} |
case kMipsFloat64Min: { |
- // (a < b) ? a : b |
- if (IsMipsArchVariant(kMips32r6)) { |
- __ cmp_d(OLT, i.OutputDoubleRegister(), i.InputDoubleRegister(0), |
- i.InputDoubleRegister(1)); |
- __ sel_d(i.OutputDoubleRegister(), i.InputDoubleRegister(1), |
- i.InputDoubleRegister(0)); |
- } else { |
- __ c_d(OLT, i.InputDoubleRegister(1), i.InputDoubleRegister(0)); |
- // Right operand is result, passthrough if false. |
- __ movt_d(i.OutputDoubleRegister(), i.InputDoubleRegister(1)); |
- } |
- break; |
- } |
- case kMipsFloat32Max: { |
- // (b < a) ? a : b |
- if (IsMipsArchVariant(kMips32r6)) { |
- __ cmp_s(OLT, i.OutputDoubleRegister(), i.InputDoubleRegister(1), |
- i.InputDoubleRegister(0)); |
- __ sel_s(i.OutputDoubleRegister(), i.InputDoubleRegister(1), |
- i.InputDoubleRegister(0)); |
- } else { |
- __ c_s(OLT, i.InputDoubleRegister(0), i.InputDoubleRegister(1)); |
- // Left operand is result, passthrough if false. |
- __ movt_s(i.OutputDoubleRegister(), i.InputDoubleRegister(1)); |
- } |
- break; |
- } |
- case kMipsFloat32Min: { |
- // (a < b) ? a : b |
- if (IsMipsArchVariant(kMips32r6)) { |
- __ cmp_s(OLT, i.OutputDoubleRegister(), i.InputDoubleRegister(0), |
- i.InputDoubleRegister(1)); |
- __ sel_s(i.OutputDoubleRegister(), i.InputDoubleRegister(1), |
- i.InputDoubleRegister(0)); |
- } else { |
- __ c_s(OLT, i.InputDoubleRegister(1), i.InputDoubleRegister(0)); |
- // Right operand is result, passthrough if false. |
- __ movt_s(i.OutputDoubleRegister(), i.InputDoubleRegister(1)); |
- } |
+ Label compare_nan, done_compare; |
+ __ MinNaNCheck_d(i.OutputDoubleRegister(), i.InputDoubleRegister(0), |
+ i.InputDoubleRegister(1), &compare_nan); |
+ __ Branch(&done_compare); |
+ __ bind(&compare_nan); |
+ __ Move(i.OutputDoubleRegister(), |
+ std::numeric_limits<double>::quiet_NaN()); |
+ __ bind(&done_compare); |
break; |
} |
case kMipsCvtSD: { |