[llvm-commits] [llvm] r131493 - in /llvm/trunk: lib/Transforms/InstCombine/InstCombineCalls.cpp lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp test/CodeGen/X86/2011-05-17-pmovzxwd.ll

Chris Lattner clattner at apple.com
Tue May 17 21:33:45 PDT 2011


On May 17, 2011, at 3:13 PM, Stuart Hastings wrote:

> Author: stuart
> Date: Tue May 17 17:13:31 2011
> New Revision: 131493
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=131493&view=rev
> Log:
> X86 pmovsx/pmovzx ignore the upper half of their inputs.
> rdar://problem/6945110

Hi Stuart,

> +  case Intrinsic::x86_sse41_pmovzxdq: {
> +    unsigned VWidth =
> +      cast<VectorType>(II->getArgOperand(0)->getType())->getNumElements();
> +    unsigned LowHalfElts = VWidth / 2;
> +    APInt InputDemandedElts(VWidth, 0);
> +    InputDemandedElts = InputDemandedElts.getBitsSet(VWidth, 0, LowHalfElts);

getBitsSet is a static method.  Please do this instead:

APInt InputDemandedElts(APInt::getBitsSet(VWidth, 0, LowHalfElts));

> +++ llvm/trunk/test/CodeGen/X86/2011-05-17-pmovzxwd.ll Tue May 17 17:13:31 2011
> @@ -0,0 +1,15 @@
> +; RUN: opt -instcombine -S < %s | FileCheck %s
> +; <rdar://problem/6945110>
> +
> +define <4 x i32> @kernel3_vertical(<4 x i16> * %src, <8 x i16> * %foo) nounwind {
> +entry:
> +	%tmp = load <4 x i16>* %src
> +	%tmp1 = load <8 x i16>* %foo
> +; CHECK: shufflevector
> +	%tmp2 = shufflevector <4 x i16> %tmp, <4 x i16> undef, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 undef, i32 undef, i32 undef, i32 undef>
> +; CHECK-NOT: shufflevector
> +	%tmp3 = shufflevector <8 x i16> %tmp1, <8 x i16> %tmp2, <8 x i32> <i32 8, i32 9, i32 10, i32 11, i32 4, i32 5, i32 6, i32 7>
> +	%0 = call <4 x i32> @llvm.x86.sse41.pmovzxwd(<8 x i16> %tmp3)
> +	ret <4 x i32> %0
> +}
> +declare <4 x i32> @llvm.x86.sse41.pmovzxwd(<8 x i16>) nounwind readnone

Please make the CHECK lines more specific so that it is more clear what you're doing here, add a comment explaining what is going on (to the test) and merge the test into an extant .ll file.  Thanks,

-Chris



More information about the llvm-commits mailing list