diff options
author | Dan Gohman <gohman@apple.com> | 2008-09-09 01:02:47 +0000 |
---|---|---|
committer | Dan Gohman <gohman@apple.com> | 2008-09-09 01:02:47 +0000 |
commit | c579d978a3d8f20087e55ba3ed7c8fb5b369e6e7 (patch) | |
tree | 0e3148dd228035fcd467162f54c1febef863e06f /llvm/lib/VMCore/Verifier.cpp | |
parent | 484167851a4dd2e4b46972afdf43da91ee8f6e45 (diff) | |
download | bcm5719-llvm-c579d978a3d8f20087e55ba3ed7c8fb5b369e6e7.tar.gz bcm5719-llvm-c579d978a3d8f20087e55ba3ed7c8fb5b369e6e7.zip |
Extend the vcmp/fcmp LLVM IR instructions to take vectors as arguments
and, if so, to return a vector of boolean as a result;
Extend the select LLVM IR instruction to allow you to specify a result
type which is a vector of boolean, in which case the result will be an
element-wise selection instead of choosing one vector or the other; and
Update LangRef.html to describe these changes.
This patch was contributed by Preston Gurd!
llvm-svn: 55969
Diffstat (limited to 'llvm/lib/VMCore/Verifier.cpp')
-rw-r--r-- | llvm/lib/VMCore/Verifier.cpp | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/llvm/lib/VMCore/Verifier.cpp b/llvm/lib/VMCore/Verifier.cpp index 805fb2564a4..af11fce5e72 100644 --- a/llvm/lib/VMCore/Verifier.cpp +++ b/llvm/lib/VMCore/Verifier.cpp @@ -659,8 +659,21 @@ void Verifier::visitSwitchInst(SwitchInst &SI) { } void Verifier::visitSelectInst(SelectInst &SI) { - Assert1(SI.getCondition()->getType() == Type::Int1Ty, - "Select condition type must be bool!", &SI); + if (const VectorType* vt + = dyn_cast<VectorType>(SI.getCondition()->getType())) { + Assert1( vt->getElementType() == Type::Int1Ty, + "Select condition type must be vector of bool!", &SI); + if (const VectorType* val_vt + = dyn_cast<VectorType>(SI.getTrueValue()->getType())) { + Assert1( vt->getNumElements() == val_vt->getNumElements(), + "Select vector size != value vector size", &SI); + } else { + Assert1(0, "Vector select values must have vector types", &SI); + } + } else { + Assert1(SI.getCondition()->getType() == Type::Int1Ty, + "Select condition type must be bool!", &SI); + } Assert1(SI.getTrueValue()->getType() == SI.getFalseValue()->getType(), "Select values must have identical types!", &SI); Assert1(SI.getTrueValue()->getType() == SI.getType(), @@ -1028,7 +1041,7 @@ void Verifier::visitICmpInst(ICmpInst& IC) { Assert1(Op0Ty == Op1Ty, "Both operands to ICmp instruction are not of the same type!", &IC); // Check that the operands are the right type - Assert1(Op0Ty->isInteger() || isa<PointerType>(Op0Ty), + Assert1(Op0Ty->isIntOrIntVector() || isa<PointerType>(Op0Ty), "Invalid operand types for ICmp instruction", &IC); visitInstruction(IC); } @@ -1040,7 +1053,7 @@ void Verifier::visitFCmpInst(FCmpInst& FC) { Assert1(Op0Ty == Op1Ty, "Both operands to FCmp instruction are not of the same type!", &FC); // Check that the operands are the right type - Assert1(Op0Ty->isFloatingPoint(), + Assert1(Op0Ty->isFPOrFPVector(), "Invalid operand types for FCmp instruction", &FC); visitInstruction(FC); } |