llvm/libc/src/math/generic/sincosf_utils.h

//===-- Collection of utils for sinf/cosf/sincosf ---------------*- 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_GENERIC_SINCOSF_UTILS_H
#define LLVM_LIBC_SRC_MATH_GENERIC_SINCOSF_UTILS_H

#include "src/__support/FPUtil/FPBits.h"
#include "src/__support/FPUtil/PolyEval.h"
#include "src/__support/macros/config.h"
#include "src/__support/macros/properties/cpu_features.h" // LIBC_TARGET_CPU_HAS_FMA

#if defined(LIBC_TARGET_CPU_HAS_FMA)
#include "range_reduction_fma.h"
// using namespace LIBC_NAMESPACE::fma;
using LIBC_NAMESPACE::fma::FAST_PASS_BOUND;
using LIBC_NAMESPACE::fma::large_range_reduction;
using LIBC_NAMESPACE::fma::small_range_reduction;

#else
#include "range_reduction.h"
// using namespace LIBC_NAMESPACE::generic;
FAST_PASS_BOUND;
large_range_reduction;
small_range_reduction;
#endif // LIBC_TARGET_CPU_HAS_FMA

namespace LIBC_NAMESPACE_DECL {

// Lookup table for sin(k * pi / 32) with k = 0, ..., 63.
// Table is generated with Sollya as follow:
// > display = hexadecimal;
// > for k from 0 to 63 do { D(sin(k * pi/32)); };
const double SIN_K_PI_OVER_32[64] =;

static LIBC_INLINE void sincosf_poly_eval(int64_t k, double y, double &sin_k,
                                          double &cos_k, double &sin_y,
                                          double &cosm1_y) {}

LIBC_INLINE void sincosf_eval(double xd, uint32_t x_abs, double &sin_k,
                              double &cos_k, double &sin_y, double &cosm1_y) {}

// Return k and y, where
//   k = round(x * 32) and y = (x * 32) - k.
//   => pi * x = (k + y) * pi / 32
static LIBC_INLINE int64_t range_reduction_sincospi(double x, double &y) {}

LIBC_INLINE void sincospif_eval(double xd, double &sin_k, double &cos_k,
                                double &sin_y, double &cosm1_y) {}

} // namespace LIBC_NAMESPACE_DECL

#endif // LLVM_LIBC_SRC_MATH_GENERIC_SINCOSF_UTILS_H