[llvm] [AArch64][SVE] Fix for wide adds trying to be generated (PR #118838)

James Chesterman via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 5 12:03:38 PST 2024


https://github.com/JamesChesterman updated https://github.com/llvm/llvm-project/pull/118838

>From 1a68328b4a9fcd7dd8f3be01312cf30c827ef0bd Mon Sep 17 00:00:00 2001
From: James Chesterman <james.chesterman at arm.com>
Date: Thu, 5 Dec 2024 17:29:38 +0000
Subject: [PATCH 1/2] [AArch64][SVE] Fix for wide adds trying to be generated

Wide adds would try to be generated when SVE is enabled not SVE2.
---
 llvm/lib/Target/AArch64/AArch64ISelLowering.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp b/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
index 7ab3fc06715ec8..75f0bae84db67e 100644
--- a/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
+++ b/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
@@ -21814,7 +21814,7 @@ SDValue tryLowerPartialReductionToWideAdd(SDNode *N,
              Intrinsic::experimental_vector_partial_reduce_add &&
          "Expected a partial reduction node");
 
-  if (!Subtarget->isSVEorStreamingSVEAvailable())
+  if (!Subtarget->hasSVE2() && !Subtarget->isStreamingSVEAvailable())
     return SDValue();
 
   SDLoc DL(N);

>From 8e55b1ab8bc9b61c1526f3e218799a62b750031a Mon Sep 17 00:00:00 2001
From: James Chesterman <james.chesterman at arm.com>
Date: Thu, 5 Dec 2024 20:02:49 +0000
Subject: [PATCH 2/2] Add extra run line to file to protect the fix.

---
 llvm/test/CodeGen/AArch64/sve-partial-reduce-wide-add.ll | 1 +
 1 file changed, 1 insertion(+)

diff --git a/llvm/test/CodeGen/AArch64/sve-partial-reduce-wide-add.ll b/llvm/test/CodeGen/AArch64/sve-partial-reduce-wide-add.ll
index 1d05649964670d..adf6a1760526dc 100644
--- a/llvm/test/CodeGen/AArch64/sve-partial-reduce-wide-add.ll
+++ b/llvm/test/CodeGen/AArch64/sve-partial-reduce-wide-add.ll
@@ -1,5 +1,6 @@
 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 5
 ; RUN: llc -mtriple=aarch64 -mattr=+sve2 %s -o - | FileCheck %s
+; RUN: llc -mtriple=aarch64 -mattr=+sve %s -o - | FileCheck %s
 
 define <vscale x 2 x i64> @signed_wide_add_nxv4i32(<vscale x 2 x i64> %acc, <vscale x 4 x i32> %input){
 ; CHECK-LABEL: signed_wide_add_nxv4i32:



More information about the llvm-commits mailing list