diff options
| author | Simon Pilgrim <llvm-dev@redking.me.uk> | 2018-02-14 14:14:29 +0000 |
|---|---|---|
| committer | Simon Pilgrim <llvm-dev@redking.me.uk> | 2018-02-14 14:14:29 +0000 |
| commit | 86d15bff68fbec668fc4b2449af7dfd449b491fb (patch) | |
| tree | c2387baf09e7451d693e4e2b41cd0786e22b8f0e /llvm/lib/Target/X86/X86ISelLowering.cpp | |
| parent | b4e3bad89bc0922133f29064c87bb59a3935af39 (diff) | |
| download | bcm5719-llvm-86d15bff68fbec668fc4b2449af7dfd449b491fb.tar.gz bcm5719-llvm-86d15bff68fbec668fc4b2449af7dfd449b491fb.zip | |
[X86][SSE] Relax type legality for combineTruncateWithSat PACKSS/PACKUS truncation
While the AVX512 VTRUNCS/VTRUNCUS instructions require legal types, truncateVectorWithPACK handles cases with multiples of legal types through splitting/concatenation. So we just need to ensure that the src/dst scalar types are correct and leave truncateVectorWithPACK to handle the rest of it.
llvm-svn: 325127
Diffstat (limited to 'llvm/lib/Target/X86/X86ISelLowering.cpp')
| -rw-r--r-- | llvm/lib/Target/X86/X86ISelLowering.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp index a1e37975b7a..4a2eba05aee 100644 --- a/llvm/lib/Target/X86/X86ISelLowering.cpp +++ b/llvm/lib/Target/X86/X86ISelLowering.cpp @@ -34214,15 +34214,15 @@ static SDValue combineTruncateWithSat(SDValue In, EVT VT, const SDLoc &DL, const X86Subtarget &Subtarget) { EVT InVT = In.getValueType(); const TargetLowering &TLI = DAG.getTargetLoweringInfo(); - if (!TLI.isTypeLegal(InVT) || !TLI.isTypeLegal(VT)) - return SDValue(); - if (isSATValidOnAVX512Subtarget(InVT, VT, Subtarget)) { + if (TLI.isTypeLegal(InVT) && TLI.isTypeLegal(VT) && + isSATValidOnAVX512Subtarget(InVT, VT, Subtarget)) { if (auto SSatVal = detectSSatPattern(In, VT)) return DAG.getNode(X86ISD::VTRUNCS, DL, VT, SSatVal); if (auto USatVal = detectUSatPattern(In, VT)) return DAG.getNode(X86ISD::VTRUNCUS, DL, VT, USatVal); } - if ((VT.getScalarType() == MVT::i8 && InVT.getScalarType() == MVT::i16) || + if (VT.isVector() && isPowerOf2_32(VT.getVectorNumElements()) && + (VT.getScalarType() == MVT::i8 && InVT.getScalarType() == MVT::i16) || (VT.getScalarType() == MVT::i16 && InVT.getScalarType() == MVT::i32)) { if (auto SSatVal = detectSSatPattern(In, VT)) return truncateVectorWithPACK(X86ISD::PACKSS, VT, SSatVal, DL, DAG, |

