Commit 44c37cd7 authored by Milad Farazmand's avatar Milad Farazmand Committed by Commit Bot

PPC: [wasm-simd] Implement simd bitwise operations

Change-Id: I1b045c2c3e9b199d3f24b191639b5f8c28e8ac5b
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2247038Reviewed-by: 's avatarJunliang Yan <jyan@ca.ibm.com>
Commit-Queue: Milad Farazmand <miladfar@ca.ibm.com>
Cr-Commit-Position: refs/heads/master@{#68351}
parent ddc5ae61
......@@ -1922,7 +1922,9 @@ using Instr = uint32_t;
/* Vector Permute */ \
V(vperm, VPERM, 0x1000002B) \
/* Vector Multiply-Low-Add Unsigned Halfword Modulo */ \
V(vmladduhm, VMLADDUHM, 0x10000022)
V(vmladduhm, VMLADDUHM, 0x10000022) \
/* Vector Select */ \
V(vsel, VSEL, 0x1000002A)
#define PPC_VA_OPCODE_UNUSED_LIST(V) \
/* Vector Add Extended & write Carry Unsigned Quadword */ \
......@@ -1949,8 +1951,6 @@ using Instr = uint32_t;
V(vmsumuhs, VMSUMUHS, 0x10000027) \
/* Vector Negative Multiply-Subtract Single-Precision */ \
V(vnmsubfp, VNMSUBFP, 0x1000002F) \
/* Vector Select */ \
V(vsel, VSEL, 0x1000002A) \
/* Vector Shift Left Double by Octet Immediate */ \
V(vsldoi, VSLDOI, 0x1000002C) \
/* Vector Subtract Extended & write Carry Unsigned Quadword */ \
......@@ -2306,7 +2306,9 @@ using Instr = uint32_t;
/* Vector Shift Right Algebraic Halfword */ \
V(vsrah, VSRAH, 0x10000344) \
/* Vector Shift Right Algebraic Doubleword */ \
V(vsrad, VSRAD, 0x100003C4)
V(vsrad, VSRAD, 0x100003C4) \
/* Vector Logical AND */ \
V(vand, VAND, 0x10000404)
#define PPC_VX_OPCODE_UNUSED_LIST(V) \
/* Decimal Add Modulo */ \
......@@ -2335,8 +2337,6 @@ using Instr = uint32_t;
V(vadduqm, VADDUQM, 0x10000100) \
/* Vector Add Unsigned Word Saturate */ \
V(vadduws, VADDUWS, 0x10000280) \
/* Vector Logical AND */ \
V(vand, VAND, 0x10000404) \
/* Vector Logical AND with Complement */ \
V(vandc, VANDC, 0x10000444) \
/* Vector Average Signed Byte */ \
......
......@@ -2876,6 +2876,43 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
break;
}
#undef VECTOR_SHIFT
case kPPC_S128And: {
Simd128Register dst = i.OutputSimd128Register();
Simd128Register src = i.InputSimd128Register(1);
__ vand(dst, i.InputSimd128Register(0), src);
break;
}
case kPPC_S128Or: {
Simd128Register dst = i.OutputSimd128Register();
Simd128Register src = i.InputSimd128Register(1);
__ vor(dst, i.InputSimd128Register(0), src);
break;
}
case kPPC_S128Xor: {
Simd128Register dst = i.OutputSimd128Register();
Simd128Register src = i.InputSimd128Register(1);
__ vxor(dst, i.InputSimd128Register(0), src);
break;
}
case kPPC_S128Zero: {
Simd128Register dst = i.OutputSimd128Register();
__ vxor(dst, dst, dst);
break;
}
case kPPC_S128Not: {
Simd128Register dst = i.OutputSimd128Register();
Simd128Register src = i.InputSimd128Register(1);
__ vnor(dst, i.InputSimd128Register(0), src);
break;
}
case kPPC_S128Select: {
Simd128Register dst = i.OutputSimd128Register();
Simd128Register mask = i.InputSimd128Register(0);
Simd128Register src1 = i.InputSimd128Register(1);
Simd128Register src2 = i.InputSimd128Register(2);
__ vsel(dst, src2, src1, mask);
break;
}
case kPPC_StoreCompressTagged: {
ASSEMBLE_STORE_INTEGER(StoreTaggedField, StoreTaggedFieldX);
break;
......
......@@ -291,6 +291,12 @@ namespace compiler {
V(PPC_I8x16Shl) \
V(PPC_I8x16ShrS) \
V(PPC_I8x16ShrU) \
V(PPC_S128And) \
V(PPC_S128Or) \
V(PPC_S128Xor) \
V(PPC_S128Zero) \
V(PPC_S128Not) \
V(PPC_S128Select) \
V(PPC_StoreCompressTagged) \
V(PPC_LoadDecompressTaggedSigned) \
V(PPC_LoadDecompressTaggedPointer) \
......
......@@ -214,6 +214,12 @@ int InstructionScheduler::GetTargetInstructionFlags(
case kPPC_I8x16Shl:
case kPPC_I8x16ShrS:
case kPPC_I8x16ShrU:
case kPPC_S128And:
case kPPC_S128Or:
case kPPC_S128Xor:
case kPPC_S128Zero:
case kPPC_S128Not:
case kPPC_S128Select:
return kNoOpcodeFlags;
case kPPC_LoadWordS8:
......
......@@ -2186,7 +2186,12 @@ void InstructionSelector::VisitInt64AbsWithOverflow(Node* node) {
V(I8x16GtS) \
V(I8x16GeS) \
V(I8x16GtU) \
V(I8x16GeU)
V(I8x16GeU) \
V(S128And) \
V(S128Or) \
V(S128Xor)
#define SIMD_UNOP_LIST(V) V(S128Not)
#define SIMD_SHIFT_LIST(V) \
V(I64x2Shl) \
......@@ -2251,6 +2256,16 @@ SIMD_BINOP_LIST(SIMD_VISIT_BINOP)
#undef SIMD_VISIT_BINOP
#undef SIMD_BINOP_LIST
#define SIMD_VISIT_UNOP(Opcode) \
void InstructionSelector::Visit##Opcode(Node* node) { \
PPCOperandGenerator g(this); \
Emit(kPPC_##Opcode, g.DefineAsRegister(node), \
g.UseRegister(node->InputAt(0))); \
}
SIMD_UNOP_LIST(SIMD_VISIT_UNOP)
#undef SIMD_VISIT_UNOP
#undef SIMD_UNOP_LIST
#define SIMD_VISIT_SHIFT(Opcode) \
void InstructionSelector::Visit##Opcode(Node* node) { \
PPCOperandGenerator g(this); \
......@@ -2263,6 +2278,18 @@ SIMD_SHIFT_LIST(SIMD_VISIT_SHIFT)
#undef SIMD_SHIFT_LIST
#undef SIMD_TYPES
void InstructionSelector::VisitS128Zero(Node* node) {
PPCOperandGenerator g(this);
Emit(kPPC_S128Zero, g.DefineAsRegister(node));
}
void InstructionSelector::VisitS128Select(Node* node) {
PPCOperandGenerator g(this);
Emit(kPPC_S128Select, g.DefineAsRegister(node),
g.UseRegister(node->InputAt(0)), g.UseRegister(node->InputAt(1)),
g.UseRegister(node->InputAt(2)));
}
void InstructionSelector::VisitI32x4Neg(Node* node) { UNIMPLEMENTED(); }
void InstructionSelector::VisitI16x8AddSaturateS(Node* node) {
......@@ -2309,18 +2336,8 @@ void InstructionSelector::VisitI8x16SubSaturateU(Node* node) {
UNIMPLEMENTED();
}
void InstructionSelector::VisitS128And(Node* node) { UNIMPLEMENTED(); }
void InstructionSelector::VisitS128Or(Node* node) { UNIMPLEMENTED(); }
void InstructionSelector::VisitS128Xor(Node* node) { UNIMPLEMENTED(); }
void InstructionSelector::VisitS128Not(Node* node) { UNIMPLEMENTED(); }
void InstructionSelector::VisitS128AndNot(Node* node) { UNIMPLEMENTED(); }
void InstructionSelector::VisitS128Zero(Node* node) { UNIMPLEMENTED(); }
void InstructionSelector::EmitPrepareResults(
ZoneVector<PushParameter>* results, const CallDescriptor* call_descriptor,
Node* node) {
......@@ -2352,8 +2369,6 @@ void InstructionSelector::VisitF32x4Min(Node* node) { UNIMPLEMENTED(); }
void InstructionSelector::VisitF32x4Max(Node* node) { UNIMPLEMENTED(); }
void InstructionSelector::VisitS128Select(Node* node) { UNIMPLEMENTED(); }
void InstructionSelector::VisitF32x4Neg(Node* node) { UNIMPLEMENTED(); }
void InstructionSelector::VisitF32x4Abs(Node* node) { UNIMPLEMENTED(); }
......
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