Skip to content

[libc][math] Refactor acoshf16 implementation to header-only in src/__support/math folder. #148568

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 16 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions libc/shared/math.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,23 @@

#include "libc_common.h"

#include "math/acos.h"
#include "math/acosf.h"
#include "math/acosf16.h"
#include "math/acoshf.h"
#include "math/acoshf16.h"
#include "math/erff.h"
#include "math/exp.h"
#include "math/exp10.h"
#include "math/exp10f.h"
#include "math/exp10f16.h"
#include "math/expf.h"
#include "math/expf16.h"
#include "math/frexpf.h"
#include "math/frexpf128.h"
#include "math/frexpf16.h"
#include "math/ldexpf.h"
#include "math/ldexpf128.h"
#include "math/ldexpf16.h"

#endif // LLVM_LIBC_SHARED_MATH_H
23 changes: 23 additions & 0 deletions libc/shared/math/acos.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
//===-- Shared acos function ------------------------------------*- 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_SHARED_MATH_ACOS_H
#define LLVM_LIBC_SHARED_MATH_ACOS_H

#include "shared/libc_common.h"
#include "src/__support/math/acos.h"

namespace LIBC_NAMESPACE_DECL {
namespace shared {

using math::acos;

} // namespace shared
} // namespace LIBC_NAMESPACE_DECL

#endif // LLVM_LIBC_SHARED_MATH_ACOS_H
23 changes: 23 additions & 0 deletions libc/shared/math/acosf.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
//===-- Shared acosf function -----------------------------------*- 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_SHARED_MATH_ACOSF_H
#define LLVM_LIBC_SHARED_MATH_ACOSF_H

#include "shared/libc_common.h"
#include "src/__support/math/acosf.h"

namespace LIBC_NAMESPACE_DECL {
namespace shared {

using math::acosf;

} // namespace shared
} // namespace LIBC_NAMESPACE_DECL

#endif // LLVM_LIBC_SHARED_MATH_ACOSF_H
29 changes: 29 additions & 0 deletions libc/shared/math/acosf16.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
//===-- Shared acosf16 function ---------------------------------*- 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_SHARED_MATH_ACOSF16_H
#define LLVM_LIBC_SHARED_MATH_ACOSF16_H

#include "include/llvm-libc-macros/float16-macros.h"

#ifdef LIBC_TYPES_HAS_FLOAT16

#include "shared/libc_common.h"
#include "src/__support/math/acosf16.h"

namespace LIBC_NAMESPACE_DECL {
namespace shared {

using math::acosf16;

} // namespace shared
} // namespace LIBC_NAMESPACE_DECL

#endif // LIBC_TYPES_HAS_FLOAT16

#endif // LLVM_LIBC_SHARED_MATH_ACOSF16_H
23 changes: 23 additions & 0 deletions libc/shared/math/acoshf.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
//===-- Shared acoshf function ----------------------------------*- 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_SHARED_MATH_ACOSHF_H
#define LLVM_LIBC_SHARED_MATH_ACOSHF_H

#include "shared/libc_common.h"
#include "src/__support/math/acoshf.h"

namespace LIBC_NAMESPACE_DECL {
namespace shared {

using math::acoshf;

} // namespace shared
} // namespace LIBC_NAMESPACE_DECL

#endif // LLVM_LIBC_SHARED_MATH_ACOSHF_H
29 changes: 29 additions & 0 deletions libc/shared/math/acoshf16.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
//===-- Shared acoshf16 function --------------------------------*- 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_SHARED_MATH_ACOSHF16_H
#define LLVM_LIBC_SHARED_MATH_ACOSHF16_H

#include "include/llvm-libc-macros/float16-macros.h"

#ifdef LIBC_TYPES_HAS_FLOAT16

#include "shared/libc_common.h"
#include "src/__support/math/acoshf16.h"

namespace LIBC_NAMESPACE_DECL {
namespace shared {

using math::acoshf16;

} // namespace shared
} // namespace LIBC_NAMESPACE_DECL

#endif // LIBC_TYPES_HAS_FLOAT16

#endif // LLVM_LIBC_SHARED_MATH_ACOSHF16_H
23 changes: 23 additions & 0 deletions libc/shared/math/erff.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
//===-- Shared erff function ------------------------------------*- 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_SHARED_MATH_ERFF_H
#define LLVM_LIBC_SHARED_MATH_ERFF_H

#include "shared/libc_common.h"
#include "src/__support/math/erff.h"

namespace LIBC_NAMESPACE_DECL {
namespace shared {

using math::erff;

} // namespace shared
} // namespace LIBC_NAMESPACE_DECL

#endif // LLVM_LIBC_SHARED_MATH_ERFF_H
23 changes: 23 additions & 0 deletions libc/shared/math/exp.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
//===-- Shared exp function -------------------------------------*- 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_SHARED_MATH_EXP_H
#define LLVM_LIBC_SHARED_MATH_EXP_H

#include "shared/libc_common.h"
#include "src/__support/math/exp.h"

