[clang] [llvm] [AsmWriter] Print `nan`, `pinf`, and `ninf` when applicable (PR #105618)

Matt Arsenault via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 21 22:48:35 PDT 2024


================
@@ -4426,6 +4425,32 @@ represented by ``0xH`` followed by 4 hexadecimal digits. The bfloat 16-bit
 format is represented by ``0xR`` followed by 4 hexadecimal digits. All
 hexadecimal formats are big-endian (sign bit at the left).
 
+Some of the special floating point values can be represented by the following
+identifiers:
+
+    +-------------------+---------------------------------------------------+
+    | Name              | Description                                       |
+    +===================+===================================================+
+    | ``nan``           | Positive quiet NaN w/ payload equal to zero       |
+    +-------------------+---------------------------------------------------+
+    | ``qnan(payload)`` | Positive quiet NaN w/ custom payload              |
+    +-------------------+---------------------------------------------------+
+    | ``snan(payload)`` | Positive signaling NaN w/ custom payload          |
+    +-------------------+---------------------------------------------------+
+    | ``pinf``          | Positive infinity                                 |
+    +-------------------+---------------------------------------------------+
+    | ``ninf``          | Negative infinity                                 |
+    +-------------------+---------------------------------------------------+
+
+Please be careful when specifying the payload of ``snan`` and ``qnan``: the parser
+always uses a ``double`` to carry floating point constants before converting it to
+the target type. In some conversion cases, converting to ``float`` for instance,
----------------
arsenm wrote:

I'd expect the payload to just be an integer 

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


More information about the cfe-commits mailing list