[llvm] r306976 - [X86][SSE] Add test showing missed opportunity to combine to pshuflw

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Sun Jul 2 05:56:10 PDT 2017


Author: rksimon
Date: Sun Jul  2 05:56:10 2017
New Revision: 306976

URL: http://llvm.org/viewvc/llvm-project?rev=306976&view=rev
Log:
[X86][SSE] Add test showing missed opportunity to combine to pshuflw

We are combining shuffles to bit shifts before unary permutes, which means we can't fold loads plus the destination register is destructive

Modified:
    llvm/trunk/test/CodeGen/X86/vector-shuffle-combining-ssse3.ll

Modified: llvm/trunk/test/CodeGen/X86/vector-shuffle-combining-ssse3.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/vector-shuffle-combining-ssse3.ll?rev=306976&r1=306975&r2=306976&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/vector-shuffle-combining-ssse3.ll (original)
+++ llvm/trunk/test/CodeGen/X86/vector-shuffle-combining-ssse3.ll Sun Jul  2 05:56:10 2017
@@ -445,6 +445,24 @@ define <16 x i8> @combine_pshufb_not_as_
   ret <16 x i8> %res1
 }
 
+; TODO - we could fold the load if we lowered to pshuflw instead.
+define <16 x i8> @combine_vpshufb_as_pshuflw_not_pslld(<16 x i8> *%a0) {
+; SSE-LABEL: combine_vpshufb_as_pshuflw_not_pslld:
+; SSE:       # BB#0:
+; SSE-NEXT:    movdqa (%rdi), %xmm0
+; SSE-NEXT:    pslld $16, %xmm0
+; SSE-NEXT:    retq
+;
+; AVX-LABEL: combine_vpshufb_as_pshuflw_not_pslld:
+; AVX:       # BB#0:
+; AVX-NEXT:    vmovdqa (%rdi), %xmm0
+; AVX-NEXT:    vpslld $16, %xmm0, %xmm0
+; AVX-NEXT:    retq
+  %res0 = load <16 x i8>, <16 x i8> *%a0, align 16
+  %res1 = call <16 x i8> @llvm.x86.ssse3.pshuf.b.128(<16 x i8> %res0, <16 x i8> <i8 undef, i8 undef, i8 0, i8 1, i8 undef, i8 undef, i8 4, i8 5, i8 undef, i8 undef, i8 undef, i8 undef, i8 undef, i8 undef, i8 undef, i8 undef>)
+  ret <16 x i8> %res1
+}
+
 define <16 x i8> @combine_pshufb_as_unary_unpcklbw(<16 x i8> %a0) {
 ; SSE-LABEL: combine_pshufb_as_unary_unpcklbw:
 ; SSE:       # BB#0:




More information about the llvm-commits mailing list