Commit 1568a47c authored by Milad Farazmand's avatar Milad Farazmand Committed by Commit Bot

PPC: [wasm-simd] Implement Simd128 Load and Store

Change-Id: I436c779613e7ddf4b5c830807414dbc8787b89f5
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2151103Reviewed-by: 's avatarJunliang Yan <jyan@ca.ibm.com>
Commit-Queue: Milad Farazmand <miladfar@ca.ibm.com>
Cr-Commit-Position: refs/heads/master@{#67211}
parent 80e5e2b4
......@@ -1229,7 +1229,11 @@ using Instr = uint32_t;
/* Store Floating-Point Single with Update Indexed */ \
V(stfsux, STFSUX, 0x7C00056E) \
/* Store Floating-Point Single Indexed */ \
V(stfsx, STFSX, 0x7C00052E)
V(stfsx, STFSX, 0x7C00052E) \
/* Load Vector Indexed */ \
V(lvx, LVX, 0x7C0000CE) \
/* Store Vector Indexed */ \
V(stvx, STVX, 0x7C0001CE)
#define PPC_X_OPCODE_E_FORM_LIST(V) \
/* Shift Right Algebraic Word Immediate */ \
......@@ -1693,8 +1697,6 @@ using Instr = uint32_t;
V(lvsl, LVSL, 0x7C00000C) \
/* Load Vector for Shift Right */ \
V(lvsr, LVSR, 0x7C00004C) \
/* Load Vector Indexed */ \
V(lvx, LVX, 0x7C0000CE) \
/* Load Vector Indexed Last */ \
V(lvxl, LVXL, 0x7C0002CE) \
/* Store Vector Element Byte Indexed */ \
......@@ -1703,8 +1705,6 @@ using Instr = uint32_t;
V(stvehx, STVEHX, 0x7C00014E) \
/* Store Vector Element Word Indexed */ \
V(stvewx, STVEWX, 0x7C00018E) \
/* Store Vector Indexed */ \
V(stvx, STVX, 0x7C0001CE) \
/* Store Vector Indexed Last */ \
V(stvxl, STVXL, 0x7C0003CE) \
/* Vector Minimum Signed Doubleword */ \
......
......@@ -1991,6 +1991,18 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
case kPPC_LoadDouble:
ASSEMBLE_LOAD_FLOAT(lfd, lfdx);
break;
case kPPC_LoadSimd128: {
Simd128Register result = i.OutputSimd128Register();
AddressingMode mode = kMode_None;
MemOperand operand = i.MemoryOperand(&mode);
bool is_atomic = i.InputInt32(2);
// lvx only supports MRR.
DCHECK_EQ(mode, kMode_MRR);
__ lvx(result, operand);
if (is_atomic) __ lwsync();
DCHECK_EQ(LeaveRC, i.OutputRCBit());
break;
}
case kPPC_StoreWord8:
ASSEMBLE_STORE_INTEGER(stb, stbx);
break;
......@@ -2011,6 +2023,20 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
case kPPC_StoreDouble:
ASSEMBLE_STORE_FLOAT(stfd, stfdx);
break;
case kPPC_StoreSimd128: {
size_t index = 0;
AddressingMode mode = kMode_None;
MemOperand operand = i.MemoryOperand(&mode, &index);
Simd128Register value = i.InputSimd128Register(index);
bool is_atomic = i.InputInt32(3);
if (is_atomic) __ lwsync();
// stvx only supports MRR.
DCHECK_EQ(mode, kMode_MRR);
__ stvx(value, operand);
if (is_atomic) __ sync();
DCHECK_EQ(LeaveRC, i.OutputRCBit());
break;
}
case kWord32AtomicLoadInt8:
case kPPC_AtomicLoadUint8:
case kWord32AtomicLoadInt16:
......
......@@ -121,12 +121,14 @@ namespace compiler {
V(PPC_LoadWord64) \
V(PPC_LoadFloat32) \
V(PPC_LoadDouble) \
V(PPC_LoadSimd128) \
V(PPC_StoreWord8) \
V(PPC_StoreWord16) \
V(PPC_StoreWord32) \
V(PPC_StoreWord64) \
V(PPC_StoreFloat32) \
V(PPC_StoreDouble) \
V(PPC_StoreSimd128) \
V(PPC_ByteRev32) \
V(PPC_ByteRev64) \
V(PPC_CompressSigned) \
......
......@@ -124,6 +124,7 @@ int InstructionScheduler::GetTargetInstructionFlags(
case kPPC_LoadWord64:
case kPPC_LoadFloat32:
case kPPC_LoadDouble:
case kPPC_LoadSimd128:
case kPPC_AtomicLoadUint8:
case kPPC_AtomicLoadUint16:
case kPPC_AtomicLoadWord32:
......@@ -137,6 +138,7 @@ int InstructionScheduler::GetTargetInstructionFlags(
case kPPC_StoreWord64:
case kPPC_StoreFloat32:
case kPPC_StoreDouble:
case kPPC_StoreSimd128:
case kPPC_Push:
case kPPC_PushFrame:
case kPPC_StoreToStackSlot:
......
......@@ -198,9 +198,13 @@ void InstructionSelector::VisitLoad(Node* node) {
opcode = kPPC_LoadWord64;
mode = kInt16Imm_4ByteAligned;
break;
case MachineRepresentation::kSimd128:
opcode = kPPC_LoadSimd128;
// Vectors do not support MRI mode, only MRR is available.
mode = kNoImmediate;
break;
case MachineRepresentation::kCompressedPointer: // Fall through.
case MachineRepresentation::kCompressed: // Fall through.
case MachineRepresentation::kSimd128: // Fall through.
case MachineRepresentation::kNone:
UNREACHABLE();
}
......@@ -321,9 +325,13 @@ void InstructionSelector::VisitStore(Node* node) {
#else
case MachineRepresentation::kWord64: // Fall through.
#endif
case MachineRepresentation::kSimd128:
opcode = kPPC_StoreSimd128;
// Vectors do not support MRI mode, only MRR is available.
mode = kNoImmediate;
break;
case MachineRepresentation::kCompressedPointer: // Fall through.
case MachineRepresentation::kCompressed: // Fall through.
case MachineRepresentation::kSimd128: // Fall through.
case MachineRepresentation::kNone:
UNREACHABLE();
return;
......
......@@ -832,6 +832,10 @@ void Decoder::DecodeExt2(Instruction* instr) {
Format(instr, "sthux 'rs, 'ra, 'rb");
return;
}
case STVX: {
Format(instr, "stvx 'Dt, 'ra, 'rb");
return;
}
case LWZX: {
Format(instr, "lwzx 'rt, 'ra, 'rb");
return;
......@@ -876,6 +880,10 @@ void Decoder::DecodeExt2(Instruction* instr) {
Format(instr, "lwarx 'rt, 'ra, 'rb");
return;
}
case LVX: {
Format(instr, "lvx 'Dt, 'ra, 'rb");
return;
}
#if V8_TARGET_ARCH_PPC64
case LDX: {
Format(instr, "ldx 'rt, 'ra, 'rb");
......
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