[PATCH] D50804: DAG: Fix isKnownNeverNaN for basic non-sNaN cases
Sanjay Patel via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 16 06:54:32 PDT 2018
spatel added a comment.
The change should be visible in tests because there's a DAGCombine that uses isKnownNeverNaN()?
Try the following with:
$ llc -o - fmaxnm.ll -mtriple=aarch64 -enable-no-signed-zeros-fp-math
; 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
}
https://reviews.llvm.org/D50804
More information about the llvm-commits
mailing list