[libc-commits] [libc] f79264b - [libc][math] Remove placeholder implementations of asin and pow.

Tue Ly via libc-commits libc-commits at lists.llvm.org
Wed Apr 19 22:28:30 PDT 2023


Author: Tue Ly
Date: 2023-04-20T01:28:16-04:00
New Revision: f79264b5f66f54d9102d358ac00a3d8de25fada7

URL: https://github.com/llvm/llvm-project/commit/f79264b5f66f54d9102d358ac00a3d8de25fada7
DIFF: https://github.com/llvm/llvm-project/commit/f79264b5f66f54d9102d358ac00a3d8de25fada7.diff

LOG: [libc][math] Remove placeholder implementations of asin and pow.

Reviewed By: sivachandra

Differential Revision: https://reviews.llvm.org/D148781

Added: 
    

Modified: 
    libc/config/linux/aarch64/entrypoints.txt
    libc/config/linux/riscv64/entrypoints.txt
    libc/config/linux/x86_64/entrypoints.txt
    libc/config/windows/entrypoints.txt
    libc/src/math/CMakeLists.txt
    libc/src/math/generic/CMakeLists.txt
    libc/test/src/math/CMakeLists.txt

Removed: 
    libc/src/math/asin.h
    libc/src/math/generic/asin.cpp
    libc/src/math/generic/pow.cpp
    libc/src/math/pow.h
    libc/test/src/math/asin_test.cpp
    libc/test/src/math/pow_test.cpp


