Teach the legalizer how to promote SINT_TO_FP to a wider SINT_TO_FP that
authorNate Begeman <natebegeman@mac.com>
Sat, 16 Jul 2005 02:02:34 +0000 (02:02 +0000)
committerNate Begeman <natebegeman@mac.com>
Sat, 16 Jul 2005 02:02:34 +0000 (02:02 +0000)
commit5a8441ea3fc145393d6274156bd05c4a006099ea
treecc5a8d6efc77c3e61d52510456c108fd2b4c9f27
parent11cefd926a1be9e6cd52b4e189a99081a385d57f
Teach the legalizer how to promote SINT_TO_FP to a wider SINT_TO_FP that
the target natively supports.  This eliminates some special-case code from
the x86 backend and generates better code as well.

For an i8 to f64 conversion, before & after:

_x87 before:
        subl $2, %esp
        movb 6(%esp), %al
        movsbw %al, %ax
        movw %ax, (%esp)
        filds (%esp)
        addl $2, %esp
        ret

_x87 after:
        subl $2, %esp
        movsbw 6(%esp), %ax
        movw %ax, (%esp)
        filds (%esp)
        addl $2, %esp
        ret

_sse before:
        subl $12, %esp
        movb 16(%esp), %al
        movsbl %al, %eax
        cvtsi2sd %eax, %xmm0
        addl $12, %esp
        ret

_sse after:
        subl $12, %esp
        movsbl 16(%esp), %eax
        cvtsi2sd %eax, %xmm0
        addl $12, %esp
        ret

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22452 91177308-0d34-0410-b5e6-96231b3b80d8
lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
lib/Target/X86/X86ISelPattern.cpp