[llvm] [IR][AsmParser] Revamp how floating-point literals work in LLVM IR. (PR #121838)
Jay Foad via llvm-commits
llvm-commits at lists.llvm.org
Wed Jan 15 02:05:12 PST 2025
================
@@ -4595,11 +4595,13 @@ Simple Constants
zeros. So '``s0x0001``' of type '``i16``' will be -1, not 1.
**Floating-point constants**
Floating-point constants use standard decimal notation (e.g.
- 123.421), exponential notation (e.g. 1.23421e+2), or a more precise
- hexadecimal notation (see below). The assembler requires the exact
- decimal value of a floating-point constant. For example, the
- assembler accepts 1.25 but rejects 1.3 because 1.3 is a repeating
- decimal in binary. Floating-point constants must have a
+ 123.421), exponential notation (e.g. 1.23421e+2), standard hexadecimal
+ notation (e.g., 0x1.3effp-43), one of several special values, or a
+ precise bitstring for the underlying value. When converting decimal and
+ hexadecimal literals to the floating-point type, the value is converted
+ using the default rounding mode (round to nearest, half to even). String
+ conversions that underflow to 0 or overflow to infinity are not permitted.
----------------
jayfoad wrote:
Allowing rounding seems nice. Any particular reason not to allow overflow/underflow? Just being conservative?
https://github.com/llvm/llvm-project/pull/121838
More information about the llvm-commits
mailing list