Commit 9e81be74 authored by Ng Zhi An's avatar Ng Zhi An Committed by Commit Bot

[wasm-simd][scalar-lowering] Fix i64 to i32 replacements

Since we are converting Int64x2 to Int32x4, we should be truncating
the nodes, not sign-extending.

Bug: v8:10507
Change-Id: I09dabdcaaa378842ffb4da5505199c188b5101f1
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2404751Reviewed-by: 's avatarBill Budge <bbudge@chromium.org>
Commit-Queue: Zhi An Ng <zhin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#69831}
parent 413ebe59
......@@ -2112,15 +2112,14 @@ void SimdScalarLowering::Float32ToInt32(Node** replacements, Node** result) {
void SimdScalarLowering::Int64ToInt32(Node** replacements, Node** result) {
const int num_ints = sizeof(int64_t) / sizeof(int32_t);
const int bit_size = sizeof(int32_t) * 8;
const Operator* sign_extend = machine()->SignExtendWord32ToInt64();
const Operator* truncate = machine()->TruncateInt64ToInt32();
for (int i = 0; i < kNumLanes64; i++) {
if (replacements[i] != nullptr) {
for (int j = 0; j < num_ints; j++) {
result[num_ints * i + j] = graph()->NewNode(
sign_extend,
graph()->NewNode(machine()->Word64Sar(), replacements[i],
mcgraph_->Int32Constant(j * bit_size)));
truncate, graph()->NewNode(machine()->Word64Sar(), replacements[i],
mcgraph_->Int32Constant(j * bit_size)));
}
} else {
for (int j = 0; j < num_ints; j++) {
......
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