<div dir="ltr">Yes, of course. Thanks for pointing that out and thanks for fixing the semantics.<div>







<p class="">Committed r209947.</p><p class=""><br></p><p class="">Filipe</p></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, May 29, 2014 at 5:33 PM, Quentin Colombet <span dir="ltr"><<a href="mailto:qcolombet@apple.com" target="_blank">qcolombet@apple.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Filipe,<br>
<br>
Could you check the actual arguments of the blend instruction in your test case?<br>
I want to make sure we are doing the right lowering.<br>
<br>
See r209324 for an example.<br>
<br>
Thanks,<br>
-Quentin<br>
<div class="HOEnZb"><div class="h5"><br>
On May 29, 2014, at 3:04 PM, Filipe Cabecinhas <<a href="mailto:me@filcab.net">me@filcab.net</a>> wrote:<br>
<br>
> Author: filcab<br>
> Date: Thu May 29 17:04:42 2014<br>
> New Revision: 209853<br>
><br>
> URL: <a href="http://llvm.org/viewvc/llvm-project?rev=209853&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=209853&view=rev</a><br>
> Log:<br>
> Added tests for shufflevector lowering to blend instrs.<br>
><br>
> These tests ensure that a change I will propose in clang works as<br>
> expected.<br>
><br>
> Summary:<br>
> Added tests for the generation of blend+immediate instructions from a<br>
> shufflevector.<br>
> These tests were proposed along with a patch that was dropped. I'm<br>
> committing the tests anyway to protect against possible regressions in<br>
> codegen.<br>
><br>
> Reviewers: nadav, bkramer<br>
><br>
> Subscribers: llvm-commits<br>
><br>
> Differential Revision: <a href="http://reviews.llvm.org/D3600" target="_blank">http://reviews.llvm.org/D3600</a><br>
><br>
> Modified:<br>
>    llvm/trunk/test/CodeGen/X86/avx-blend.ll<br>
>    llvm/trunk/test/CodeGen/X86/avx2-shuffle.ll<br>
>    llvm/trunk/test/CodeGen/X86/sse41-blend.ll<br>
><br>
> Modified: llvm/trunk/test/CodeGen/X86/avx-blend.ll<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/avx-blend.ll?rev=209853&r1=209852&r2=209853&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/avx-blend.ll?rev=209853&r1=209852&r2=209853&view=diff</a><br>

> ==============================================================================<br>
> --- llvm/trunk/test/CodeGen/X86/avx-blend.ll (original)<br>
> +++ llvm/trunk/test/CodeGen/X86/avx-blend.ll Thu May 29 17:04:42 2014<br>
> @@ -158,3 +158,36 @@ define <8 x float> @constant_blendvps_av<br>
><br>
> declare <8 x float> @llvm.x86.avx.blendv.ps.256(<8 x float>, <8 x float>, <8 x float>)<br>
> declare <4 x double> @llvm.x86.avx.blendv.pd.256(<4 x double>, <4 x double>, <4 x double>)<br>
> +<br>
> +;; 4 tests for shufflevectors that optimize to blend + immediate<br>
> +; CHECK-LABEL: @blend_shufflevector_4xfloat<br>
> +define <4 x float> @blend_shufflevector_4xfloat(<4 x float> %a, <4 x float> %b) {<br>
> +; CHECK: vblendps<br>
> +; CHECK: ret<br>
> +  %1 = shufflevector <4 x float> %a, <4 x float> %b, <4 x i32> <i32 0, i32 5, i32 2, i32 7><br>
> +  ret <4 x float> %1<br>
> +}<br>
> +<br>
> +; CHECK-LABEL: @blend_shufflevector_8xfloat<br>
> +define <8 x float> @blend_shufflevector_8xfloat(<8 x float> %a, <8 x float> %b) {<br>
> +; CHECK: vblendps<br>
> +; CHECK: ret<br>
> +  %1 = shufflevector <8 x float> %a, <8 x float> %b, <8 x i32> <i32 0, i32 9, i32 10, i32 11, i32 12, i32 13, i32 6, i32 15><br>
> +  ret <8 x float> %1<br>
> +}<br>
> +<br>
> +; CHECK-LABEL: @blend_shufflevector_4xdouble<br>
> +define <4 x double> @blend_shufflevector_4xdouble(<4 x double> %a, <4 x double> %b) {<br>
> +; CHECK: vblendpd<br>
> +; CHECK: ret<br>
> +  %1 = shufflevector <4 x double> %a, <4 x double> %b, <4 x i32> <i32 0, i32 5, i32 2, i32 3><br>
> +  ret <4 x double> %1<br>
> +}<br>
> +<br>
> +; CHECK-LABEL: @blend_shufflevector_4xi64<br>
> +define <4 x i64> @blend_shufflevector_4xi64(<4 x i64> %a, <4 x i64> %b) {<br>
> +; CHECK: vblendpd<br>
> +; CHECK: ret<br>
> +  %1 = shufflevector <4 x i64> %a, <4 x i64> %b, <4 x i32> <i32 4, i32 1, i32 6, i32 7><br>
> +  ret <4 x i64> %1<br>
> +}<br>
><br>
> Modified: llvm/trunk/test/CodeGen/X86/avx2-shuffle.ll<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/avx2-shuffle.ll?rev=209853&r1=209852&r2=209853&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/avx2-shuffle.ll?rev=209853&r1=209852&r2=209853&view=diff</a><br>

