[libc-commits] [libc] [libc] Use -fno-math-errno to for __builtin_fma* to generate fma instructions. (PR #124200)

via libc-commits libc-commits at lists.llvm.org
Fri Jan 24 06:52:34 PST 2025


================
@@ -28,6 +28,13 @@ function(_get_compile_options_from_flags output_var)
       elseif(LIBC_TARGET_ARCHITECTURE_IS_RISCV64)
         list(APPEND compile_options "-D__LIBC_RISCV_USE_FMA")
       endif()
+      # For clang, we will build the math functions with `-fno-math-errno` so that
+      # __builtin_fma* will generate the fused-mutliply-add instructions.  We
+      # don't put the control flag to the public config yet, and see if it makes
+      # sense to just enable this flag by default.
+      if(LIBC_ADD_FNO_MATH_ERRNO)
----------------
lntue wrote:

I was planning to use the flag `LIBC_MATH_NO_ERRNO` differently, in the sense that our math functions entry points won't set or change errno, regardless of what `math_errhandling` is set to.  And another quite likely possibility that we can just add `-fno-math-errno` flag by default.  So right now I don't add it to our config generator config.json yet.  Maybe I should add it to config.json?

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


More information about the libc-commits mailing list