[libc-commits] [libc] [libc][math] Fix missing LIBC_INLINE on exp_range_reduction() function (PR #103305)

via libc-commits libc-commits at lists.llvm.org
Tue Aug 13 09:13:42 PDT 2024


https://github.com/overmighty created https://github.com/llvm/llvm-project/pull/103305

See Buildbot failure:
https://lab.llvm.org/buildbot/#/builders/73/builds/3669.


>From fc127f39d75481841125fe05a1f271bca4912e45 Mon Sep 17 00:00:00 2001
From: OverMighty <its.overmighty at gmail.com>
Date: Tue, 13 Aug 2024 18:08:03 +0200
Subject: [PATCH] [libc][math] Fix missing LIBC_INLINE on exp_range_reduction()
 function

See Buildbot failure:
https://lab.llvm.org/buildbot/#/builders/73/builds/3669.
---
 libc/src/math/generic/CMakeLists.txt | 1 +
 libc/src/math/generic/expxf16.h      | 3 ++-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/libc/src/math/generic/CMakeLists.txt b/libc/src/math/generic/CMakeLists.txt
index faa910139fa355..745bd65e1d75b5 100644
--- a/libc/src/math/generic/CMakeLists.txt
+++ b/libc/src/math/generic/CMakeLists.txt
@@ -1367,6 +1367,7 @@ add_entrypoint_object(
     libc.src.__support.FPUtil.fp_bits
     libc.src.__support.FPUtil.polyeval
     libc.src.__support.FPUtil.rounding_mode
+    libc.src.__support.macros.attributes
     libc.src.__support.macros.optimization
   COMPILE_OPTIONS
     -O3
diff --git a/libc/src/math/generic/expxf16.h b/libc/src/math/generic/expxf16.h
index 53815e0e275533..a0db6cee438e92 100644
--- a/libc/src/math/generic/expxf16.h
+++ b/libc/src/math/generic/expxf16.h
@@ -13,6 +13,7 @@
 #include "src/__support/FPUtil/PolyEval.h"
 #include "src/__support/FPUtil/multiply_add.h"
 #include "src/__support/FPUtil/nearest_integer.h"
+#include "src/__support/macros/attributes.h"
 #include "src/__support/macros/config.h"
 #include <stdint.h>
 
@@ -45,7 +46,7 @@ struct ExpRangeReduction {
   float exp_lo;
 };
 
-ExpRangeReduction exp_range_reduction(float16 x) {
+LIBC_INLINE ExpRangeReduction exp_range_reduction(float16 x) {
   // For -18 < x < 12, to compute exp(x), we perform the following range
   // reduction: find hi, mid, lo, such that:
   //   x = hi + mid + lo, in which



More information about the libc-commits mailing list