Commit 1d48b7bf authored by Clemens Hammacher's avatar Clemens Hammacher Committed by Commit Bot

[Liftoff] Add f32.load and f32.store support

There is not much missing to support loading and storing f32 values.
This CL adds that.

R=titzer@chromium.org

Bug: v8:6600
Change-Id: If4a21490bfcb9cccec1ba62986a23549b3c857fa
Reviewed-on: https://chromium-review.googlesource.com/866711Reviewed-by: 's avatarBen Titzer <titzer@chromium.org>
Commit-Queue: Clemens Hammacher <clemensh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#50606}
parent ce7ad569
...@@ -116,6 +116,9 @@ void LiftoffAssembler::Load(LiftoffRegister dst, Register src_addr, ...@@ -116,6 +116,9 @@ void LiftoffAssembler::Load(LiftoffRegister dst, Register src_addr,
case LoadType::kI32Load: case LoadType::kI32Load:
mov(dst.gp(), src_op); mov(dst.gp(), src_op);
break; break;
case LoadType::kF32Load:
movss(dst.fp(), src_op);
break;
default: default:
UNREACHABLE(); UNREACHABLE();
} }
...@@ -156,6 +159,9 @@ void LiftoffAssembler::Store(Register dst_addr, Register offset_reg, ...@@ -156,6 +159,9 @@ void LiftoffAssembler::Store(Register dst_addr, Register offset_reg,
case StoreType::kI32Store: case StoreType::kI32Store:
mov(dst_op, src.gp()); mov(dst_op, src.gp());
break; break;
case StoreType::kF32Store:
movss(dst_op, src.fp());
break;
default: default:
UNREACHABLE(); UNREACHABLE();
} }
......
...@@ -808,7 +808,8 @@ class LiftoffCompiler { ...@@ -808,7 +808,8 @@ class LiftoffCompiler {
const MemoryAccessOperand<validate>& operand, const MemoryAccessOperand<validate>& operand,
const Value& index_val, Value* result) { const Value& index_val, Value* result) {
ValueType value_type = type.value_type(); ValueType value_type = type.value_type();
if (value_type != kWasmI32) return unsupported(decoder, "non-i32 load"); if (value_type != kWasmI32 && value_type != kWasmF32)
return unsupported(decoder, "unsupported load type");
LiftoffRegList pinned; LiftoffRegList pinned;
Register index = pinned.set(__ PopToRegister(kGpReg)).gp(); Register index = pinned.set(__ PopToRegister(kGpReg)).gp();
if (!env_->use_trap_handler) { if (!env_->use_trap_handler) {
...@@ -834,7 +835,8 @@ class LiftoffCompiler { ...@@ -834,7 +835,8 @@ class LiftoffCompiler {
const MemoryAccessOperand<validate>& operand, const MemoryAccessOperand<validate>& operand,
const Value& index_val, const Value& value_val) { const Value& index_val, const Value& value_val) {
ValueType value_type = type.value_type(); ValueType value_type = type.value_type();
if (value_type != kWasmI32) return unsupported(decoder, "non-i32 store"); if (value_type != kWasmI32 && value_type != kWasmF32)
return unsupported(decoder, "unsupported store type");
RegClass rc = reg_class_for(value_type); RegClass rc = reg_class_for(value_type);
LiftoffRegList pinned; LiftoffRegList pinned;
LiftoffRegister value = pinned.set(__ PopToRegister(rc)); LiftoffRegister value = pinned.set(__ PopToRegister(rc));
......
...@@ -112,6 +112,9 @@ void LiftoffAssembler::Load(LiftoffRegister dst, Register src_addr, ...@@ -112,6 +112,9 @@ void LiftoffAssembler::Load(LiftoffRegister dst, Register src_addr,
case LoadType::kI64Load: case LoadType::kI64Load:
movq(dst.gp(), src_op); movq(dst.gp(), src_op);
break; break;
case LoadType::kF32Load:
Movss(dst.fp(), src_op);
break;
default: default:
UNREACHABLE(); UNREACHABLE();
} }
...@@ -148,6 +151,9 @@ void LiftoffAssembler::Store(Register dst_addr, Register offset_reg, ...@@ -148,6 +151,9 @@ void LiftoffAssembler::Store(Register dst_addr, Register offset_reg,
case StoreType::kI64Store: case StoreType::kI64Store:
movq(dst_op, src.gp()); movq(dst_op, src.gp());
break; break;
case StoreType::kF32Store:
Movss(dst_op, src.fp());
break;
default: default:
UNREACHABLE(); 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