[llvm] [LV][AArch64] Support partial reductions of extended compares (PR #212190)

Graham Hunter via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 26 04:03:33 PDT 2026


================
@@ -973,3 +973,49 @@ exit:
 !36 = distinct !{!36, !37, !38}
 !37 = !{!"llvm.loop.interleave.count", i32 1}
 !38 = !{!"llvm.loop.vectorize.width", i32 4}
+
+; zext(i1 mask)->i64 summed which should be costed at the compare's operand width and not at i1.
+define i64 @count_matches_i8_i64(ptr %src, i32 %n) {
+; NEON-LABEL: 'count_matches_i8_i64'
+; SVE-LABEL: 'count_matches_i8_i64'
+; SVE:  Cost of 1 for VF 16: EXPRESSION vp<[[VP7:%[0-9]+]]> = ir<%acc> + partial.reduce.add (ir<%cmp> zext to i64)
+; SVE:  Cost of 1 for VF vscale x 16: EXPRESSION vp<[[VP7]]> = ir<%acc> + partial.reduce.add (ir<%cmp> zext to i64)
----------------
huntergr-arm wrote:

These costs are lower than I would expect, at least for reciprocal throughput. But that can be dealt with in a separate patch.

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


More information about the llvm-commits mailing list