s390x: [liftoff] implement constant loading

Change-Id: Iec2fdaf3f180e6e59e40a558bf85a41cd96826ee
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2626464
Reviewed-by: Milad Fa <mfarazma@redhat.com>
Commit-Queue: Junliang Yan <junyan@redhat.com>
Cr-Commit-Position: refs/heads/master@{#72071}
This commit is contained in:
Junliang Yan 2021-01-13 10:42:47 -05:00 committed by Commit Bot
parent d232ab8996
commit a7ccf248f9

View File

@ -150,7 +150,28 @@ bool LiftoffAssembler::NeedsAlignment(ValueType type) {
void LiftoffAssembler::LoadConstant(LiftoffRegister reg, WasmValue value,
RelocInfo::Mode rmode) {
bailout(kUnsupportedArchitecture, "LoadConstant");
switch (value.type().kind()) {
case ValueType::kI32:
mov(reg.gp(), Operand(value.to_i32(), rmode));
break;
case ValueType::kI64:
mov(reg.gp(), Operand(value.to_i64(), rmode));
break;
case ValueType::kF32: {
UseScratchRegisterScope temps(this);
Register scratch = temps.Acquire();
LoadF32(reg.fp(), value.to_f32_boxed().get_scalar(), scratch);
break;
}
case ValueType::kF64: {
UseScratchRegisterScope temps(this);
Register scratch = temps.Acquire();
LoadF64(reg.fp(), value.to_f64_boxed().get_bits(), scratch);
break;
}
default:
UNREACHABLE();
}
}
void LiftoffAssembler::LoadFromInstance(Register dst, int offset, int size) {