Commit ee63b842 authored by Ng Zhi An's avatar Ng Zhi An Committed by Commit Bot

[scalar-lowering][wasm-simd] Remove unnecessary equal

We are comparing equals to 0, we can remove this equality comparison,
and invert the phi outputs. This saves 1 op/node for every lowered
comparision.

Bug: v8:10824
Change-Id: I4957bed635c34d47fff98c5556ab55754d3fd91e
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2391911Reviewed-by: 's avatarBill Budge <bbudge@chromium.org>
Commit-Queue: Zhi An Ng <zhin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#69702}
parent ba797ba2
......@@ -687,15 +687,13 @@ void SimdScalarLowering::LowerCompareOp(Node* node, SimdType input_rep_type,
} else {
cmp_result = graph()->NewNode(op, rep_left[i], rep_right[i]);
}
Diamond d_cmp(graph(), common(),
graph()->NewNode(machine()->Word32Equal(), cmp_result,
mcgraph_->Int32Constant(0)));
Diamond d_cmp(graph(), common(), cmp_result);
MachineRepresentation rep =
(input_rep_type == SimdType::kFloat32x4)
? MachineRepresentation::kWord32
: MachineTypeFrom(input_rep_type).representation();
rep_node[i] =
d_cmp.Phi(rep, mcgraph_->Int32Constant(0), mcgraph_->Int32Constant(-1));
d_cmp.Phi(rep, mcgraph_->Int32Constant(-1), mcgraph_->Int32Constant(0));
}
ReplaceNode(node, rep_node, num_lanes);
}
......
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