[llvm] 3efd2a0 - [x86] make helper for useVPTERNLOG; NFC
Sanjay Patel via llvm-commits
llvm-commits at lists.llvm.org
Wed Oct 20 07:27:24 PDT 2021
Author: Sanjay Patel
Date: 2021-10-20T10:26:53-04:00
New Revision: 3efd2a0bec0298d804f274fcc10ea14431b61de1
URL: https://github.com/llvm/llvm-project/commit/3efd2a0bec0298d804f274fcc10ea14431b61de1
DIFF: https://github.com/llvm/llvm-project/commit/3efd2a0bec0298d804f274fcc10ea14431b61de1.diff
LOG: [x86] make helper for useVPTERNLOG; NFC
See D112085 for another use case.
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 304b49d4ad2e..ba6cc4056208 100644
--- a/llvm/lib/Target/X86/X86ISelLowering.cpp
+++ b/llvm/lib/Target/X86/X86ISelLowering.cpp
@@ -5338,6 +5338,9 @@ static bool hasFPCMov(unsigned X86CC) {
}
}
+static bool useVPTERNLOG(const X86Subtarget &Subtarget, MVT VT) {
+ return Subtarget.hasVLX() || (Subtarget.hasAVX512() && VT.is512BitVector());
+}
bool X86TargetLowering::getTgtMemIntrinsic(IntrinsicInfo &Info,
const CallInst &I,
@@ -46112,9 +46115,7 @@ static SDValue canonicalizeBitSelect(SDNode *N, SelectionDAG &DAG,
// On XOP we'll lower to PCMOV so accept one use. With AVX512, we can use
// VPTERNLOG. Otherwise only do this if either mask has multiple uses already.
- bool UseVPTERNLOG = (Subtarget.hasAVX512() && VT.is512BitVector()) ||
- Subtarget.hasVLX();
- if (!(Subtarget.hasXOP() || UseVPTERNLOG ||
+ if (!(Subtarget.hasXOP() || useVPTERNLOG(Subtarget, VT) ||
!N0.getOperand(1).hasOneUse() || !N1.getOperand(1).hasOneUse()))
return SDValue();
@@ -46138,8 +46139,8 @@ static SDValue canonicalizeBitSelect(SDNode *N, SelectionDAG &DAG,
SDLoc DL(N);
- if (UseVPTERNLOG) {
- // Emit a VPTERNLOG node directly.
+ if (useVPTERNLOG(Subtarget, VT)) {
+ // Emit a VPTERNLOG node directly - 0xCA is the imm code for A?B:C.
SDValue A = DAG.getBitcast(VT, N0.getOperand(1));
SDValue B = DAG.getBitcast(VT, N0.getOperand(0));
SDValue C = DAG.getBitcast(VT, N1.getOperand(0));
More information about the llvm-commits
mailing list