]> granicus.if.org Git - llvm/commit
[X86] Combining CMOVs with [ANY,SIGN,ZERO]_EXTEND for cases where CMOV has constant...
authorAlexander Ivchenko <alexander.ivchenko@intel.com>
Fri, 22 Sep 2017 13:21:39 +0000 (13:21 +0000)
committerAlexander Ivchenko <alexander.ivchenko@intel.com>
Fri, 22 Sep 2017 13:21:39 +0000 (13:21 +0000)
commit9bd5ef3869720bf73837a7bd4779c53752e0ed33
tree40d8e0807a019b423a33d2f5997857312b8418ab
parentcbb0a9e68ecae9dd34694493aed7b8cb9a960627
[X86] Combining CMOVs with [ANY,SIGN,ZERO]_EXTEND for cases where CMOV has constant arguments

Combine CMOV[i16]<-[SIGN,ZERO,ANY]_EXTEND to [i32,i64] into CMOV[i32,i64].
One example of where it is useful is:

before (20 bytes)
    <foo>:
    test $0x1,%dil
    mov $0x307e,%ax
    mov $0xffff,%cx
    cmovne %ax,%cx
    movzwl %cx,%eax
    retq

after (18 bytes)
    <foo>:
    test $0x1,%dil
    mov $0x307e,%ecx
    mov $0xffff,%eax
    cmovne %ecx,%eax
    retq

Reviewers: craig.topper, aaboud, spatel, RKSimon, zvi

Reviewed By: spatel

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D36711

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