diff options
author | Nick Lewycky <nicholas@mxc.ca> | 2009-10-25 03:50:03 +0000 |
---|---|---|
committer | Nick Lewycky <nicholas@mxc.ca> | 2009-10-25 03:50:03 +0000 |
commit | 7494b3b1d417435e6b8e276a4ac2e9a96e50b276 (patch) | |
tree | 6418c3c969bb15fca5d5c53e3771464de783d173 /llvm/lib/VMCore/Instructions.cpp | |
parent | a4ea29e3626b72639839a90e84d4b386e2125023 (diff) | |
download | bcm5719-llvm-7494b3b1d417435e6b8e276a4ac2e9a96e50b276.tar.gz bcm5719-llvm-7494b3b1d417435e6b8e276a4ac2e9a96e50b276.zip |
Sink isTrueWhenEqual from ICmpInst to CmpInst. Add a matching isFalseWhenEqual
which is equal to !isTrueWhenEqual for ints but not for floats.
llvm-svn: 85036
Diffstat (limited to 'llvm/lib/VMCore/Instructions.cpp')
-rw-r--r-- | llvm/lib/VMCore/Instructions.cpp | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/llvm/lib/VMCore/Instructions.cpp b/llvm/lib/VMCore/Instructions.cpp index 60e203a7e0b..b73ce505f22 100644 --- a/llvm/lib/VMCore/Instructions.cpp +++ b/llvm/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 //===----------------------------------------------------------------------===// |