Commit d1464deb authored by Clemens Hammacher's avatar Clemens Hammacher Committed by Commit Bot

[Liftoff] Implement i32/i64 to f64 conversions

After the refactoring for supporting f32 conversions, adding f64
conversions is straight forward.

R=titzer@chromium.org

Bug: v8:6600
Change-Id: I8f76fbef3f1e67ecdb02dd1d103868f2d1d3226f
Reviewed-on: https://chromium-review.googlesource.com/957026
Commit-Queue: Clemens Hammacher <clemensh@chromium.org>
Reviewed-by: 's avatarBen Titzer <titzer@chromium.org>
Cr-Commit-Position: refs/heads/master@{#51864}
parent 94bbb8bb
......@@ -707,6 +707,12 @@ bool LiftoffAssembler::emit_type_conversion(WasmOpcode opcode,
Cvtui2ss(dst.fp(), src.gp(), scratch);
return true;
}
case kExprF64SConvertI32:
Cvtsi2sd(dst.fp(), src.gp());
return true;
case kExprF64UConvertI32:
LoadUint32(dst.fp(), src.gp());
return true;
default:
return false;
}
......
......@@ -514,7 +514,8 @@ class LiftoffCompiler {
__ SetCCallStackParamAddr(num_stack_params, num_lowered_args, arg_type);
++num_stack_params;
}
num_lowered_args += 1 + needs_reg_pair(arg_type);
num_lowered_args +=
RoundUp<kPointerSize>(WasmOpcodes::MemSize(arg_type)) / kPointerSize;
++input_idx;
};
for (ValueType arg_type : sig->parameters()) {
......@@ -637,6 +638,12 @@ class LiftoffCompiler {
&ExternalReference::wasm_int64_to_float32)
CASE_TYPE_CONVERSION(F32UConvertI64, F32, I64,
&ExternalReference::wasm_uint64_to_float32)
CASE_TYPE_CONVERSION(F64SConvertI32, F64, I32, nullptr)
CASE_TYPE_CONVERSION(F64UConvertI32, F64, I32, nullptr)
CASE_TYPE_CONVERSION(F64SConvertI64, F64, I64,
&ExternalReference::wasm_int64_to_float64)
CASE_TYPE_CONVERSION(F64UConvertI64, F64, I64,
&ExternalReference::wasm_uint64_to_float64)
default:
return unsupported(decoder, WasmOpcodes::OpcodeName(opcode));
}
......
......@@ -658,6 +658,19 @@ bool LiftoffAssembler::emit_type_conversion(WasmOpcode opcode,
case kExprF32UConvertI64:
Cvtqui2ss(dst.fp(), src.gp(), kScratchRegister);
return true;
case kExprF64SConvertI32:
Cvtlsi2sd(dst.fp(), src.gp());
return true;
case kExprF64UConvertI32:
movl(kScratchRegister, src.gp());
Cvtqsi2sd(dst.fp(), kScratchRegister);
return true;
case kExprF64SConvertI64:
Cvtqsi2sd(dst.fp(), src.gp());
return true;
case kExprF64UConvertI64:
Cvtqui2sd(dst.fp(), src.gp(), kScratchRegister);
return true;
default:
UNREACHABLE();
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment