1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 18:54:02 +01:00

[x86] improve comments for SHRUNKBLEND node creation; NFC

llvm-svn: 294344
This commit is contained in:
Sanjay Patel 2017-02-07 19:54:16 +00:00
parent df3b8cddb2
commit 704fe71950
2 changed files with 27 additions and 28 deletions

View File

@ -29520,39 +29520,38 @@ static SDValue combineSelect(SDNode *N, SelectionDAG &DAG,
if (TLO.ShrinkDemandedConstant(Cond, DemandedMask) || if (TLO.ShrinkDemandedConstant(Cond, DemandedMask) ||
TLI.SimplifyDemandedBits(Cond, DemandedMask, KnownZero, KnownOne, TLI.SimplifyDemandedBits(Cond, DemandedMask, KnownZero, KnownOne,
TLO)) { TLO)) {
// If we changed the computation somewhere in the DAG, this change // If we changed the computation somewhere in the DAG, this change will
// will affect all users of Cond. // affect all users of Cond. Make sure it is fine and update all the nodes
// Make sure it is fine and update all the nodes so that we do not // so that we do not use the generic VSELECT anymore. Otherwise, we may
// use the generic VSELECT anymore. Otherwise, we may perform // perform wrong optimizations as we messed with the actual expectation
// wrong optimizations as we messed up with the actual expectation
// for the vector boolean values. // for the vector boolean values.
if (Cond != TLO.Old) { if (Cond != TLO.Old) {
// Check all uses of that condition operand to check whether it will be // Check all uses of the condition operand to check whether it will be
// consumed by non-BLEND instructions, which may depend on all bits are // consumed by non-BLEND instructions. Those may require that all bits
// set properly. // are set properly.
for (SDNode *U : Cond->uses()) for (SDNode *U : Cond->uses()) {
// TODO: Add other opcodes eventually lowered into BLEND.
if (U->getOpcode() != ISD::VSELECT) if (U->getOpcode() != ISD::VSELECT)
// TODO: Add other opcodes eventually lowered into BLEND.
return SDValue(); return SDValue();
}
// Update all the users of the condition, before committing the change, // Update all users of the condition before committing the change, so
// so that the VSELECT optimizations that expect the correct vector // that the VSELECT optimizations that expect the correct vector boolean
// boolean value will not be triggered. // value will not be triggered.
for (SDNode *U : Cond->uses()) for (SDNode *U : Cond->uses()) {
DAG.ReplaceAllUsesOfValueWith( SDValue SB = DAG.getNode(X86ISD::SHRUNKBLEND, SDLoc(U),
SDValue(U, 0), U->getValueType(0), Cond, U->getOperand(1),
DAG.getNode(X86ISD::SHRUNKBLEND, SDLoc(U), U->getValueType(0), U->getOperand(2));
Cond, U->getOperand(1), U->getOperand(2))); DAG.ReplaceAllUsesOfValueWith(SDValue(U, 0), SB);
}
DCI.CommitTargetLoweringOpt(TLO); DCI.CommitTargetLoweringOpt(TLO);
return SDValue(); return SDValue();
} }
// At this point, only Cond is changed. Change the condition // Only Cond (rather than other nodes in the computation chain) was
// just for N to keep the opportunity to optimize all other // changed. Change the condition just for N to keep the opportunity to
// users their own way. // optimize all other users their own way.
DAG.ReplaceAllUsesOfValueWith( SDValue SB = DAG.getNode(X86ISD::SHRUNKBLEND, DL, VT, TLO.New, LHS, RHS);
SDValue(N, 0), DAG.ReplaceAllUsesOfValueWith(SDValue(N, 0), SB);
DAG.getNode(X86ISD::SHRUNKBLEND, SDLoc(N), N->getValueType(0),
TLO.New, N->getOperand(1), N->getOperand(2)));
return SDValue(); return SDValue();
} }
} }

View File

@ -195,9 +195,9 @@ namespace llvm {
/// Blend where the selector is an immediate. /// Blend where the selector is an immediate.
BLENDI, BLENDI,
/// Blend where the condition has been shrunk. /// Dynamic (non-constant condition) vector blend where only the sign bits
/// This is used to emphasize that the condition mask is /// of the condition elements are used. This is used to enforce that the
/// no more valid for generic VSELECT optimizations. /// condition mask is not valid for generic VSELECT optimizations.
SHRUNKBLEND, SHRUNKBLEND,
/// Combined add and sub on an FP vector. /// Combined add and sub on an FP vector.