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

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

Issue 1495213003: [turbofan] Changed TruncateFloat64ToInt64 to TryTruncateFloat64ToInt64. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: 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 | « no previous file | src/compiler/arm64/instruction-selector-arm64.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/arm64/code-generator-arm64.cc
diff --git a/src/compiler/arm64/code-generator-arm64.cc b/src/compiler/arm64/code-generator-arm64.cc
index 750874cea812769bd3dcf437bdff4d9212b3bda3..86adc8b21c7c29470bcbb6a05105ad9958d2d8f5 100644
--- a/src/compiler/arm64/code-generator-arm64.cc
+++ b/src/compiler/arm64/code-generator-arm64.cc
@@ -33,6 +33,8 @@ class Arm64OperandConverter final : public InstructionOperandConverter {
return InputDoubleRegister(index);
}
+ size_t OutputCount() { return instr_->OutputCount(); }
+
DoubleRegister OutputFloat32Register() { return OutputDoubleRegister().S(); }
DoubleRegister OutputFloat64Register() { return OutputDoubleRegister(); }
@@ -1037,7 +1039,23 @@ void CodeGenerator::AssembleArchInstruction(Instruction* instr) {
__ Fcvtzs(i.OutputRegister64(), i.InputFloat32Register(0));
break;
case kArm64Float64ToInt64:
- __ Fcvtzs(i.OutputRegister64(), i.InputDoubleRegister(0));
+ __ Fcvtzs(i.OutputRegister(0), i.InputDoubleRegister(0));
+ if (i.OutputCount() > 1) {
+ UseScratchRegisterScope scope(masm());
+ Label overflow;
+ Label done;
+ __ Fcmp(i.InputDoubleRegister(0), i.InputDoubleRegister(0));
+ __ B(ne, &overflow);
+ __ Cmp(i.OutputRegister(0), i.InputInt64(1));
Rodolph Perfetta (ARM) 2015/12/04 16:15:45 Have a look at MacroAssembler::TryConvertDoubleToI
ahaas 2015/12/07 11:00:34 Done.
+ __ B(eq, &overflow);
+ __ Cmp(i.OutputRegister(0), i.InputInt64(2));
+ __ B(eq, &overflow);
+ __ Mov(i.OutputRegister(1), 1);
Rodolph Perfetta (ARM) 2015/12/04 16:15:45 using cset will give you more compact code.
ahaas 2015/12/07 11:00:34 Done.
+ __ B(&done);
+ __ Bind(&overflow);
+ __ Mov(i.OutputRegister(1), 0);
+ __ Bind(&done);
+ }
break;
case kArm64Float32ToUint64:
__ Fcvtzu(i.OutputRegister64(), i.InputFloat32Register(0));
« no previous file with comments | « no previous file | src/compiler/arm64/instruction-selector-arm64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698