diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Core/Executor.cpp | 49 |
1 files changed, 20 insertions, 29 deletions
diff --git a/lib/Core/Executor.cpp b/lib/Core/Executor.cpp index f0781e5b..24fcea88 100644 --- a/lib/Core/Executor.cpp +++ b/lib/Core/Executor.cpp @@ -2333,69 +2333,60 @@ void Executor::executeInstruction(ExecutionState &state, KInstruction *ki) { switch( fi->getPredicate() ) { // Predicates which only care about whether or not the operands are NaNs. case FCmpInst::FCMP_ORD: - Result = CmpRes != APFloat::cmpUnordered; + Result = (CmpRes != APFloat::cmpUnordered); break; case FCmpInst::FCMP_UNO: - Result = CmpRes == APFloat::cmpUnordered; + Result = (CmpRes == APFloat::cmpUnordered); break; // Ordered comparisons return false if either operand is NaN. Unordered // comparisons return true if either operand is NaN. case FCmpInst::FCMP_UEQ: - if (CmpRes == APFloat::cmpUnordered) { - Result = true; - break; - } + Result = (CmpRes == APFloat::cmpUnordered || CmpRes == APFloat::cmpEqual); + break; case FCmpInst::FCMP_OEQ: - Result = CmpRes == APFloat::cmpEqual; + Result = (CmpRes != APFloat::cmpUnordered && CmpRes == APFloat::cmpEqual); break; case FCmpInst::FCMP_UGT: - if (CmpRes == APFloat::cmpUnordered) { - Result = true; - break; - } + Result = (CmpRes == APFloat::cmpUnordered || CmpRes == APFloat::cmpGreaterThan); + break; case FCmpInst::FCMP_OGT: - Result = CmpRes == APFloat::cmpGreaterThan; + Result = (CmpRes != APFloat::cmpUnordered && CmpRes == APFloat::cmpGreaterThan); break; case FCmpInst::FCMP_UGE: - if (CmpRes == APFloat::cmpUnordered) { - Result = true; - break; - } + Result = (CmpRes == APFloat::cmpUnordered || (CmpRes == APFloat::cmpGreaterThan || CmpRes == APFloat::cmpEqual)); + break; case FCmpInst::FCMP_OGE: - Result = CmpRes == APFloat::cmpGreaterThan || CmpRes == APFloat::cmpEqual; + Result = (CmpRes != APFloat::cmpUnordered && (CmpRes == APFloat::cmpGreaterThan || CmpRes == APFloat::cmpEqual)); break; case FCmpInst::FCMP_ULT: - if (CmpRes == APFloat::cmpUnordered) { - Result = true; - break; - } + Result = (CmpRes == APFloat::cmpUnordered || CmpRes == APFloat::cmpLessThan); + break; case FCmpInst::FCMP_OLT: - Result = CmpRes == APFloat::cmpLessThan; + Result = (CmpRes != APFloat::cmpUnordered && CmpRes == APFloat::cmpLessThan); break; case FCmpInst::FCMP_ULE: - if (CmpRes == APFloat::cmpUnordered) { - Result = true; - break; - } + Result = (CmpRes == APFloat::cmpUnordered || (CmpRes == APFloat::cmpLessThan || CmpRes == APFloat::cmpEqual)); + break; case FCmpInst::FCMP_OLE: - Result = CmpRes == APFloat::cmpLessThan || CmpRes == APFloat::cmpEqual; + Result = (CmpRes != APFloat::cmpUnordered && (CmpRes == APFloat::cmpLessThan || CmpRes == APFloat::cmpEqual)); break; case FCmpInst::FCMP_UNE: - Result = CmpRes == APFloat::cmpUnordered || CmpRes != APFloat::cmpEqual; + Result = (CmpRes == APFloat::cmpUnordered || CmpRes != APFloat::cmpEqual); break; case FCmpInst::FCMP_ONE: - Result = CmpRes != APFloat::cmpUnordered && CmpRes != APFloat::cmpEqual; + Result = (CmpRes != APFloat::cmpUnordered && CmpRes != APFloat::cmpEqual); break; default: assert(0 && "Invalid FCMP predicate!"); + break; case FCmpInst::FCMP_FALSE: Result = false; break; |