[llvm] [SelectionDAG] Avoid irregular INSERT_SUBVECTOR when widening CTTZ_ELTS (PR #218019)

Oscar Priego via llvm-commits llvm-commits at lists.llvm.org
Sat Aug 22 08:55:35 PDT 2026


================
@@ -101,5 +101,24 @@ define i8 @ctz_v8i16_poison(<8 x i16> %a) {
   ret i8 %res
 }
 
+; Irregular predicate vectors widen to a power-of-two number of lanes. The
+; widened lanes must be active so an all-zero input returns the original lane
+; count, without requiring an irregular INSERT_SUBVECTOR during legalization.
+define i32 @ctz_zero_v17i1() {
+; CHECK-LABEL: ctz_zero_v17i1:
+; CHECK:         retq
----------------
Opriego wrote:

Addressed, added full coverage for the v17i1/v31i1 regression cases and removed the unnecessary intrinsic declarations. The implementation itself is unchanged. The X86 test, semantic width validation, and feature matrix all pass locally.

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


More information about the llvm-commits mailing list