[PATCH] D137444: InstCombine: Fold compare with smallest normal if input denormals are flushed

Matt Arsenault via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 4 10:02:16 PDT 2022


arsenm created this revision.
arsenm added reviewers: spatel, kpn, scanon, andrew.w.kaylor.
Herald added a subscriber: hiraditya.
Herald added a project: All.
arsenm requested review of this revision.
Herald added a subscriber: wdng.
Herald added a project: LLVM.

Try to simplify comparisons with the smallest normalized value. If
denormals will be treated as 0, we can simplify by using an equality
comparison with 0.

      

fcmp olt fabs(x), smallest_normalized_number -> fcmp oeq x, 0.0
fcmp ult fabs(x), smallest_normalized_number -> fcmp ueq x, 0.0
fcmp oge fabs(x), smallest_normalized_number -> fcmp one x, 0.0
fcmp ult fabs(x), smallest_normalized_number -> fcmp ueq x, 0.0

      

The device libraries have a few range checks that look like
this for denormal handling paths.


https://reviews.llvm.org/D137444

Files:
  llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
  llvm/test/Transforms/InstCombine/fcmp-denormals-are-zero.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D137444.473276.patch
Type: text/x-patch
Size: 21617 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20221104/aba80b43/attachment.bin>


More information about the llvm-commits mailing list