summaryrefslogtreecommitdiff
path: root/lib/VMCore
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2008-09-09 01:02:47 +0000
committerDan Gohman <gohman@apple.com>2008-09-09 01:02:47 +0000
commitf72fb679eff7de84e3e18b75d63a18cb3510bcdd (patch)
treedbb8edc6c23b2810ff37d055e1f19f2a81bcb504 /lib/VMCore
parent3eb594013f666d6af9f943df5fb6ac4d902debee (diff)
downloadllvm-f72fb679eff7de84e3e18b75d63a18cb3510bcdd.tar.gz
llvm-f72fb679eff7de84e3e18b75d63a18cb3510bcdd.tar.bz2
llvm-f72fb679eff7de84e3e18b75d63a18cb3510bcdd.tar.xz
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! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55969 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore')
-rw-r--r--lib/VMCore/Verifier.cpp21
1 files changed, 17 insertions, 4 deletions
diff --git a/lib/VMCore/Verifier.cpp b/lib/VMCore/Verifier.cpp
index 805fb2564a..af11fce5e7 100644
--- a/lib/VMCore/Verifier.cpp
+++ b/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);
}