[llvm] LangRef: state explicitly that floats generally behave according to IEEE-754 (PR #102140)

Ralf Jung via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 12 10:51:00 PDT 2024


================
@@ -3577,6 +3577,12 @@ seq\_cst total orderings of other operations that are not marked
 Floating-Point Environment
 --------------------------
 
+Unless noted otherwise, LLVM works with IEEE 754 floating-point semantics: LLVM
+backends assume that the CPU is configured to provide IEEE-compatible behavior,
+and LLVM frontends can assume that LLVM IR floating-point operations behave
+according to the IEEE specification (with an :ref:`exception around NaN values
+<floatnan>`).
----------------
RalfJung wrote:

> This is also worded a bit broadly, and seems to contradict some of the text later in the section.

I assume you are talking about the exceptions related to NaN results? That's why it starts with "unless noted otherwise". I'm open for better wordings here if you have any suggestions.

> Maybe should specify the bitlayouts are assumed to be the IEEE pattern?

It already says that.

The goal of this PR is to say that `fadd` et al will use IEEE-754 rules to compute the desired results. That's a much stronger statement than just saying that the bitpatterns are interpreted as per IEEE-754.

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


More information about the llvm-commits mailing list