> ==============================================================================<br>
> --- llvm/trunk/test/CodeGen/X86/avx2-shuffle.ll (original)<br>
> +++ llvm/trunk/test/CodeGen/X86/avx2-shuffle.ll Thu May 29 17:04:42 2014<br>
> @@ -60,6 +60,24 @@ define <4 x i64> @blend_test4(<4 x i64><br>
>   ret <4 x i64> %t<br>
> }<br>
><br>
> +;; 2 tests for shufflevectors that optimize to blend + immediate<br>
> +; CHECK-LABEL: @blend_test5<br>
> +; CHECK: vpblendd<br>
> +; CHECK: ret<br>
> +define <4 x i32> @blend_test5(<4 x i32> %a, <4 x i32> %b) {<br>
> +  %1 = shufflevector <4 x i32> %a, <4 x i32> %b, <4 x i32> <i32 0, i32 5, i32 2, i32 7><br>
> +  ret <4 x i32> %1<br>
> +}<br>
> +<br>
> +; CHECK-LABEL: @blend_test6<br>
> +; CHECK: vpblendw<br>
> +; CHECK: ret<br>
> +define <16 x i16> @blend_test6(<16 x i16> %a, <16 x i16> %b) {<br>
> +  %1 = shufflevector <16 x i16> %a, <16 x i16> %b, <16 x i32> <i32 0, i32 17, i32 18, i32  3, i32  4, i32  5, i32  6, i32 23,<br>
> +                                                               i32 8, i32 25, i32 26, i32 11, i32 12, i32 13, i32 14, i32 31><br>
> +  ret <16 x i16> %1<br>
> +}<br>
> +<br>
> ; CHECK: vpshufhw $27, %ymm<br>
> define <16 x i16> @vpshufhw(<16 x i16> %src1) nounwind uwtable readnone ssp {<br>
> entry:<br>
><br>
> Modified: llvm/trunk/test/CodeGen/X86/sse41-blend.ll<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/sse41-blend.ll?rev=209853&r1=209852&r2=209853&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/sse41-blend.ll?rev=209853&r1=209852&r2=209853&view=diff</a><br>

> ==============================================================================<br>
> --- llvm/trunk/test/CodeGen/X86/sse41-blend.ll (original)<br>
> +++ llvm/trunk/test/CodeGen/X86/sse41-blend.ll Thu May 29 17:04:42 2014<br>
> @@ -117,6 +117,24 @@ define <16 x i8> @constant_pblendvb(<16<br>
>   %1 = select <16 x i1> <i1 false, i1 false, i1 true, i1 false, i1 true, i1 true, i1 true, i1 false, i1 false, i1 false, i1 true, i1 false, i1 true, i1 true, i1 true, i1 false>, <16 x i8> %xyzw, <16 x i8> %abcd<br>

>   ret <16 x i8> %1<br>
> }<br>
> +<br>
> declare <16 x i8> @llvm.x86.sse41.pblendvb(<16 x i8>, <16 x i8>, <16 x i8>)<br>
> declare <4 x float> @llvm.x86.sse41.blendvps(<4 x float>, <4 x float>, <4 x float>)<br>
> declare <2 x double> @llvm.x86.sse41.blendvpd(<2 x double>, <2 x double>, <2 x double>)<br>
> +<br>
> +;; 2 tests for shufflevectors that optimize to blend + immediate<br>
> +; CHECK-LABEL: @blend_shufflevector_4xfloat<br>
> +; CHECK: blendps<br>
> +; CHECK: ret<br>
> +define <4 x float> @blend_shufflevector_4xfloat(<4 x float> %a, <4 x float> %b) {<br>
> +  %1 = shufflevector <4 x float> %a, <4 x float> %b, <4 x i32> <i32 0, i32 5, i32 6, i32 3><br>
> +  ret <4 x float> %1<br>
> +}<br>
> +<br>
> +; CHECK-LABEL: @blend_shufflevector_8xi16<br>
> +; CHECK: pblendw<br>
> +; CHECK: ret<br>
> +define <8 x i16> @blend_shufflevector_8xi16(<8 x i16> %a, <8 x i16> %b) {<br>
> +  %1 = shufflevector <8 x i16> %a, <8 x i16> %b, <8 x i32> <i32 0, i32 9, i32 10, i32 3, i32 4, i32 5, i32 6, i32 15><br>
> +  ret <8 x i16> %1<br>
> +}<br>
><br>
><br>
> _______________________________________________<br>
> llvm-commits mailing list<br>
> <a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>
> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
</div></div></blockquote></div><br></div>