Currently the fsub optimizations in InstSimplify don't know how to fold X - +0.0 to X when using the constrained intrinsics. This adds the support.
This review is split out from D107285.
Paths
| Differential D118928
[FPEnv][InstSimplify] Fold fsub X, +0 ==> X ClosedPublic Authored by kpn on Feb 3 2022, 11:13 AM.
Details Summary Currently the fsub optimizations in InstSimplify don't know how to fold X - +0.0 to X when using the constrained intrinsics. This adds the support. This review is split out from D107285.
Diff Detail
Event Timeline
Comment Actions
Sounds great! I tried to play with this case, but got failure: https://alive2.llvm.org/ce/z/BV68q5 . Comment Actions
let's ping @regehr to see if he has time to update the online version. Comment Actions Update for review comments: don't fold away a case that can and should result in -0.0. Add tests for this very case. This revision is now accepted and ready to land.Feb 14 2022, 8:08 AM This revision was landed with ongoing or failed builds.Feb 14 2022, 8:57 AM Closed by commit rG22bd65fbe7ec: [FPEnv][InstSimplify] Fold fsub X, +0 ==> X (authored by kpn). · Explain Why This revision was automatically updated to reflect the committed changes.
Revision Contents
Diff 405717 llvm/lib/Analysis/InstructionSimplify.cpp
llvm/test/Transforms/InstSimplify/strictfp-fsub.ll
|
What if X==+0 and rounding is downward? In this case fsub X, +0 should produce -0.0 (https://en.wikipedia.org/wiki/Signed_zero#Arithmetic).