[libc-commits] [libc] d5f0634 - [libc] add flag for FP_*LOGB0/NAN values (#86723)
via libc-commits
libc-commits at lists.llvm.org
Wed Mar 27 15:10:02 PDT 2024
Author: Michael Jones
Date: 2024-03-27T15:09:57-07:00
New Revision: d5f06342a3007f414c783ba42cb49453a9cee835
URL: https://github.com/llvm/llvm-project/commit/d5f06342a3007f414c783ba42cb49453a9cee835
DIFF: https://github.com/llvm/llvm-project/commit/d5f06342a3007f414c783ba42cb49453a9cee835.diff
LOG: [libc] add flag for FP_*LOGB0/NAN values (#86723)
These values vary by system, this flag allows you to toggle their value.
Added:
Modified:
libc/include/llvm-libc-macros/math-macros.h
utils/bazel/llvm-project-overlay/libc/BUILD.bazel
Removed:
################################################################################
diff --git a/libc/include/llvm-libc-macros/math-macros.h b/libc/include/llvm-libc-macros/math-macros.h
index 03c7a823e6e96b..1497e32044e975 100644
--- a/libc/include/llvm-libc-macros/math-macros.h
+++ b/libc/include/llvm-libc-macros/math-macros.h
@@ -31,10 +31,15 @@
#define NAN __builtin_nanf("")
#define FP_ILOGB0 (-INT_MAX - 1)
-#define FP_ILOGBNAN INT_MAX
-
#define FP_LLOGB0 (-LONG_MAX - 1)
+
+#ifdef __FP_LOGBNAN_MIN
+#define FP_ILOGBNAN (-INT_MAX - 1)
+#define FP_LLOGBNAN (-LONG_MAX - 1)
+#else
+#define FP_ILOGBNAN INT_MAX
#define FP_LLOGBNAN LONG_MAX
+#endif
#ifdef __FAST_MATH__
#define math_errhandling 0
diff --git a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
index eb0afbb6dd6ffe..acdf9349fd5868 100644
--- a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
@@ -68,6 +68,7 @@ libc_support_library(
name = "llvm_libc_macros_math_macros",
hdrs = ["include/llvm-libc-macros/math-macros.h"],
deps = [":llvm_libc_macros_limits_macros"],
+ defines = ["__FP_LOGBNAN_MIN"],
)
libc_support_library(
More information about the libc-commits
mailing list