generalize the previous check to handle -1 on either side of the
authorChris Lattner <sabre@nondot.org>
Sun, 5 Dec 2010 02:00:51 +0000 (02:00 +0000)
committerChris Lattner <sabre@nondot.org>
Sun, 5 Dec 2010 02:00:51 +0000 (02:00 +0000)
commit96908b17ae7df4c838853a41df9a4c034b435446
treedcd1cafb1d787a430ba7f4c0b5f61b2eb5ac6889
parentc8c20d14867ea7c5502df88bb0acd8c84526c42f
generalize the previous check to handle -1 on either side of the
select, inserting a not to compensate.  Add a missing isZero check
that I lost somehow.

This improves codegen of:

void *func(long count) {
      return new int[count];
}

from:

__Z4funcl:                              ## @_Z4funcl
movl $4, %ecx                ## encoding: [0xb9,0x04,0x00,0x00,0x00]
movq %rdi, %rax              ## encoding: [0x48,0x89,0xf8]
mulq %rcx                    ## encoding: [0x48,0xf7,0xe1]
testq %rdx, %rdx              ## encoding: [0x48,0x85,0xd2]
movq $-1, %rdi               ## encoding: [0x48,0xc7,0xc7,0xff,0xff,0xff,0xff]
cmoveq %rax, %rdi              ## encoding: [0x48,0x0f,0x44,0xf8]
jmp __Znam                  ## TAILCALL
                                        ## encoding: [0xeb,A]

to:

__Z4funcl:                              ## @_Z4funcl
movl $4, %ecx                ## encoding: [0xb9,0x04,0x00,0x00,0x00]
movq %rdi, %rax              ## encoding: [0x48,0x89,0xf8]
mulq %rcx                    ## encoding: [0x48,0xf7,0xe1]
cmpq $1, %rdx                ## encoding: [0x48,0x83,0xfa,0x01]
sbbq %rdi, %rdi              ## encoding: [0x48,0x19,0xff]
notq %rdi                    ## encoding: [0x48,0xf7,0xd7]
orq %rax, %rdi              ## encoding: [0x48,0x09,0xc7]
jmp __Znam                  ## TAILCALL
                                        ## encoding: [0xeb,A]

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120932 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Target/X86/X86ISelLowering.cpp
test/CodeGen/X86/select.ll