Index: src/compiler/ia32/code-generator-ia32.cc |
diff --git a/src/compiler/ia32/code-generator-ia32.cc b/src/compiler/ia32/code-generator-ia32.cc |
index 63be7f22084548d5be65d1d8ee9a11d0cf0681b2..88eda422edb297af7ad81ce3443553bcd5dcaf42 100644 |
--- a/src/compiler/ia32/code-generator-ia32.cc |
+++ b/src/compiler/ia32/code-generator-ia32.cc |
@@ -197,17 +197,33 @@ class OutOfLineLoadInteger final : public OutOfLineCode { |
Register const result_; |
}; |
-class OutOfLineLoadNaN final : public OutOfLineCode { |
+class OutOfLineLoadFloat32NaN final : public OutOfLineCode { |
public: |
- OutOfLineLoadNaN(CodeGenerator* gen, XMMRegister result) |
+ OutOfLineLoadFloat32NaN(CodeGenerator* gen, XMMRegister result) |
: OutOfLineCode(gen), result_(result) {} |
- void Generate() final { __ pcmpeqd(result_, result_); } |
+ void Generate() final { |
+ __ xorps(result_, result_); |
+ __ divss(result_, result_); |
+ } |
private: |
XMMRegister const result_; |
}; |
+class OutOfLineLoadFloat64NaN final : public OutOfLineCode { |
+ public: |
+ OutOfLineLoadFloat64NaN(CodeGenerator* gen, XMMRegister result) |
+ : OutOfLineCode(gen), result_(result) {} |
+ |
+ void Generate() final { |
+ __ xorpd(result_, result_); |
+ __ divsd(result_, result_); |
+ } |
+ |
+ private: |
+ XMMRegister const result_; |
+}; |
class OutOfLineTruncateDoubleToI final : public OutOfLineCode { |
public: |
@@ -270,7 +286,7 @@ class OutOfLineRecordWrite final : public OutOfLineCode { |
} // namespace |
-#define ASSEMBLE_CHECKED_LOAD_FLOAT(asm_instr) \ |
+#define ASSEMBLE_CHECKED_LOAD_FLOAT(asm_instr, OutOfLineLoadNaN) \ |
do { \ |
auto result = i.OutputDoubleRegister(); \ |
auto offset = i.InputRegister(0); \ |
@@ -1039,7 +1055,8 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction( |
} else { |
__ ucomisd(i.InputDoubleRegister(0), i.InputOperand(1)); |
} |
- auto ool = new (zone()) OutOfLineLoadNaN(this, i.OutputDoubleRegister()); |
+ auto ool = |
+ new (zone()) OutOfLineLoadFloat64NaN(this, i.OutputDoubleRegister()); |
__ j(parity_even, ool->entry()); |
__ j(above, &done_compare, Label::kNear); |
__ j(below, &compare_swap, Label::kNear); |
@@ -1063,7 +1080,8 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction( |
} else { |
__ ucomisd(i.InputDoubleRegister(0), i.InputOperand(1)); |
} |
- auto ool = new (zone()) OutOfLineLoadNaN(this, i.OutputDoubleRegister()); |
+ auto ool = |
+ new (zone()) OutOfLineLoadFloat64NaN(this, i.OutputDoubleRegister()); |
__ j(parity_even, ool->entry()); |
__ j(below, &done_compare, Label::kNear); |
__ j(above, &compare_swap, Label::kNear); |
@@ -1496,10 +1514,10 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction( |
ASSEMBLE_CHECKED_LOAD_INTEGER(mov); |
break; |
case kCheckedLoadFloat32: |
- ASSEMBLE_CHECKED_LOAD_FLOAT(movss); |
+ ASSEMBLE_CHECKED_LOAD_FLOAT(movss, OutOfLineLoadFloat32NaN); |
break; |
case kCheckedLoadFloat64: |
- ASSEMBLE_CHECKED_LOAD_FLOAT(movsd); |
+ ASSEMBLE_CHECKED_LOAD_FLOAT(movsd, OutOfLineLoadFloat64NaN); |
break; |
case kCheckedStoreWord8: |
ASSEMBLE_CHECKED_STORE_INTEGER(mov_b); |