################################################################################
diff  --git a/libc/config/linux/aarch64/entrypoints.txt b/libc/config/linux/aarch64/entrypoints.txt
index 104c5dfa95904..a6413add96db5 100644
--- a/libc/config/linux/aarch64/entrypoints.txt
+++ b/libc/config/linux/aarch64/entrypoints.txt
@@ -220,7 +220,6 @@ set(TARGET_LIBM_ENTRYPOINTS
     # math.h entrypoints
     libc.src.math.acosf
     libc.src.math.acoshf
-    libc.src.math.asin
     libc.src.math.asinf
     libc.src.math.asinhf
     libc.src.math.atanf
@@ -296,7 +295,6 @@ set(TARGET_LIBM_ENTRYPOINTS
     libc.src.math.nextafter
     libc.src.math.nextafterf
     libc.src.math.nextafterl
-    libc.src.math.pow
     libc.src.math.remainderf
     libc.src.math.remainder
     libc.src.math.remainderl

diff  --git a/libc/config/linux/riscv64/entrypoints.txt b/libc/config/linux/riscv64/entrypoints.txt
index 19ff4e85b953c..6e1f8e30dea92 100644
--- a/libc/config/linux/riscv64/entrypoints.txt
+++ b/libc/config/linux/riscv64/entrypoints.txt
@@ -227,7 +227,6 @@ set(TARGET_LIBM_ENTRYPOINTS
     # math.h entrypoints
     libc.src.math.acosf
     libc.src.math.acoshf
-    libc.src.math.asin
     libc.src.math.asinf
     libc.src.math.asinhf
     libc.src.math.atanf
@@ -302,7 +301,6 @@ set(TARGET_LIBM_ENTRYPOINTS
     libc.src.math.nextafter
     libc.src.math.nextafterf
     libc.src.math.nextafterl
-    libc.src.math.pow
     libc.src.math.remainderf
     libc.src.math.remainder
     libc.src.math.remainderl

diff  --git a/libc/config/linux/x86_64/entrypoints.txt b/libc/config/linux/x86_64/entrypoints.txt
index c5093dbb615c2..0c084bba18cab 100644
--- a/libc/config/linux/x86_64/entrypoints.txt
+++ b/libc/config/linux/x86_64/entrypoints.txt
@@ -227,7 +227,6 @@ set(TARGET_LIBM_ENTRYPOINTS
     # math.h entrypoints
     libc.src.math.acosf
     libc.src.math.acoshf
-    libc.src.math.asin
     libc.src.math.asinf
     libc.src.math.asinhf
     libc.src.math.atanf
@@ -304,7 +303,6 @@ set(TARGET_LIBM_ENTRYPOINTS
     libc.src.math.nextafter
     libc.src.math.nextafterf
     libc.src.math.nextafterl
-    libc.src.math.pow
     libc.src.math.remainderf
     libc.src.math.remainder
     libc.src.math.remainderl

diff  --git a/libc/config/windows/entrypoints.txt b/libc/config/windows/entrypoints.txt
index d89ef042c26e9..0cfcb82713090 100644
--- a/libc/config/windows/entrypoints.txt
+++ b/libc/config/windows/entrypoints.txt
@@ -114,7 +114,6 @@ set(TARGET_LIBM_ENTRYPOINTS
     # math.h entrypoints
     libc.src.math.acosf
     libc.src.math.acoshf
-    libc.src.math.asin
     libc.src.math.asinf
     libc.src.math.asinhf
     libc.src.math.atanf    
@@ -191,7 +190,6 @@ set(TARGET_LIBM_ENTRYPOINTS
     libc.src.math.nextafter
     libc.src.math.nextafterf
     libc.src.math.nextafterl
-    libc.src.math.pow
     libc.src.math.remainderf
     libc.src.math.remainder
     libc.src.math.remainderl

diff  --git a/libc/src/math/CMakeLists.txt b/libc/src/math/CMakeLists.txt
index bc9a5d7a237f4..3189777af4d1b 100644
--- a/libc/src/math/CMakeLists.txt
+++ b/libc/src/math/CMakeLists.txt
@@ -43,7 +43,6 @@ endfunction()
 add_math_entrypoint_object(acosf)
 add_math_entrypoint_object(acoshf)
 
-add_math_entrypoint_object(asin)
 add_math_entrypoint_object(asinf)
 add_math_entrypoint_object(asinhf)
 
@@ -153,8 +152,6 @@ add_math_entrypoint_object(nextafter)
 add_math_entrypoint_object(nextafterf)
 add_math_entrypoint_object(nextafterl)
 
-add_math_entrypoint_object(pow)
-
 add_math_entrypoint_object(remainder)
 add_math_entrypoint_object(remainderf)
 add_math_entrypoint_object(remainderl)

diff  --git a/libc/src/math/asin.h b/libc/src/math/asin.h
deleted file mode 100644
index d8f3f191a3578..0000000000000
--- a/libc/src/math/asin.h
+++ /dev/null
@@ -1,18 +0,0 @@
-//===-- Implementation header for asin --------------------------*- C++ -*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_LIBC_SRC_MATH_ASIN_H
-#define LLVM_LIBC_SRC_MATH_ASIN_H
-
-namespace __llvm_libc {
-
-double asin(double x);
-
-} // namespace __llvm_libc
-
-#endif // LLVM_LIBC_SRC_MATH_ASIN_H

diff  --git a/libc/src/math/generic/CMakeLists.txt b/libc/src/math/generic/CMakeLists.txt
index ac48e9cef7a38..55e5d8de90044 100644
--- a/libc/src/math/generic/CMakeLists.txt
+++ b/libc/src/math/generic/CMakeLists.txt
@@ -1383,18 +1383,6 @@ add_entrypoint_object(
     -O3
 )
 
-add_entrypoint_object(
-  asin
-  SRCS
-    asin.cpp
-  HDRS
-    ../asin.h
-  DEPENDS
-    .asinf
-  COMPILE_OPTIONS
-    -O3
-)
-
 add_entrypoint_object(
   acosf
   SRCS
@@ -1428,19 +1416,6 @@ add_entrypoint_object(
     -O3
 )
 
-add_entrypoint_object(
-  pow
-  SRCS
-    pow.cpp
-  HDRS
-    ../pow.h
-  DEPENDS
-    .expf
-    .logf
-  COMPILE_OPTIONS
-    -O3
-)
-
 add_entrypoint_object(
   scalbn
   SRCS

diff  --git a/libc/src/math/generic/asin.cpp b/libc/src/math/generic/asin.cpp
deleted file mode 100644
index a53ae0a210376..0000000000000
--- a/libc/src/math/generic/asin.cpp
+++ /dev/null
@@ -1,22 +0,0 @@
-//===-- Double-precision asin function ------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#include "src/math/asin.h"
-#include "src/math/asinf.h"
-
-#include "src/__support/common.h"
-
-namespace __llvm_libc {
-
-LLVM_LIBC_FUNCTION(double, asin, (double x)) {
-  // Place-holder implementation for double precision asin function.
-  // TODO: Implement correctly rounded asin function for double precision.
-  return static_cast<double>(asinf(static_cast<float>(x)));
-}
-
-} // namespace __llvm_libc

diff  --git a/libc/src/math/generic/pow.cpp b/libc/src/math/generic/pow.cpp
deleted file mode 100644
index 77f866842e691..0000000000000
--- a/libc/src/math/generic/pow.cpp
+++ /dev/null
@@ -1,24 +0,0 @@
-//===-- Implementation of pow function ------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#include "src/math/pow.h"
-#include "src/math/expf.h"
-#include "src/math/logf.h"
-
-#include "src/__support/common.h"
-
-namespace __llvm_libc {
-
-LLVM_LIBC_FUNCTION(double, pow, (double x, double y)) {
-  // Place-holder implementation for double precision pow function.
-  // TODO: Implement correctly rounded pow function for double precision.
-  return static_cast<double>(
-      expf(static_cast<float>(y) * logf(static_cast<float>(x))));
-}
-
-} // namespace __llvm_libc

diff  --git a/libc/src/math/pow.h b/libc/src/math/pow.h
deleted file mode 100644
index 26fed175787a9..0000000000000
--- a/libc/src/math/pow.h
+++ /dev/null
@@ -1,18 +0,0 @@
-//===-- Implementation header for pow ---------------------------*- C++ -*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_LIBC_SRC_MATH_POW_H
-#define LLVM_LIBC_SRC_MATH_POW_H
-
-namespace __llvm_libc {
-
-double pow(double x, double y);
-
-} // namespace __llvm_libc
-
-#endif // LLVM_LIBC_SRC_MATH_POW_H

diff  --git a/libc/test/src/math/CMakeLists.txt b/libc/test/src/math/CMakeLists.txt
index c8fa74da00440..0cececdc0cdb4 100644
--- a/libc/test/src/math/CMakeLists.txt
+++ b/libc/test/src/math/CMakeLists.txt
@@ -1482,18 +1482,6 @@ add_fp_unittest(
     libc.src.__support.FPUtil.fp_bits
 )
 
-add_fp_unittest(
-  asin_test
-  NEED_MPFR
-  SUITE
-    libc_math_unittests
-  SRCS
-    asin_test.cpp
-  DEPENDS
-    libc.src.errno.errno
-    libc.src.math.asin
-)
-
 add_fp_unittest(
   acosf_test
   NEED_MPFR
@@ -1534,18 +1522,6 @@ add_fp_unittest(
     libc.src.__support.FPUtil.fp_bits
 )
 
-add_fp_unittest(
-  pow_test
-  NEED_MPFR
-  SUITE
-    libc_math_unittests
-  SRCS
-    pow_test.cpp
-  DEPENDS
-    libc.src.errno.errno
-    libc.src.math.pow
-)
-
 add_fp_unittest(
   scalbn_test
   NEED_MPFR

diff  --git a/libc/test/src/math/asin_test.cpp b/libc/test/src/math/asin_test.cpp
deleted file mode 100644
index 2ccbebfdb22bf..0000000000000
--- a/libc/test/src/math/asin_test.cpp
+++ /dev/null
@@ -1,42 +0,0 @@
-//===-- Unittests for asin ------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#include "src/errno/libc_errno.h"
-#include "src/math/asin.h"
-#include "test/UnitTest/FPMatcher.h"
-#include "test/UnitTest/Test.h"
-#include "utils/MPFRWrapper/MPFRUtils.h"
-#include <math.h>
-
-#include <errno.h>
-#include <stdint.h>
-
-using FPBits = __llvm_libc::fputil::FPBits<double>;
-
-namespace mpfr = __llvm_libc::testing::mpfr;
-
-DECLARE_SPECIAL_CONSTANTS(double)
-
-TEST(LlvmLibcAsinTest, SpecialNumbers) {
-  libc_errno = 0;
-
-  EXPECT_FP_EQ(aNaN, __llvm_libc::asin(aNaN));
-  EXPECT_MATH_ERRNO(0);
-
-  EXPECT_FP_EQ(0.0, __llvm_libc::asin(0.0));
-  EXPECT_MATH_ERRNO(0);
-
-  EXPECT_FP_EQ(-0.0, __llvm_libc::asin(-0.0));
-  EXPECT_MATH_ERRNO(0);
-
-  EXPECT_FP_EQ(aNaN, __llvm_libc::asin(inf));
-  EXPECT_MATH_ERRNO(EDOM);
-
-  EXPECT_FP_EQ(aNaN, __llvm_libc::asin(neg_inf));
-  EXPECT_MATH_ERRNO(EDOM);
-}

diff  --git a/libc/test/src/math/pow_test.cpp b/libc/test/src/math/pow_test.cpp
deleted file mode 100644
index eff578ae9e380..0000000000000
--- a/libc/test/src/math/pow_test.cpp
+++ /dev/null
@@ -1,38 +0,0 @@
-//===-- Unittests for pow -------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#include "src/errno/libc_errno.h"
-#include "src/math/pow.h"
-#include "test/UnitTest/FPMatcher.h"
-#include "test/UnitTest/Test.h"
-#include "utils/MPFRWrapper/MPFRUtils.h"
-#include <math.h>
-
-#include <errno.h>
-#include <stdint.h>
-
-using FPBits = __llvm_libc::fputil::FPBits<double>;
-
-namespace mpfr = __llvm_libc::testing::mpfr;
-
-DECLARE_SPECIAL_CONSTANTS(double)
-
-TEST(LlvmLibcAsinTest, SpecialNumbers) {
-  libc_errno = 0;
-
-  EXPECT_FP_EQ(aNaN, __llvm_libc::pow(aNaN, aNaN));
-  EXPECT_MATH_ERRNO(0);
-
-  EXPECT_FP_EQ(1.0, __llvm_libc::pow(1.0, 1.0));
-  EXPECT_MATH_ERRNO(0);
-
-  EXPECT_FP_EQ(1.0, __llvm_libc::pow(1.0, 2.0));
-  EXPECT_MATH_ERRNO(0);
-
-  EXPECT_FP_EQ(inf, __llvm_libc::pow(2.0, inf));
-}


        


More information about the libc-commits mailing list