From: Simon Pilgrim Date: Tue, 14 Feb 2017 11:20:11 +0000 (+0000) Subject: [X86][SSE] Test case showing missed PSHUFB target shuffle constant fold opportunity. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=10283cd1fa7c81b70d0b3a16d61bf757901ec9b2;p=llvm [X86][SSE] Test case showing missed PSHUFB target shuffle constant fold opportunity. It also shows an unnecessary pshufb/broadcast being used - the original pshufb mask only requested the lowest byte. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@295046 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/test/CodeGen/X86/vector-shuffle-combining-ssse3.ll b/test/CodeGen/X86/vector-shuffle-combining-ssse3.ll index 792496e83f0..7b73bda48ce 100644 --- a/test/CodeGen/X86/vector-shuffle-combining-ssse3.ll +++ b/test/CodeGen/X86/vector-shuffle-combining-ssse3.ll @@ -586,3 +586,38 @@ define <16 x i8> @constant_fold_pshufb() { %1 = tail call <16 x i8> @llvm.x86.ssse3.pshuf.b.128(<16 x i8> , <16 x i8> ) ret <16 x i8> %1 } + +; FIXME - unnecessary pshufb/broadcast being used - pshufb mask only needs lowest byte. +define <16 x i8> @constant_fold_pshufb_2() { +; SSE-LABEL: constant_fold_pshufb_2: +; SSE: # BB#0: +; SSE-NEXT: movl $2, %eax +; SSE-NEXT: movd %eax, %xmm0 +; SSE-NEXT: pxor %xmm1, %xmm1 +; SSE-NEXT: pshufb %xmm1, %xmm0 +; SSE-NEXT: retq +; +; AVX1-LABEL: constant_fold_pshufb_2: +; AVX1: # BB#0: +; AVX1-NEXT: movl $2, %eax +; AVX1-NEXT: vmovd %eax, %xmm0 +; AVX1-NEXT: vpxor %xmm1, %xmm1, %xmm1 +; AVX1-NEXT: vpshufb %xmm1, %xmm0, %xmm0 +; AVX1-NEXT: retq +; +; AVX2-LABEL: constant_fold_pshufb_2: +; AVX2: # BB#0: +; AVX2-NEXT: movl $2, %eax +; AVX2-NEXT: vmovd %eax, %xmm0 +; AVX2-NEXT: vpbroadcastb %xmm0, %xmm0 +; AVX2-NEXT: retq +; +; AVX512F-LABEL: constant_fold_pshufb_2: +; AVX512F: # BB#0: +; AVX512F-NEXT: movl $2, %eax +; AVX512F-NEXT: vmovd %eax, %xmm0 +; AVX512F-NEXT: vpbroadcastb %xmm0, %xmm0 +; AVX512F-NEXT: retq + %1 = tail call <16 x i8> @llvm.x86.ssse3.pshuf.b.128(<16 x i8> , <16 x i8> ) + ret <16 x i8> %1 +}