From 9e81be7423bda1465a8724453de6764dba5a053d Mon Sep 17 00:00:00 2001 From: Ng Zhi An Date: Thu, 10 Sep 2020 15:46:03 -0700 Subject: [PATCH] [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/+/2404751 Reviewed-by: Bill Budge Commit-Queue: Zhi An Ng Cr-Commit-Position: refs/heads/master@{#69831} --- src/compiler/simd-scalar-lowering.cc | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/compiler/simd-scalar-lowering.cc b/src/compiler/simd-scalar-lowering.cc index d64ebe0aad..c12810a808 100644 --- a/src/compiler/simd-scalar-lowering.cc +++ b/src/compiler/simd-scalar-lowering.cc @@ -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++) {