X86: optimization for max-like struct
authorManman Ren <mren@apple.com>
Tue, 1 May 2012 17:16:15 +0000 (17:16 +0000)
committerManman Ren <mren@apple.com>
Tue, 1 May 2012 17:16:15 +0000 (17:16 +0000)
commit769ea2f93fa7fdd73f8388e863cf4dc9689d2e38
treea26f03e58df98343d7a91ec65aebad9d8dc5f8c3
parentd07d06ceef942c478c0f75a4c4d7442e61ddff1d
X86: optimization for max-like struct

This patch will optimize the following cases on X86
(a > b) ? (a-b) : 0
(a >= b) ? (a-b) : 0
(b < a) ? (a-b) : 0
(b <= a) ? (a-b) : 0

FROM
movl    %edi, %ecx
subl    %esi, %ecx
cmpl    %edi, %esi
movl    $0, %eax
cmovll  %ecx, %eax
TO
xorl    %eax, %eax
subl    %esi, %edi
cmovll  %eax, %edi
movl    %edi, %eax

rdar: 10734411

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