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

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

Issue 2233273002: X87: [wasm] Use the Float64Max/Min machine operators to implement F64Max/Min. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Updated the CL according to ahaas's comment Created 4 years, 4 months 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
« no previous file with comments | « no previous file | src/crankshaft/x87/lithium-codegen-x87.cc » ('j') | src/crankshaft/x87/lithium-codegen-x87.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/x87/code-generator-x87.cc
diff --git a/src/compiler/x87/code-generator-x87.cc b/src/compiler/x87/code-generator-x87.cc
index 9b8b823be33beb2d5f76a603c40436a2251e0671..976cd0ac426e182ffb1b025e87fad3a79496c38e 100644
--- a/src/compiler/x87/code-generator-x87.cc
+++ b/src/compiler/x87/code-generator-x87.cc
@@ -191,17 +191,35 @@ class OutOfLineLoadInteger final : public OutOfLineCode {
Register const result_;
};
-class OutOfLineLoadNaN final : public OutOfLineCode {
+class OutOfLineLoadFloat32NaN final : public OutOfLineCode {
public:
- OutOfLineLoadNaN(CodeGenerator* gen, X87Register result)
+ OutOfLineLoadFloat32NaN(CodeGenerator* gen, X87Register result)
: OutOfLineCode(gen), result_(result) {}
void Generate() final {
DCHECK(result_.code() == 0);
USE(result_);
__ fstp(0);
- __ push(Immediate(0xffffffff));
- __ push(Immediate(0x7fffffff));
+ __ push(Immediate(0xffc00000));
+ __ fld_s(MemOperand(esp, 0));
+ __ lea(esp, Operand(esp, kFloatSize));
+ }
+
+ private:
+ X87Register const result_;
+};
+
+class OutOfLineLoadFloat64NaN final : public OutOfLineCode {
+ public:
+ OutOfLineLoadFloat64NaN(CodeGenerator* gen, X87Register result)
+ : OutOfLineCode(gen), result_(result) {}
+
+ void Generate() final {
+ DCHECK(result_.code() == 0);
+ USE(result_);
+ __ fstp(0);
+ __ push(Immediate(0xfff80000));
+ __ push(Immediate(0x00000000));
__ fld_d(MemOperand(esp, 0));
__ lea(esp, Operand(esp, kDoubleSize));
}
@@ -210,7 +228,6 @@ class OutOfLineLoadNaN final : public OutOfLineCode {
X87Register const result_;
};
-
class OutOfLineTruncateDoubleToI final : public OutOfLineCode {
public:
OutOfLineTruncateDoubleToI(CodeGenerator* gen, Register result,
@@ -271,7 +288,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); \
@@ -1295,7 +1312,8 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
__ fld(1);
__ FCmp();
- 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);
@@ -1330,7 +1348,8 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
__ fld(1);
__ FCmp();
- 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);
@@ -1898,10 +1917,10 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
ASSEMBLE_CHECKED_LOAD_INTEGER(mov);
break;
case kCheckedLoadFloat32:
- ASSEMBLE_CHECKED_LOAD_FLOAT(fld_s);
+ ASSEMBLE_CHECKED_LOAD_FLOAT(fld_s, OutOfLineLoadFloat32NaN);
break;
case kCheckedLoadFloat64:
- ASSEMBLE_CHECKED_LOAD_FLOAT(fld_d);
+ ASSEMBLE_CHECKED_LOAD_FLOAT(fld_d, OutOfLineLoadFloat64NaN);
break;
case kCheckedStoreWord8:
ASSEMBLE_CHECKED_STORE_INTEGER(mov_b);
« no previous file with comments | « no previous file | src/crankshaft/x87/lithium-codegen-x87.cc » ('j') | src/crankshaft/x87/lithium-codegen-x87.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698