diff options
author | Pete Cooper <peter_cooper@apple.com> | 2012-09-01 22:27:48 +0000 |
---|---|---|
committer | Pete Cooper <peter_cooper@apple.com> | 2012-09-01 22:27:48 +0000 |
commit | 2455e9c4a5fd265edd372d922b6a818b7414a031 (patch) | |
tree | 9feb4b740b01a7874505586fb2b009f829a9e9b7 /llvm/lib/CodeGen/SelectionDAG/LegalizeVectorOps.cpp | |
parent | d02949b9f5417c6949cf545be715d099052a4c10 (diff) | |
download | bcm5719-llvm-2455e9c4a5fd265edd372d922b6a818b7414a031.tar.gz bcm5719-llvm-2455e9c4a5fd265edd372d922b6a818b7414a031.zip |
Only legalise a VSELECT in to bitwise operations if the vector mask bool is zeros or all ones. A vector bool with just ones isn't suitable for masking with.
No test case unfortunately as i couldn't find a target which fit all
the conditions needed to hit this code.
llvm-svn: 163075
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG/LegalizeVectorOps.cpp')
-rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/LegalizeVectorOps.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/LegalizeVectorOps.cpp b/llvm/lib/CodeGen/SelectionDAG/LegalizeVectorOps.cpp index dbb2f12dea8..c334f1fba5f 100644 --- a/llvm/lib/CodeGen/SelectionDAG/LegalizeVectorOps.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/LegalizeVectorOps.cpp @@ -514,9 +514,14 @@ SDValue VectorLegalizer::ExpandVSELECT(SDValue Op) { // AND,OR,XOR, we will have to scalarize the op. // Notice that the operation may be 'promoted' which means that it is // 'bitcasted' to another type which is handled. + // This operation also isn't safe with AND, OR, XOR when the boolean + // type is 0/1 as we need an all ones vector constant to mask with. + // FIXME: Sign extend 1 to all ones if thats legal on the target. if (TLI.getOperationAction(ISD::AND, VT) == TargetLowering::Expand || TLI.getOperationAction(ISD::XOR, VT) == TargetLowering::Expand || - TLI.getOperationAction(ISD::OR, VT) == TargetLowering::Expand) + TLI.getOperationAction(ISD::OR, VT) == TargetLowering::Expand || + TLI.getBooleanContents(true) != + TargetLowering::ZeroOrNegativeOneBooleanContent) return DAG.UnrollVectorOp(Op.getNode()); assert(VT.getSizeInBits() == Op1.getValueType().getSizeInBits() |