[libc-commits] [libc] [libc][math] Implement double precision sin correctly rounded to all rounding modes. (PR #95736)
Nick Desaulniers via libc-commits
libc-commits at lists.llvm.org
Tue Jun 18 10:29:25 PDT 2024
================
@@ -0,0 +1,570 @@
+//===-- Double-precision sin 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/sin.h"
+#include "hdr/errno_macros.h"
+#include "src/__support/FPUtil/FEnvImpl.h"
+#include "src/__support/FPUtil/FPBits.h"
+#include "src/__support/FPUtil/PolyEval.h"
+#include "src/__support/FPUtil/double_double.h"
+#include "src/__support/FPUtil/dyadic_float.h"
+#include "src/__support/FPUtil/multiply_add.h"
+#include "src/__support/FPUtil/nearest_integer.h"
+#include "src/__support/FPUtil/rounding_mode.h"
+#include "src/__support/common.h"
+#include "src/__support/macros/optimization.h" // LIBC_UNLIKELY
+#include "src/__support/macros/properties/cpu_features.h" // LIBC_TARGET_CPU_HAS_FMA
+
+#include "range_reduction_double_fma.h"
+
+#ifdef LIBC_TARGET_CPU_HAS_FMA
+using LIBC_NAMESPACE::fma::range_reduction_small;
+#else
+#include "range_reduction_double.h"
+using LIBC_NAMESPACE::generic::range_reduction_small;
+#endif // LIBC_TARGET_CPU_HAS_FMA
+
+// TODO: Implement generic's range_reduction_large correctly rounded for all
+// rounding modes. The current fma's range_reduction_large only works for
+// round-to-nearest without FMA instruction.
+using LIBC_NAMESPACE::fma::range_reduction_large;
+using LIBC_NAMESPACE::fma::range_reduction_large_f128;
+using LIBC_NAMESPACE::fma::range_reduction_small_f128;
+
+#include "sincos_eval.h"
----------------
nickdesaulniers wrote:
Consider using the fuller path for this, then include it in the include block L9-L21.
https://github.com/llvm/llvm-project/pull/95736
More information about the libc-commits
mailing list