Index: lib/CodeGen/SelectionDAG/DAGCombiner.cpp =================================================================== --- lib/CodeGen/SelectionDAG/DAGCombiner.cpp +++ lib/CodeGen/SelectionDAG/DAGCombiner.cpp @@ -13782,6 +13782,13 @@ // converts. } + // vextract (v1iX extract_subvector(vNiX, Idx)) -> vextract(vNiX,Idx) + if (InVec.getOpcode() == ISD::EXTRACT_SUBVECTOR && + VT.getVectorNumElements() == 1) { + return DAG.getNode(ISD::EXTRACT_VECTOR_ELT, SDLoc(N), NVT, + InVec->getOperand(0), InVec->getOperand(1)); + } + // extract_vector_elt (v2i32 (bitcast i64:x)), EltTrunc -> i32 (trunc i64:x) bool isLE = DAG.getDataLayout().isLittleEndian(); unsigned EltTrunc = isLE ? 0 : VT.getVectorNumElements() - 1; Index: test/CodeGen/X86/pr33349.ll =================================================================== --- test/CodeGen/X86/pr33349.ll +++ test/CodeGen/X86/pr33349.ll @@ -43,8 +43,6 @@ ; SKX-NEXT: kshiftrw $2, %k0, %k1 ; SKX-NEXT: kshiftlw $15, %k1, %k2 ; SKX-NEXT: kshiftrw $15, %k2, %k2 -; SKX-NEXT: kshiftlw $15, %k2, %k2 -; SKX-NEXT: kshiftrw $15, %k2, %k2 ; SKX-NEXT: kmovd %k2, %eax ; SKX-NEXT: testb $1, %al ; SKX-NEXT: fld1 @@ -53,24 +51,18 @@ ; SKX-NEXT: fcmovne %st(2), %st(0) ; SKX-NEXT: kshiftlw $14, %k1, %k1 ; SKX-NEXT: kshiftrw $15, %k1, %k1 -; SKX-NEXT: kshiftlw $15, %k1, %k1 -; SKX-NEXT: kshiftrw $15, %k1, %k1 ; SKX-NEXT: kmovd %k1, %eax ; SKX-NEXT: testb $1, %al ; SKX-NEXT: fld %st(1) ; SKX-NEXT: fcmovne %st(3), %st(0) ; SKX-NEXT: kshiftlw $15, %k0, %k1 ; SKX-NEXT: kshiftrw $15, %k1, %k1 -; SKX-NEXT: kshiftlw $15, %k1, %k1 -; SKX-NEXT: kshiftrw $15, %k1, %k1 ; SKX-NEXT: kmovd %k1, %eax ; SKX-NEXT: testb $1, %al ; SKX-NEXT: fld %st(2) ; SKX-NEXT: fcmovne %st(4), %st(0) ; SKX-NEXT: kshiftlw $14, %k0, %k0 ; SKX-NEXT: kshiftrw $15, %k0, %k0 -; SKX-NEXT: kshiftlw $15, %k0, %k0 -; SKX-NEXT: kshiftrw $15, %k0, %k0 ; SKX-NEXT: kmovd %k0, %eax ; SKX-NEXT: testb $1, %al ; SKX-NEXT: fxch %st(3)