[llvm] [WebAssembly] Fold extended vector shifts by constant to extmul (PR #184007)

via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 2 23:26:19 PST 2026


================
@@ -195,3 +195,47 @@ define <8 x i32> @zext_sext_mul_v8i16(<8 x i16> %a, <8 x i16> %b) {
   %mul = mul <8 x i32> %wide.a, %wide.b
   ret <8 x i32> %mul
 }
+
+define <4 x i32> @sext_mul_v8i16_with_symmetric_constant_vector(<8 x i16> %v) {
----------------
ParkHanbum wrote:


I can't comment on the review of the test code below, so I'm written here. When we create the constant vector, the reference vector is Extend's Operand. That is, v8i16 as shown in the following log.

```
Vector-legalized selection DAG: %bb.0 'combine_with_constant:'
SelectionDAG has 18 nodes:
  t2: v8i16 = WebAssemblyISD::ARGUMENT TargetConstant:i32<0>
    t58: v4i32 = WebAssemblyISD::EXTEND_LOW_S t2
      t63: v8i16 = BUILD_VECTOR Constant:i16<4096>, Constant:i16<1>, Constant:i16<4096>, Constant:i16<1>, poison:i16, poison:i16, poison:i16, poison:i16
    t64: v4i32 = WebAssemblyISD::EXTEND_LOW_S t63
  t65: v4i32 = mul t58, t64
    t59: v4i32 = WebAssemblyISD::EXTEND_HIGH_S t2
      t66: v8i16 = BUILD_VECTOR poison:i16, poison:i16, poison:i16, poison:i16, Constant:i16<4096>, Constant:i16<1>, Constant:i16<4096>, Constant:i16<1>
    t67: v4i32 = WebAssemblyISD::EXTEND_HIGH_S t66
  t68: v4i32 = mul t59, t67
 ```

https://github.com/llvm/llvm-project/pull/184007


More information about the llvm-commits mailing list