[llvm] LangRef: Clarify llvm.minnum and llvm.maxnum about sNaN (PR #112852)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Sun Oct 20 08:20:06 PDT 2024


================
@@ -16464,8 +16464,8 @@ type.
 
 Semantics:
 """"""""""
-Follows the IEEE754 2008 semantics for minNum, except for handling of
-+0.0 vs -0.0. This matches the behavior of libm's fmin.
+Follows the IEEE754 2008 semantics for minNum.
+This also matches the behavior of libm's fmin.
----------------
arsenm wrote:

> For some architectures, such as X86/ARM-preV8/MIPS-prer6, it will need more work to archive +0.0>-0.0.

Correct, these will need some kind of lowering code.

> So I think that we should have a intrinsic just suite for libc's fmin/fmax.

No, you can implement these with an nsz flag on the one intrinsic with the stricter definition. You should end up with the same codegen if you know the sign of zero is insignificant. The last thing we need is more min/max intrinsic variants.

> we can export ISD::FMINNUM_IEEE as an new intrinsic.

There should be no new intrinsic. FMINNUM_IEEE should just be the minnum behavior for the existing intrinsic

https://github.com/llvm/llvm-project/pull/112852


More information about the llvm-commits mailing list