aboutsummaryrefslogtreecommitdiffstats
path: root/lib/VMCore
diff options
context:
space:
mode:
authorNick Lewycky <nicholas@mxc.ca>2009-10-25 03:50:03 +0000
committerNick Lewycky <nicholas@mxc.ca>2009-10-25 03:50:03 +0000
commit44df023d5f56e301d6280df20e36e68b1c4a761e (patch)
tree3dc81ac9fed1799f51742701c4b7ec2fd5e03e21 /lib/VMCore
parentedb8997821d6d7ae3cb8fc03e9b50190e990154a (diff)
downloadexternal_llvm-44df023d5f56e301d6280df20e36e68b1c4a761e.zip
external_llvm-44df023d5f56e301d6280df20e36e68b1c4a761e.tar.gz
external_llvm-44df023d5f56e301d6280df20e36e68b1c4a761e.tar.bz2
Sink isTrueWhenEqual from ICmpInst to CmpInst. Add a matching isFalseWhenEqual
which is equal to !isTrueWhenEqual for ints but not for floats. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85036 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore')
-rw-r--r--lib/VMCore/Instructions.cpp19
1 files changed, 18 insertions, 1 deletions
diff --git a/lib/VMCore/Instructions.cpp b/lib/VMCore/Instructions.cpp
index 60e203a..b73ce50 100644
--- a/lib/VMCore/Instructions.cpp
+++ b/lib/VMCore/Instructions.cpp
@@ -2943,7 +2943,7 @@ bool CmpInst::isUnsigned(unsigned short predicate) {
}
}
-bool CmpInst::isSigned(unsigned short predicate){
+bool CmpInst::isSigned(unsigned short predicate) {
switch (predicate) {
default: return false;
case ICmpInst::ICMP_SLT: case ICmpInst::ICMP_SLE: case ICmpInst::ICMP_SGT:
@@ -2969,6 +2969,23 @@ bool CmpInst::isUnordered(unsigned short predicate) {
}
}
+bool CmpInst::isTrueWhenEqual(unsigned short predicate) {
+ switch(predicate) {
+ default: return false;
+ case ICMP_EQ: case ICMP_UGE: case ICMP_ULE: case ICMP_SGE: case ICMP_SLE:
+ case FCMP_TRUE: case FCMP_UEQ: case FCMP_UGE: case FCMP_ULE: return true;
+ }
+}
+
+bool CmpInst::isFalseWhenEqual(unsigned short predicate) {
+ switch(predicate) {
+ case ICMP_NE: case ICMP_UGT: case ICMP_ULT: case ICMP_SGT: case ICMP_SLT:
+ case FCMP_FALSE: case FCMP_ONE: case FCMP_OGT: case FCMP_OLT: return true;
+ default: return false;
+ }
+}
+
+
//===----------------------------------------------------------------------===//
// SwitchInst Implementation
//===----------------------------------------------------------------------===//