[PATCH] D106959: [PowerPC] swdiv builtins for XL compatibility
Eli Friedman via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Jul 30 13:39:09 PDT 2021
efriedma added inline comments.
================
Comment at: llvm/test/CodeGen/PowerPC/LowerCheckedFPArith.ll:36
+; CHECK-NEXT: %2 = fdiv fast float %0, %1
+; CHECK-NEXT: %3 = fcmp une float %2, %2
+; CHECK-NEXT: br i1 %3, label %swdiv_HWDIV, label %swdiv_MERGE
----------------
quinnp wrote:
> efriedma wrote:
> > A "fast" fdiv never produces NaN, per LangRef. Using fcmp like this is fragile at best.
> >
> > (Maybe you want "fdiv arcp"?)
> Thank you, I see what you mean. I have changed it to emit a `fdiv ninf arcp` instead of a `fdiv fast`. I included the `ninf` flag because without it the compiler doesn't produce the software div estimate.
ninf is also an issue, although maybe less likely to bite in practice. Consider what happens if someone passes infinity to swdivs: the fdiv reduces to poison, so the branch is undefined behavior.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D106959/new/
https://reviews.llvm.org/D106959
More information about the cfe-commits
mailing list