PPC [liftoff]: Avoid overwriting offset register during fp load

Change-Id: I2abc916894b84aad5794e4a69979ca8683644806
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3289933
Commit-Queue: Milad Fa <mfarazma@redhat.com>
Reviewed-by: Junliang Yan <junyan@redhat.com>
Cr-Commit-Position: refs/heads/main@{#77990}
This commit is contained in:
Milad Fa 2021-11-18 15:50:02 -05:00 committed by V8 LUCI CQ
parent 31e20c034e
commit 500defa505

View File

@ -410,14 +410,32 @@ void LiftoffAssembler::Load(LiftoffRegister dst, Register src_addr,
break;
case LoadType::kF32Load:
if (is_load_mem) {
LoadF32LE(dst.fp(), src_op, r0, ip);
// `ip` could be used as offset_reg.
Register scratch = ip;
if (offset_reg == ip) {
scratch = GetRegisterThatIsNotOneOf(src_addr);
push(scratch);
}
LoadF32LE(dst.fp(), src_op, r0, scratch);
if (offset_reg == ip) {
pop(scratch);
}
} else {
LoadF32(dst.fp(), src_op, r0);
}
break;
case LoadType::kF64Load:
if (is_load_mem) {
// `ip` could be used as offset_reg.
Register scratch = ip;
if (offset_reg == ip) {
scratch = GetRegisterThatIsNotOneOf(src_addr);
push(scratch);
}
LoadF64LE(dst.fp(), src_op, r0, ip);
if (offset_reg == ip) {
pop(scratch);
}
} else {
LoadF64(dst.fp(), src_op, r0);
}