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: |