[clang] [llvm] Intrinsic: introduce minimumnum and maximumnum (PR #93841)

YunQiang Su via cfe-commits cfe-commits at lists.llvm.org
Tue Jun 11 02:51:07 PDT 2024


================
@@ -15883,6 +15883,95 @@ The returned value is completely identical to the input except for the sign bit;
 in particular, if the input is a NaN, then the quiet/signaling bit and payload
 are perfectly preserved.
 
+.. _i_fminmax_family:
+
+'``llvm.min.*``' Intrinsics Comparation
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+Standard:
+"""""""""
+
+IEEE754 and ISO C define some min/max operations, and they have some differences
+on working with qNaN/sNaN and +0.0/-0.0. Here is the list:
+
+.. list-table::
+   :header-rows: 2
+
+   * - ``ISO C``
+     - fmin/fmax
+     - none
+     - fmininum/fmaximum
+     - fminimum_num/fmaximum_num
+
+   * - ``IEEE754``
+     - none
+     - nimNUM/maxNUM (2008)
+     - minimum/maximum (2019)
+     - minimumNumber/maximumNumber (2019)
+
+   * - ``+0.0 vs -0.0``
+     - either one
+     - +0.0 > -0.0
+     - +0.0 > -0.0
+     - +0.0 > -0.0
+
+   * - ``NUM/qNaN vs sNaN``
+     - qNaN, invalid exception
+     - qNaN, invalid exception
+     - qNaN, invalid exception
+     - NUM/qNaN, invalid exception
+
+   * - ``NUM/qNaN vs qNaN``
+     - NUM/qNaN, no excpetion
----------------
wzssyqa wrote:

For more details about sNaN on constrained intrinsics, we may need to update them in future PRs.
Since this PR is only about add `minimumnum and maximumnum`.

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


More information about the cfe-commits mailing list