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

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

Issue 1507703002: [turbofan] Change TruncateFloat64ToUint64 to TryTruncateFloatToUint64. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Added mips64 implementation, fixed nits. Created 5 years 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 | « src/compiler/verifier.cc ('k') | src/compiler/x64/instruction-selector-x64.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/x64/code-generator-x64.cc
diff --git a/src/compiler/x64/code-generator-x64.cc b/src/compiler/x64/code-generator-x64.cc
index 62003f10551c913b7673cdde1553915318a54406..e72844c27f616ea462d219204e3d9ac5e16a9d98 100644
--- a/src/compiler/x64/code-generator-x64.cc
+++ b/src/compiler/x64/code-generator-x64.cc
@@ -1106,11 +1106,15 @@ void CodeGenerator::AssembleArchInstruction(Instruction* instr) {
} else {
__ Cvttsd2siq(i.OutputRegister(), i.InputOperand(0));
}
+ if (instr->OutputCount() > 1) {
+ __ Set(i.OutputRegister(1), 0);
+ }
// Check if the result of the Float64ToInt64 conversion is positive, we
// are already done.
__ testq(i.OutputRegister(), i.OutputRegister());
Label done;
- __ j(positive, &done);
+ Label success;
+ __ j(positive, &success);
// The result of the first conversion was negative, which means that the
// input value was not within the positive int64 range. We subtract 2^64
// and convert it again to see if it is within the uint64 range.
@@ -1128,9 +1132,12 @@ void CodeGenerator::AssembleArchInstruction(Instruction* instr) {
// The input value is within uint64 range and the second conversion worked
// successfully, but we still have to undo the subtraction we did
// earlier.
- __ movq(kScratchRegister, Immediate(1));
- __ shlq(kScratchRegister, Immediate(63));
+ __ Set(kScratchRegister, 0x8000000000000000);
__ orq(i.OutputRegister(), kScratchRegister);
+ __ bind(&success);
+ if (instr->OutputCount() > 1) {
+ __ Set(i.OutputRegister(1), 1);
+ }
__ bind(&done);
break;
}
« no previous file with comments | « src/compiler/verifier.cc ('k') | src/compiler/x64/instruction-selector-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698