[llvm] r357177 - [x86] add vector test for sext of negate; NFC
Sanjay Patel via llvm-commits
llvm-commits at lists.llvm.org
Thu Mar 28 08:30:10 PDT 2019
Author: spatel
Date: Thu Mar 28 08:30:09 2019
New Revision: 357177
URL: http://llvm.org/viewvc/llvm-project?rev=357177&view=rev
Log:
[x86] add vector test for sext of negate; NFC
Modified:
llvm/trunk/test/CodeGen/X86/vector-sext.ll
Modified: llvm/trunk/test/CodeGen/X86/vector-sext.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/vector-sext.ll?rev=357177&r1=357176&r2=357177&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/vector-sext.ll (original)
+++ llvm/trunk/test/CodeGen/X86/vector-sext.ll Thu Mar 28 08:30:09 2019
@@ -6335,3 +6335,89 @@ entry:
%e = sext <8 x i6> %d to <8 x i64>
ret <8 x i64> %e
}
+
+define <8 x i32> @zext_negate_sext(<8 x i8> %x) {
+; SSE2-LABEL: zext_negate_sext:
+; SSE2: # %bb.0:
+; SSE2-NEXT: pand {{.*}}(%rip), %xmm0
+; SSE2-NEXT: pxor %xmm1, %xmm1
+; SSE2-NEXT: psubw %xmm0, %xmm1
+; SSE2-NEXT: punpcklwd {{.*#+}} xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1],xmm0[2],xmm1[2],xmm0[3],xmm1[3]
+; SSE2-NEXT: psrad $16, %xmm0
+; SSE2-NEXT: punpckhwd {{.*#+}} xmm1 = xmm1[4,4,5,5,6,6,7,7]
+; SSE2-NEXT: psrad $16, %xmm1
+; SSE2-NEXT: retq
+;
+; SSSE3-LABEL: zext_negate_sext:
+; SSSE3: # %bb.0:
+; SSSE3-NEXT: pand {{.*}}(%rip), %xmm0
+; SSSE3-NEXT: pxor %xmm1, %xmm1
+; SSSE3-NEXT: psubw %xmm0, %xmm1
+; SSSE3-NEXT: punpcklwd {{.*#+}} xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1],xmm0[2],xmm1[2],xmm0[3],xmm1[3]
+; SSSE3-NEXT: psrad $16, %xmm0
+; SSSE3-NEXT: punpckhwd {{.*#+}} xmm1 = xmm1[4,4,5,5,6,6,7,7]
+; SSSE3-NEXT: psrad $16, %xmm1
+; SSSE3-NEXT: retq
+;
+; SSE41-LABEL: zext_negate_sext:
+; SSE41: # %bb.0:
+; SSE41-NEXT: pand {{.*}}(%rip), %xmm0
+; SSE41-NEXT: pxor %xmm1, %xmm1
+; SSE41-NEXT: psubw %xmm0, %xmm1
+; SSE41-NEXT: pmovsxwd %xmm1, %xmm0
+; SSE41-NEXT: pshufd {{.*#+}} xmm1 = xmm1[2,3,0,1]
+; SSE41-NEXT: pmovsxwd %xmm1, %xmm1
+; SSE41-NEXT: retq
+;
+; AVX1-LABEL: zext_negate_sext:
+; AVX1: # %bb.0:
+; AVX1-NEXT: vpand {{.*}}(%rip), %xmm0, %xmm0
+; AVX1-NEXT: vpxor %xmm1, %xmm1, %xmm1
+; AVX1-NEXT: vpsubw %xmm0, %xmm1, %xmm0
+; AVX1-NEXT: vpmovsxwd %xmm0, %xmm1
+; AVX1-NEXT: vpshufd {{.*#+}} xmm0 = xmm0[2,3,0,1]
+; AVX1-NEXT: vpmovsxwd %xmm0, %xmm0
+; AVX1-NEXT: vinsertf128 $1, %xmm0, %ymm1, %ymm0
+; AVX1-NEXT: retq
+;
+; AVX2-LABEL: zext_negate_sext:
+; AVX2: # %bb.0:
+; AVX2-NEXT: vpand {{.*}}(%rip), %xmm0, %xmm0
+; AVX2-NEXT: vpxor %xmm1, %xmm1, %xmm1
+; AVX2-NEXT: vpsubw %xmm0, %xmm1, %xmm0
+; AVX2-NEXT: vpmovsxwd %xmm0, %ymm0
+; AVX2-NEXT: retq
+;
+; AVX512-LABEL: zext_negate_sext:
+; AVX512: # %bb.0:
+; AVX512-NEXT: vpand {{.*}}(%rip), %xmm0, %xmm0
+; AVX512-NEXT: vpxor %xmm1, %xmm1, %xmm1
+; AVX512-NEXT: vpsubw %xmm0, %xmm1, %xmm0
+; AVX512-NEXT: vpmovsxwd %xmm0, %ymm0
+; AVX512-NEXT: retq
+;
+; X32-SSE2-LABEL: zext_negate_sext:
+; X32-SSE2: # %bb.0:
+; X32-SSE2-NEXT: pand {{\.LCPI.*}}, %xmm0
+; X32-SSE2-NEXT: pxor %xmm1, %xmm1
+; X32-SSE2-NEXT: psubw %xmm0, %xmm1
+; X32-SSE2-NEXT: punpcklwd {{.*#+}} xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1],xmm0[2],xmm1[2],xmm0[3],xmm1[3]
+; X32-SSE2-NEXT: psrad $16, %xmm0
+; X32-SSE2-NEXT: punpckhwd {{.*#+}} xmm1 = xmm1[4,4,5,5,6,6,7,7]
+; X32-SSE2-NEXT: psrad $16, %xmm1
+; X32-SSE2-NEXT: retl
+;
+; X32-SSE41-LABEL: zext_negate_sext:
+; X32-SSE41: # %bb.0:
+; X32-SSE41-NEXT: pand {{\.LCPI.*}}, %xmm0
+; X32-SSE41-NEXT: pxor %xmm1, %xmm1
+; X32-SSE41-NEXT: psubw %xmm0, %xmm1
+; X32-SSE41-NEXT: pmovsxwd %xmm1, %xmm0
+; X32-SSE41-NEXT: pshufd {{.*#+}} xmm1 = xmm1[2,3,0,1]
+; X32-SSE41-NEXT: pmovsxwd %xmm1, %xmm1
+; X32-SSE41-NEXT: retl
+ %z = zext <8 x i8> %x to <8 x i16>
+ %neg = sub nsw <8 x i16> zeroinitializer, %z
+ %r = sext <8 x i16> %neg to <8 x i32>
+ ret <8 x i32> %r
+}
More information about the llvm-commits
mailing list