@@ -16131,6 +16131,96 @@ The returned value is completely identical to the input except for the sign bit;
16131
16131
in particular, if the input is a NaN, then the quiet/signaling bit and payload
16132
16132
are perfectly preserved.
16133
16133
16134
+ .. _i_fminmax_family:
16135
+
16136
+ '``llvm.min.*``' Intrinsics Comparation
16137
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
16138
+
16139
+ Standard:
16140
+ """""""""
16141
+
16142
+ IEEE754 and ISO C define some min/max operations, and they have some differences
16143
+ on working with qNaN/sNaN and +0.0/-0.0. Here is the list:
16144
+
16145
+ .. list-table::
16146
+ :header-rows: 2
16147
+
16148
+ * - ``ISO C``
16149
+ - fmin/fmax
16150
+ - fmininum/fmaximum
16151
+ - fminimum_num/fmaximum_num
16152
+
16153
+ * - ``IEEE754``
16154
+ - minNum/maxNum (2008)
16155
+ - minimum/maximum (2019)
16156
+ - minimumNumber/maximumNumber (2019)
16157
+
16158
+ * - ``+0.0 vs -0.0``
16159
+ - either one
16160
+ - +0.0 > -0.0
16161
+ - +0.0 > -0.0
16162
+
16163
+ * - ``NUM vs sNaN``
16164
+ - qNaN, invalid exception
16165
+ - qNaN, invalid exception
16166
+ - NUM, invalid exception
16167
+
16168
+ * - ``qNaN vs sNaN``
16169
+ - qNaN, invalid exception
16170
+ - qNaN, invalid exception
16171
+ - qNaN, invalid exception
16172
+
16173
+ * - ``NUM vs qNaN``
16174
+ - NUM, no exception
16175
+ - qNaN, no exception
16176
+ - NUM, no exception
16177
+
16178
+ LLVM Implementation:
16179
+ """"""""""""""""""""
16180
+
16181
+ LLVM implements all ISO C flavors as listed in this table, except in the
16182
+ default floating-point environment exceptions are ignored. The constrained
16183
+ versions of the intrinsics respect the exception behavior.
16184
+
16185
+ .. list-table::
16186
+ :header-rows: 1
16187
+ :widths: 16 28 28 28
16188
+
16189
+ * - Operation
16190
+ - minnum/maxnum
16191
+ - minimum/maximum
16192
+ - minimumnum/maximumnum
16193
+
16194
+ * - ``NUM vs qNaN``
16195
+ - NUM, no exception
16196
+ - qNaN, no exception
16197
+ - NUM, no exception
16198
+
16199
+ * - ``NUM vs sNaN``
16200
+ - qNaN, invalid exception
16201
+ - qNaN, invalid exception
16202
+ - NUM, invalid exception
16203
+
16204
+ * - ``qNaN vs sNaN``
16205
+ - qNaN, invalid exception
16206
+ - qNaN, invalid exception
16207
+ - qNaN, invalid exception
16208
+
16209
+ * - ``sNaN vs sNaN``
16210
+ - qNaN, invalid exception
16211
+ - qNaN, invalid exception
16212
+ - qNaN, invalid exception
16213
+
16214
+ * - ``+0.0 vs -0.0``
16215
+ - either one
16216
+ - +0.0(max)/-0.0(min)
16217
+ - +0.0(max)/-0.0(min)
16218
+
16219
+ * - ``NUM vs NUM``
16220
+ - larger(max)/smaller(min)
16221
+ - larger(max)/smaller(min)
16222
+ - larger(max)/smaller(min)
16223
+
16134
16224
.. _i_minnum:
16135
16225
16136
16226
'``llvm.minnum.*``' Intrinsic
@@ -16312,6 +16402,98 @@ of the two arguments. -0.0 is considered to be less than +0.0 for this
16312
16402
intrinsic. Note that these are the semantics specified in the draft of
16313
16403
IEEE 754-2019.
16314
16404
16405
+ .. _i_minimumnum:
16406
+
16407
+ '``llvm.minimumnum.*``' Intrinsic
16408
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
16409
+
16410
+ Syntax:
16411
+ """""""
16412
+
16413
+ This is an overloaded intrinsic. You can use ``llvm.minimumnum`` on any
16414
+ floating-point or vector of floating-point type. Not all targets support
16415
+ all types however.
16416
+
16417
+ ::
16418
+
16419
+ declare float @llvm.minimumnum.f32(float %Val0, float %Val1)
16420
+ declare double @llvm.minimumnum.f64(double %Val0, double %Val1)
16421
+ declare x86_fp80 @llvm.minimumnum.f80(x86_fp80 %Val0, x86_fp80 %Val1)
16422
+ declare fp128 @llvm.minimumnum.f128(fp128 %Val0, fp128 %Val1)
16423
+ declare ppc_fp128 @llvm.minimumnum.ppcf128(ppc_fp128 %Val0, ppc_fp128 %Val1)
16424
+
16425
+ Overview:
16426
+ """""""""
16427
+
16428
+ The '``llvm.minimumnum.*``' intrinsics return the minimum of the two
16429
+ arguments, not propagating NaNs and treating -0.0 as less than +0.0.
16430
+
16431
+
16432
+ Arguments:
16433
+ """"""""""
16434
+
16435
+ The arguments and return value are floating-point numbers of the same
16436
+ type.
16437
+
16438
+ Semantics:
16439
+ """"""""""
16440
+ If both operands are NaNs (including sNaN), returns qNaN. If one operand
16441
+ is NaN (including sNaN) and another operand is a number, return the number.
16442
+ Otherwise returns the lesser of the two arguments. -0.0 is considered to
16443
+ be less than +0.0 for this intrinsic.
16444
+
16445
+ Note that these are the semantics of minimumNumber specified in IEEE 754-2019.
16446
+
16447
+ It has some differences with '``llvm.minnum.*``':
16448
+ 1)'``llvm.minnum.*``' will return qNaN if either operand is sNaN.
16449
+ 2)'``llvm.minnum*``' may return either one if we compare +0.0 vs -0.0.
16450
+
16451
+ .. _i_maximumnum:
16452
+
16453
+ '``llvm.maximumnum.*``' Intrinsic
16454
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
16455
+
16456
+ Syntax:
16457
+ """""""
16458
+
16459
+ This is an overloaded intrinsic. You can use ``llvm.maximumnum`` on any
16460
+ floating-point or vector of floating-point type. Not all targets support
16461
+ all types however.
16462
+
16463
+ ::
16464
+
16465
+ declare float @llvm.maximumnum.f32(float %Val0, float %Val1)
16466
+ declare double @llvm.maximumnum.f64(double %Val0, double %Val1)
16467
+ declare x86_fp80 @llvm.maximumnum.f80(x86_fp80 %Val0, x86_fp80 %Val1)
16468
+ declare fp128 @llvm.maximumnum.f128(fp128 %Val0, fp128 %Val1)
16469
+ declare ppc_fp128 @llvm.maximumnum.ppcf128(ppc_fp128 %Val0, ppc_fp128 %Val1)
16470
+
16471
+ Overview:
16472
+ """""""""
16473
+
16474
+ The '``llvm.maximumnum.*``' intrinsics return the maximum of the two
16475
+ arguments, not propagating NaNs and treating -0.0 as less than +0.0.
16476
+
16477
+
16478
+ Arguments:
16479
+ """"""""""
16480
+
16481
+ The arguments and return value are floating-point numbers of the same
16482
+ type.
16483
+
16484
+ Semantics:
16485
+ """"""""""
16486
+ If both operands are NaNs (including sNaN), returns qNaN. If one operand
16487
+ is NaN (including sNaN) and another operand is a number, return the number.
16488
+ Otherwise returns the greater of the two arguments. -0.0 is considered to
16489
+ be less than +0.0 for this intrinsic.
16490
+
16491
+ Note that these are the semantics of maximumNumber specified in IEEE 754-2019.
16492
+
16493
+ It has some differences with '``llvm.maxnum.*``':
16494
+ 1)'``llvm.maxnum.*``' will return qNaN if either operand is sNaN.
16495
+ 2)'``llvm.maxnum*``' may return either one if we compare +0.0 vs -0.0.
16496
+
16315
16497
.. _int_copysign:
16316
16498
16317
16499
'``llvm.copysign.*``' Intrinsic
0 commit comments