================
@@ -302,17 +303,26 @@ deriveNeonSISDIntrinsicOperandTypes(CIRGenFunction &cgf, 
unsigned modifier,
   else if (vecArgTy && !(modifier & AddRetType))
     funcResTy = wrapAsVector(resultTy);
 
-  // When VectorizeArgTypes is set, wrap every operand that has the same
-  // scalar type as arg0 into a vector. This covers intrinsics with multiple
-  // data operands of the same type (e.g. vsri takes two data operands,
-  // both of which must be wrapped into the same vector type).
+  // LLVMExtendedType<0> preserves the result vector's lane count while
+  // widening its element type. Reconstruct that source type from the Clang
+  // builtin's scalar data type.
+  if (modifier & WidenArgs) {
+    auto resVecTy = mlir::dyn_cast<cir::VectorType>(funcResTy);
+    assert(resVecTy && "widened SISD arguments require a vector result");
+    vecArgTy = cir::VectorType::get(arg0Ty, resVecTy.getSize());
+  }
+
+  // Wrap every non-immediate data operand that has the same scalar type as
+  // arg0. Checking the ICE bitmap is required when a data operand and an
+  // immediate both have i32 type (e.g. vqshrns_n_s32).
----------------
iamvickynguyen wrote:

Thank you for the refactor!

I find it would be better if this comment includes which flags make `vecArgTy` 
non-empty; otherwise, we have to read all way up to know whether wrapping 
happens.

Something like:

```suggestion
  // Runs when VectorizeArgTypes or WidenArgs marked this intrinsic for
  // vectorized arguments. Wrap every non-immediate data operand that has the 
same scalar type as
  // arg0. Checking the ICE bitmap is required when a data operand and an
  // immediate both have i32 type (e.g. vqshrns_n_s32).
```

https://github.com/llvm/llvm-project/pull/209389
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to