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; ...@@ -1229,7 +1229,11 @@ using Instr = uint32_t;
/* Store Floating-Point Single with Update Indexed */ \ /* Store Floating-Point Single with Update Indexed */ \
V(stfsux, STFSUX, 0x7C00056E) \ V(stfsux, STFSUX, 0x7C00056E) \
/* Store Floating-Point Single Indexed */ \ /* 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) \ #define PPC_X_OPCODE_E_FORM_LIST(V) \
/* Shift Right Algebraic Word Immediate */ \ /* Shift Right Algebraic Word Immediate */ \
...@@ -1693,8 +1697,6 @@ using Instr = uint32_t; ...@@ -1693,8 +1697,6 @@ using Instr = uint32_t;
V(lvsl, LVSL, 0x7C00000C) \ V(lvsl, LVSL, 0x7C00000C) \
/* Load Vector for Shift Right */ \ /* Load Vector for Shift Right */ \
V(lvsr, LVSR, 0x7C00004C) \ V(lvsr, LVSR, 0x7C00004C) \
/* Load Vector Indexed */ \
V(lvx, LVX, 0x7C0000CE) \
/* Load Vector Indexed Last */ \ /* Load Vector Indexed Last */ \
V(lvxl, LVXL, 0x7C0002CE) \ V(lvxl, LVXL, 0x7C0002CE) \
/* Store Vector Element Byte Indexed */ \ /* Store Vector Element Byte Indexed */ \
...@@ -1703,8 +1705,6 @@ using Instr = uint32_t; ...@@ -1703,8 +1705,6 @@ using Instr = uint32_t;
V(stvehx, STVEHX, 0x7C00014E) \ V(stvehx, STVEHX, 0x7C00014E) \
/* Store Vector Element Word Indexed */ \ /* Store Vector Element Word Indexed */ \
V(stvewx, STVEWX, 0x7C00018E) \ V(stvewx, STVEWX, 0x7C00018E) \
/* Store Vector Indexed */ \
V(stvx, STVX, 0x7C0001CE) \
/* Store Vector Indexed Last */ \ /* Store Vector Indexed Last */ \
V(stvxl, STVXL, 0x7C0003CE) \ V(stvxl, STVXL, 0x7C0003CE) \
/* Vector Minimum Signed Doubleword */ \ /* Vector Minimum Signed Doubleword */ \
......
...@@ -1991,6 +1991,18 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction( ...@@ -1991,6 +1991,18 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
case kPPC_LoadDouble: case kPPC_LoadDouble:
ASSEMBLE_LOAD_FLOAT(lfd, lfdx); ASSEMBLE_LOAD_FLOAT(lfd, lfdx);
break; 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: case kPPC_StoreWord8:
ASSEMBLE_STORE_INTEGER(stb, stbx); ASSEMBLE_STORE_INTEGER(stb, stbx);
break; break;
...@@ -2011,6 +2023,20 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction( ...@@ -2011,6 +2023,20 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
case kPPC_StoreDouble: case kPPC_StoreDouble:
ASSEMBLE_STORE_FLOAT(stfd, stfdx); ASSEMBLE_STORE_FLOAT(stfd, stfdx);
break; 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 kWord32AtomicLoadInt8:
case kPPC_AtomicLoadUint8: case kPPC_AtomicLoadUint8:
case kWord32AtomicLoadInt16: case kWord32AtomicLoadInt16:
......
...@@ -121,12 +121,14 @@ namespace compiler { ...@@ -121,12 +121,14 @@ namespace compiler {
V(PPC_LoadWord64) \ V(PPC_LoadWord64) \
V(PPC_LoadFloat32) \ V(PPC_LoadFloat32) \
V(PPC_LoadDouble) \ V(PPC_LoadDouble) \
V(PPC_LoadSimd128) \
V(PPC_StoreWord8) \ V(PPC_StoreWord8) \
V(PPC_StoreWord16) \ V(PPC_StoreWord16) \
V(PPC_StoreWord32) \ V(PPC_StoreWord32) \
V(PPC_StoreWord64) \ V(PPC_StoreWord64) \
V(PPC_StoreFloat32) \ V(PPC_StoreFloat32) \
V(PPC_StoreDouble) \ V(PPC_StoreDouble) \
V(PPC_StoreSimd128) \
V(PPC_ByteRev32) \ V(PPC_ByteRev32) \
V(PPC_ByteRev64) \ V(PPC_ByteRev64) \
V(PPC_CompressSigned) \ V(PPC_CompressSigned) \
......
...@@ -124,6 +124,7 @@ int InstructionScheduler::GetTargetInstructionFlags( ...@@ -124,6 +124,7 @@ int InstructionScheduler::GetTargetInstructionFlags(
case kPPC_LoadWord64: case kPPC_LoadWord64:
case kPPC_LoadFloat32: case kPPC_LoadFloat32:
case kPPC_LoadDouble: case kPPC_LoadDouble:
case kPPC_LoadSimd128:
case kPPC_AtomicLoadUint8: case kPPC_AtomicLoadUint8:
case kPPC_AtomicLoadUint16: case kPPC_AtomicLoadUint16:
case kPPC_AtomicLoadWord32: case kPPC_AtomicLoadWord32:
...@@ -137,6 +138,7 @@ int InstructionScheduler::GetTargetInstructionFlags( ...@@ -137,6 +138,7 @@ int InstructionScheduler::GetTargetInstructionFlags(
case kPPC_StoreWord64: case kPPC_StoreWord64:
case kPPC_StoreFloat32: case kPPC_StoreFloat32:
case kPPC_StoreDouble: case kPPC_StoreDouble:
case kPPC_StoreSimd128:
case kPPC_Push: case kPPC_Push:
case kPPC_PushFrame: case kPPC_PushFrame:
case kPPC_StoreToStackSlot: case kPPC_StoreToStackSlot:
......
...@@ -198,9 +198,13 @@ void InstructionSelector::VisitLoad(Node* node) { ...@@ -198,9 +198,13 @@ void InstructionSelector::VisitLoad(Node* node) {
opcode = kPPC_LoadWord64; opcode = kPPC_LoadWord64;
mode = kInt16Imm_4ByteAligned; mode = kInt16Imm_4ByteAligned;
break; 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::kCompressedPointer: // Fall through.
case MachineRepresentation::kCompressed: // Fall through. case MachineRepresentation::kCompressed: // Fall through.
case MachineRepresentation::kSimd128: // Fall through.
case MachineRepresentation::kNone: case MachineRepresentation::kNone:
UNREACHABLE(); UNREACHABLE();
} }
...@@ -321,9 +325,13 @@ void InstructionSelector::VisitStore(Node* node) { ...@@ -321,9 +325,13 @@ void InstructionSelector::VisitStore(Node* node) {
#else #else
case MachineRepresentation::kWord64: // Fall through. case MachineRepresentation::kWord64: // Fall through.
#endif #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::kCompressedPointer: // Fall through.
case MachineRepresentation::kCompressed: // Fall through. case MachineRepresentation::kCompressed: // Fall through.
case MachineRepresentation::kSimd128: // Fall through.
case MachineRepresentation::kNone: case MachineRepresentation::kNone:
UNREACHABLE(); UNREACHABLE();
return; return;
......
...@@ -832,6 +832,10 @@ void Decoder::DecodeExt2(Instruction* instr) { ...@@ -832,6 +832,10 @@ void Decoder::DecodeExt2(Instruction* instr) {
Format(instr, "sthux 'rs, 'ra, 'rb"); Format(instr, "sthux 'rs, 'ra, 'rb");
return; return;
} }
case STVX: {
Format(instr, "stvx 'Dt, 'ra, 'rb");
return;
}
case LWZX: { case LWZX: {
Format(instr, "lwzx 'rt, 'ra, 'rb"); Format(instr, "lwzx 'rt, 'ra, 'rb");
return; return;
...@@ -876,6 +880,10 @@ void Decoder::DecodeExt2(Instruction* instr) { ...@@ -876,6 +880,10 @@ void Decoder::DecodeExt2(Instruction* instr) {
Format(instr, "lwarx 'rt, 'ra, 'rb"); Format(instr, "lwarx 'rt, 'ra, 'rb");
return; return;
} }
case LVX: {
Format(instr, "lvx 'Dt, 'ra, 'rb");
return;
}
#if V8_TARGET_ARCH_PPC64 #if V8_TARGET_ARCH_PPC64
case LDX: { case LDX: {
Format(instr, "ldx 'rt, 'ra, 'rb"); 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