Commit 835a53e4 authored by jing.bao's avatar jing.bao Committed by Commit Bot

[wasm]Fix simd lowering for S128Select and ReplaceLane

Change-Id: I46a46bacda356b838f3b7a7a9c7fb79f703dbae3
Reviewed-on: https://chromium-review.googlesource.com/892497Reviewed-by: 's avatarAseem Garg <aseemgarg@chromium.org>
Reviewed-by: 's avatarBill Budge <bbudge@chromium.org>
Commit-Queue: Jing Bao <jing.bao@intel.com>
Cr-Commit-Position: refs/heads/master@{#51012}
parent 26fc3d58
......@@ -1016,7 +1016,11 @@ void SimdScalarLowering::LowerNode(Node* node) {
DCHECK_EQ(2, node->InputCount());
Node* repNode = node->InputAt(1);
int32_t lane = OpParameter<int32_t>(node);
Node** rep_node = GetReplacementsWithType(node->InputAt(0), rep_type);
Node** old_rep_node = GetReplacementsWithType(node->InputAt(0), rep_type);
Node** rep_node = zone()->NewArray<Node*>(num_lanes);
for (int i = 0; i < num_lanes; ++i) {
rep_node[i] = old_rep_node[i];
}
if (HasReplacement(0, repNode)) {
rep_node[lane] = GetReplacements(repNode)[0];
} else {
......@@ -1089,11 +1093,12 @@ void SimdScalarLowering::LowerNode(Node* node) {
Node** rep_right = GetReplacementsWithType(node->InputAt(2), rep_type);
Node** rep_node = zone()->NewArray<Node*>(num_lanes);
for (int i = 0; i < num_lanes; ++i) {
Diamond d(graph(), common(),
graph()->NewNode(machine()->Word32Equal(), boolean_input[i],
jsgraph_->Int32Constant(0)));
rep_node[i] = d.Phi(MachineTypeFrom(rep_type).representation(),
rep_right[1], rep_left[0]);
Node* tmp1 =
graph()->NewNode(machine()->Word32Xor(), rep_left[i], rep_right[i]);
Node* tmp2 =
graph()->NewNode(machine()->Word32And(), boolean_input[i], tmp1);
rep_node[i] =
graph()->NewNode(machine()->Word32Xor(), rep_right[i], tmp2);
}
ReplaceNode(node, rep_node, num_lanes);
break;
......
......@@ -1505,7 +1505,7 @@ WASM_SIMD_TEST(I8x16ShrU) {
// rest false, and comparing for non-equality with zero to convert to a boolean
// vector.
#define WASM_SIMD_SELECT_TEST(format) \
WASM_SIMD_COMPILED_TEST(S##format##Select) { \
WASM_SIMD_TEST(S##format##Select) { \
WasmRunner<int32_t, int32_t, int32_t> r(kExecuteTurbofan, lower_simd); \
byte val1 = 0; \
byte val2 = 1; \
......@@ -1545,7 +1545,7 @@ WASM_SIMD_SELECT_TEST(8x16)
// Test Select by making a mask where the 0th and 3rd lanes are non-zero and the
// rest 0. The mask is not the result of a comparison op.
#define WASM_SIMD_NON_CANONICAL_SELECT_TEST(format) \
WASM_SIMD_COMPILED_TEST(S##format##NonCanonicalSelect) { \
WASM_SIMD_TEST(S##format##NonCanonicalSelect) { \
WasmRunner<int32_t, int32_t, int32_t, int32_t> r(kExecuteTurbofan, \
lower_simd); \
byte val1 = 0; \
......
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