summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen
diff options
context:
space:
mode:
authorPete Cooper <peter_cooper@apple.com>2012-08-30 23:58:52 +0000
committerPete Cooper <peter_cooper@apple.com>2012-08-30 23:58:52 +0000
commite969340fea89f582949b63741c0f67204c0029ac (patch)
tree2606452e2024c84d47e67f4e7a7cb08edb1bdb45 /llvm/lib/CodeGen
parentcd278ffa285694df0bcb22fdff270af1cf03559a (diff)
downloadbcm5719-llvm-e969340fea89f582949b63741c0f67204c0029ac.tar.gz
bcm5719-llvm-e969340fea89f582949b63741c0f67204c0029ac.zip
Take account of boolean vector contents when promoting a build vector from i1 to some other type. rdar://problem/12210060
llvm-svn: 162960
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp18
1 files changed, 17 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp b/llvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp
index e8e968aaef3..cd93a511b66 100644
--- a/llvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp
@@ -2913,8 +2913,24 @@ SDValue DAGTypeLegalizer::PromoteIntRes_BUILD_VECTOR(SDNode *N) {
SmallVector<SDValue, 8> Ops;
Ops.reserve(NumElems);
+ unsigned ExtendOp = ISD::ANY_EXTEND;
+ // Extending boolean constants needs to consider the
+ // value boolean vector constants take on this target and extend
+ // with sign or zeros appropriately.
+ if (OutVT.getVectorElementType() == MVT::i1) {
+ switch (TLI.getBooleanContents(true)) {
+ case TargetLowering::UndefinedBooleanContent:
+ break;
+ case TargetLowering::ZeroOrOneBooleanContent:
+ ExtendOp = ISD::ZERO_EXTEND;
+ break;
+ case TargetLowering::ZeroOrNegativeOneBooleanContent:
+ ExtendOp = ISD::SIGN_EXTEND;
+ break;
+ }
+ }
for (unsigned i = 0; i != NumElems; ++i) {
- SDValue Op = DAG.getNode(ISD::ANY_EXTEND, dl, NOutVTElem, N->getOperand(i));
+ SDValue Op = DAG.getNode(ExtendOp, dl, NOutVTElem, N->getOperand(i));
Ops.push_back(Op);
}
OpenPOWER on IntegriCloud