aboutsummaryrefslogtreecommitdiff
path: root/include/llvm/Instructions.h
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 /include/llvm/Instructions.h
parent3eb594013f666d6af9f943df5fb6ac4d902debee (diff)
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 'include/llvm/Instructions.h')
-rw-r--r--include/llvm/Instructions.h22
1 files changed, 14 insertions, 8 deletions
diff --git a/include/llvm/Instructions.h b/include/llvm/Instructions.h
index 355103cfa6..8ae9c375fb 100644
--- a/include/llvm/Instructions.h
+++ b/include/llvm/Instructions.h
@@ -621,7 +621,8 @@ public:
Value *RHS, ///< The right-hand-side of the expression
const std::string &NameStr = "", ///< Name of the instruction
Instruction *InsertBefore = 0 ///< Where to insert
- ) : CmpInst(Type::Int1Ty, Instruction::ICmp, pred, LHS, RHS, NameStr,
+ ) : CmpInst(makeCmpResultType(LHS->getType()),
+ Instruction::ICmp, pred, LHS, RHS, NameStr,
InsertBefore) {
assert(pred >= CmpInst::FIRST_ICMP_PREDICATE &&
pred <= CmpInst::LAST_ICMP_PREDICATE &&
@@ -629,7 +630,7 @@ public:
assert(getOperand(0)->getType() == getOperand(1)->getType() &&
"Both operands to ICmp instruction are not of the same type!");
// Check that the operands are the right type
- assert((getOperand(0)->getType()->isInteger() ||
+ assert((getOperand(0)->getType()->isIntOrIntVector() ||
isa<PointerType>(getOperand(0)->getType())) &&
"Invalid operand types for ICmp instruction");
}
@@ -641,7 +642,8 @@ public:
Value *RHS, ///< The right-hand-side of the expression
const std::string &NameStr, ///< Name of the instruction
BasicBlock *InsertAtEnd ///< Block to insert into.
- ) : CmpInst(Type::Int1Ty, Instruction::ICmp, pred, LHS, RHS, NameStr,
+ ) : CmpInst(makeCmpResultType(LHS->getType()),
+ Instruction::ICmp, pred, LHS, RHS, NameStr,
InsertAtEnd) {
assert(pred >= CmpInst::FIRST_ICMP_PREDICATE &&
pred <= CmpInst::LAST_ICMP_PREDICATE &&
@@ -649,7 +651,7 @@ public:
assert(getOperand(0)->getType() == getOperand(1)->getType() &&
"Both operands to ICmp instruction are not of the same type!");
// Check that the operands are the right type
- assert((getOperand(0)->getType()->isInteger() ||
+ assert((getOperand(0)->getType()->isIntOrIntVector() ||
isa<PointerType>(getOperand(0)->getType())) &&
"Invalid operand types for ICmp instruction");
}
@@ -754,6 +756,7 @@ public:
static inline bool classof(const Value *V) {
return isa<Instruction>(V) && classof(cast<Instruction>(V));
}
+
};
//===----------------------------------------------------------------------===//
@@ -773,14 +776,15 @@ public:
Value *RHS, ///< The right-hand-side of the expression
const std::string &NameStr = "", ///< Name of the instruction
Instruction *InsertBefore = 0 ///< Where to insert
- ) : CmpInst(Type::Int1Ty, Instruction::FCmp, pred, LHS, RHS, NameStr,
+ ) : CmpInst(makeCmpResultType(LHS->getType()),
+ Instruction::FCmp, pred, LHS, RHS, NameStr,
InsertBefore) {
assert(pred <= FCmpInst::LAST_FCMP_PREDICATE &&
"Invalid FCmp predicate value");
assert(getOperand(0)->getType() == getOperand(1)->getType() &&
"Both operands to FCmp instruction are not of the same type!");
// Check that the operands are the right type
- assert(getOperand(0)->getType()->isFloatingPoint() &&
+ assert(getOperand(0)->getType()->isFPOrFPVector() &&
"Invalid operand types for FCmp instruction");
}
@@ -791,14 +795,15 @@ public:
Value *RHS, ///< The right-hand-side of the expression
const std::string &NameStr, ///< Name of the instruction
BasicBlock *InsertAtEnd ///< Block to insert into.
- ) : CmpInst(Type::Int1Ty, Instruction::FCmp, pred, LHS, RHS, NameStr,
+ ) : CmpInst(makeCmpResultType(LHS->getType()),
+ Instruction::FCmp, pred, LHS, RHS, NameStr,
InsertAtEnd) {
assert(pred <= FCmpInst::LAST_FCMP_PREDICATE &&
"Invalid FCmp predicate value");
assert(getOperand(0)->getType() == getOperand(1)->getType() &&
"Both operands to FCmp instruction are not of the same type!");
// Check that the operands are the right type
- assert(getOperand(0)->getType()->isFloatingPoint() &&
+ assert(getOperand(0)->getType()->isFPOrFPVector() &&
"Invalid operand types for FCmp instruction");
}
@@ -837,6 +842,7 @@ public:
static inline bool classof(const Value *V) {
return isa<Instruction>(V) && classof(cast<Instruction>(V));
}
+
};
//===----------------------------------------------------------------------===//