<div dir="ltr">Nice!</div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Nov 11, 2014 at 3:20 AM, Andrea Di Biagio <span dir="ltr"><<a href="mailto:Andrea_DiBiagio@sn.scee.net" target="_blank">Andrea_DiBiagio@sn.scee.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: adibiagio<br>
Date: Tue Nov 11 05:20:31 2014<br>
New Revision: 221684<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=221684&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=221684&view=rev</a><br>
Log:<br>
[X86] Add missing check for 'isINSERTPSMask' in method 'isShuffleMaskLegal'.<br>
<br>
This helps the DAGCombiner to identify more opportunities to fold shuffles.<br>
<br>
Modified:<br>
llvm/trunk/lib/Target/X86/X86ISelLowering.cpp<br>
llvm/trunk/test/CodeGen/X86/vector-shuffle-combining.ll<br>
<br>
Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=221684&r1=221683&r2=221684&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=221684&r1=221683&r2=221684&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original)<br>
+++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Tue Nov 11 05:20:31 2014<br>
@@ -19482,7 +19482,8 @@ X86TargetLowering::isShuffleMaskLegal(co<br>
isUNPCKHMask(M, SVT, Subtarget->hasInt256()) ||<br>
isUNPCKL_v_undef_Mask(M, SVT, Subtarget->hasInt256()) ||<br>
isUNPCKH_v_undef_Mask(M, SVT, Subtarget->hasInt256()) ||<br>
- isBlendMask(M, SVT, Subtarget->hasSSE41(), Subtarget->hasInt256()));<br>
+ isBlendMask(M, SVT, Subtarget->hasSSE41(), Subtarget->hasInt256()) ||<br>
+ (Subtarget->hasSSE41() && isINSERTPSMask(M, SVT)));<br>
}<br>
<br>
bool<br>
<br>
Modified: llvm/trunk/test/CodeGen/X86/vector-shuffle-combining.ll<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/vector-shuffle-combining.ll?rev=221684&r1=221683&r2=221684&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/vector-shuffle-combining.ll?rev=221684&r1=221683&r2=221684&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/test/CodeGen/X86/vector-shuffle-combining.ll (original)<br>
+++ llvm/trunk/test/CodeGen/X86/vector-shuffle-combining.ll Tue Nov 11 05:20:31 2014<br>
@@ -1621,17 +1621,13 @@ define <4 x float> @combine_test1b(<4 x<br>
;<br>
; SSE41-LABEL: combine_test1b:<br>
; SSE41: # BB#0:<br>
-; SSE41-NEXT: blendps {{.*#+}} xmm0 = xmm1[0],xmm0[1],xmm1[2],xmm0[3]<br>
-; SSE41-NEXT: shufps {{.*#+}} xmm1 = xmm1[1,0],xmm0[0,0]<br>
-; SSE41-NEXT: shufps {{.*#+}} xmm1 = xmm1[2,0],xmm0[2,0]<br>
+; SSE41-NEXT: shufps {{.*#+}} xmm1 = xmm1[0,1,2,0]<br>
; SSE41-NEXT: movaps %xmm1, %xmm0<br>
; SSE41-NEXT: retq<br>
;<br>
; AVX-LABEL: combine_test1b:<br>
; AVX: # BB#0:<br>
-; AVX-NEXT: vblendps {{.*#+}} xmm0 = xmm1[0],xmm0[1],xmm1[2],xmm0[3]<br>
-; AVX-NEXT: vshufps {{.*#+}} xmm1 = xmm1[1,0],xmm0[0,0]<br>
-; AVX-NEXT: vshufps {{.*#+}} xmm0 = xmm1[2,0],xmm0[2,0]<br>
+; AVX-NEXT: vpermilps {{.*#+}} xmm0 = xmm1[0,1,2,0]<br>
; AVX-NEXT: retq<br>
%1 = shufflevector <4 x float> %a, <4 x float> %b, <4 x i32> <i32 4, i32 1, i32 6, i32 3><br>
%2 = shufflevector <4 x float> %1, <4 x float> %b, <4 x i32> <i32 0, i32 5, i32 2, i32 0><br>
@@ -1722,17 +1718,13 @@ define <4 x float> @combine_test4b(<4 x<br>
;<br>
; SSE41-LABEL: combine_test4b:<br>
; SSE41: # BB#0:<br>
-; SSE41-NEXT: blendps {{.*#+}} xmm0 = xmm1[0],xmm0[1],xmm1[2],xmm0[3]<br>
-; SSE41-NEXT: shufps {{.*#+}} xmm0 = xmm0[2,0],xmm1[3,0]<br>
-; SSE41-NEXT: shufps {{.*#+}} xmm1 = xmm1[1,1],xmm0[0,2]<br>
+; SSE41-NEXT: shufps {{.*#+}} xmm1 = xmm1[1,1,2,3]<br>
; SSE41-NEXT: movaps %xmm1, %xmm0<br>
; SSE41-NEXT: retq<br>
;<br>
; AVX-LABEL: combine_test4b:<br>
; AVX: # BB#0:<br>
-; AVX-NEXT: vblendps {{.*#+}} xmm0 = xmm1[0],xmm0[1],xmm1[2],xmm0[3]<br>
-; AVX-NEXT: vshufps {{.*#+}} xmm0 = xmm0[2,0],xmm1[3,0]<br>
-; AVX-NEXT: vshufps {{.*#+}} xmm0 = xmm1[1,1],xmm0[0,2]<br>
+; AVX-NEXT: vpermilps {{.*#+}} xmm0 = xmm1[1,1,2,3]<br>
; AVX-NEXT: retq<br>
%1 = shufflevector <4 x float> %a, <4 x float> %b, <4 x i32> <i32 4, i32 1, i32 6, i32 3><br>
%2 = shufflevector <4 x float> %1, <4 x float> %b, <4 x i32> <i32 5, i32 5, i32 2, i32 7><br>
@@ -2565,3 +2557,63 @@ define <8 x i32> @combine_unneeded_subve<br>
%d = shufflevector <8 x i32> %b, <8 x i32> %c, <8 x i32> <i32 7, i32 6, i32 5, i32 4, i32 15, i32 14, i32 13, i32 12><br>
ret <8 x i32> %d<br>
}<br>
+<br>
+define <4 x float> @combine_insertps1(<4 x float> %a, <4 x float> %b) {<br>
+; SSE41-LABEL: combine_insertps1:<br>
+; SSE41: # BB#0:<br>
+; SSE41-NEXT: insertps {{.*#+}} xmm0 = xmm1[2],xmm0[1,2,3]<br>
+; SSE41-NEXT: retq<br>
+<br>
+; AVX-LABEL: combine_insertps1:<br>
+; AVX: # BB#0:<br>
+; AVX-NEXT: vinsertps {{.*#+}} xmm0 = xmm1[2],xmm0[1,2,3]<br>
+; AVX-NEXT: retq<br>
+ %c = shufflevector <4 x float> %a, <4 x float> %b, <4 x i32><i32 0, i32 6, i32 2, i32 4><br>
+ %d = shufflevector <4 x float> %a, <4 x float> %c, <4 x i32> <i32 5, i32 1, i32 6, i32 3><br>
+ ret <4 x float> %d<br>
+}<br>
+<br>
+define <4 x float> @combine_insertps2(<4 x float> %a, <4 x float> %b) {<br>
+; SSE41-LABEL: combine_insertps2:<br>
+; SSE41: # BB#0:<br>
+; SSE41-NEXT: insertps {{.*#+}} xmm0 = xmm0[0],xmm1[2],xmm0[2,3]<br>
+; SSE41-NEXT: retq<br>
+<br>
+; AVX-LABEL: combine_insertps2:<br>
+; AVX: # BB#0:<br>
+; AVX-NEXT: vinsertps {{.*#+}} xmm0 = xmm0[0],xmm1[2],xmm0[2,3]<br>
+; AVX-NEXT: retq<br>
+ %c = shufflevector <4 x float> %a, <4 x float> %b, <4 x i32><i32 0, i32 1, i32 6, i32 7><br>
+ %d = shufflevector <4 x float> %a, <4 x float> %c, <4 x i32> <i32 4, i32 6, i32 2, i32 3><br>
+ ret <4 x float> %d<br>
+}<br>
+<br>
+define <4 x float> @combine_insertps3(<4 x float> %a, <4 x float> %b) {<br>
+; SSE41-LABEL: combine_insertps3:<br>
+; SSE41: # BB#0:<br>
+; SSE41-NEXT: insertps {{.*#+}} xmm0 = xmm0[0,1],xmm1[0],xmm0[3]<br>
+; SSE41-NEXT: retq<br>
+<br>
+; AVX-LABEL: combine_insertps3:<br>
+; AVX: # BB#0:<br>
+; AVX-NEXT: vinsertps {{.*#+}} xmm0 = xmm0[0,1],xmm1[0],xmm0[3]<br>
+; AVX-NEXT: retq<br>
+ %c = shufflevector <4 x float> %a, <4 x float> %b, <4 x i32><i32 0, i32 4, i32 2, i32 5><br>
+ %d = shufflevector <4 x float> %a, <4 x float> %c, <4 x i32><i32 4, i32 1, i32 5, i32 3><br>
+ ret <4 x float> %d<br>
+}<br>
+<br>
+define <4 x float> @combine_insertps4(<4 x float> %a, <4 x float> %b) {<br>
+; SSE41-LABEL: combine_insertps4:<br>
+; SSE41: # BB#0:<br>
+; SSE41-NEXT: insertps {{.*#+}} xmm0 = xmm0[0,1,2],xmm1[0]<br>
+; SSE41-NEXT: retq<br>
+<br>
+; AVX-LABEL: combine_insertps4:<br>
+; AVX: # BB#0:<br>
+; AVX-NEXT: vinsertps {{.*#+}} xmm0 = xmm0[0,1,2],xmm1[0]<br>
+; AVX-NEXT: retq<br>
+ %c = shufflevector <4 x float> %a, <4 x float> %b, <4 x i32><i32 0, i32 4, i32 2, i32 5><br>
+ %d = shufflevector <4 x float> %a, <4 x float> %c, <4 x i32><i32 4, i32 1, i32 6, i32 5><br>
+ ret <4 x float> %d<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>
</blockquote></div><br></div>