assert(E->getOpcode() == BinaryOperator::NE &&
"Invalid complex comparison.");
return Success(((CR_r == APFloat::cmpGreaterThan ||
- CR_r == APFloat::cmpLessThan) &&
+ CR_r == APFloat::cmpLessThan ||
+ CR_r == APFloat::cmpUnordered) ||
(CR_i == APFloat::cmpGreaterThan ||
- CR_i == APFloat::cmpLessThan)), E);
+ CR_i == APFloat::cmpLessThan ||
+ CR_i == APFloat::cmpUnordered)), E);
}
} else {
if (E->getOpcode() == BinaryOperator::EQ)
return Success(CR == APFloat::cmpEqual, E);
case BinaryOperator::NE:
return Success(CR == APFloat::cmpGreaterThan
- || CR == APFloat::cmpLessThan, E);
+ || CR == APFloat::cmpLessThan
+ || CR == APFloat::cmpUnordered, E);
}
}
--- /dev/null
+// RUN: %clang_cc1 -emit-llvm -o - %s | FileCheck %s
+
+// Checks folding of an unordered comparison
+int nan_ne_check() {
+ // CHECK: store i32 1
+ return (__builtin_nanf("") != __builtin_nanf("")) ? 1 : 0;
+}