DAGCombiner: Canonicalize select(and/or,x,y) depending on target.
authorMatthias Braun <matze@braunis.de>
Fri, 6 Mar 2015 19:49:10 +0000 (19:49 +0000)
committerMatthias Braun <matze@braunis.de>
Fri, 6 Mar 2015 19:49:10 +0000 (19:49 +0000)
commit47941aa098fe064276632fef1867581effe0dd26
tree4e011a48ea709379fe795dfa2b35fed1e454d2e0
parentfdd8f37dc6bed238496c8f5ce18bd52eaac760b0
DAGCombiner: Canonicalize select(and/or,x,y) depending on target.

This is based on the following equivalences:
select(C0 & C1, X, Y) <=> select(C0, select(C1, X, Y), Y)
select(C0 | C1, X, Y) <=> select(C0, X, select(C1, X, Y))

Many target cannot perform and/or on the CPU flags and therefore the
right side should be choosen to avoid materializign the i1 flags in an
integer register. If the target can perform this operation efficiently
we normalize to the left form.

Differential Revision: http://reviews.llvm.org/D7622

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@231507 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/Target/TargetLowering.h
lib/CodeGen/SelectionDAG/DAGCombiner.cpp
test/CodeGen/ARM/movcc-double.ll [new file with mode: 0644]
test/CodeGen/R600/or.ll
test/CodeGen/X86/cmov-double.ll [new file with mode: 0644]
test/CodeGen/X86/jump_sign.ll
test/CodeGen/X86/zext-sext.ll