Commit 4ea81214 authored by Milad Farazmand's avatar Milad Farazmand Committed by Commit Bot

PPC/s390: [wasm-simd] Bitmask instructions

Port 043ac205

Original Commit Message:

    Implement i8x16.bitmask, i16x8.bitmask, i32x4.bitmask on x64.

R=zhin@chromium.org, joransiu@ca.ibm.com, jyan@ca.ibm.com, michael_dawson@ca.ibm.com
BUG=
LOG=N

Change-Id: I1bb6439abb3db27c50e1f06a833954c473119bcd
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2219007Reviewed-by: 's avatarJunliang Yan <jyan@ca.ibm.com>
Reviewed-by: 's avatarZhi An Ng <zhin@chromium.org>
Commit-Queue: Milad Farazmand <miladfar@ca.ibm.com>
Cr-Commit-Position: refs/heads/master@{#68023}
parent 839e9695
...@@ -567,11 +567,12 @@ using SixByteInstr = uint64_t; ...@@ -567,11 +567,12 @@ using SixByteInstr = uint64_t;
V(va, VA, 0xE7F3) /* type = VRR_C VECTOR ADD */ \ V(va, VA, 0xE7F3) /* type = VRR_C VECTOR ADD */ \
V(vscbi, VSCBI, \ V(vscbi, VSCBI, \
0xE7F5) /* type = VRR_C VECTOR SUBTRACT COMPUTE BORROW INDICATION */ \ 0xE7F5) /* type = VRR_C VECTOR SUBTRACT COMPUTE BORROW INDICATION */ \
V(vs, VS, 0xE7F7) /* type = VRR_C VECTOR SUBTRACT */ \ V(vs, VS, 0xE7F7) /* type = VRR_C VECTOR SUBTRACT */ \
V(vmnl, VMNL, 0xE7FC) /* type = VRR_C VECTOR MINIMUM LOGICAL */ \ V(vmnl, VMNL, 0xE7FC) /* type = VRR_C VECTOR MINIMUM LOGICAL */ \
V(vmxl, VMXL, 0xE7FD) /* type = VRR_C VECTOR MAXIMUM LOGICAL */ \ V(vmxl, VMXL, 0xE7FD) /* type = VRR_C VECTOR MAXIMUM LOGICAL */ \
V(vmn, VMN, 0xE7FE) /* type = VRR_C VECTOR MINIMUM */ \ V(vmn, VMN, 0xE7FE) /* type = VRR_C VECTOR MINIMUM */ \
V(vmx, VMX, 0xE7FF) /* type = VRR_C VECTOR MAXIMUM */ V(vmx, VMX, 0xE7FF) /* type = VRR_C VECTOR MAXIMUM */ \
V(vbperm, VBPERM, 0xE785) /* type = VRR_C VECTOR BIT PERMUTE */
#define S390_VRI_A_OPCODE_LIST(V) \ #define S390_VRI_A_OPCODE_LIST(V) \
V(vleib, VLEIB, 0xE740) /* type = VRI_A VECTOR LOAD ELEMENT IMMEDIATE (8) */ \ V(vleib, VLEIB, 0xE740) /* type = VRI_A VECTOR LOAD ELEMENT IMMEDIATE (8) */ \
......
...@@ -2197,6 +2197,12 @@ SIMD_BINOP_LIST(SIMD_VISIT_BINOP) ...@@ -2197,6 +2197,12 @@ SIMD_BINOP_LIST(SIMD_VISIT_BINOP)
#undef SIMD_BINOP_LIST #undef SIMD_BINOP_LIST
#undef SIMD_TYPES #undef SIMD_TYPES
void InstructionSelector::VisitI32x4BitMask(Node* node) { UNIMPLEMENTED(); }
void InstructionSelector::VisitI16x8BitMask(Node* node) { UNIMPLEMENTED(); }
void InstructionSelector::VisitI8x16BitMask(Node* node) { UNIMPLEMENTED(); }
void InstructionSelector::VisitI32x4Shl(Node* node) { UNIMPLEMENTED(); } void InstructionSelector::VisitI32x4Shl(Node* node) { UNIMPLEMENTED(); }
void InstructionSelector::VisitI32x4ShrS(Node* node) { UNIMPLEMENTED(); } void InstructionSelector::VisitI32x4ShrS(Node* node) { UNIMPLEMENTED(); }
......
...@@ -4185,6 +4185,38 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction( ...@@ -4185,6 +4185,38 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
#endif #endif
break; break;
} }
case kS390_I32x4BitMask: {
__ lgfi(kScratchReg, Operand(0x204060));
__ aih(kScratchReg, Operand(0x80808080)); // Zeroing the high bits
__ vlvg(kScratchDoubleReg, kScratchReg, MemOperand(r0, 1), Condition(3));
__ vbperm(kScratchDoubleReg, i.InputSimd128Register(0), kScratchDoubleReg,
Condition(0), Condition(0), Condition(0));
__ vlgv(i.OutputRegister(), kScratchDoubleReg, MemOperand(r0, 7),
Condition(0));
break;
}
case kS390_I16x8BitMask: {
__ lgfi(kScratchReg, Operand(0x40506070));
__ aih(kScratchReg, Operand(0x102030));
__ vlvg(kScratchDoubleReg, kScratchReg, MemOperand(r0, 1), Condition(3));
__ vbperm(kScratchDoubleReg, i.InputSimd128Register(0), kScratchDoubleReg,
Condition(0), Condition(0), Condition(0));
__ vlgv(i.OutputRegister(), kScratchDoubleReg, MemOperand(r0, 7),
Condition(0));
break;
}
case kS390_I8x16BitMask: {
__ lgfi(r0, Operand(0x60687078));
__ aih(r0, Operand(0x40485058));
__ lgfi(ip, Operand(0x20283038));
__ aih(ip, Operand(0x81018));
__ vlvgp(kScratchDoubleReg, ip, r0);
__ vbperm(kScratchDoubleReg, i.InputSimd128Register(0), kScratchDoubleReg,
Condition(0), Condition(0), Condition(0));
__ vlgv(i.OutputRegister(), kScratchDoubleReg, MemOperand(r0, 3),
Condition(1));
break;
}
case kS390_StoreCompressTagged: { case kS390_StoreCompressTagged: {
CHECK(!instr->HasOutput()); CHECK(!instr->HasOutput());
size_t index = 0; size_t index = 0;
......
...@@ -286,6 +286,7 @@ namespace compiler { ...@@ -286,6 +286,7 @@ namespace compiler {
V(S390_I32x4UConvertI16x8Low) \ V(S390_I32x4UConvertI16x8Low) \
V(S390_I32x4UConvertI16x8High) \ V(S390_I32x4UConvertI16x8High) \
V(S390_I32x4Abs) \ V(S390_I32x4Abs) \
V(S390_I32x4BitMask) \
V(S390_I16x8Splat) \ V(S390_I16x8Splat) \
V(S390_I16x8ExtractLaneU) \ V(S390_I16x8ExtractLaneU) \
V(S390_I16x8ExtractLaneS) \ V(S390_I16x8ExtractLaneS) \
...@@ -320,6 +321,7 @@ namespace compiler { ...@@ -320,6 +321,7 @@ namespace compiler {
V(S390_I16x8SubSaturateU) \ V(S390_I16x8SubSaturateU) \
V(S390_I16x8RoundingAverageU) \ V(S390_I16x8RoundingAverageU) \
V(S390_I16x8Abs) \ V(S390_I16x8Abs) \
V(S390_I16x8BitMask) \
V(S390_I8x16Splat) \ V(S390_I8x16Splat) \
V(S390_I8x16ExtractLaneU) \ V(S390_I8x16ExtractLaneU) \
V(S390_I8x16ExtractLaneS) \ V(S390_I8x16ExtractLaneS) \
...@@ -349,6 +351,7 @@ namespace compiler { ...@@ -349,6 +351,7 @@ namespace compiler {
V(S390_I8x16SubSaturateU) \ V(S390_I8x16SubSaturateU) \
V(S390_I8x16RoundingAverageU) \ V(S390_I8x16RoundingAverageU) \
V(S390_I8x16Abs) \ V(S390_I8x16Abs) \
V(S390_I8x16BitMask) \
V(S390_S8x16Shuffle) \ V(S390_S8x16Shuffle) \
V(S390_S8x16Swizzle) \ V(S390_S8x16Swizzle) \
V(S390_V64x2AnyTrue) \ V(S390_V64x2AnyTrue) \
......
...@@ -232,6 +232,7 @@ int InstructionScheduler::GetTargetInstructionFlags( ...@@ -232,6 +232,7 @@ int InstructionScheduler::GetTargetInstructionFlags(
case kS390_I32x4UConvertI16x8Low: case kS390_I32x4UConvertI16x8Low:
case kS390_I32x4UConvertI16x8High: case kS390_I32x4UConvertI16x8High:
case kS390_I32x4Abs: case kS390_I32x4Abs:
case kS390_I32x4BitMask:
case kS390_I16x8Splat: case kS390_I16x8Splat:
case kS390_I16x8ExtractLaneU: case kS390_I16x8ExtractLaneU:
case kS390_I16x8ExtractLaneS: case kS390_I16x8ExtractLaneS:
...@@ -266,6 +267,7 @@ int InstructionScheduler::GetTargetInstructionFlags( ...@@ -266,6 +267,7 @@ int InstructionScheduler::GetTargetInstructionFlags(
case kS390_I16x8SubSaturateU: case kS390_I16x8SubSaturateU:
case kS390_I16x8RoundingAverageU: case kS390_I16x8RoundingAverageU:
case kS390_I16x8Abs: case kS390_I16x8Abs:
case kS390_I16x8BitMask:
case kS390_I8x16Splat: case kS390_I8x16Splat:
case kS390_I8x16ExtractLaneU: case kS390_I8x16ExtractLaneU:
case kS390_I8x16ExtractLaneS: case kS390_I8x16ExtractLaneS:
...@@ -295,6 +297,7 @@ int InstructionScheduler::GetTargetInstructionFlags( ...@@ -295,6 +297,7 @@ int InstructionScheduler::GetTargetInstructionFlags(
case kS390_I8x16SubSaturateU: case kS390_I8x16SubSaturateU:
case kS390_I8x16RoundingAverageU: case kS390_I8x16RoundingAverageU:
case kS390_I8x16Abs: case kS390_I8x16Abs:
case kS390_I8x16BitMask:
case kS390_S8x16Shuffle: case kS390_S8x16Shuffle:
case kS390_S8x16Swizzle: case kS390_S8x16Swizzle:
case kS390_V64x2AnyTrue: case kS390_V64x2AnyTrue:
......
...@@ -2794,6 +2794,17 @@ SIMD_VISIT_QFMOP(F64x2Qfms) ...@@ -2794,6 +2794,17 @@ SIMD_VISIT_QFMOP(F64x2Qfms)
SIMD_VISIT_QFMOP(F32x4Qfma) SIMD_VISIT_QFMOP(F32x4Qfma)
SIMD_VISIT_QFMOP(F32x4Qfms) SIMD_VISIT_QFMOP(F32x4Qfms)
#undef SIMD_VISIT_QFMOP #undef SIMD_VISIT_QFMOP
#define SIMD_VISIT_BITMASK(Opcode) \
void InstructionSelector::Visit##Opcode(Node* node) { \
S390OperandGenerator g(this); \
Emit(kS390_##Opcode, g.DefineAsRegister(node), \
g.UseUniqueRegister(node->InputAt(0))); \
}
SIMD_VISIT_BITMASK(I8x16BitMask)
SIMD_VISIT_BITMASK(I16x8BitMask)
SIMD_VISIT_BITMASK(I32x4BitMask)
#undef SIMD_VISIT_BITMASK
#undef SIMD_TYPES #undef SIMD_TYPES
void InstructionSelector::VisitS8x16Shuffle(Node* node) { void InstructionSelector::VisitS8x16Shuffle(Node* node) {
......
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