diff options
| author | Andrea Di Biagio <Andrea_DiBiagio@sn.scee.net> | 2014-11-05 13:04:14 +0000 | 
|---|---|---|
| committer | Andrea Di Biagio <Andrea_DiBiagio@sn.scee.net> | 2014-11-05 13:04:14 +0000 | 
| commit | ce46b97b4839d065521bf187e43425ab9b77643f (patch) | |
| tree | cafa7fe9b61c538588aa8af362aa671caecbb09a /llvm/lib/CodeGen/SelectionDAG | |
| parent | c8d452eed8a80820e96843831a1c4e75ba87cd99 (diff) | |
| download | bcm5719-llvm-ce46b97b4839d065521bf187e43425ab9b77643f.tar.gz bcm5719-llvm-ce46b97b4839d065521bf187e43425ab9b77643f.zip | |
[X86] Teach method 'isVectorClearMaskLegal' how to check for legal blend masks.
This patch improves the folding of vector AND nodes into blend operations for
targets that feature SSE4.1. A vector AND node where one of the operands is
a constant build_vector with elements that are either zero or all-ones can be
converted into a blend.
This allows for example to simplify the following code:
define <4 x i32> @test(<4 x i32> %A, <4 x i32> %B) {
  %1 = and <4 x i32> %A, <i32 0, i32 0, i32 0, i32 -1>
  %2 = and <4 x i32> %B, <i32 -1, i32 -1, i32 -1, i32 0>
  %3 = or <4 x i32> %1, %2
  ret <4 x i32> %3
}
Before this patch llc (-mcpu=corei7) generated:
        andps  LCPI1_0(%rip), %xmm0, %xmm0
        andps  LCPI1_1(%rip), %xmm1, %xmm1
        orps   %xmm1, %xmm0, %xmm0
        retq
With this patch we generate a single 'vpblendw'.
llvm-svn: 221343
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG')
| -rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp | 2 | 
1 files changed, 1 insertions, 1 deletions
| diff --git a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp index 107f5a12693..33b2527287e 100644 --- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp @@ -11293,7 +11293,7 @@ SDValue DAGCombiner::XformToShuffleWithZero(SDNode *N) {          if (cast<ConstantSDNode>(Elt)->isAllOnesValue())            Indices.push_back(i);          else if (cast<ConstantSDNode>(Elt)->isNullValue()) -          Indices.push_back(NumElts); +          Indices.push_back(NumElts+i);          else            return SDValue();        } | 

