diff options
| author | Craig Topper <craig.topper@intel.com> | 2018-02-10 08:06:49 +0000 |
|---|---|---|
| committer | Craig Topper <craig.topper@intel.com> | 2018-02-10 08:06:49 +0000 |
| commit | d34af6f636f8bedd76d4ab50f387793dafea592d (patch) | |
| tree | cc5b9ae9ed04b53079f9d46f1d06529ed5db2ac6 /llvm/lib | |
| parent | 4f0f426d1fffc145f8defce6c7a85d17f4428908 (diff) | |
| download | bcm5719-llvm-d34af6f636f8bedd76d4ab50f387793dafea592d.tar.gz bcm5719-llvm-d34af6f636f8bedd76d4ab50f387793dafea592d.zip | |
[X86] Teach combineExtSetcc to handle ZERO_EXTEND by widening the setcc and then masking. A later DAG combine will convert to a shift.
This helps to avoid a constant pool load needed to zero extend from the mask.
llvm-svn: 324804
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/Target/X86/X86ISelLowering.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp index 64577422d15..8dbff9f0565 100644 --- a/llvm/lib/Target/X86/X86ISelLowering.cpp +++ b/llvm/lib/Target/X86/X86ISelLowering.cpp @@ -36218,10 +36218,6 @@ static SDValue combineExtSetcc(SDNode *N, SelectionDAG &DAG, EVT VT = N->getValueType(0); SDLoc dl(N); - // Only handle sext/aext for now. - if (N->getOpcode() != ISD::SIGN_EXTEND && N->getOpcode() != ISD::ANY_EXTEND) - return SDValue(); - // Only do this combine with AVX512 for vector extends. if (!Subtarget.hasAVX512() || !VT.isVector() || N0->getOpcode() != ISD::SETCC) return SDValue(); @@ -36249,7 +36245,12 @@ static SDValue combineExtSetcc(SDNode *N, SelectionDAG &DAG, if (Size != MatchingVecType.getSizeInBits()) return SDValue(); - return DAG.getSetCC(dl, VT, N0.getOperand(0), N0.getOperand(1), CC); + SDValue Res = DAG.getSetCC(dl, VT, N0.getOperand(0), N0.getOperand(1), CC); + + if (N->getOpcode() == ISD::ZERO_EXTEND) + Res = DAG.getZeroExtendInReg(Res, dl, N0.getValueType().getScalarType()); + + return Res; } static SDValue combineSext(SDNode *N, SelectionDAG &DAG, |

