[llvm] r342592 - [x86] add test for add+not vector fold; NFC

Sanjay Patel via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 19 14:28:39 PDT 2018


Author: spatel
Date: Wed Sep 19 14:28:39 2018
New Revision: 342592

URL: http://llvm.org/viewvc/llvm-project?rev=342592&view=rev
Log:
[x86] add test for add+not vector fold; NFC
  
The fold uses 'isBitwiseNot()', but that's not vector-friendly currently.

Modified:
    llvm/trunk/test/CodeGen/X86/add.ll

Modified: llvm/trunk/test/CodeGen/X86/add.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/add.ll?rev=342592&r1=342591&r2=342592&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/add.ll (original)
+++ llvm/trunk/test/CodeGen/X86/add.ll Wed Sep 19 14:28:39 2018
@@ -406,6 +406,47 @@ define i32 @inc_not(i32 %a) {
   ret i32 %r
 }
 
+define <4 x i32> @inc_not_vec(<4 x i32> %a) nounwind {
+; X32-LABEL: inc_not_vec:
+; X32:       # %bb.0:
+; X32-NEXT:    pushl %edi
+; X32-NEXT:    pushl %esi
+; X32-NEXT:    movl {{[0-9]+}}(%esp), %eax
+; X32-NEXT:    xorl %ecx, %ecx
+; X32-NEXT:    xorl %edx, %edx
+; X32-NEXT:    subl {{[0-9]+}}(%esp), %edx
+; X32-NEXT:    xorl %esi, %esi
+; X32-NEXT:    subl {{[0-9]+}}(%esp), %esi
+; X32-NEXT:    xorl %edi, %edi
+; X32-NEXT:    subl {{[0-9]+}}(%esp), %edi
+; X32-NEXT:    subl {{[0-9]+}}(%esp), %ecx
+; X32-NEXT:    movl %ecx, 12(%eax)
+; X32-NEXT:    movl %edi, 8(%eax)
+; X32-NEXT:    movl %esi, 4(%eax)
+; X32-NEXT:    movl %edx, (%eax)
+; X32-NEXT:    popl %esi
+; X32-NEXT:    popl %edi
+; X32-NEXT:    retl $4
+;
+; X64-LINUX-LABEL: inc_not_vec:
+; X64-LINUX:       # %bb.0:
+; X64-LINUX-NEXT:    pcmpeqd %xmm1, %xmm1
+; X64-LINUX-NEXT:    pxor %xmm1, %xmm0
+; X64-LINUX-NEXT:    psubd %xmm1, %xmm0
+; X64-LINUX-NEXT:    retq
+;
+; X64-WIN32-LABEL: inc_not_vec:
+; X64-WIN32:       # %bb.0:
+; X64-WIN32-NEXT:    pcmpeqd %xmm1, %xmm1
+; X64-WIN32-NEXT:    movdqa (%rcx), %xmm0
+; X64-WIN32-NEXT:    pxor %xmm1, %xmm0
+; X64-WIN32-NEXT:    psubd %xmm1, %xmm0
+; X64-WIN32-NEXT:    retq
+  %nota = xor <4 x i32> %a, <i32 -1, i32 -1, i32 -1, i32 -1>
+  %r = add <4 x i32> %nota, <i32 1, i32 1, i32 1, i32 1>
+  ret <4 x i32> %r
+}
+
 define void @uaddo1_not(i32 %a, i32* %p0, i1* %p1) {
 ; X32-LABEL: uaddo1_not:
 ; X32:       # %bb.0:




More information about the llvm-commits mailing list