mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-26 04:32:44 +01:00
[x86] improve comments for SHRUNKBLEND node creation; NFC
llvm-svn: 294344
This commit is contained in:
parent
df3b8cddb2
commit
704fe71950
@ -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();
|
||||
}
|
||||
}
|
||||
|
@ -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.
|
||||
|
Loading…
Reference in New Issue
Block a user