The sibling fold for 'oge' --> 'ord' was already here,
but this half was missing.
The result of fabs() must be positive or nan, so asking
if the result is negative or nan is the same as asking
if the result is nan.
This is another step towards fixing:
https://bugs.llvm.org/show_bug.cgi?id=39475
llvm-svn: 346321
assert(!I.hasNoNaNs() && "fcmp should have simplified");
return new FCmpInst(FCmpInst::FCMP_ORD, X, I.getOperand(1));
+ case FCmpInst::FCMP_ULT:
+ // fabs(X) u< 0.0 --> isnan(X)
+ assert(!I.hasNoNaNs() && "fcmp should have simplified");
+ return new FCmpInst(FCmpInst::FCMP_UNO, X, I.getOperand(1));
+
case FCmpInst::FCMP_OEQ:
case FCmpInst::FCMP_UEQ:
case FCmpInst::FCMP_ONE:
define i1 @fabs_ult(double %a) {
; CHECK-LABEL: @fabs_ult(
-; CHECK-NEXT: [[CALL:%.*]] = call double @llvm.fabs.f64(double [[A:%.*]])
-; CHECK-NEXT: [[CMP:%.*]] = fcmp reassoc arcp ult double [[CALL]], 0.000000e+00
+; CHECK-NEXT: [[CMP:%.*]] = fcmp uno double [[A:%.*]], 0.000000e+00
; CHECK-NEXT: ret i1 [[CMP]]
;
%call = call double @llvm.fabs.f64(double %a)