[llvm] r267651 - [X86] Re-enable MMX i32 extractelt combine.
Ahmed Bougacha via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 26 18:35:25 PDT 2016
Author: ab
Date: Tue Apr 26 20:35:25 2016
New Revision: 267651
URL: http://llvm.org/viewvc/llvm-project?rev=267651&view=rev
Log:
[X86] Re-enable MMX i32 extractelt combine.
This effectively adds back the extractelt combine removed by r262358:
the direct case can still occur (because x86_mmx is special, see
r262446), but it's the indirect case that's now superseded by the
generic combine.
Modified:
llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
llvm/trunk/test/CodeGen/X86/vec_extract-mmx.ll
Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=267651&r1=267650&r2=267651&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Tue Apr 26 20:35:25 2016
@@ -25224,16 +25224,9 @@ static SDValue combineExtractVectorElt(S
InputVector.getValueType() == MVT::v2i32) {
SDValue MMXSrc = InputVector.getNode()->getOperand(0);
- // The mmx is indirect: (i64 extract_elt (v1i64 bitcast (x86mmx ...))).
- if (MMXSrc.getOpcode() == ISD::EXTRACT_VECTOR_ELT && MMXSrc.hasOneUse() &&
- MMXSrc.getValueType() == MVT::i64) {
- SDValue MMXSrcOp = MMXSrc.getOperand(0);
- if (MMXSrcOp.hasOneUse() && MMXSrcOp.getOpcode() == ISD::BITCAST &&
- MMXSrcOp.getValueType() == MVT::v1i64 &&
- MMXSrcOp.getOperand(0).getValueType() == MVT::x86mmx)
- return DAG.getNode(X86ISD::MMX_MOVD2W, SDLoc(InputVector),
- N->getValueType(0), MMXSrcOp.getOperand(0));
- }
+ // The bitcast source is a direct mmx result.
+ if (MMXSrc.getValueType() == MVT::x86mmx)
+ return DAG.getNode(X86ISD::MMX_MOVD2W, dl, MVT::i32, MMXSrc);
}
EVT VT = N->getValueType(0);
Modified: llvm/trunk/test/CodeGen/X86/vec_extract-mmx.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/vec_extract-mmx.ll?rev=267651&r1=267650&r2=267651&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/vec_extract-mmx.ll (original)
+++ llvm/trunk/test/CodeGen/X86/vec_extract-mmx.ll Tue Apr 26 20:35:25 2016
@@ -125,5 +125,20 @@ entry:
ret i32 %7
}
+define i32 @test3(x86_mmx %a) nounwind {
+; X32-LABEL: test3:
+; X32: # BB#0:
+; X32-NEXT: movd %mm0, %eax
+; X32-NEXT: retl
+;
+; X64-LABEL: test3:
+; X64: # BB#0:
+; X64-NEXT: movd %mm0, %eax
+; X64-NEXT: retq
+ %tmp0 = bitcast x86_mmx %a to <2 x i32>
+ %tmp1 = extractelement <2 x i32> %tmp0, i32 0
+ ret i32 %tmp1
+}
+
declare x86_mmx @llvm.x86.sse.pshuf.w(x86_mmx, i8)
declare void @llvm.x86.mmx.emms()
More information about the llvm-commits
mailing list