[llvm] fc7c79b - [X86] hasBZHI - simplify to a basic check as there's no need for a switch statement. NFCI.
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Tue Jan 30 07:32:18 PST 2024
Author: Simon Pilgrim
Date: 2024-01-30T15:32:06Z
New Revision: fc7c79b60ca0846f1cc916b6b04eedd1fc21537e
URL: https://github.com/llvm/llvm-project/commit/fc7c79b60ca0846f1cc916b6b04eedd1fc21537e
DIFF: https://github.com/llvm/llvm-project/commit/fc7c79b60ca0846f1cc916b6b04eedd1fc21537e.diff
LOG: [X86] hasBZHI - simplify to a basic check as there's no need for a switch statement. NFCI.
Added:
Modified:
llvm/lib/Target/X86/X86ISelLowering.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp
index 89dd7f67ea9c1..531e00862558c 100644
--- a/llvm/lib/Target/X86/X86ISelLowering.cpp
+++ b/llvm/lib/Target/X86/X86ISelLowering.cpp
@@ -48331,14 +48331,8 @@ static SDValue getIndexFromUnindexedLoad(LoadSDNode *Ld) {
}
static bool hasBZHI(const X86Subtarget &Subtarget, MVT VT) {
- if (Subtarget.hasBMI2() && VT.isScalarInteger()) {
- switch (VT.getSizeInBits()) {
- default: return false;
- case 64: return Subtarget.is64Bit() ? true : false;
- case 32: return true;
- }
- }
- return false;
+ return Subtarget.hasBMI2() &&
+ (VT == MVT::i32 || (VT == MVT::i64 && Subtarget.is64Bit()));
}
// This function recognizes cases where X86 bzhi instruction can replace and
More information about the llvm-commits
mailing list