-
Notifications
You must be signed in to change notification settings - Fork 15.3k
[X86] commuteSelect - update to use SDPatternMatch. NFC. #146868
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
@llvm/pr-subscribers-backend-x86 Author: Simon Pilgrim (RKSimon) ChangesFull diff: https://github.com/llvm/llvm-project/pull/146868.diff 1 Files Affected:
diff --git a/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp
index feafdc909332c..f5d8d65070a3b 100644
--- a/llvm/lib/Target/X86/X86ISelLowering.cpp
+++ b/llvm/lib/Target/X86/X86ISelLowering.cpp
@@ -47568,31 +47568,26 @@ static SDValue combineLogicBlendIntoConditionalNegate(
static SDValue commuteSelect(SDNode *N, SelectionDAG &DAG, const SDLoc &DL,
const X86Subtarget &Subtarget) {
+ using namespace SDPatternMatch;
if (!Subtarget.hasAVX512())
return SDValue();
- if (N->getOpcode() != ISD::VSELECT)
- return SDValue();
-
- SDValue Cond = N->getOperand(0);
- SDValue LHS = N->getOperand(1);
- SDValue RHS = N->getOperand(2);
-
- if (canCombineAsMaskOperation(LHS, Subtarget))
- return SDValue();
- if (!canCombineAsMaskOperation(RHS, Subtarget))
+ ISD::CondCode CC;
+ SDValue Cond, X, Y, LHS, RHS;
+ if (!sd_match(N, m_VSelect(m_AllOf(m_Value(Cond),
+ m_OneUse(m_SetCC(m_Value(X), m_Value(Y),
+ m_CondCode(CC)))),
+ m_Value(LHS), m_Value(RHS))))
return SDValue();
- if (Cond.getOpcode() != ISD::SETCC || !Cond.hasOneUse())
+ if (canCombineAsMaskOperation(LHS, Subtarget) ||
+ !canCombineAsMaskOperation(RHS, Subtarget))
return SDValue();
// Commute LHS and RHS to create opportunity to select mask instruction.
// (vselect M, L, R) -> (vselect ~M, R, L)
- ISD::CondCode NewCC =
- ISD::getSetCCInverse(cast<CondCodeSDNode>(Cond.getOperand(2))->get(),
- Cond.getOperand(0).getValueType());
- Cond = DAG.getSetCC(SDLoc(Cond), Cond.getValueType(), Cond.getOperand(0),
- Cond.getOperand(1), NewCC);
+ ISD::CondCode NewCC = ISD::getSetCCInverse(CC, X.getValueType());
+ Cond = DAG.getSetCC(SDLoc(Cond), Cond.getValueType(), X, Y, NewCC);
return DAG.getSelect(DL, LHS.getValueType(), Cond, RHS, LHS);
}
|
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/207/builds/3318 Here is the relevant piece of the build log for the reference |
No description provided.