From d4795b700d5e6cf4ce87c71d9fe9376115a3d212 Mon Sep 17 00:00:00 2001 From: Craig Topper Date: Fri, 26 Jan 2018 20:02:52 +0000 Subject: [X86] Allow any_extend to be combined with setcc on VLX targets. For VLX target getSetccResultType returns vXi1 which prevents the target independent DAG combine from doing this tranform itself. llvm-svn: 323555 --- llvm/lib/Target/X86/X86ISelLowering.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'llvm/lib') diff --git a/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp index 5f08c9dd120..18f14316636 100644 --- a/llvm/lib/Target/X86/X86ISelLowering.cpp +++ b/llvm/lib/Target/X86/X86ISelLowering.cpp @@ -36221,6 +36221,10 @@ 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(); @@ -36474,6 +36478,10 @@ static SDValue combineZext(SDNode *N, SelectionDAG &DAG, if (SDValue NewCMov = combineToExtendCMOV(N, DAG)) return NewCMov; + if (DCI.isBeforeLegalizeOps()) + if (SDValue V = combineExtSetcc(N, DAG, Subtarget)) + return V; + if (SDValue V = combineToExtendVectorInReg(N, DAG, DCI, Subtarget)) return V; -- cgit v1.2.3