From 8dc9e521fa8bedd599a8f8d719b4e507e8b50c66 Mon Sep 17 00:00:00 2001 From: Milad Fa Date: Fri, 19 Aug 2022 15:51:34 -0400 Subject: [PATCH] PPC: pass a gp scratch register to SwapSimd128 Change-Id: I5da6270dc5c3d9b561eeb6c6dd3a938e705039c4 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3843088 Reviewed-by: Junliang Yan Commit-Queue: Milad Farazmand Cr-Commit-Position: refs/heads/main@{#82604} --- src/codegen/ppc/macro-assembler-ppc.cc | 18 +++++++++--------- src/codegen/ppc/macro-assembler-ppc.h | 4 ++-- src/compiler/backend/ppc/code-generator-ppc.cc | 5 +++-- 3 files changed, 14 insertions(+), 13 deletions(-) diff --git a/src/codegen/ppc/macro-assembler-ppc.cc b/src/codegen/ppc/macro-assembler-ppc.cc index 8ee31eb064..837dedcc78 100644 --- a/src/codegen/ppc/macro-assembler-ppc.cc +++ b/src/codegen/ppc/macro-assembler-ppc.cc @@ -3986,21 +3986,21 @@ void TurboAssembler::SwapSimd128(Simd128Register src, Simd128Register dst, } void TurboAssembler::SwapSimd128(Simd128Register src, MemOperand dst, - Simd128Register scratch) { - DCHECK(src != scratch); - LoadSimd128(scratch, dst, ip); + Simd128Register scratch1, Register scratch2) { + DCHECK(src != scratch1); + LoadSimd128(scratch1, dst, scratch2); StoreSimd128(src, dst, ip); - vor(src, scratch, scratch); + vor(src, scratch1, scratch1); } void TurboAssembler::SwapSimd128(MemOperand src, MemOperand dst, Simd128Register scratch1, - Simd128Register scratch2) { - LoadSimd128(scratch1, src, ip); - LoadSimd128(scratch2, dst, ip); + Simd128Register scratch2, Register scratch3) { + LoadSimd128(scratch1, src, scratch3); + LoadSimd128(scratch2, dst, scratch3); - StoreSimd128(scratch1, dst, ip); - StoreSimd128(scratch2, src, ip); + StoreSimd128(scratch1, dst, scratch3); + StoreSimd128(scratch2, src, scratch3); } void TurboAssembler::ByteReverseU16(Register dst, Register val, diff --git a/src/codegen/ppc/macro-assembler-ppc.h b/src/codegen/ppc/macro-assembler-ppc.h index 36cf117545..377e6a573a 100644 --- a/src/codegen/ppc/macro-assembler-ppc.h +++ b/src/codegen/ppc/macro-assembler-ppc.h @@ -615,9 +615,9 @@ class V8_EXPORT_PRIVATE TurboAssembler : public TurboAssemblerBase { void SwapSimd128(Simd128Register src, Simd128Register dst, Simd128Register scratch); void SwapSimd128(Simd128Register src, MemOperand dst, - Simd128Register scratch); + Simd128Register scratch1, Register scratch2); void SwapSimd128(MemOperand src, MemOperand dst, Simd128Register scratch1, - Simd128Register scratch2); + Simd128Register scratch2, Register scratch3); void ByteReverseU16(Register dst, Register val, Register scratch); void ByteReverseU32(Register dst, Register val, Register scratch); diff --git a/src/compiler/backend/ppc/code-generator-ppc.cc b/src/compiler/backend/ppc/code-generator-ppc.cc index b243bd1543..a62bd69312 100644 --- a/src/compiler/backend/ppc/code-generator-ppc.cc +++ b/src/compiler/backend/ppc/code-generator-ppc.cc @@ -4518,12 +4518,13 @@ void CodeGenerator::AssembleSwap(InstructionOperand* source, __ SwapSimd128(src, g.ToSimd128Register(destination), kScratchSimd128Reg); } else { DCHECK(destination->IsSimd128StackSlot()); - __ SwapSimd128(src, g.ToMemOperand(destination), kScratchSimd128Reg); + __ SwapSimd128(src, g.ToMemOperand(destination), kScratchSimd128Reg, + kScratchReg); } } else if (source->IsSimd128StackSlot()) { DCHECK(destination->IsSimd128StackSlot()); __ SwapSimd128(g.ToMemOperand(source), g.ToMemOperand(destination), - kScratchSimd128Reg, kScratchSimd128Reg2); + kScratchSimd128Reg, kScratchSimd128Reg2, kScratchReg); } else { UNREACHABLE();