[llvm] [ARM][AArch64] Refactor hasAndNot to reflect the fact that we can use bic for any scalar (NFC) (PR #196324)
via llvm-commits
llvm-commits at lists.llvm.org
Thu May 7 07:57:55 PDT 2026
https://github.com/LumioseSil updated https://github.com/llvm/llvm-project/pull/196324
>From cace420c526b95edded7866a51d33ba77af9bd0f Mon Sep 17 00:00:00 2001
From: AZero13 <gfunni234 at gmail.com>
Date: Thu, 7 May 2026 10:09:27 -0400
Subject: [PATCH] [ARM][AArch64] Refactor hasAndNot to reflect the fact that we
can use bic for any scalar
---
llvm/lib/Target/AArch64/AArch64ISelLowering.h | 9 +++++----
llvm/lib/Target/ARM/ARMISelLowering.cpp | 17 ++++++++++-------
2 files changed, 15 insertions(+), 11 deletions(-)
diff --git a/llvm/lib/Target/AArch64/AArch64ISelLowering.h b/llvm/lib/Target/AArch64/AArch64ISelLowering.h
index 80d49bb2ed318..f181eb769a3a5 100644
--- a/llvm/lib/Target/AArch64/AArch64ISelLowering.h
+++ b/llvm/lib/Target/AArch64/AArch64ISelLowering.h
@@ -416,13 +416,14 @@ class AArch64TargetLowering : public TargetLowering {
bool hasAndNot(SDValue Y) const override {
EVT VT = Y.getValueType();
- if (!VT.isVector())
- return hasAndNotCompare(Y);
-
if (VT.isScalableVector())
return true;
- return VT.getFixedSizeInBits() >= 64; // vector 'bic'
+ if (VT.isVector())
+ return VT.getFixedSizeInBits() >= 64; // vector 'bic'
+
+ // We can use bic for any scalar.
+ return true;
}
bool shouldProduceAndByConstByHoistingConstFromShiftsLHSOfAnd(
diff --git a/llvm/lib/Target/ARM/ARMISelLowering.cpp b/llvm/lib/Target/ARM/ARMISelLowering.cpp
index cbff40f697b9b..8ec7245bcfd9c 100644
--- a/llvm/lib/Target/ARM/ARMISelLowering.cpp
+++ b/llvm/lib/Target/ARM/ARMISelLowering.cpp
@@ -17748,13 +17748,16 @@ SDValue ARMTargetLowering::PerformIntrinsicCombine(SDNode *N,
bool ARMTargetLowering::hasAndNot(SDValue Y) const {
EVT VT = Y.getValueType();
- if (!VT.isVector())
- return hasAndNotCompare(Y);
- if (Subtarget->hasMVEIntegerOps())
- return VT.is128BitVector();
- if (Subtarget->hasNEON())
- return VT.is64BitVector() || VT.is128BitVector();
- return false;
+
+ if (VT.isVector()) {
+ if (Subtarget->hasMVEIntegerOps())
+ return VT.getFixedSizeInBits() >= 128;
+ if (Subtarget->hasNEON())
+ return VT.getFixedSizeInBits() >= 64;
+ }
+
+ // We can use bic for any scalar.
+ return true;
}
/// PerformShiftCombine - Checks for immediate versions of vector shifts and
More information about the llvm-commits
mailing list