[llvm] r329356 - X86 Tests: Add a case for combining sdiv by a splatted pow2 negative. NFC.

Zvi Rackover via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 5 14:57:20 PDT 2018


Author: zvi
Date: Thu Apr  5 14:57:20 2018
New Revision: 329356

URL: http://llvm.org/viewvc/llvm-project?rev=329356&view=rev
Log:
X86 Tests: Add a case for combining sdiv by a splatted pow2 negative. NFC.

Noticed test was missing while working on D42479.

Modified:
    llvm/trunk/test/CodeGen/X86/combine-sdiv.ll

Modified: llvm/trunk/test/CodeGen/X86/combine-sdiv.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/combine-sdiv.ll?rev=329356&r1=329355&r2=329356&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/combine-sdiv.ll (original)
+++ llvm/trunk/test/CodeGen/X86/combine-sdiv.ll Thu Apr  5 14:57:20 2018
@@ -202,6 +202,31 @@ define <4 x i32> @combine_vec_sdiv_by_po
   ret <4 x i32> %1
 }
 
+define <4 x i32> @combine_vec_sdiv_by_pow2a_neg(<4 x i32> %x) {
+; SSE-LABEL: combine_vec_sdiv_by_pow2a_neg:
+; SSE:       # %bb.0:
+; SSE-NEXT:    movdqa %xmm0, %xmm1
+; SSE-NEXT:    psrad $31, %xmm1
+; SSE-NEXT:    psrld $30, %xmm1
+; SSE-NEXT:    paddd %xmm0, %xmm1
+; SSE-NEXT:    psrad $2, %xmm1
+; SSE-NEXT:    pxor %xmm0, %xmm0
+; SSE-NEXT:    psubd %xmm1, %xmm0
+; SSE-NEXT:    retq
+;
+; AVX-LABEL: combine_vec_sdiv_by_pow2a_neg:
+; AVX:       # %bb.0:
+; AVX-NEXT:    vpsrad $31, %xmm0, %xmm1
+; AVX-NEXT:    vpsrld $30, %xmm1, %xmm1
+; AVX-NEXT:    vpaddd %xmm1, %xmm0, %xmm0
+; AVX-NEXT:    vpsrad $2, %xmm0, %xmm0
+; AVX-NEXT:    vpxor %xmm1, %xmm1, %xmm1
+; AVX-NEXT:    vpsubd %xmm0, %xmm1, %xmm0
+; AVX-NEXT:    retq
+  %1 = sdiv <4 x i32> %x, <i32 -4, i32 -4, i32 -4, i32 -4>
+  ret <4 x i32> %1
+}
+
 define <16 x i8> @combine_vec_sdiv_by_pow2b_v16i8(<16 x i8> %x) {
 ; SSE-LABEL: combine_vec_sdiv_by_pow2b_v16i8:
 ; SSE:       # %bb.0:




More information about the llvm-commits mailing list