Chromium Code Reviews| 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)); |