# math.h entrypoints
libc.src.math.acosf
+ libc.src.math.asin
libc.src.math.asinf
libc.src.math.atanf
libc.src.math.atanhf
# math.h entrypoints
libc.src.math.acosf
+ libc.src.math.asin
libc.src.math.asinf
libc.src.math.atanf
libc.src.math.atanhf
# math.h entrypoints
libc.src.math.acosf
+ libc.src.math.asin
libc.src.math.asinf
libc.src.math.atanf
libc.src.math.atanhf
FunctionSpec<"acosf", RetValSpec<FloatType>, [ArgSpec<FloatType>]>,
FunctionSpec<"asinf", RetValSpec<FloatType>, [ArgSpec<FloatType>]>,
+ FunctionSpec<"asin", RetValSpec<DoubleType>, [ArgSpec<DoubleType>]>,
FunctionSpec<"atanf", RetValSpec<FloatType>, [ArgSpec<FloatType>]>,
FunctionSpec<"atanhf", RetValSpec<FloatType>, [ArgSpec<FloatType>]>,
)
add_math_entrypoint_object(acosf)
+
+add_math_entrypoint_object(asin)
add_math_entrypoint_object(asinf)
+
add_math_entrypoint_object(atanf)
add_math_entrypoint_object(atanhf)
--- /dev/null
+//===-- 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
-O3
)
+add_entrypoint_object(
+ asin
+ SRCS
+ asin.cpp
+ HDRS
+ ../asin.h
+ DEPENDS
+ .asinf
+ COMPILE_OPTIONS
+ -O3
+)
+
add_entrypoint_object(
acosf
SRCS
--- /dev/null
+//===-- 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
libc.src.__support.FPUtil.fp_bits
)
+add_fp_unittest(
+ asin_test
+ NEED_MPFR
+ SUITE
+ libc_math_unittests
+ SRCS
+ asin_test.cpp
+ DEPENDS
+ libc.include.errno
+ libc.src.errno.errno
+ libc.src.math.asin
+)
+
add_fp_unittest(
acosf_test
NEED_MPFR
--- /dev/null
+//===-- 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/math/asin.h"
+#include "utils/MPFRWrapper/MPFRUtils.h"
+#include "utils/UnitTest/FPMatcher.h"
+#include "utils/UnitTest/Test.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) {
+ 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);
+}