Implement negation of longs efficiently. For this testcase:
authorChris Lattner <sabre@nondot.org>
Tue, 6 Apr 2004 01:48:06 +0000 (01:48 +0000)
committerChris Lattner <sabre@nondot.org>
Tue, 6 Apr 2004 01:48:06 +0000 (01:48 +0000)
commitedd5e4957a46237461b4c7901230efd6b7bc4881
treea1e077b1e910403dae586469ac1f9f71d3983b18
parent502e36c3c95c6bf65094ae6a6ca52d7ff4e13d68
Implement negation of longs efficiently.  For this testcase:

long %test(long %X) {
        %Y = sub long 0, %X
        ret long %Y
}

We used to generate:

test:
        sub %ESP, 4
        mov DWORD PTR [%ESP], %ESI
        mov %ECX, DWORD PTR [%ESP + 8]
        mov %ESI, DWORD PTR [%ESP + 12]
        mov %EAX, 0
        mov %EDX, 0
        sub %EAX, %ECX
        sbb %EDX, %ESI
        mov %ESI, DWORD PTR [%ESP]
        add %ESP, 4
        ret

Now we generate:

test:
        mov %EAX, DWORD PTR [%ESP + 4]
        mov %EDX, DWORD PTR [%ESP + 8]
        neg %EAX
        adc %EDX, 0
        neg %EDX
        ret

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12681 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Target/X86/InstSelectSimple.cpp
lib/Target/X86/X86ISelSimple.cpp