diff options
author | Sanjay Patel <spatel@rotateright.com> | 2017-02-07 19:54:16 +0000 |
---|---|---|
committer | Sanjay Patel <spatel@rotateright.com> | 2017-02-07 19:54:16 +0000 |
commit | b0cee9b273e87ca2d8ad0ec53929f36796ecd8ac (patch) | |
tree | a2f2d26dfe3f159691d1cff6b3594ddd7ca6a1a3 /llvm/lib | |
parent | f3965c02462e2f6f8e07823e219cc923e76e5708 (diff) | |
download | bcm5719-llvm-b0cee9b273e87ca2d8ad0ec53929f36796ecd8ac.tar.gz bcm5719-llvm-b0cee9b273e87ca2d8ad0ec53929f36796ecd8ac.zip |
[x86] improve comments for SHRUNKBLEND node creation; NFC
llvm-svn: 294344
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/Target/X86/X86ISelLowering.cpp | 49 | ||||
-rw-r--r-- | llvm/lib/Target/X86/X86ISelLowering.h | 6 |
2 files changed, 27 insertions, 28 deletions
diff --git a/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp index 7e62c99b773..d293d6baa99 100644 --- a/llvm/lib/Target/X86/X86ISelLowering.cpp +++ b/llvm/lib/Target/X86/X86ISelLowering.cpp @@ -29520,39 +29520,38 @@ static SDValue combineSelect(SDNode *N, SelectionDAG &DAG, if (TLO.ShrinkDemandedConstant(Cond, DemandedMask) || TLI.SimplifyDemandedBits(Cond, DemandedMask, KnownZero, KnownOne, TLO)) { - // If we changed the computation somewhere in the DAG, this change - // will affect all users of Cond. - // Make sure it is fine and update all the nodes so that we do not - // use the generic VSELECT anymore. Otherwise, we may perform - // wrong optimizations as we messed up with the actual expectation + // If we changed the computation somewhere in the DAG, this change will + // affect all users of Cond. Make sure it is fine and update all the nodes + // so that we do not use the generic VSELECT anymore. Otherwise, we may + // perform wrong optimizations as we messed with the actual expectation // for the vector boolean values. if (Cond != TLO.Old) { - // Check all uses of that condition operand to check whether it will be - // consumed by non-BLEND instructions, which may depend on all bits are - // set properly. - for (SDNode *U : Cond->uses()) + // Check all uses of the condition operand to check whether it will be + // consumed by non-BLEND instructions. Those may require that all bits + // are set properly. + for (SDNode *U : Cond->uses()) { + // TODO: Add other opcodes eventually lowered into BLEND. if (U->getOpcode() != ISD::VSELECT) - // TODO: Add other opcodes eventually lowered into BLEND. return SDValue(); + } - // Update all the users of the condition, before committing the change, - // so that the VSELECT optimizations that expect the correct vector - // boolean value will not be triggered. - for (SDNode *U : Cond->uses()) - DAG.ReplaceAllUsesOfValueWith( - SDValue(U, 0), - DAG.getNode(X86ISD::SHRUNKBLEND, SDLoc(U), U->getValueType(0), - Cond, U->getOperand(1), U->getOperand(2))); + // Update all users of the condition before committing the change, so + // that the VSELECT optimizations that expect the correct vector boolean + // value will not be triggered. + for (SDNode *U : Cond->uses()) { + SDValue SB = DAG.getNode(X86ISD::SHRUNKBLEND, SDLoc(U), + U->getValueType(0), Cond, U->getOperand(1), + U->getOperand(2)); + DAG.ReplaceAllUsesOfValueWith(SDValue(U, 0), SB); + } DCI.CommitTargetLoweringOpt(TLO); return SDValue(); } - // At this point, only Cond is changed. Change the condition - // just for N to keep the opportunity to optimize all other - // users their own way. - DAG.ReplaceAllUsesOfValueWith( - SDValue(N, 0), - DAG.getNode(X86ISD::SHRUNKBLEND, SDLoc(N), N->getValueType(0), - TLO.New, N->getOperand(1), N->getOperand(2))); + // Only Cond (rather than other nodes in the computation chain) was + // changed. Change the condition just for N to keep the opportunity to + // optimize all other users their own way. + SDValue SB = DAG.getNode(X86ISD::SHRUNKBLEND, DL, VT, TLO.New, LHS, RHS); + DAG.ReplaceAllUsesOfValueWith(SDValue(N, 0), SB); return SDValue(); } } diff --git a/llvm/lib/Target/X86/X86ISelLowering.h b/llvm/lib/Target/X86/X86ISelLowering.h index 9969c909347..4797a3dca38 100644 --- a/llvm/lib/Target/X86/X86ISelLowering.h +++ b/llvm/lib/Target/X86/X86ISelLowering.h @@ -195,9 +195,9 @@ namespace llvm { /// Blend where the selector is an immediate. BLENDI, - /// Blend where the condition has been shrunk. - /// This is used to emphasize that the condition mask is - /// no more valid for generic VSELECT optimizations. + /// Dynamic (non-constant condition) vector blend where only the sign bits + /// of the condition elements are used. This is used to enforce that the + /// condition mask is not valid for generic VSELECT optimizations. SHRUNKBLEND, /// Combined add and sub on an FP vector. |