[X86] Add two combine rules to simplify dag nodes introduced during type legalization...
authorAndrea Di Biagio <Andrea_DiBiagio@sn.scee.net>
Fri, 30 May 2014 23:17:53 +0000 (23:17 +0000)
committerAndrea Di Biagio <Andrea_DiBiagio@sn.scee.net>
Fri, 30 May 2014 23:17:53 +0000 (23:17 +0000)
commit1726e2ff15a44ea39b6bc1fb719a459de5656b8b
tree24f4b08344c32fe74c3a6d75d3d0e29793c3fdec
parentd99cefbad17a3680601914ff73a28d3214f91c70
[X86] Add two combine rules to simplify dag nodes introduced during type legalization when promoting nodes with illegal vector type.

This patch teaches the backend how to simplify/canonicalize dag node
sequences normally introduced by the backend when promoting certain dag nodes
with illegal vector type.

This patch adds two new combine rules:
1) fold (shuffle (bitcast (BINOP A, B)), Undef, <Mask>) ->
        (shuffle (BINOP (bitcast A), (bitcast B)), Undef, <Mask>)

2) fold (BINOP (shuffle (A, Undef, <Mask>)), (shuffle (B, Undef, <Mask>))) ->
        (shuffle (BINOP A, B), Undef, <Mask>).

Both rules are only triggered on the type-legalized DAG.
In particular, rule 1. is a target specific combine rule that attempts
to sink a bitconvert into the operands of a binary operation.
Rule 2. is a target independet rule that attempts to move a shuffle
immediately after a binary operation.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@209930 91177308-0d34-0410-b5e6-96231b3b80d8
lib/CodeGen/SelectionDAG/DAGCombiner.cpp
lib/Target/X86/X86ISelLowering.cpp
test/CodeGen/X86/combine-64bit-vec-binop.ll [new file with mode: 0644]
test/CodeGen/X86/lower-bitcast.ll