Skip to content

Commit 70b90f1

Browse files
committed
fmin requires +0>-0
1 parent f8b9bba commit 70b90f1

File tree

1 file changed

+16
-8
lines changed

1 file changed

+16
-8
lines changed

llvm/docs/LangRef.rst

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16420,7 +16420,7 @@ versions of the intrinsics respect the exception behavior.
1642016420
- qNaN, invalid exception
1642116421

1642216422
* - ``+0.0 vs -0.0``
16423-
- either one
16423+
- +0.0(max)/-0.0(min)
1642416424
- +0.0(max)/-0.0(min)
1642516425
- +0.0(max)/-0.0(min)
1642616426

@@ -16464,8 +16464,14 @@ type.
1646416464

1646516465
Semantics:
1646616466
""""""""""
16467-
Follows the IEEE754 2008 semantics for minNum.
16468-
This also matches the current (C23) behavior of libm's fmin.
16467+
Follows the IEEE754 2008 semantics for minNum with +0.0>-0.0.
16468+
This is more strict than current (C23) behavior of libm's fmin.
16469+
Some applications like Clang, can call '``llvm.minnum.*``' with '``nsz``' attribute
16470+
to archive the same behaivor of libm's fmin.
16471+
16472+
For some architecturs, such as ARMv8, LoongArch, MIPSr6, PowerPC/VSX, they have the
16473+
strict same instructions; thus it is quite simple for these architectures.
16474+
For other architectures, the custom or expand methods may provide '``nsz``' flavor.
1646916475

1647016476
Historically, libc returns NUM for NUM vs (sNaN or qNaN), and may return
1647116477
sNaN for qNaN vs sNaN. Withe recent libc versions, libc follows IEEE754-2008:
@@ -16511,12 +16517,14 @@ type.
1651116517

1651216518
Semantics:
1651316519
""""""""""
16514-
Follows the IEEE754 2008 semantics for maxNum.
16515-
This also matches the current (C23) behavior of libm's fmax.
16520+
Follows the IEEE754 2008 semantics for maxNum with +0.0>-0.0.
16521+
This is more strict than current (C23) behavior of libm's fmax.
16522+
Some applications like Clang, can call '``llvm.maxnum.*``' with '``nsz``' attribute
16523+
to archive the same behaivor of libm's fmax.
1651616524

16517-
Historically, libc returns NUM for NUM vs (sNaN or qNaN), and may return
16518-
sNaN for qNaN vs sNaN. Withe recent libc versions, libc follows IEEE754-2008:
16519-
NUM vs sNaN -> qNaN; NUM vs qNaN -> NUM; qNaN vs sNaN -> qNaN; sNaN vs sNaN -> qNaN.
16525+
For some architecturs, such as ARMv8, LoongArch, MIPSr6, PowerPC/VSX, they have the
16526+
strict same instructions; thus it is quite simple for these architectures.
16527+
For other architectures, the custom or expand methods may provide '``nsz``' flavor.
1652016528

1652116529
If either operand is a NaN, returns the other non-NaN operand. Returns
1652216530
NaN only if both operands are NaN or either operand is sNaN.

0 commit comments

Comments
 (0)