mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-10-19 11:02:59 +02:00
[X86] Simplify creation of saturating truncating stores.
We just need to check if the truncating store is legal instead of going through isSATValidOnAVX512Subtarget. llvm-svn: 368607
This commit is contained in:
parent
747bfa048d
commit
699ceb4cd6
@ -39021,36 +39021,6 @@ static SDValue detectSSatPattern(SDValue In, EVT VT, bool MatchPackUS = false) {
|
|||||||
return SDValue();
|
return SDValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Detect a pattern of truncation with signed saturation.
|
|
||||||
/// The types should allow to use VPMOVSS* instruction on AVX512.
|
|
||||||
/// Return the source value to be truncated or SDValue() if the pattern was not
|
|
||||||
/// matched.
|
|
||||||
static SDValue detectAVX512SSatPattern(SDValue In, EVT VT,
|
|
||||||
const X86Subtarget &Subtarget,
|
|
||||||
const TargetLowering &TLI) {
|
|
||||||
if (!TLI.isTypeLegal(In.getValueType()))
|
|
||||||
return SDValue();
|
|
||||||
if (!isSATValidOnAVX512Subtarget(In.getValueType(), VT, Subtarget))
|
|
||||||
return SDValue();
|
|
||||||
return detectSSatPattern(In, VT);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Detect a pattern of truncation with saturation:
|
|
||||||
/// (truncate (umin (x, unsigned_max_of_dest_type)) to dest_type).
|
|
||||||
/// The types should allow to use VPMOVUS* instruction on AVX512.
|
|
||||||
/// Return the source value to be truncated or SDValue() if the pattern was not
|
|
||||||
/// matched.
|
|
||||||
static SDValue detectAVX512USatPattern(SDValue In, EVT VT, SelectionDAG &DAG,
|
|
||||||
const SDLoc &DL,
|
|
||||||
const X86Subtarget &Subtarget,
|
|
||||||
const TargetLowering &TLI) {
|
|
||||||
if (!TLI.isTypeLegal(In.getValueType()))
|
|
||||||
return SDValue();
|
|
||||||
if (!isSATValidOnAVX512Subtarget(In.getValueType(), VT, Subtarget))
|
|
||||||
return SDValue();
|
|
||||||
return detectUSatPattern(In, VT, DAG, DL);
|
|
||||||
}
|
|
||||||
|
|
||||||
static SDValue combineTruncateWithSat(SDValue In, EVT VT, const SDLoc &DL,
|
static SDValue combineTruncateWithSat(SDValue In, EVT VT, const SDLoc &DL,
|
||||||
SelectionDAG &DAG,
|
SelectionDAG &DAG,
|
||||||
const X86Subtarget &Subtarget) {
|
const X86Subtarget &Subtarget) {
|
||||||
@ -39653,17 +39623,17 @@ static SDValue combineStore(SDNode *N, SelectionDAG &DAG,
|
|||||||
St->getPointerInfo(), St->getAlignment(),
|
St->getPointerInfo(), St->getAlignment(),
|
||||||
St->getMemOperand()->getFlags());
|
St->getMemOperand()->getFlags());
|
||||||
|
|
||||||
if (SDValue Val =
|
if (TLI.isTruncStoreLegal(VT, StVT)) {
|
||||||
detectAVX512SSatPattern(St->getValue(), St->getMemoryVT(), Subtarget,
|
if (SDValue Val = detectSSatPattern(St->getValue(), St->getMemoryVT()))
|
||||||
TLI))
|
|
||||||
return EmitTruncSStore(true /* Signed saturation */, St->getChain(),
|
return EmitTruncSStore(true /* Signed saturation */, St->getChain(),
|
||||||
dl, Val, St->getBasePtr(),
|
dl, Val, St->getBasePtr(),
|
||||||
St->getMemoryVT(), St->getMemOperand(), DAG);
|
St->getMemoryVT(), St->getMemOperand(), DAG);
|
||||||
if (SDValue Val = detectAVX512USatPattern(St->getValue(), St->getMemoryVT(),
|
if (SDValue Val = detectUSatPattern(St->getValue(), St->getMemoryVT(),
|
||||||
DAG, dl, Subtarget, TLI))
|
DAG, dl))
|
||||||
return EmitTruncSStore(false /* Unsigned saturation */, St->getChain(),
|
return EmitTruncSStore(false /* Unsigned saturation */, St->getChain(),
|
||||||
dl, Val, St->getBasePtr(),
|
dl, Val, St->getBasePtr(),
|
||||||
St->getMemoryVT(), St->getMemOperand(), DAG);
|
St->getMemoryVT(), St->getMemOperand(), DAG);
|
||||||
|
}
|
||||||
|
|
||||||
return SDValue();
|
return SDValue();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user