Commit c2373c46 authored by Milad Farazmand's avatar Milad Farazmand Committed by Commit Bot

PPC/s390: [wasm-simd] Use S128AllOnes in v128.const implementation

Change-Id: I997abb5576224d4e7fe00ef593afa0265ef80e16
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2288428Reviewed-by: 's avatarJunliang Yan <jyan@ca.ibm.com>
Commit-Queue: Milad Farazmand <miladfar@ca.ibm.com>
Cr-Commit-Position: refs/heads/master@{#68747}
parent 90258718
...@@ -2330,6 +2330,8 @@ void InstructionSelector::VisitS128Select(Node* node) { ...@@ -2330,6 +2330,8 @@ void InstructionSelector::VisitS128Select(Node* node) {
g.UseRegister(node->InputAt(2))); g.UseRegister(node->InputAt(2)));
} }
void InstructionSelector::VisitS128Const(Node* node) { UNIMPLEMENTED(); }
void InstructionSelector::VisitI16x8AddSaturateS(Node* node) { void InstructionSelector::VisitI16x8AddSaturateS(Node* node) {
UNIMPLEMENTED(); UNIMPLEMENTED();
} }
......
...@@ -3938,6 +3938,11 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction( ...@@ -3938,6 +3938,11 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
__ vx(dst, dst, dst, Condition(0), Condition(0), Condition(0)); __ vx(dst, dst, dst, Condition(0), Condition(0), Condition(0));
break; break;
} }
case kS390_S128AllOnes: {
Simd128Register dst = i.OutputSimd128Register();
__ vceq(dst, dst, dst, Condition(0), Condition(3));
break;
}
case kS390_S128Select: { case kS390_S128Select: {
Simd128Register dst = i.OutputSimd128Register(); Simd128Register dst = i.OutputSimd128Register();
Simd128Register mask = i.InputSimd128Register(0); Simd128Register mask = i.InputSimd128Register(0);
......
...@@ -380,6 +380,7 @@ namespace compiler { ...@@ -380,6 +380,7 @@ namespace compiler {
V(S390_S128Xor) \ V(S390_S128Xor) \
V(S390_S128Const) \ V(S390_S128Const) \
V(S390_S128Zero) \ V(S390_S128Zero) \
V(S390_S128AllOnes) \
V(S390_S128Not) \ V(S390_S128Not) \
V(S390_S128Select) \ V(S390_S128Select) \
V(S390_S128AndNot) \ V(S390_S128AndNot) \
......
...@@ -326,6 +326,7 @@ int InstructionScheduler::GetTargetInstructionFlags( ...@@ -326,6 +326,7 @@ int InstructionScheduler::GetTargetInstructionFlags(
case kS390_S128Xor: case kS390_S128Xor:
case kS390_S128Const: case kS390_S128Const:
case kS390_S128Zero: case kS390_S128Zero:
case kS390_S128AllOnes:
case kS390_S128Not: case kS390_S128Not:
case kS390_S128Select: case kS390_S128Select:
case kS390_S128AndNot: case kS390_S128AndNot:
......
...@@ -2878,15 +2878,17 @@ void InstructionSelector::VisitS8x16Swizzle(Node* node) { ...@@ -2878,15 +2878,17 @@ void InstructionSelector::VisitS8x16Swizzle(Node* node) {
void InstructionSelector::VisitS128Const(Node* node) { void InstructionSelector::VisitS128Const(Node* node) {
S390OperandGenerator g(this); S390OperandGenerator g(this);
static const int kUint32Immediates = 4; uint32_t val[kSimd128Size / sizeof(uint32_t)];
uint32_t val[kUint32Immediates];
STATIC_ASSERT(sizeof(val) == kSimd128Size);
memcpy(val, S128ImmediateParameterOf(node->op()).data(), kSimd128Size); memcpy(val, S128ImmediateParameterOf(node->op()).data(), kSimd128Size);
// If all bytes are zeros, avoid emitting code for generic constants // If all bytes are zeros, avoid emitting code for generic constants.
bool all_zeros = !(val[0] && val[1] && val[2] && val[3]); bool all_zeros = !(val[0] || val[1] || val[2] || val[3]);
bool all_ones = val[0] == UINT32_MAX && val[1] == UINT32_MAX &&
val[2] == UINT32_MAX && val[3] == UINT32_MAX;
InstructionOperand dst = g.DefineAsRegister(node); InstructionOperand dst = g.DefineAsRegister(node);
if (all_zeros) { if (all_zeros) {
Emit(kS390_S128Zero, dst); Emit(kS390_S128Zero, dst);
} else if (all_ones) {
Emit(kS390_S128AllOnes, dst);
} else { } else {
// We have to use Pack4Lanes to reverse the bytes (lanes) on BE, // We have to use Pack4Lanes to reverse the bytes (lanes) on BE,
// Which in this case is ineffective on LE. // Which in this case is ineffective on LE.
......
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