[libc-commits] [libc] [libc][math] Implement double precision sin correctly rounded to all rounding modes. (PR #95736)

via libc-commits libc-commits at lists.llvm.org
Thu Jun 20 09:02:31 PDT 2024


================
@@ -1,19 +0,0 @@
-//===-- Implementation of the sin function for x86_64 ---------------------===//
-//
-// 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 "src/__support/common.h"
-
-namespace LIBC_NAMESPACE {
-
-LLVM_LIBC_FUNCTION(double, sin, (double x)) {
-  __asm__ __volatile__("fsin" : "+t"(x));
----------------
lntue wrote:

it's the old x87 instruction, standing for `Floating-point sin`, which is neither fast nor accurate:
https://members.loria.fr/PZimmermann/papers/accuracy.pdf listed the maximum observed errors are +Inf,
the CORE-MATH perf test reported the instruction is 2.5x slower than glibc's software implementation.

https://github.com/llvm/llvm-project/pull/95736


More information about the libc-commits mailing list