Skip to content

Commit 3efd2a0

Browse files
committed
[x86] make helper for useVPTERNLOG; NFC
See D112085 for another use case.
1 parent 6a99423 commit 3efd2a0

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

llvm/lib/Target/X86/X86ISelLowering.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5338,6 +5338,9 @@ static bool hasFPCMov(unsigned X86CC) {
53385338
}
53395339
}
53405340

5341+
static bool useVPTERNLOG(const X86Subtarget &Subtarget, MVT VT) {
5342+
return Subtarget.hasVLX() || (Subtarget.hasAVX512() && VT.is512BitVector());
5343+
}
53415344

53425345
bool X86TargetLowering::getTgtMemIntrinsic(IntrinsicInfo &Info,
53435346
const CallInst &I,
@@ -46112,9 +46115,7 @@ static SDValue canonicalizeBitSelect(SDNode *N, SelectionDAG &DAG,
4611246115

4611346116
// On XOP we'll lower to PCMOV so accept one use. With AVX512, we can use
4611446117
// VPTERNLOG. Otherwise only do this if either mask has multiple uses already.
46115-
bool UseVPTERNLOG = (Subtarget.hasAVX512() && VT.is512BitVector()) ||
46116-
Subtarget.hasVLX();
46117-
if (!(Subtarget.hasXOP() || UseVPTERNLOG ||
46118+
if (!(Subtarget.hasXOP() || useVPTERNLOG(Subtarget, VT) ||
4611846119
!N0.getOperand(1).hasOneUse() || !N1.getOperand(1).hasOneUse()))
4611946120
return SDValue();
4612046121

@@ -46138,8 +46139,8 @@ static SDValue canonicalizeBitSelect(SDNode *N, SelectionDAG &DAG,
4613846139

4613946140
SDLoc DL(N);
4614046141

46141-
if (UseVPTERNLOG) {
46142-
// Emit a VPTERNLOG node directly.
46142+
if (useVPTERNLOG(Subtarget, VT)) {
46143+
// Emit a VPTERNLOG node directly - 0xCA is the imm code for A?B:C.
4614346144
SDValue A = DAG.getBitcast(VT, N0.getOperand(1));
4614446145
SDValue B = DAG.getBitcast(VT, N0.getOperand(0));
4614546146
SDValue C = DAG.getBitcast(VT, N1.getOperand(0));

0 commit comments

Comments
 (0)