[libc-commits] [llvm] [libc] [libc][bazel] Add powf target and fix bazel overlay. (PR #71464)

via libc-commits libc-commits at lists.llvm.org
Mon Nov 6 15:54:16 PST 2023


https://github.com/lntue created https://github.com/llvm/llvm-project/pull/71464

None

>From c5b8cfbae37c302158e3671a271634c71693123a Mon Sep 17 00:00:00 2001
From: Tue Ly <lntue at google.com>
Date: Mon, 6 Nov 2023 18:52:11 -0500
Subject: [PATCH] [libc][bazel] Add powf target and fix bazel overlay.

---
 libc/src/math/generic/exp10f_impl.h           |  1 -
 .../llvm-project-overlay/libc/BUILD.bazel     | 46 ++++++++++++++++---
 .../libc/test/src/math/BUILD.bazel            |  7 +++
 3 files changed, 47 insertions(+), 7 deletions(-)

diff --git a/libc/src/math/generic/exp10f_impl.h b/libc/src/math/generic/exp10f_impl.h
index 6fe542649400276..24888b7d4c98f5d 100644
--- a/libc/src/math/generic/exp10f_impl.h
+++ b/libc/src/math/generic/exp10f_impl.h
@@ -19,7 +19,6 @@
 #include "src/__support/FPUtil/rounding_mode.h"
 #include "src/__support/common.h"
 #include "src/__support/macros/optimization.h" // LIBC_UNLIKELY
-#include "src/math/exp10f.h"
 
 #include <errno.h>
 
diff --git a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
index f2449cbfc17045d..c3f82eb7f69e31d 100644
--- a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
@@ -1271,9 +1271,10 @@ libc_math_function(
     ],
 )
 
-libc_math_function(
-    name = "exp10f",
-    additional_deps = [
+libc_support_library(
+    name = "exp10f_impl",
+    hdrs = ["src/math/generic/exp10f_impl.h"],
+    deps = [
         ":__support_fputil_fma",
         ":__support_fputil_multiply_add",
         ":__support_fputil_nearest_integer",
@@ -1285,6 +1286,13 @@ libc_math_function(
     ],
 )
 
+libc_math_function(
+    name = "exp10f",
+    additional_deps = [
+        ":exp10f_impl",
+    ],
+)
+
 libc_math_function(
     name = "exp2",
     additional_deps = [
@@ -1301,9 +1309,10 @@ libc_math_function(
     ],
 )
 
-libc_math_function(
-    name = "exp2f",
-    additional_deps = [
+libc_support_library(
+    name = "exp2f_impl",
+    hdrs = ["src/math/generic/exp2f_impl.h"],
+    deps = [
         ":__support_fputil_fma",
         ":__support_fputil_multiply_add",
         ":__support_fputil_nearest_integer",
@@ -1315,6 +1324,13 @@ libc_math_function(
     ],
 )
 
+libc_math_function(
+    name = "exp2f",
+    additional_deps = [
+        ":exp2f_impl",
+    ],
+)
+
 libc_math_function(
     name = "logf",
     additional_deps = [
@@ -1546,6 +1562,24 @@ libc_math_function(
     ],
 )
 
+libc_math_function(
+    name = "powf",
+    additional_deps = [
+        ":__support_fputil_double_double",
+        ":__support_fputil_multiply_add",
+        ":__support_fputil_nearest_integer",
+        ":__support_fputil_polyeval",
+        ":__support_fputil_rounding_mode",
+        ":__support_fputil_sqrt",
+        ":__support_fputil_triple_double",
+        ":__support_macros_optimization",
+        ":common_constants",
+        ":explogxf",
+        ":exp2f_impl",
+        ":exp10f_impl",
+    ],
+)
+
 libc_math_function(name = "fabs")
 
 libc_math_function(name = "fabsf")
diff --git a/utils/bazel/llvm-project-overlay/libc/test/src/math/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/test/src/math/BUILD.bazel
index f2ce0d54803b584..22df9fa494ead24 100644
--- a/utils/bazel/llvm-project-overlay/libc/test/src/math/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/libc/test/src/math/BUILD.bazel
@@ -760,6 +760,13 @@ math_test(
     ],
 )
 
+math_test(
+    name = "powf",
+    deps = [
+        "//libc/utils/MPFRWrapper:mpfr_wrapper",
+    ],
+)
+
 math_test(
     name = "fmod",
     hdrs = ["FModTest.h"],



More information about the libc-commits mailing list