diff options
| author | Quentin Colombet <qcolombet@apple.com> | 2014-05-21 22:00:39 +0000 |
|---|---|---|
| committer | Quentin Colombet <qcolombet@apple.com> | 2014-05-21 22:00:39 +0000 |
| commit | b4d53f1afa36283fcb8121d9574c576d48038421 (patch) | |
| tree | 1b446ac999f1930e62ac0f7105ed3a2ef18b9efa /llvm/lib/Target | |
| parent | 339d12ff126e206fa3dc3f951661eab5bc2b0074 (diff) | |
| download | bcm5719-llvm-b4d53f1afa36283fcb8121d9574c576d48038421.tar.gz bcm5719-llvm-b4d53f1afa36283fcb8121d9574c576d48038421.zip | |
[X86] Fix a bug in the lowering of BLENDI introduced in r209043.
ISD::VSELECT mask uses 1 to identify the first argument and 0 to identify the
second argument.
On the other hand, BLENDI uses 0 to identify the first argument and 1 to
identify the second argument.
Fix the generation of the blend mask to account for this difference.
The bug did not show up with r209043, because we were not checking for the
actual arguments of the blend instruction!
This commit also fixes the test cases.
Note: The same mask works for the BLENDr variant because the arguments are
swapped during instruction selection (see the BLENDXXrr patterns).
<rdar://problem/16975435>
llvm-svn: 209324
Diffstat (limited to 'llvm/lib/Target')
| -rw-r--r-- | llvm/lib/Target/X86/X86ISelLowering.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp index 72743a97abd..61828759fc2 100644 --- a/llvm/lib/Target/X86/X86ISelLowering.cpp +++ b/llvm/lib/Target/X86/X86ISelLowering.cpp @@ -7980,7 +7980,7 @@ X86TargetLowering::LowerVECTOR_SHUFFLE(SDValue Op, SelectionDAG &DAG) const { return SDValue(); } -// This function assumes its argument is a BUILD_VECTOR of constand or +// This function assumes its argument is a BUILD_VECTOR of constants or // undef SDNodes. i.e: ISD::isBuildVectorOfConstantSDNodes(BuildVector) is // true. static bool BUILD_VECTORtoBlendMask(BuildVectorSDNode *BuildVector, @@ -8004,9 +8004,13 @@ static bool BUILD_VECTORtoBlendMask(BuildVectorSDNode *BuildVector, Lane2Cond = !isZero(SndLaneEltCond); if (Lane1Cond == Lane2Cond || Lane2Cond < 0) - MaskValue |= !!Lane1Cond << i; + // Lane1Cond != 0, means we want the first argument. + // Lane1Cond == 0, means we want the second argument. + // The encoding of this argument is 0 for the first argument, 1 + // for the second. Therefore, invert the condition. + MaskValue |= !Lane1Cond << i; else if (Lane1Cond < 0) - MaskValue |= !!Lane2Cond << i; + MaskValue |= !Lane2Cond << i; else return false; } |

