Commit df106114 authored by George Wort's avatar George Wort Committed by Commit Bot

[liftoff][arm] Support the use of f32 values

This makes changes to the generic code in Liftoff to support f32 values on the
arm32 port, but does not implement any handling of them in practice.

Bug: v8:6600
Change-Id: Ia1587c4eee0158ef6b0caa46b6b212cb96ef579f
Reviewed-on: https://chromium-review.googlesource.com/c/1352287
Commit-Queue: Clemens Hammacher <clemensh@chromium.org>
Reviewed-by: 's avatarClemens Hammacher <clemensh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#57902}
parent e43d2e21
......@@ -506,7 +506,18 @@ void LiftoffAssembler::PrepareCall(FunctionSig* sig,
if (loc.IsRegister()) {
DCHECK(!loc.IsAnyRegister());
RegClass rc = is_pair ? kGpReg : reg_class_for(type);
LiftoffRegister reg = LiftoffRegister::from_code(rc, loc.AsRegister());
int reg_code = loc.AsRegister();
#if V8_TARGET_ARCH_ARM
// Liftoff assumes a one-to-one mapping between float registers and
// double registers, and so does not distinguish between f32 and f64
// registers. The f32 register code must therefore be halved in order to
// pass the f64 code to Liftoff.
DCHECK_IMPLIES(type == kWasmF32, (reg_code % 2) == 0);
LiftoffRegister reg = LiftoffRegister::from_code(
rc, (type == kWasmF32) ? (reg_code / 2) : reg_code);
#else
LiftoffRegister reg = LiftoffRegister::from_code(rc, reg_code);
#endif
param_regs.set(reg);
if (is_pair) {
stack_transfers.LoadI64HalfIntoRegister(reg, slot, stack_idx, half);
......@@ -566,6 +577,11 @@ void LiftoffAssembler::FinishCall(FunctionSig* sig,
const bool need_pair = kNeedI64RegPair && return_type == kWasmI64;
DCHECK_EQ(need_pair ? 2 : 1, call_descriptor->ReturnCount());
RegClass rc = need_pair ? kGpReg : reg_class_for(return_type);
#if V8_TARGET_ARCH_ARM
// If the return register was not d0 for f32, the code value would have to
// be halved as is done for the parameter registers.
DCHECK_EQ(call_descriptor->GetReturnLocation(0).AsRegister(), 0);
#endif
LiftoffRegister return_reg = LiftoffRegister::from_code(
rc, call_descriptor->GetReturnLocation(0).AsRegister());
DCHECK(GetCacheRegList(rc).has(return_reg));
......
......@@ -104,13 +104,8 @@ compiler::CallDescriptor* GetLoweredCallDescriptor(
: call_desc;
}
// TODO(arm): Add support for F32 registers. Fix arm32 FP registers alias.
#if V8_TARGET_ARCH_ARM
constexpr ValueType kSupportedTypesArr[] = {kWasmI32, kWasmI64, kWasmF64};
#else
constexpr ValueType kSupportedTypesArr[] = {kWasmI32, kWasmI64, kWasmF32,
kWasmF64};
#endif
constexpr Vector<const ValueType> kSupportedTypes =
ArrayVector(kSupportedTypesArr);
......@@ -257,6 +252,16 @@ class LiftoffCompiler {
if (param_loc.IsRegister()) {
DCHECK(!param_loc.IsAnyRegister());
int reg_code = param_loc.AsRegister();
#if V8_TARGET_ARCH_ARM
// Liftoff assumes a one-to-one mapping between float registers and
// double registers, and so does not distinguish between f32 and f64
// registers. The f32 register code must therefore be halved in order to
// pass the f64 code to Liftoff.
DCHECK_IMPLIES(type == kWasmF32, (reg_code % 2) == 0);
if (type == kWasmF32) {
reg_code /= 2;
}
#endif
RegList cache_regs = rc == kGpReg ? kLiftoffAssemblerGpCacheRegs
: kLiftoffAssemblerFpCacheRegs;
if (cache_regs & (1ULL << reg_code)) {
......
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