[libc-commits] [libc] [libc] Set -fno-math-errno for FMA (PR #125752)
Petr Hosek via libc-commits
libc-commits at lists.llvm.org
Tue Feb 4 12:07:11 PST 2025
https://github.com/petrhosek created https://github.com/llvm/llvm-project/pull/125752
We need to set -fno-math-errno so __builtin_fma* generate the fused-multiply-add instructions rather than an fma call.
>From 672cc84ffbf61dbf0ab04e65357b4e819a098d87 Mon Sep 17 00:00:00 2001
From: Petr Hosek <phosek at google.com>
Date: Tue, 4 Feb 2025 20:03:57 +0000
Subject: [PATCH] [libc] Set -fno-math-errno for FMA
We need to set -fno-math-errno so __builtin_fma* generate the
fused-multiply-add instructions rather than an fma call.
---
libc/src/__support/FPUtil/CMakeLists.txt | 8 ++++++++
1 file changed, 8 insertions(+)
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(
More information about the libc-commits
mailing list