[llvm] [libc] add sin/cos/tan functions to bazel build file (PR #101756)

via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 5 11:04:04 PDT 2024


https://github.com/RoseZhang03 updated https://github.com/llvm/llvm-project/pull/101756

>From f030a06bbe4e0664303e5c1b41af3b63d2a443d5 Mon Sep 17 00:00:00 2001
From: Rose Zhang <rosezhang at google.com>
Date: Fri, 2 Aug 2024 21:44:25 +0000
Subject: [PATCH 1/2] [libc] add sin/cos/tan functions to bazel build file

Needed to add sin/cos/tan fuzz tests to google3
---
 .../llvm-project-overlay/libc/BUILD.bazel     | 39 +++++++++++++++++++
 1 file changed, 39 insertions(+)

diff --git a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
index 253b89216a88f..32bc69544f031 100644
--- a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
@@ -2070,6 +2070,17 @@ libc_math_function(name = "fmaxl")
 
 libc_math_function(name = "fmaxf128")
 
+libc_math_function(
+    name = "cos",
+    additional_deps = [
+        ":__support_fputil_fma",
+        ":__support_macros_optimization",
+        ":__support_macros_properties_cpu_features",
+        ":range_reduction",
+        ":sincosf_utils",
+    ],
+)
+
 libc_math_function(
     name = "cosf",
     additional_deps = [
@@ -2081,6 +2092,20 @@ libc_math_function(
     ],
 )
 
+libc_math_function(
+    name = "sin",
+    additional_deps = [
+        ":__support_fputil_fma",
+        ":__support_fputil_multiply_add",
+        ":__support_fputil_polyeval",
+        ":__support_fputil_rounding_mode",
+        ":__support_macros_optimization",
+        ":__support_macros_properties_cpu_features",
+        ":range_reduction",
+        ":sincosf_utils",
+    ],
+)
+
 libc_math_function(
     name = "sincosf",
     additional_deps = [
@@ -2107,6 +2132,20 @@ libc_math_function(
     ],
 )
 
+libc_math_function(
+    name = "tan",
+    additional_deps = [
+        ":__support_fputil_fma",
+        ":__support_fputil_multiply_add",
+        ":__support_fputil_polyeval",
+        ":__support_fputil_rounding_mode",
+        ":__support_macros_optimization",
+        ":__support_macros_properties_cpu_features",
+        ":range_reduction",
+        ":sincosf_utils",
+    ],
+)
+
 libc_math_function(
     name = "tanf",
     additional_deps = [

>From c4c6ecf1715b6bc40535575aae37a3f86e5a457f Mon Sep 17 00:00:00 2001
From: Rose Zhang <rosezhang at google.com>
Date: Mon, 5 Aug 2024 18:03:44 +0000
Subject: [PATCH 2/2] bazel build file matches google3

---
 .../llvm-project-overlay/libc/BUILD.bazel     | 76 ++++++++++++++-----
 1 file changed, 58 insertions(+), 18 deletions(-)

diff --git a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
index 32bc69544f031..8f2007153e409 100644
--- a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
@@ -1427,6 +1427,41 @@ libc_support_library(
     ],
 )
 
+libc_support_library(
+    name = "range_reduction_double",
+    hdrs = [
+        "src/math/generic/range_reduction_double_common.h",
+        "src/math/generic/range_reduction_double_fma.h",
+        "src/math/generic/range_reduction_double_nofma.h",
+    ],
+    deps = [
+        ":__support_common",
+        ":__support_fputil_double_double",
+        ":__support_fputil_dyadic_float",
+        ":__support_fputil_fp_bits",
+        ":__support_fputil_multiply_add",
+        ":__support_fputil_nearest_integer",
+        ":__support_fputil_rounding_mode",
+        ":__support_integer_literals",
+    ],
+)
+
+libc_support_library(
+    name = "sincos_eval",
+    hdrs = [
+        "src/math/generic/sincos_eval.h",
+    ],
+    deps = [
+        ":__support_common",
+        ":__support_fputil_double_double",
+        ":__support_fputil_dyadic_float",
+        ":__support_fputil_fp_bits",
+        ":__support_fputil_multiply_add",
+        ":__support_fputil_polyeval",
+        ":__support_integer_literals",
+    ],
+)
+
 libc_support_library(
     name = "sincosf_utils",
     hdrs = ["src/math/generic/sincosf_utils.h"],
@@ -2071,50 +2106,47 @@ libc_math_function(name = "fmaxl")
 libc_math_function(name = "fmaxf128")
 
 libc_math_function(
-    name = "cos",
+    name = "cosf",
     additional_deps = [
         ":__support_fputil_fma",
+        ":__support_fputil_multiply_add",
         ":__support_macros_optimization",
         ":__support_macros_properties_cpu_features",
-        ":range_reduction",
         ":sincosf_utils",
     ],
 )
 
 libc_math_function(
-    name = "cosf",
+    name = "cos",
     additional_deps = [
-        ":__support_fputil_fma",
         ":__support_fputil_multiply_add",
         ":__support_macros_optimization",
         ":__support_macros_properties_cpu_features",
-        ":sincosf_utils",
+        ":range_reduction_double",
+        ":sincos_eval",
     ],
 )
 
 libc_math_function(
-    name = "sin",
+    name = "sincosf",
     additional_deps = [
         ":__support_fputil_fma",
         ":__support_fputil_multiply_add",
-        ":__support_fputil_polyeval",
         ":__support_fputil_rounding_mode",
         ":__support_macros_optimization",
         ":__support_macros_properties_cpu_features",
-        ":range_reduction",
         ":sincosf_utils",
     ],
 )
 
 libc_math_function(
-    name = "sincosf",
+    name = "sincos",
     additional_deps = [
-        ":__support_fputil_fma",
         ":__support_fputil_multiply_add",
-        ":__support_fputil_rounding_mode",
         ":__support_macros_optimization",
         ":__support_macros_properties_cpu_features",
-        ":sincosf_utils",
+        ":range_reduction_double",
+        ":sincos_eval",
     ],
 )
 
@@ -2133,16 +2165,13 @@ libc_math_function(
 )
 
 libc_math_function(
-    name = "tan",
+    name = "sin",
     additional_deps = [
-        ":__support_fputil_fma",
         ":__support_fputil_multiply_add",
-        ":__support_fputil_polyeval",
-        ":__support_fputil_rounding_mode",
         ":__support_macros_optimization",
         ":__support_macros_properties_cpu_features",
-        ":range_reduction",
-        ":sincosf_utils",
+        ":range_reduction_double",
+        ":sincos_eval",
     ],
 )
 
@@ -2160,6 +2189,17 @@ libc_math_function(
     ],
 )
 
+libc_math_function(
+    name = "tan",
+    additional_deps = [
+        ":__support_fputil_multiply_add",
+        ":__support_macros_optimization",
+        ":__support_macros_properties_cpu_features",
+        ":range_reduction_double",
+        ":sincos_eval",
+    ],
+)
+
 libc_math_function(
     name = "sqrt",
     additional_deps = [



More information about the llvm-commits mailing list