Commit 0279d82c authored by Milad Fa's avatar Milad Fa Committed by Commit Bot

PPC: [wasm-simd] Retrieve the value of SupportsWasmSimd128() in builtin

Port 68105996

Original Commit Message:

    WasmCompileLazy needs to save the content of vector
    parameter registers. If Simd is not enabled or the hardware
    does not support Simd operations then we need to saves the value of
    Double registers instead, therefore we need a way to retrieve the
    value of "CpuFeatures::SupportsWasmSimd128()" in builtins
    during runtime.

R=mfarazma@redhat.com, joransiu@ca.ibm.com, junyan@redhat.com, midawson@redhat.com
BUG=
LOG=N

Change-Id: I523f1353c61942acaa97c11637342b5be3d39b9d
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2684980Reviewed-by: 's avatarJunliang Yan <junyan@redhat.com>
Commit-Queue: Milad Fa <mfarazma@redhat.com>
Cr-Commit-Position: refs/heads/master@{#72610}
parent 5d67f90e
......@@ -2419,17 +2419,22 @@ void Builtins::Generate_WasmCompileLazy(MacroAssembler* masm) {
// As these registers are two different sets on ppc we must make
// sure to also save them when Simd is enabled.
// Check the comments under crrev.com/c/2645694 for more details.
if (CpuFeatures::SupportsWasmSimd128()) {
__ MultiPushV128(simd_regs);
} else {
// kFixedFrameSizeFromFp is hard coded to include space for Simd
// registers, so we still need to allocate space on the stack even if we
// are not pushing them.
__ addi(
sp, sp,
Operand(-static_cast<int8_t>(base::bits::CountPopulation(simd_regs)) *
kSimd128Size));
}
Label push_empty_simd, simd_pushed;
__ Move(ip, ExternalReference::supports_wasm_simd_128_address());
__ LoadByte(ip, MemOperand(ip), r0);
__ cmpi(ip, Operand::Zero()); // If > 0 then simd is available.
__ ble(&push_empty_simd);
__ MultiPushV128(simd_regs);
__ b(&simd_pushed);
__ bind(&push_empty_simd);
// kFixedFrameSizeFromFp is hard coded to include space for Simd
// registers, so we still need to allocate space on the stack even if we
// are not pushing them.
__ addi(
sp, sp,
Operand(-static_cast<int8_t>(base::bits::CountPopulation(simd_regs)) *
kSimd128Size));
__ bind(&simd_pushed);
// Pass instance and function index as explicit arguments to the runtime
// function.
......@@ -2442,14 +2447,19 @@ void Builtins::Generate_WasmCompileLazy(MacroAssembler* masm) {
__ mr(r11, kReturnRegister0);
// Restore registers.
if (CpuFeatures::SupportsWasmSimd128()) {
__ MultiPopV128(simd_regs);
} else {
__ addi(
sp, sp,
Operand(static_cast<int8_t>(base::bits::CountPopulation(simd_regs)) *
kSimd128Size));
}
Label pop_empty_simd, simd_popped;
__ Move(ip, ExternalReference::supports_wasm_simd_128_address());
__ LoadByte(ip, MemOperand(ip), r0);
__ cmpi(ip, Operand::Zero()); // If > 0 then simd is available.
__ ble(&pop_empty_simd);
__ MultiPopV128(simd_regs);
__ b(&simd_popped);
__ bind(&pop_empty_simd);
__ addi(
sp, sp,
Operand(static_cast<int8_t>(base::bits::CountPopulation(simd_regs)) *
kSimd128Size));
__ bind(&simd_popped);
__ MultiPopDoubles(fp_regs);
__ MultiPop(gp_regs);
}
......
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