Reviewers: Hablich,
Description:
Version 4.5.103.6 (cherry-pick)
Merged a02e644c50289e4a141799a4a612a3374eeb26ad
X87: [turbofan] Add TruncationMode for TruncateFloat64ToInt32.
[email protected]
BUG=
Please review this at https://codereview.chromium.org/1228353003/
Base URL: https://chromium.googlesource.com/v8/[email protected]
Affected files (+25, -6 lines):
M include/v8-version.h
M src/compiler/x87/code-generator-x87.cc
M src/compiler/x87/instruction-selector-x87.cc
Index: include/v8-version.h
diff --git a/include/v8-version.h b/include/v8-version.h
index
bcfff275755c34cad4e5e14f549186a528d6849b..a853712d26462bf454cb9535ca6ee79c9c407704
100644
--- a/include/v8-version.h
+++ b/include/v8-version.h
@@ -11,7 +11,7 @@
#define V8_MAJOR_VERSION 4
#define V8_MINOR_VERSION 5
#define V8_BUILD_NUMBER 103
-#define V8_PATCH_LEVEL 5
+#define V8_PATCH_LEVEL 6
// Use 1 for candidates and 0 otherwise.
// (Boolean macro values are not supported by all preprocessors.)
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
d337ecc9d845934a614a1167996ea0d5ce120cdd..1335d3f56809d832b612e8e3e7d711a0a3b641a3
100644
--- a/src/compiler/x87/code-generator-x87.cc
+++ b/src/compiler/x87/code-generator-x87.cc
@@ -422,11 +422,13 @@ void
CodeGenerator::AssembleArchInstruction(Instruction* instr) {
__ mov(i.OutputRegister(), esp);
break;
case kArchTruncateDoubleToI: {
- auto input = i.InputDoubleRegister(0);
- USE(input);
- DCHECK(input.code() == 0);
- auto result_reg = i.OutputRegister();
- __ TruncateX87TOSToI(result_reg);
+ if (!instr->InputAt(0)->IsDoubleRegister()) {
+ __ fld_d(i.InputOperand(0));
+ }
+ __ TruncateX87TOSToI(i.OutputRegister());
+ if (!instr->InputAt(0)->IsDoubleRegister()) {
+ __ fstp(0);
+ }
break;
}
case kX87Add:
Index: src/compiler/x87/instruction-selector-x87.cc
diff --git a/src/compiler/x87/instruction-selector-x87.cc
b/src/compiler/x87/instruction-selector-x87.cc
index
7dda86efdc61150eaa41cae3eebdc88f163cf166..d350738e0b32e084cd42e43b255aedfb632bf0f1
100644
--- a/src/compiler/x87/instruction-selector-x87.cc
+++ b/src/compiler/x87/instruction-selector-x87.cc
@@ -647,6 +647,23 @@ void
InstructionSelector::VisitTruncateFloat64ToFloat32(Node* node) {
}
+void InstructionSelector::VisitTruncateFloat64ToInt32(Node* node) {
+ X87OperandGenerator g(this);
+
+ switch (TruncationModeOf(node->op())) {
+ case TruncationMode::kJavaScript:
+ Emit(kArchTruncateDoubleToI, g.DefineAsRegister(node),
+ g.Use(node->InputAt(0)));
+ return;
+ case TruncationMode::kRoundToZero:
+ Emit(kX87Float64ToInt32, g.DefineAsRegister(node),
+ g.Use(node->InputAt(0)));
+ return;
+ }
+ UNREACHABLE();
+}
+
+
void InstructionSelector::VisitFloat32Add(Node* node) {
X87OperandGenerator g(this);
Emit(kX87PushFloat32, g.NoOutput(), g.Use(node->InputAt(0)));
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.