Commit b4809718 authored by Milad Fa's avatar Milad Fa Committed by V8 LUCI CQ

PPC/AIX [simd]: Implement vector load and splat

This CL takes advantage of the P9 `vector byte-reverse`
instruction to implement Simd LoadSplat opcodes.

We will need to implement the rest of the `load transform` ops
before enabling this from wasm-compiler on BE machines.

Change-Id: I094e37d3b15e0dc04484eb2a701cb479f18e2f9e
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3371790Reviewed-by: 's avatarJunliang Yan <junyan@redhat.com>
Commit-Queue: Milad Farazmand <mfarazma@redhat.com>
Cr-Commit-Position: refs/heads/main@{#78544}
parent 62539209
......@@ -431,9 +431,15 @@ using Instr = uint32_t;
/* signalling */ \
V(xscvspdpn, XSCVSPDPN, 0xF000052C)
#define PPC_XX2_OPCODE_B_FORM_LIST(V) \
/* Vector Byte-Reverse Quadword */ \
V(xxbrq, XXBRQ, 0xF01F076C)
#define PPC_XX2_OPCODE_B_FORM_LIST(V) \
/* Vector Byte-Reverse Quadword */ \
V(xxbrq, XXBRQ, 0xF01F076C) \
/* Vector Byte-Reverse Doubleword */ \
V(xxbrd, XXBRD, 0xF017076C) \
/* Vector Byte-Reverse Word */ \
V(xxbrw, XXBRW, 0xF00F076C) \
/* Vector Byte-Reverse Halfword */ \
V(xxbrh, XXBRH, 0xF007076C)
#define PPC_XX2_OPCODE_UNUSED_LIST(V) \
/* VSX Scalar Square Root Double-Precision */ \
......
......@@ -3358,6 +3358,11 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
MemOperand operand = i.MemoryOperand(&mode); \
DCHECK_EQ(mode, kMode_MRR); \
__ load_instr(scratch, operand);
#if V8_TARGET_BIG_ENDIAN
#define MAYBE_REVERSE_BYTES(reg, instr) __ instr(reg, reg);
#else
#define MAYBE_REVERSE_BYTES(reg, instr)
#endif
case kPPC_S128Load8Splat: {
Simd128Register dst = i.OutputSimd128Register();
ASSEMBLE_LOAD_TRANSFORM(kScratchSimd128Reg, lxsibzx)
......@@ -3367,12 +3372,14 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
case kPPC_S128Load16Splat: {
Simd128Register dst = i.OutputSimd128Register();
ASSEMBLE_LOAD_TRANSFORM(kScratchSimd128Reg, lxsihzx)
MAYBE_REVERSE_BYTES(kScratchSimd128Reg, xxbrh)
__ vsplth(dst, kScratchSimd128Reg, Operand(3));
break;
}
case kPPC_S128Load32Splat: {
Simd128Register dst = i.OutputSimd128Register();
ASSEMBLE_LOAD_TRANSFORM(kScratchSimd128Reg, lxsiwzx)
MAYBE_REVERSE_BYTES(kScratchSimd128Reg, xxbrw)
__ vspltw(dst, kScratchSimd128Reg, Operand(1));
break;
}
......@@ -3380,6 +3387,7 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
constexpr int lane_width_in_bytes = 8;
Simd128Register dst = i.OutputSimd128Register();
ASSEMBLE_LOAD_TRANSFORM(dst, lxsdx)
MAYBE_REVERSE_BYTES(dst, xxbrd)
__ vinsertd(dst, dst, Operand(1 * lane_width_in_bytes));
break;
}
......@@ -3453,6 +3461,7 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
__ vinsertd(dst, kScratchSimd128Reg, Operand(1 * lane_width_in_bytes));
break;
}
#undef MAYBE_REVERSE_BYTES
#undef ASSEMBLE_LOAD_TRANSFORM
case kPPC_S128Load8Lane: {
Simd128Register dst = i.OutputSimd128Register();
......
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