fadd/fsub/fmul need to worry about infinities as well as fdiv.
No test because the combines that care about the non-sNaN case are interfered with by matching compare and select patterns in the IR.
Differential D50804
DAG: Fix isKnownNeverNaN for basic non-sNaN cases Authored by arsenm on Aug 15 2018, 1:34 PM.
Details
fadd/fsub/fmul need to worry about infinities as well as fdiv. No test because the combines that care about the non-sNaN case are interfered with by matching compare and select patterns in the IR.
Diff Detail Event TimelineComment Actions The change should be visible in tests because there's a DAGCombine that uses isKnownNeverNaN()? Try the following with: ; This should codegen to fmaxnm with no-signed-zeros.
define float @fmaxnm(i32 %i1, i32 %i2) {
%f1 = uitofp i32 %i1 to float
%fadd1 = fadd float %f1, 11.0
%f2 = uitofp i32 %i2 to float
%fadd2 = fadd float %f2, 17.0
%cmp = fcmp uge float %fadd1, %fadd2
%val = select i1 %cmp, float %fadd1, float %fadd2
ret float %val
}
; If i1 is 0, fmul is NaN because 0.0 * -INF = NaN
; Therefore, this is not fmaxnm.
define float @not_fmaxnm(i32 %i1, i32 %i2) {
%f1 = uitofp i32 %i1 to float
%fmul = fmul float %f1, 0xfff0000000000000 ; -INFINITY as 64-bit hex
%f2 = uitofp i32 %i2 to float
%fadd2 = fadd float %f2, 17.0
%cmp = fcmp uge float %fmul, %fadd2
%val = select i1 %cmp, float %fmul, float %fadd2
ret float %val
} |