[AArch64][GlobalISel] Add patterns for signed scalar extend intrinsics#201617
Merged
Conversation
Follow on from [llvm#201546])(llvm#201546). Add patterns for signed versions of scalar extend intrinsics as well.
|
@llvm/pr-subscribers-backend-aarch64 Author: Joshua Rodriguez (JoshdRod) ChangesFollow on from #201546 3 Files Affected:
diff --git a/llvm/lib/Target/AArch64/AArch64InstrInfo.td b/llvm/lib/Target/AArch64/AArch64InstrInfo.td
index 151cbd9bc5a7c..200808665c93e 100644
--- a/llvm/lib/Target/AArch64/AArch64InstrInfo.td
+++ b/llvm/lib/Target/AArch64/AArch64InstrInfo.td
@@ -6696,8 +6696,13 @@ defm UQXTN : SIMDTwoScalarMixedBHS<1, 0b10100, "uqxtn", int_aarch64_neon_scalar
defm USQADD : SIMDTwoScalarBHSDTied< 1, 0b00011, "usqadd", AArch64usqadd,
int_aarch64_neon_usqadd>;
+// Scalar i32 -> i64 extend
def : Pat<(i32 (int_aarch64_neon_scalar_uqxtn (i64 FPR64:$Rn))),
(i32 (UQXTNv1i32 FPR64:$Rn))>;
+def : Pat<(i32 (int_aarch64_neon_scalar_sqxtn (i64 FPR64:$Rn))),
+ (i32 (SQXTNv1i32 FPR64:$Rn))>;
+def : Pat<(i32 (int_aarch64_neon_scalar_sqxtun (i64 FPR64:$Rn))),
+ (i32 (SQXTUNv1i32 FPR64:$Rn))>;
// ssub_sat(0, R) -> sqneg(R)
def : Pat<(v16i8 (ssubsat immAllZerosV, V128:$reg)),
diff --git a/llvm/lib/Target/AArch64/GISel/AArch64RegisterBankInfo.cpp b/llvm/lib/Target/AArch64/GISel/AArch64RegisterBankInfo.cpp
index ee9e57e705750..4767493e107b4 100644
--- a/llvm/lib/Target/AArch64/GISel/AArch64RegisterBankInfo.cpp
+++ b/llvm/lib/Target/AArch64/GISel/AArch64RegisterBankInfo.cpp
@@ -654,6 +654,8 @@ static bool isFPIntrinsic(const MachineRegisterInfo &MRI,
case Intrinsic::aarch64_neon_sqneg:
case Intrinsic::aarch64_neon_sqabs:
case Intrinsic::aarch64_neon_scalar_uqxtn:
+ case Intrinsic::aarch64_neon_scalar_sqxtn:
+ case Intrinsic::aarch64_neon_scalar_sqxtun:
case Intrinsic::aarch64_crypto_sha1h:
case Intrinsic::aarch64_crypto_sha1c:
case Intrinsic::aarch64_crypto_sha1p:
diff --git a/llvm/test/CodeGen/AArch64/arm64-arith-saturating.ll b/llvm/test/CodeGen/AArch64/arm64-arith-saturating.ll
index 15812d2d52d40..33c258d18ddcc 100644
--- a/llvm/test/CodeGen/AArch64/arm64-arith-saturating.ll
+++ b/llvm/test/CodeGen/AArch64/arm64-arith-saturating.ll
@@ -1,12 +1,6 @@
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
-; RUN: llc < %s -mtriple=arm64-eabi -mcpu=cyclone | FileCheck %s --check-prefixes=CHECK
-; RUN: llc < %s -mtriple=arm64-eabi -mcpu=cyclone -global-isel -global-isel-abort=2 2>&1 | FileCheck %s --check-prefixes=CHECK,CHECK-GI
-
-; CHECK-GI: warning: Instruction selection used fallback path for vqmovund
-; CHECK-GI-NEXT: warning: Instruction selection used fallback path for vqmovnd_s
-; CHECK-GI-NEXT: warning: Instruction selection used fallback path for sqxtn_ins
-; CHECK-GI-NEXT: warning: Instruction selection used fallback path for sqxtun_insext
-; CHECK-GI-NEXT: warning: Instruction selection used fallback path for saddluse
+; RUN: llc < %s -mtriple=arm64-eabi -mcpu=cyclone | FileCheck %s
+; RUN: llc < %s -mtriple=arm64-eabi -mcpu=cyclone -global-isel | FileCheck %s
define i32 @qadds(<4 x i32> %b, <4 x i32> %c) nounwind readnone optsize ssp {
; CHECK-LABEL: qadds:
|
c-rhodes
reviewed
Jun 5, 2026
Comment on lines
+2
to
+3
| ; RUN: llc < %s -mtriple=arm64-eabi -mcpu=cyclone | FileCheck %s | ||
| ; RUN: llc < %s -mtriple=arm64-eabi -mcpu=cyclone -global-isel | FileCheck %s |
Contributor
There was a problem hiding this comment.
why are the run lines being changed?
Contributor
Author
There was a problem hiding this comment.
Because gisel no longer causes any fallbacks, we can remove the -global-isel-abort=2. This way, when there's any sort of fallback, the test fails.
I also removed the --check-prefixes flag, because gisel and sdag output is now the same.
Contributor
There was a problem hiding this comment.
ah ok, it wasn't obvious to me the default is enable. Nothing major but it would be clearer if the intent was explicit with -global-isel-abort=1
c-rhodes
approved these changes
Jun 5, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow on from #201546
Add patterns for signed versions of scalar extend intrinsics as well.