From 9dbe45c00061a38521b8921cfbc6aa7c48d93d73 Mon Sep 17 00:00:00 2001 From: Evan Cheng Date: Thu, 25 Sep 2008 23:35:16 +0000 Subject: [PATCH] Prefer movlhps over punpcklqdq, etc. in more cases. llvm-svn: 56627 --- llvm/lib/Target/X86/X86ISelLowering.cpp | 10 +++++----- llvm/test/CodeGen/X86/vec_set-9.ll | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp index fc97c4edd0bb..8b5104f7c70b 100644 --- a/llvm/lib/Target/X86/X86ISelLowering.cpp +++ b/llvm/lib/Target/X86/X86ISelLowering.cpp @@ -3942,17 +3942,17 @@ X86TargetLowering::LowerVECTOR_SHUFFLE(SDValue Op, SelectionDAG &DAG) { else if (isIdentityMask(PermMask.getNode(), true)) return V2; + // Canonicalize movddup shuffles. + if (V2IsUndef && Subtarget->hasSSE2() && + X86::isMOVDDUPMask(PermMask.getNode())) + return CanonicalizeMovddup(Op, V1, PermMask, DAG, Subtarget->hasSSE3()); + if (isSplatMask(PermMask.getNode())) { if (isMMX || NumElems < 4) return Op; // Promote it to a v4{if}32 splat. return PromoteSplat(Op, DAG, Subtarget->hasSSE2()); } - // Canonicalize movddup shuffles. - if (V2IsUndef && Subtarget->hasSSE2() && - X86::isMOVDDUPMask(PermMask.getNode())) - return CanonicalizeMovddup(Op, V1, PermMask, DAG, Subtarget->hasSSE3()); - // If the shuffle can be profitably rewritten as a narrower shuffle, then // do it! if (VT == MVT::v8i16 || VT == MVT::v16i8) { diff --git a/llvm/test/CodeGen/X86/vec_set-9.ll b/llvm/test/CodeGen/X86/vec_set-9.ll index 38f729fbc892..5c1b8f5dacb8 100644 --- a/llvm/test/CodeGen/X86/vec_set-9.ll +++ b/llvm/test/CodeGen/X86/vec_set-9.ll @@ -1,5 +1,5 @@ ; RUN: llvm-as < %s | llc -march=x86-64 | grep movd | count 1 -; RUN: llvm-as < %s | llc -march=x86-64 | grep {punpcklqdq.*%xmm0, %xmm0} +; RUN: llvm-as < %s | llc -march=x86-64 | grep {movlhps.*%xmm0, %xmm0} define <2 x i64> @test3(i64 %A) nounwind { entry: