@@ -16936,7 +16936,7 @@ versions of the intrinsics respect the exception behavior.
16936
16936
- qNaN, invalid exception
16937
16937
16938
16938
* - ``+0.0 vs -0.0``
16939
- - +0.0(max)/-0.0(min)
16939
+ - either one
16940
16940
- +0.0(max)/-0.0(min)
16941
16941
- +0.0(max)/-0.0(min)
16942
16942
@@ -16980,30 +16980,21 @@ type.
16980
16980
16981
16981
Semantics:
16982
16982
""""""""""
16983
- Follows the semantics of minNum in IEEE-754-2008, except that -0.0 < +0.0 for the purposes
16984
- of this intrinsic. As for signaling NaNs, per the minNum semantics, if either operand is sNaN,
16985
- the result is qNaN. This matches the recommended behavior for the libm
16986
- function ``fmin``, although not all implementations have implemented these recommended behaviors.
16987
-
16988
- If either operand is a qNaN, returns the other non-NaN operand. Returns NaN only if both operands are
16989
- NaN or if either operand is sNaN. Note that arithmetic on an sNaN doesn't consistently produce a qNaN,
16990
- so arithmetic feeding into a minnum can produce inconsistent results. For example,
16991
- ``minnum(fadd(sNaN, -0.0), 1.0)`` can produce qNaN or 1.0 depending on whether ``fadd`` is folded.
16992
16983
16993
- IEEE-754-2008 defines minNum, and it was removed in IEEE-754-2019. As the replacement, IEEE-754-2019
16994
- defines :ref:`minimumNumber <i_minimumnum>` .
16984
+ Follows the IEEE-754 semantics for minNum, except for handling of
16985
+ signaling NaNs. This match's the behavior of libm's fmin .
16995
16986
16996
- If the intrinsic is marked with the nsz attribute, then the effect is as in the definition in C
16997
- and IEEE-754-2008: the result of ``minnum(-0.0, +0.0)`` may be either -0.0 or +0.0.
16987
+ If either operand is a NaN, returns the other non-NaN operand. Returns
16988
+ NaN only if both operands are NaN. If the operands compare equal,
16989
+ returns either one of the operands. For example, this means that
16990
+ fmin(+0.0, -0.0) returns either operand.
16998
16991
16999
- Some architectures, such as ARMv8 (FMINNM), LoongArch (fmin), MIPSr6 (min.fmt), PowerPC/VSX (xsmindp),
17000
- have instructions that match these semantics exactly; thus it is quite simple for these architectures.
17001
- Some architectures have similiar ones while they are not exact equivalent. Such as x86 implements ``MINPS``,
17002
- which implements the semantics of C code ``a<b?a:b``: NUM vs qNaN always return qNaN. ``MINPS`` can be used
17003
- if ``nsz`` and ``nnan`` are given.
17004
-
17005
- For existing libc implementations, the behaviors of fmin may be quite different on sNaN and signed zero behaviors,
17006
- even in the same release of a single libm implemention.
16992
+ Unlike the IEEE-754 2008 behavior, this does not distinguish between
16993
+ signaling and quiet NaN inputs. If a target's implementation follows
16994
+ the standard and returns a quiet NaN if either input is a signaling
16995
+ NaN, the intrinsic lowering is responsible for quieting the inputs to
16996
+ correctly return the non-NaN input (e.g. by using the equivalent of
16997
+ ``llvm.canonicalize``).
17007
16998
17008
16999
.. _i_maxnum:
17009
17000
@@ -17040,30 +17031,20 @@ type.
17040
17031
17041
17032
Semantics:
17042
17033
""""""""""
17043
- Follows the semantics of maxNum in IEEE-754-2008, except that -0.0 < +0.0 for the purposes
17044
- of this intrinsic. As for signaling NaNs, per the maxNum semantics, if either operand is sNaN,
17045
- the result is qNaN. This matches the recommended behavior for the libm
17046
- function ``fmax``, although not all implementations have implemented these recommended behaviors.
17047
-
17048
- If either operand is a qNaN, returns the other non-NaN operand. Returns NaN only if both operands are
17049
- NaN or if either operand is sNaN. Note that arithmetic on an sNaN doesn't consistently produce a qNaN,
17050
- so arithmetic feeding into a maxnum can produce inconsistent results. For example,
17051
- ``maxnum(fadd(sNaN, -0.0), 1.0)`` can produce qNaN or 1.0 depending on whether ``fadd`` is folded.
17034
+ Follows the IEEE-754 semantics for maxNum except for the handling of
17035
+ signaling NaNs. This matches the behavior of libm's fmax.
17052
17036
17053
- IEEE-754-2008 defines maxNum, and it was removed in IEEE-754-2019. As the replacement, IEEE-754-2019
17054
- defines :ref:`maximumNumber <i_maximumnum>`.
17037
+ If either operand is a NaN, returns the other non-NaN operand. Returns
17038
+ NaN only if both operands are NaN. If the operands compare equal,
17039
+ returns either one of the operands. For example, this means that
17040
+ fmax(+0.0, -0.0) returns either -0.0 or 0.0.
17055
17041
17056
- If the intrinsic is marked with the nsz attribute, then the effect is as in the definition in C
17057
- and IEEE-754-2008: the result of maxnum(-0.0, +0.0) may be either -0.0 or +0.0.
17058
-
17059
- Some architectures, such as ARMv8 (FMAXNM), LoongArch (fmax), MIPSr6 (max.fmt), PowerPC/VSX (xsmaxdp),
17060
- have instructions that match these semantics exactly; thus it is quite simple for these architectures.
17061
- Some architectures have similiar ones while they are not exact equivalent. Such as x86 implements ``MAXPS``,
17062
- which implements the semantics of C code ``a>b?a:b``: NUM vs qNaN always return qNaN. ``MAXPS`` can be used
17063
- if ``nsz`` and ``nnan`` are given.
17064
-
17065
- For existing libc implementations, the behaviors of fmin may be quite different on sNaN and signed zero behaviors,
17066
- even in the same release of a single libm implemention.
17042
+ Unlike the IEEE-754 2008 behavior, this does not distinguish between
17043
+ signaling and quiet NaN inputs. If a target's implementation follows
17044
+ the standard and returns a quiet NaN if either input is a signaling
17045
+ NaN, the intrinsic lowering is responsible for quieting the inputs to
17046
+ correctly return the non-NaN input (e.g. by using the equivalent of
17047
+ ``llvm.canonicalize``).
17067
17048
17068
17049
.. _i_minimum:
17069
17050
@@ -19942,8 +19923,12 @@ The '``llvm.vector.reduce.fmax.*``' intrinsics do a floating-point
19942
19923
matches the element-type of the vector input.
19943
19924
19944
19925
This instruction has the same comparison semantics as the '``llvm.maxnum.*``'
19945
- intrinsic. If the intrinsic call has the ``nnan`` fast-math flag, then the
19946
- operation can assume that NaNs are not present in the input vector.
19926
+ intrinsic. That is, the result will always be a number unless all elements of
19927
+ the vector are NaN. For a vector with maximum element magnitude 0.0 and
19928
+ containing both +0.0 and -0.0 elements, the sign of the result is unspecified.
19929
+
19930
+ If the intrinsic call has the ``nnan`` fast-math flag, then the operation can
19931
+ assume that NaNs are not present in the input vector.
19947
19932
19948
19933
Arguments:
19949
19934
""""""""""
@@ -19971,8 +19956,12 @@ The '``llvm.vector.reduce.fmin.*``' intrinsics do a floating-point
19971
19956
matches the element-type of the vector input.
19972
19957
19973
19958
This instruction has the same comparison semantics as the '``llvm.minnum.*``'
19974
- intrinsic. If the intrinsic call has the ``nnan`` fast-math flag, then the
19975
- operation can assume that NaNs are not present in the input vector.
19959
+ intrinsic. That is, the result will always be a number unless all elements of
19960
+ the vector are NaN. For a vector with minimum element magnitude 0.0 and
19961
+ containing both +0.0 and -0.0 elements, the sign of the result is unspecified.
19962
+
19963
+ If the intrinsic call has the ``nnan`` fast-math flag, then the operation can
19964
+ assume that NaNs are not present in the input vector.
19976
19965
19977
19966
Arguments:
19978
19967
""""""""""
@@ -22262,7 +22251,7 @@ This is an overloaded intrinsic.
22262
22251
Overview:
22263
22252
"""""""""
22264
22253
22265
- Predicated floating-point IEEE-754-2008 minNum of two vectors of floating-point values.
22254
+ Predicated floating-point IEEE-754 minNum of two vectors of floating-point values.
22266
22255
22267
22256
22268
22257
Arguments:
@@ -22311,7 +22300,7 @@ This is an overloaded intrinsic.
22311
22300
Overview:
22312
22301
"""""""""
22313
22302
22314
- Predicated floating-point IEEE-754-2008 maxNum of two vectors of floating-point values.
22303
+ Predicated floating-point IEEE-754 maxNum of two vectors of floating-point values.
22315
22304
22316
22305
22317
22306
Arguments:
@@ -23610,7 +23599,10 @@ result type. If only ``nnan`` is set then the neutral value is ``-Infinity``.
23610
23599
23611
23600
This instruction has the same comparison semantics as the
23612
23601
:ref:`llvm.vector.reduce.fmax <int_vector_reduce_fmax>` intrinsic (and thus the
23613
- '``llvm.maxnum.*``' intrinsic).
23602
+ '``llvm.maxnum.*``' intrinsic). That is, the result will always be a number
23603
+ unless all elements of the vector and the starting value are ``NaN``. For a
23604
+ vector with maximum element magnitude ``0.0`` and containing both ``+0.0`` and
23605
+ ``-0.0`` elements, the sign of the result is unspecified.
23614
23606
23615
23607
To ignore the start value, the neutral value can be used.
23616
23608
@@ -23677,7 +23669,10 @@ result type. If only ``nnan`` is set then the neutral value is ``+Infinity``.
23677
23669
23678
23670
This instruction has the same comparison semantics as the
23679
23671
:ref:`llvm.vector.reduce.fmin <int_vector_reduce_fmin>` intrinsic (and thus the
23680
- '``llvm.minnum.*``' intrinsic).
23672
+ '``llvm.minnum.*``' intrinsic). That is, the result will always be a number
23673
+ unless all elements of the vector and the starting value are ``NaN``. For a
23674
+ vector with maximum element magnitude ``0.0`` and containing both ``+0.0`` and
23675
+ ``-0.0`` elements, the sign of the result is unspecified.
23681
23676
23682
23677
To ignore the start value, the neutral value can be used.
23683
23678
@@ -28349,7 +28344,7 @@ The third argument specifies the exception behavior as described above.
28349
28344
Semantics:
28350
28345
""""""""""
28351
28346
28352
- This function follows the IEEE-754-2008 semantics for maxNum.
28347
+ This function follows the IEEE-754 semantics for maxNum.
28353
28348
28354
28349
28355
28350
'``llvm.experimental.constrained.minnum``' Intrinsic
@@ -28381,7 +28376,7 @@ The third argument specifies the exception behavior as described above.
28381
28376
Semantics:
28382
28377
""""""""""
28383
28378
28384
- This function follows the IEEE-754-2008 semantics for minNum.
28379
+ This function follows the IEEE-754 semantics for minNum.
28385
28380
28386
28381
28387
28382
'``llvm.experimental.constrained.maximum``' Intrinsic
0 commit comments