namespace LIBC_NAMESPACE_DECL {
namespace shared {

using math::exp;

} // namespace shared
} // namespace LIBC_NAMESPACE_DECL

#endif // LLVM_LIBC_SHARED_MATH_EXP_H
23 changes: 23 additions & 0 deletions libc/shared/math/exp10.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
//===-- Shared exp10 function -----------------------------------*- 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_SHARED_MATH_EXP10_H
#define LLVM_LIBC_SHARED_MATH_EXP10_H

#include "shared/libc_common.h"
#include "src/__support/math/exp10.h"

namespace LIBC_NAMESPACE_DECL {
namespace shared {

using math::exp10;

} // namespace shared
} // namespace LIBC_NAMESPACE_DECL

#endif // LLVM_LIBC_SHARED_MATH_EXP10_H
24 changes: 24 additions & 0 deletions libc/shared/math/exp10f.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
//===-- Shared exp10f function -----------------------------------*- 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_SHARED_MATH_EXP10F_H
#define LLVM_LIBC_SHARED_MATH_EXP10F_H

#include "shared/libc_common.h"
#include "src/__support/math/exp10f.h"

namespace LIBC_NAMESPACE_DECL {
namespace shared {

using math::exp10f;

} // namespace shared
} // namespace LIBC_NAMESPACE_DECL

#endif // LLVM_LIBC_SHARED_MATH_EXP10F_H
29 changes: 29 additions & 0 deletions libc/shared/math/exp10f16.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
//===-- Shared exp10f16 function --------------------------------*- 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_SHARED_MATH_EXP10F_H
#define LLVM_LIBC_SHARED_MATH_EXP10F_H

#include "include/llvm-libc-macros/float16-macros.h"

#ifdef LIBC_TYPES_HAS_FLOAT16

#include "shared/libc_common.h"
#include "src/__support/math/exp10f16.h"

namespace LIBC_NAMESPACE_DECL {
namespace shared {

using math::exp10f16;

} // namespace shared
} // namespace LIBC_NAMESPACE_DECL

#endif // LIBC_TYPES_HAS_FLOAT16

#endif // LLVM_LIBC_SHARED_MATH_EXP10F_H
23 changes: 23 additions & 0 deletions libc/shared/math/ldexpf.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
//===-- Shared ldexpf function ----------------------------------*- 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_SHARED_MATH_LDEXPF_H
#define LLVM_LIBC_SHARED_MATH_LDEXPF_H

#include "shared/libc_common.h"
#include "src/__support/math/ldexpf.h"

namespace LIBC_NAMESPACE_DECL {
namespace shared {

using math::ldexpf;

} // namespace shared
} // namespace LIBC_NAMESPACE_DECL

#endif // LLVM_LIBC_SHARED_MATH_LDEXPF_H
29 changes: 29 additions & 0 deletions libc/shared/math/ldexpf128.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
//===-- Shared ldexpf128 function -------------------------------*- 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_SHARED_MATH_LDEXPF128_H
#define LLVM_LIBC_SHARED_MATH_LDEXPF128_H

#include "include/llvm-libc-types/float128.h"

#ifdef LIBC_TYPES_HAS_FLOAT128

#include "shared/libc_common.h"
#include "src/__support/math/ldexpf128.h"

namespace LIBC_NAMESPACE_DECL {
namespace shared {

using math::ldexpf128;

} // namespace shared
} // namespace LIBC_NAMESPACE_DECL

#endif // LIBC_TYPES_HAS_FLOAT128

#endif // LLVM_LIBC_SHARED_MATH_LDEXPF128_H
31 changes: 31 additions & 0 deletions libc/shared/math/ldexpf16.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
//===-- Shared ldexpf16 function --------------------------------*- 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_SHARED_MATH_ldexpf16_H
#define LLVM_LIBC_SHARED_MATH_ldexpf16_H

#include "include/llvm-libc-macros/float16-macros.h"

#ifdef LIBC_TYPES_HAS_FLOAT16

#include "shared/libc_common.h"
#include "src/__support/math/ldexpf16.h"

namespace LIBC_NAMESPACE_DECL {

namespace shared {

using math::ldexpf16;

} // namespace shared

} // namespace LIBC_NAMESPACE_DECL

#endif // LIBC_TYPES_HAS_FLOAT16

#endif // LLVM_LIBC_SHARED_MATH_ldexpf16_H
4 changes: 2 additions & 2 deletions libc/src/__support/FPUtil/double_double.h
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,8 @@ LIBC_INLINE DoubleDouble quick_mult(double a, const DoubleDouble &b) {
}

template <size_t SPLIT_B = 27>
LIBC_INLINE DoubleDouble quick_mult(const DoubleDouble &a,
const DoubleDouble &b) {
LIBC_INLINE constexpr DoubleDouble quick_mult(const DoubleDouble &a,
const DoubleDouble &b) {
DoubleDouble r = exact_mult<double, SPLIT_B>(a.hi, b.hi);
double t1 = multiply_add(a.hi, b.lo, r.lo);
double t2 = multiply_add(a.lo, b.hi, t1);
Expand Down
Loading
Loading