Move 3 "(add (select cc, 0, c), x) -> (select cc, x, (add, x, c))"
authorChris Lattner <sabre@nondot.org>
Thu, 12 Mar 2009 06:52:53 +0000 (06:52 +0000)
committerChris Lattner <sabre@nondot.org>
Thu, 12 Mar 2009 06:52:53 +0000 (06:52 +0000)
commitd1980a5acd8509ea34ee2dec5e13de5dbe16af2d
tree287038ace4f1d384e8d4f039f22ceae688138012
parent2b9f4349086247c58ed0bcd17c7d11b14b14f52b
Move 3 "(add (select cc, 0, c), x) -> (select cc, x, (add, x, c))"
related transformations out of target-specific dag combine into the
ARM backend.  These were added by Evan in r37685 with no testcases
and only seems to help ARM (e.g. test/CodeGen/ARM/select_xform.ll).

Add some simple X86-specific (for now) DAG combines that turn things
like cond ? 8 : 0  -> (zext(cond) << 3).  This happens frequently
with the recently added cp constant select optimization, but is a
very general xform.  For example, we now compile the second example
in const-select.ll to:

_test:
        movsd   LCPI2_0, %xmm0
        ucomisd 8(%esp), %xmm0
        seta    %al
        movzbl  %al, %eax
        movl    4(%esp), %ecx
        movsbl  (%ecx,%eax,4), %eax
        ret

instead of:

_test:
        movl    4(%esp), %eax
        leal    4(%eax), %ecx
        movsd   LCPI2_0, %xmm0
        ucomisd 8(%esp), %xmm0
        cmovbe  %eax, %ecx
        movsbl  (%ecx), %eax
        ret

This passes multisource and dejagnu.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66779 91177308-0d34-0410-b5e6-96231b3b80d8
lib/CodeGen/SelectionDAG/DAGCombiner.cpp
lib/Target/ARM/ARMISelLowering.cpp
lib/Target/X86/README.txt
lib/Target/X86/X86ISelLowering.cpp
test/CodeGen/X86/const-select.ll [new file with mode: 0644]
test/CodeGen/X86/mul-legalize.ll