[libc-commits] [libc] [libc] Set -fno-math-errno for FMA (PR #125752)

via libc-commits libc-commits at lists.llvm.org
Tue Feb 4 12:07:35 PST 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-libc

Author: Petr Hosek (petrhosek)

<details>
<summary>Changes</summary>

We need to set -fno-math-errno so __builtin_fma* generate the fused-multiply-add instructions rather than an fma call.

---
Full diff: https://github.com/llvm/llvm-project/pull/125752.diff


1 Files Affected:

- (modified) libc/src/__support/FPUtil/CMakeLists.txt (+8) 


``````````diff
diff --git a/libc/src/__support/FPUtil/CMakeLists.txt b/libc/src/__support/FPUtil/CMakeLists.txt
index 522b4afefd48d6..339bb58838564c 100644
--- a/libc/src/__support/FPUtil/CMakeLists.txt
+++ b/libc/src/__support/FPUtil/CMakeLists.txt
@@ -122,6 +122,10 @@ add_header_library(
     libc.src.__support.FPUtil.generic.fma
   FLAGS
     FMA_OPT
+  COMPILE_OPTIONS
+    # We need to set -fno-math-errno so __builtin_fma* generate
+    # the fused-mutliply-add instructions rather than an fma call.
+    -fno-math-errno
 )
 
 add_header_library(
@@ -132,6 +136,10 @@ add_header_library(
     libc.src.__support.common
   FLAGS
     FMA_OPT
+  COMPILE_OPTIONS
+    # We need to set -fno-math-errno so __builtin_fma* generate
+    # the fused-mutliply-add instructions rather than an fma call.
+    -fno-math-errno
 )
 
 add_header_library(

``````````

</details>


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


More information about the libc-commits mailing list