[llvm] [IR] Reject invalid partial.reduce intrinsics (PR #161831)

Benjamin Maxwell via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 3 05:45:41 PDT 2025


================
@@ -0,0 +1,19 @@
+; RUN: not llvm-as %s -o /dev/null 2>&1 | FileCheck %s
+
+define void @element_count_mismatch() {
+  ; CHECK: Invalid vector widths for partial reduction. The width of the input vector must be a known integer multiple of the width of the accumulator vector.
+  call <3 x i32> @llvm.vector.partial.reduce.add(<3 x i32> poison, <8 x i32> poison)
+
+  ; CHECK: Invalid vector widths for partial reduction. The width of the input vector must be a known integer multiple of the width of the accumulator vector.
+  call <vscale x 4 x i32> @llvm.vector.partial.reduce.add(<vscale x 4 x i32> poison, <8 x i32> poison)
+
+  ; CHECK: Invalid vector widths for partial reduction. The width of the input vector must be a known integer multiple of the width of the accumulator vector.
+  call <4 x i32> @llvm.vector.partial.reduce.add(<4 x i32> poison, <vscale x 8 x i32> poison)
----------------
MacDue wrote:

Is there a reason this case can't be allowed? Arguably, there is a know integer multiple of `2 x vscale`. 

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


More information about the llvm-commits mailing list