[libc-commits] [libc] [libc][math] Add scalbln{, f, l, f128} math functions (PR #102219)
via libc-commits
libc-commits at lists.llvm.org
Wed Aug 7 14:59:41 PDT 2024
https://github.com/aaryanshukla updated https://github.com/llvm/llvm-project/pull/102219
>From 94ce69a992969fc10d209e74605a30a792dabdae Mon Sep 17 00:00:00 2001
From: Aaryan Shukla <aaryanshukla at google.com>
Date: Sat, 3 Aug 2024 03:07:51 +0000
Subject: [PATCH 1/8] 1/5
---
libc/src/math/generic/scalbln.cpp | 19 ++++++++++++++++++
libc/src/math/generic/scalblnf.cpp | 19 ++++++++++++++++++
libc/src/math/generic/scalblnf128.cpp | 19 ++++++++++++++++++
libc/src/math/generic/scalblnl.cpp | 19 ++++++++++++++++++
libc/src/math/scalbln.h | 20 +++++++++++++++++++
libc/src/math/scalblnf.h | 20 +++++++++++++++++++
libc/src/math/scalblnf128.h | 20 +++++++++++++++++++
libc/src/math/scalblnl.h | 20 +++++++++++++++++++
libc/test/src/math/smoke/scalbln_test.cpp | 13 ++++++++++++
libc/test/src/math/smoke/scalblnf128_test.cpp | 13 ++++++++++++
libc/test/src/math/smoke/scalblnf_test.cpp | 13 ++++++++++++
libc/test/src/math/smoke/scalblnl_test.cpp | 13 ++++++++++++
12 files changed, 208 insertions(+)
create mode 100644 libc/src/math/generic/scalbln.cpp
create mode 100644 libc/src/math/generic/scalblnf.cpp
create mode 100644 libc/src/math/generic/scalblnf128.cpp
create mode 100644 libc/src/math/generic/scalblnl.cpp
create mode 100644 libc/src/math/scalbln.h
create mode 100644 libc/src/math/scalblnf.h
create mode 100644 libc/src/math/scalblnf128.h
create mode 100644 libc/src/math/scalblnl.h
create mode 100644 libc/test/src/math/smoke/scalbln_test.cpp
create mode 100644 libc/test/src/math/smoke/scalblnf128_test.cpp
create mode 100644 libc/test/src/math/smoke/scalblnf_test.cpp
create mode 100644 libc/test/src/math/smoke/scalblnl_test.cpp
diff --git a/libc/src/math/generic/scalbln.cpp b/libc/src/math/generic/scalbln.cpp
new file mode 100644
index 00000000000000..564d5e21ced137
--- /dev/null
+++ b/libc/src/math/generic/scalbln.cpp
@@ -0,0 +1,19 @@
+//===-- Implementation of scalbln 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/scalbln.h"
+#include "src/__support/common.h"
+#include "src/__support/macros/config.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+LLVM_LIBC_FUNCTION(float, scalbln, (double x, long n)) {
+ // TODO: Implement function.
+}
+
+} // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/math/generic/scalblnf.cpp b/libc/src/math/generic/scalblnf.cpp
new file mode 100644
index 00000000000000..60189c6832cd8e
--- /dev/null
+++ b/libc/src/math/generic/scalblnf.cpp
@@ -0,0 +1,19 @@
+//===-- Implementation of scalblnf 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/scalblnf.h"
+#include "src/__support/common.h"
+#include "src/__support/macros/config.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+LLVM_LIBC_FUNCTION(float, scalblnf, (float x, long n)) {
+ // TODO: Implement function.
+}
+
+} // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/math/generic/scalblnf128.cpp b/libc/src/math/generic/scalblnf128.cpp
new file mode 100644
index 00000000000000..760febb0f5d6f7
--- /dev/null
+++ b/libc/src/math/generic/scalblnf128.cpp
@@ -0,0 +1,19 @@
+//===-- Implementation of scalblnf128 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/scalblnf128.h"
+#include "src/__support/common.h"
+#include "src/__support/macros/config.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+LLVM_LIBC_FUNCTION(float, scalblnf128, (float128 x, long n)) {
+ // TODO: Implement function.
+}
+
+} // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/math/generic/scalblnl.cpp b/libc/src/math/generic/scalblnl.cpp
new file mode 100644
index 00000000000000..b7f9028bb114ed
--- /dev/null
+++ b/libc/src/math/generic/scalblnl.cpp
@@ -0,0 +1,19 @@
+//===-- Implementation of scalblnl 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/scalblnl.h"
+#include "src/__support/common.h"
+#include "src/__support/macros/config.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+LLVM_LIBC_FUNCTION(float, scalblnl, (long double x, long n)) {
+ // TODO: Implement function.
+}
+
+} // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/math/scalbln.h b/libc/src/math/scalbln.h
new file mode 100644
index 00000000000000..80f44784aa589f
--- /dev/null
+++ b/libc/src/math/scalbln.h
@@ -0,0 +1,20 @@
+//===-- Implementation header for scalbln -----------------------*- 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_SCALBLN_H
+#define LLVM_LIBC_SRC_MATH_SCALBLN_H
+
+#include "src/__support/macros/config.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+float scalbln(double x, long n);
+
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SRC_MATH_SCALBLN_H
diff --git a/libc/src/math/scalblnf.h b/libc/src/math/scalblnf.h
new file mode 100644
index 00000000000000..a757f528e78564
--- /dev/null
+++ b/libc/src/math/scalblnf.h
@@ -0,0 +1,20 @@
+//===-- Implementation header for scalblnf ----------------------*- 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_SCALBLNF_H
+#define LLVM_LIBC_SRC_MATH_SCALBLNF_H
+
+#include "src/__support/macros/config.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+float scalblnf(float x, long n);
+
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SRC_MATH_SCALBLNF_H
diff --git a/libc/src/math/scalblnf128.h b/libc/src/math/scalblnf128.h
new file mode 100644
index 00000000000000..626bcd20c43cf0
--- /dev/null
+++ b/libc/src/math/scalblnf128.h
@@ -0,0 +1,20 @@
+//===-- Implementation header for scalblnf128 -------------------*- 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_SCALBLNF128_H
+#define LLVM_LIBC_SRC_MATH_SCALBLNF128_H
+
+#include "src/__support/macros/config.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+float scalblnf128(float128 x, long n);
+
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SRC_MATH_SCALBLNF128_H
diff --git a/libc/src/math/scalblnl.h b/libc/src/math/scalblnl.h
new file mode 100644
index 00000000000000..4b1823d1faa7d2
--- /dev/null
+++ b/libc/src/math/scalblnl.h
@@ -0,0 +1,20 @@
+//===-- Implementation header for scalblnl ----------------------*- 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_SCALBLNL_H
+#define LLVM_LIBC_SRC_MATH_SCALBLNL_H
+
+#include "src/__support/macros/config.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+float scalblnl(long double x, long n);
+
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SRC_MATH_SCALBLNL_H
diff --git a/libc/test/src/math/smoke/scalbln_test.cpp b/libc/test/src/math/smoke/scalbln_test.cpp
new file mode 100644
index 00000000000000..d163c9b6332eae
--- /dev/null
+++ b/libc/test/src/math/smoke/scalbln_test.cpp
@@ -0,0 +1,13 @@
+//===-- Unittests for scalbln ---------------------------------------------===//
+//
+// 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 "ScalbnTest.h"
+
+#include "src/math/scalbln.h"
+
+LIST_SCALBN_TESTS(double, LIBC_NAMESPACE::scalbln)
diff --git a/libc/test/src/math/smoke/scalblnf128_test.cpp b/libc/test/src/math/smoke/scalblnf128_test.cpp
new file mode 100644
index 00000000000000..6dfed0b894d027
--- /dev/null
+++ b/libc/test/src/math/smoke/scalblnf128_test.cpp
@@ -0,0 +1,13 @@
+//===-- Unittests for scalblnf128 -----------------------------------------===//
+//
+// 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 "ScalbnTest.h"
+
+#include "src/math/scalblnf128.h"
+
+LIST_SCALBN_TESTS(float128, LIBC_NAMESPACE::scalblnf128)
diff --git a/libc/test/src/math/smoke/scalblnf_test.cpp b/libc/test/src/math/smoke/scalblnf_test.cpp
new file mode 100644
index 00000000000000..b2790943f242a4
--- /dev/null
+++ b/libc/test/src/math/smoke/scalblnf_test.cpp
@@ -0,0 +1,13 @@
+//===-- Unittests for scalblnf --------------------------------------------===//
+//
+// 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 "ScalbnTest.h"
+
+#include "src/math/scalblnf.h"
+
+LIST_SCALBN_TESTS(float, LIBC_NAMESPACE::scalblnf)
diff --git a/libc/test/src/math/smoke/scalblnl_test.cpp b/libc/test/src/math/smoke/scalblnl_test.cpp
new file mode 100644
index 00000000000000..e7870ea8dbfade
--- /dev/null
+++ b/libc/test/src/math/smoke/scalblnl_test.cpp
@@ -0,0 +1,13 @@
+//===-- Unittests for scalblnl --------------------------------------------===//
+//
+// 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 "ScalbnTest.h"
+
+#include "src/math/scalblnl.h"
+
+LIST_SCALBN_TESTS(float, LIBC_NAMESPACE::scalblnl)
>From 0ca82761d6266c1c47b75d7c5a961bd5d7bc0029 Mon Sep 17 00:00:00 2001
From: Aaryan Shukla <aaryanshukla at google.com>
Date: Mon, 5 Aug 2024 19:18:55 +0000
Subject: [PATCH 2/8] added to config
---
libc/config/darwin/arm/entrypoints.txt | 3 +++
libc/config/linux/aarch64/entrypoints.txt | 1 +
2 files changed, 4 insertions(+)
diff --git a/libc/config/darwin/arm/entrypoints.txt b/libc/config/darwin/arm/entrypoints.txt
index 3e4cb3cebce9b0..18e6dbcd96cb7c 100644
--- a/libc/config/darwin/arm/entrypoints.txt
+++ b/libc/config/darwin/arm/entrypoints.txt
@@ -240,6 +240,9 @@ set(TARGET_LIBM_ENTRYPOINTS
libc.src.math.round
libc.src.math.roundf
libc.src.math.roundl
+ libc.src.math.scalbln
+ libc.src.math.scalblnf
+ libc.src.math.scalblnl
libc.src.math.scalbn
libc.src.math.scalbnf
libc.src.math.scalbnl
diff --git a/libc/config/linux/aarch64/entrypoints.txt b/libc/config/linux/aarch64/entrypoints.txt
index ebdaa0f6de7fd2..e160b2f58c78c9 100644
--- a/libc/config/linux/aarch64/entrypoints.txt
+++ b/libc/config/linux/aarch64/entrypoints.txt
@@ -661,6 +661,7 @@ if(LIBC_TYPES_HAS_FLOAT128)
libc.src.math.rintf128
libc.src.math.roundf128
libc.src.math.roundevenf128
+ libc.src.math.scalblnf128
libc.src.math.scalbnf128
libc.src.math.setpayloadf128
libc.src.math.sqrtf128
>From 0b423143f105b2260540e1f04b98736fe121dbbd Mon Sep 17 00:00:00 2001
From: Aaryan Shukla <aaryanshukla at google.com>
Date: Tue, 6 Aug 2024 20:44:10 +0000
Subject: [PATCH 3/8] [libc][c23][math] scalbln
---
libc/config/baremetal/arm/entrypoints.txt | 3 +
libc/config/baremetal/riscv/entrypoints.txt | 3 +
libc/config/gpu/entrypoints.txt | 2 +
libc/config/linux/aarch64/entrypoints.txt | 3 +
libc/config/linux/arm/entrypoints.txt | 3 +
libc/config/linux/riscv/entrypoints.txt | 4 +
libc/config/linux/x86_64/entrypoints.txt | 4 +
libc/config/windows/entrypoints.txt | 3 +
libc/docs/math/index.rst | 4 +-
libc/newhdrgen/yaml/math.yaml | 613 ++++++++++--------
libc/spec/llvm_libc_ext.td | 3 +
libc/spec/stdc.td | 5 +-
libc/src/math/CMakeLists.txt | 4 +
libc/src/math/generic/CMakeLists.txt | 55 ++
libc/src/math/generic/scalbln.cpp | 10 +-
libc/src/math/generic/scalblnf.cpp | 8 +-
libc/src/math/generic/scalblnf128.cpp | 10 +-
libc/src/math/generic/scalblnl.cpp | 10 +-
libc/src/math/scalbln.h | 2 +-
libc/src/math/scalblnf128.h | 3 +-
libc/src/math/scalblnl.h | 3 +-
libc/test/src/math/smoke/CMakeLists.txt | 52 ++
libc/test/src/math/smoke/scalbln_test.cpp | 2 +-
libc/test/src/math/smoke/scalblnf128_test.cpp | 2 +-
libc/test/src/math/smoke/scalblnf_test.cpp | 2 +-
libc/test/src/math/smoke/scalblnl_test.cpp | 2 +-
26 files changed, 510 insertions(+), 305 deletions(-)
diff --git a/libc/config/baremetal/arm/entrypoints.txt b/libc/config/baremetal/arm/entrypoints.txt
index ef145e994a3d1e..78dd334c87f909 100644
--- a/libc/config/baremetal/arm/entrypoints.txt
+++ b/libc/config/baremetal/arm/entrypoints.txt
@@ -387,6 +387,9 @@ set(TARGET_LIBM_ENTRYPOINTS
libc.src.math.roundevenl
libc.src.math.roundf
libc.src.math.roundl
+ libc.src.math.scalbln
+ libc.src.math.scalblnf
+ libc.src.math.scalblnl
libc.src.math.scalbn
libc.src.math.scalbnf
libc.src.math.scalbnl
diff --git a/libc/config/baremetal/riscv/entrypoints.txt b/libc/config/baremetal/riscv/entrypoints.txt
index be41f9a13aac21..ad1c0b12887254 100644
--- a/libc/config/baremetal/riscv/entrypoints.txt
+++ b/libc/config/baremetal/riscv/entrypoints.txt
@@ -382,6 +382,9 @@ set(TARGET_LIBM_ENTRYPOINTS
libc.src.math.roundevenl
libc.src.math.roundf
libc.src.math.roundl
+ libc.src.math.scalbln
+ libc.src.math.scalblnf
+ libc.src.math.scalblnl
libc.src.math.scalbn
libc.src.math.scalbnf
libc.src.math.scalbnl
diff --git a/libc/config/gpu/entrypoints.txt b/libc/config/gpu/entrypoints.txt
index 8d29e7e2e253b2..48554df2200b87 100644
--- a/libc/config/gpu/entrypoints.txt
+++ b/libc/config/gpu/entrypoints.txt
@@ -333,6 +333,8 @@ set(TARGET_LIBM_ENTRYPOINTS
libc.src.math.rintf
libc.src.math.round
libc.src.math.roundf
+ libc.src.math.scalbln
+ libc.src.math.scalblnf
libc.src.math.scalbn
libc.src.math.scalbnf
libc.src.math.sin
diff --git a/libc/config/linux/aarch64/entrypoints.txt b/libc/config/linux/aarch64/entrypoints.txt
index e160b2f58c78c9..ffb6a12b5635a4 100644
--- a/libc/config/linux/aarch64/entrypoints.txt
+++ b/libc/config/linux/aarch64/entrypoints.txt
@@ -513,6 +513,9 @@ set(TARGET_LIBM_ENTRYPOINTS
libc.src.math.roundevenl
libc.src.math.roundf
libc.src.math.roundl
+ libc.src.math.scalbln
+ libc.src.math.scalblnl
+ libc.src.math.scalblnf
libc.src.math.scalbn
libc.src.math.scalbnf
libc.src.math.scalbnl
diff --git a/libc/config/linux/arm/entrypoints.txt b/libc/config/linux/arm/entrypoints.txt
index 90aae962080cd4..31b4a2c7bf9139 100644
--- a/libc/config/linux/arm/entrypoints.txt
+++ b/libc/config/linux/arm/entrypoints.txt
@@ -363,6 +363,9 @@ set(TARGET_LIBM_ENTRYPOINTS
libc.src.math.round
libc.src.math.roundf
libc.src.math.roundl
+ libc.src.math.scalbln
+ libc.src.math.scalblnf
+ libc.src.math.scalblnl
libc.src.math.scalbn
libc.src.math.scalbnf
libc.src.math.scalbnl
diff --git a/libc/config/linux/riscv/entrypoints.txt b/libc/config/linux/riscv/entrypoints.txt
index 29969fce6adf84..61835b06bdb79d 100644
--- a/libc/config/linux/riscv/entrypoints.txt
+++ b/libc/config/linux/riscv/entrypoints.txt
@@ -536,6 +536,9 @@ set(TARGET_LIBM_ENTRYPOINTS
libc.src.math.roundevenl
libc.src.math.roundf
libc.src.math.roundl
+ libc.src.math.scalbln
+ libc.src.math.scalblnf
+ libc.src.math.scalblnl
libc.src.math.scalbn
libc.src.math.scalbnf
libc.src.math.scalbnl
@@ -615,6 +618,7 @@ if(LIBC_TYPES_HAS_FLOAT128)
libc.src.math.rintf128
libc.src.math.roundevenf128
libc.src.math.roundf128
+ libc.src.math.scalblnf128
libc.src.math.scalbnf128
libc.src.math.sqrtf128
libc.src.math.totalorderf128
diff --git a/libc/config/linux/x86_64/entrypoints.txt b/libc/config/linux/x86_64/entrypoints.txt
index 2ed287dc8542e3..4d21d6d0bc8c83 100644
--- a/libc/config/linux/x86_64/entrypoints.txt
+++ b/libc/config/linux/x86_64/entrypoints.txt
@@ -536,6 +536,9 @@ set(TARGET_LIBM_ENTRYPOINTS
libc.src.math.roundevenl
libc.src.math.roundf
libc.src.math.roundl
+ libc.src.math.scalbln
+ libc.src.math.scalblnf
+ libc.src.math.scalblnl
libc.src.math.scalbn
libc.src.math.scalbnf
libc.src.math.scalbnl
@@ -706,6 +709,7 @@ if(LIBC_TYPES_HAS_FLOAT128)
libc.src.math.rintf128
libc.src.math.roundevenf128
libc.src.math.roundf128
+ libc.src.math.scalblnf128
libc.src.math.scalbnf128
libc.src.math.setpayloadf128
libc.src.math.sqrtf128
diff --git a/libc/config/windows/entrypoints.txt b/libc/config/windows/entrypoints.txt
index b7aac225ee0557..814b2c628b20fc 100644
--- a/libc/config/windows/entrypoints.txt
+++ b/libc/config/windows/entrypoints.txt
@@ -253,6 +253,9 @@ set(TARGET_LIBM_ENTRYPOINTS
libc.src.math.round
libc.src.math.roundf
libc.src.math.roundl
+ libc.src.math.scalbln
+ libc.src.math.scalblnf
+ libc.src.math.scalblnl
libc.src.math.scalbn
libc.src.math.scalbnf
libc.src.math.scalbnl
diff --git a/libc/docs/math/index.rst b/libc/docs/math/index.rst
index defd075d109973..e3524bdb1688f1 100644
--- a/libc/docs/math/index.rst
+++ b/libc/docs/math/index.rst
@@ -210,7 +210,7 @@ Basic Operations
+------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+
| nextup | |check| | |check| | |check| | |check| | |check| | 7.12.11.5 | F.10.8.5 |
+------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+
-| remainder | |check| | |check| | |check| | |check| | | 7.12.10.2 | F.10.7.2 |
+| remainder | |check| | |check| | |check| | |check| | |check| | 7.12.10.2 | F.10.7.2 |
+------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+
| remquo | |check| | |check| | |check| | |check| | |check| | 7.12.10.3 | F.10.7.3 |
+------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+
@@ -220,7 +220,7 @@ Basic Operations
+------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+
| roundeven | |check| | |check| | |check| | |check| | |check| | 7.12.9.8 | F.10.6.8 |
+------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+
-| scalbln | | | | |check| | | 7.12.6.19 | F.10.3.19 |
+| scalbln | |check| | |check| | |check| | |check| | |check| | 7.12.6.19 | F.10.3.19 |
+------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+
| scalbn | |check| | |check| | |check| | |check| | |check| | 7.12.6.19 | F.10.3.19 |
+------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+
diff --git a/libc/newhdrgen/yaml/math.yaml b/libc/newhdrgen/yaml/math.yaml
index ce562c653a6d21..aa5467ba6c2663 100644
--- a/libc/newhdrgen/yaml/math.yaml
+++ b/libc/newhdrgen/yaml/math.yaml
@@ -20,306 +20,306 @@ functions:
arguments:
- type: float
- name: copysign
- standards:
+ standards:
- stdc
return_type: double
arguments:
- type: double
- type: double
- name: copysignf
- standards:
+ standards:
- stdc
return_type: float
arguments:
- type: float
- type: float
- name: copysignl
- standards:
+ standards:
- stdc
return_type: long double
arguments:
- type: long double
- type: long double
- name: ceil
- standards:
+ standards:
- stdc
return_type: double
arguments:
- type: double
- name: ceilf
- standards:
+ standards:
- stdc
return_type: float
arguments:
- type: float
- name: ceill
- standards:
+ standards:
- stdc
return_type: long double
arguments:
- type: long double
- name: fabs
- standards:
+ standards:
- stdc
return_type: double
arguments:
- type: double
- name: fabsf
- standards:
+ standards:
- stdc
return_type: float
arguments:
- type: float
- name: fabsl
- standards:
+ standards:
- stdc
return_type: long double
arguments:
- type: long double
- name: fdim
- standards:
+ standards:
- stdc
return_type: double
arguments:
- type: double
- type: double
- name: fdimf
- standards:
+ standards:
- stdc
return_type: float
arguments:
- type: float
- type: float
- name: fdiml
- standards:
+ standards:
- stdc
return_type: long double
arguments:
- type: long double
- type: long double
- name: floor
- standards:
+ standards:
- stdc
return_type: double
arguments:
- type: double
- name: floorf
- standards:
+ standards:
- stdc
return_type: float
arguments:
- type: float
- name: floorl
- standards:
+ standards:
- stdc
return_type: long double
arguments:
- type: long double
- name: fmin
- standards:
+ standards:
- stdc
return_type: double
arguments:
- type: double
- type: double
- name: fminf
- standards:
+ standards:
- stdc
return_type: float
arguments:
- type: float
- type: float
- name: fminl
- standards:
+ standards:
- stdc
return_type: long double
arguments:
- type: long double
- type: long double
- name: fmax
- standards:
+ standards:
- stdc
return_type: double
arguments:
- type: double
- type: double
- name: fmaxf
- standards:
+ standards:
- stdc
return_type: float
arguments:
- type: float
- type: float
- name: fmaxl
- standards:
+ standards:
- stdc
return_type: long double
arguments:
- type: long double
- type: long double
- name: fmaximum
- standards:
+ standards:
- stdc
return_type: double
arguments:
- type: double
- type: double
- name: fmaximumf
- standards:
+ standards:
- stdc
return_type: float
arguments:
- type: float
- type: float
- name: fmaximuml
- standards:
+ standards:
- stdc
return_type: long double
arguments:
- type: long double
- type: long double
- name: fmaximum_num
- standards:
+ standards:
- stdc
return_type: double
arguments:
- type: double
- type: double
- name: fmaximum_numf
- standards:
+ standards:
- stdc
return_type: float
arguments:
- type: float
- type: float
- name: fmaximum_numl
- standards:
+ standards:
- stdc
return_type: long double
arguments:
- type: long double
- type: long double
- name: fmaximum_mag
- standards:
+ standards:
- stdc
return_type: double
arguments:
- type: double
- type: double
- name: fmaximum_magf
- standards:
+ standards:
- stdc
return_type: float
arguments:
- type: float
- type: float
- name: fmaximum_magl
- standards:
+ standards:
- stdc
return_type: long double
arguments:
- type: long double
- type: long double
- name: fmaximum_mag_num
- standards:
+ standards:
- stdc
return_type: double
arguments:
- type: double
- type: double
- name: fmaximum_mag_numf
- standards:
+ standards:
- stdc
return_type: float
arguments:
- type: float
- type: float
- name: fmaximum_mag_numl
- standards:
+ standards:
- stdc
return_type: long double
arguments:
- type: long double
- type: long double
- name: fminimum
- standards:
+ standards:
- stdc
return_type: double
arguments:
- type: double
- type: double
- name: fminimumf
- standards:
+ standards:
- stdc
return_type: float
arguments:
- type: float
- type: float
- name: fminimuml
- standards:
+ standards:
- stdc
return_type: long double
arguments:
- type: long double
- type: long double
- name: fminimum_num
- standards:
+ standards:
- stdc
return_type: double
arguments:
- type: double
- type: double
- name: fminimum_numf
- standards:
+ standards:
- stdc
return_type: float
arguments:
- type: float
- type: float
- name: fminimum_mag
- standards:
+ standards:
- stdc
return_type: double
arguments:
- type: double
- type: double
- name: fminimum_magf
- standards:
+ standards:
- stdc
return_type: float
arguments:
- type: float
- type: float
- name: fminimum_magl
- standards:
+ standards:
- stdc
return_type: long double
arguments:
- type: long double
- type: long double
- name: fminimum_mag_num
- standards:
+ standards:
- stdc
return_type: double
arguments:
- type: double
- type: double
- name: fminimum_mag_numf
- standards:
+ standards:
- stdc
return_type: float
arguments:
- type: float
- type: float
- name: fminimum_mag_numl
- standards:
+ standards:
- stdc
return_type: long double
arguments:
- type: long double
- type: long double
- name: fma
- standards:
+ standards:
- stdc
return_type: double
arguments:
@@ -327,7 +327,7 @@ functions:
- type: double
- type: double
- name: fmaf
- standards:
+ standards:
- stdc
return_type: float
arguments:
@@ -335,21 +335,21 @@ functions:
- type: float
- type: float
- name: fmod
- standards:
+ standards:
- stdc
return_type: double
arguments:
- type: double
- type: double
- name: fmodf
- standards:
+ standards:
- stdc
return_type: float
arguments:
- type: float
- type: float
- name: fmodl
- standards:
+ standards:
- stdc
return_type: long double
arguments:
@@ -377,28 +377,28 @@ functions:
- type: long double
- type: long double
- name: frexp
- standards:
+ standards:
- stdc
return_type: double
arguments:
- type: double
- type: int *
- name: frexpf
- standards:
+ standards:
- stdc
return_type: float
arguments:
- type: float
- type: int *
- name: frexpl
- standards:
+ standards:
- stdc
return_type: long double
arguments:
- type: long double
- type: int *
- name: fromfp
- standards:
+ standards:
- stdc
return_type: double
arguments:
@@ -406,7 +406,7 @@ functions:
- type: int
- type: unsigned int
- name: fromfpf
- standards:
+ standards:
- stdc
return_type: float
arguments:
@@ -414,7 +414,7 @@ functions:
- type: int
- type: unsigned int
- name: fromfpl
- standards:
+ standards:
- stdc
return_type: long double
arguments:
@@ -422,7 +422,7 @@ functions:
- type: int
- type: unsigned int
- name: fromfpx
- standards:
+ standards:
- stdc
return_type: double
arguments:
@@ -430,7 +430,7 @@ functions:
- type: int
- type: unsigned int
- name: fromfpxf
- standards:
+ standards:
- stdc
return_type: float
arguments:
@@ -438,7 +438,7 @@ functions:
- type: int
- type: unsigned int
- name: fromfpxl
- standards:
+ standards:
- stdc
return_type: long double
arguments:
@@ -446,7 +446,7 @@ functions:
- type: int
- type: unsigned int
- name: ufromfp
- standards:
+ standards:
- stdc
return_type: double
arguments:
@@ -454,7 +454,7 @@ functions:
- type: int
- type: unsigned int
- name: ufromfpf
- standards:
+ standards:
- stdc
return_type: float
arguments:
@@ -462,7 +462,7 @@ functions:
- type: int
- type: unsigned int
- name: ufromfpl
- standards:
+ standards:
- stdc
return_type: long double
arguments:
@@ -470,7 +470,7 @@ functions:
- type: int
- type: unsigned int
- name: ufromfpx
- standards:
+ standards:
- stdc
return_type: double
arguments:
@@ -478,7 +478,7 @@ functions:
- type: int
- type: unsigned int
- name: ufromfpxf
- standards:
+ standards:
- stdc
return_type: float
arguments:
@@ -486,7 +486,7 @@ functions:
- type: int
- type: unsigned int
- name: ufromfpxl
- standards:
+ standards:
- stdc
return_type: long double
arguments:
@@ -494,33 +494,33 @@ functions:
- type: int
- type: unsigned int
- name: hypot
- standards:
+ standards:
- stdc
return_type: double
arguments:
- type: double
- type: double
- name: hypotf
- standards:
+ standards:
- stdc
return_type: float
arguments:
- type: float
- type: float
- name: ilogb
- standards:
+ standards:
- stdc
return_type: int
arguments:
- type: double
- name: ilogbf
- standards:
+ standards:
- stdc
return_type: int
arguments:
- type: float
- name: ilogbl
- standards:
+ standards:
- stdc
return_type: int
arguments:
@@ -529,7 +529,7 @@ functions:
standards:
- BSDExtensions
return_type: int
- arguments:
+ arguments:
- type: double
- name: isnanf
standards:
@@ -544,151 +544,151 @@ functions:
arguments:
- type: long double
- name: llogb
- standards:
+ standards:
- stdc
return_type: long
arguments:
- type: double
- name: llogbf
- standards:
+ standards:
- stdc
return_type: long
arguments:
- type: float
- name: llogbl
- standards:
+ standards:
- stdc
return_type: long
arguments:
- type: long double
- name: ldexp
- standards:
+ standards:
- stdc
return_type: double
arguments:
- type: double
- type: int
- name: ldexpf
- standards:
+ standards:
- stdc
return_type: float
arguments:
- type: float
- type: int
- name: ldexpl
- standards:
+ standards:
- stdc
return_type: long double
arguments:
- type: long double
- type: int
- name: log10
- standards:
+ standards:
- stdc
return_type: double
arguments:
- type: double
- name: log10f
- standards:
+ standards:
- stdc
return_type: float
arguments:
- type: float
- name: log1p
- standards:
+ standards:
- stdc
return_type: double
arguments:
- type: double
- name: log1pf
- standards:
+ standards:
- stdc
return_type: float
arguments:
- type: float
- name: log2
- standards:
+ standards:
- stdc
return_type: double
arguments:
- type: double
- name: log2f
- standards:
+ standards:
- stdc
return_type: float
arguments:
- type: float
- name: log
- standards:
+ standards:
- stdc
return_type: double
arguments:
- type: double
- name: logf
- standards:
+ standards:
- stdc
return_type: float
arguments:
- type: float
- name: logb
- standards:
+ standards:
- stdc
return_type: double
arguments:
- type: double
- name: logbf
- standards:
+ standards:
- stdc
return_type: float
arguments:
- type: float
- name: logbl
- standards:
+ standards:
- stdc
return_type: long double
arguments:
- type: long double
- name: modf
- standards:
+ standards:
- stdc
return_type: double
arguments:
- type: double
- type: double *
- name: modff
- standards:
+ standards:
- stdc
return_type: float
arguments:
- type: float
- type: float *
- name: modfl
- standards:
+ standards:
- stdc
return_type: long double
arguments:
- type: long double
- type: long double *
- name: cos
- standards:
+ standards:
- stdc
return_type: double
arguments:
- type: double
- name: cosf
- standards:
+ standards:
- stdc
return_type: float
arguments:
- type: float
- name: sin
- standards:
+ standards:
- stdc
return_type: double
arguments:
- type: double
- name: sincosf
- standards:
+ standards:
- gnu
return_type: void
arguments:
@@ -696,106 +696,106 @@ functions:
- type: float *
- type: float *
- name: sinf
- standards:
+ standards:
- stdc
return_type: float
arguments:
- type: float
- name: tan
- standards:
+ standards:
- stdc
return_type: double
arguments:
- type: double
- name: tanf
- standards:
+ standards:
- stdc
return_type: float
arguments:
- type: float
- name: erff
- standards:
+ standards:
- stdc
return_type: float
arguments:
- type: float
- name: exp
- standards:
+ standards:
- stdc
return_type: double
arguments:
- type: double
- name: expf
- standards:
+ standards:
- stdc
return_type: float
arguments:
- type: float
- name: exp2
- standards:
+ standards:
- stdc
return_type: double
arguments:
- type: double
- name: exp2f
- standards:
+ standards:
- stdc
return_type: float
arguments:
- type: float
- name: exp2m1f
- standards:
+ standards:
- stdc
return_type: float
arguments:
- type: float
- name: expm1
- standards:
+ standards:
- stdc
return_type: double
arguments:
- type: double
- name: expm1f
- standards:
+ standards:
- stdc
return_type: float
arguments:
- type: float
- name: exp10
- standards:
+ standards:
- stdc
return_type: double
arguments:
- type: double
- name: exp10f
- standards:
+ standards:
- stdc
return_type: float
arguments:
- type: float
- name: remainder
- standards:
+ standards:
- stdc
return_type: double
arguments:
- type: double
- type: double
- name: remainderf
- standards:
+ standards:
- stdc
return_type: float
arguments:
- type: float
- type: float
- name: remainderl
- standards:
+ standards:
- stdc
return_type: long double
arguments:
- type: long double
- type: long double
- name: remquo
- standards:
+ standards:
- stdc
return_type: double
arguments:
@@ -803,7 +803,7 @@ functions:
- type: double
- type: int *
- name: remquof
- standards:
+ standards:
- stdc
return_type: float
arguments:
@@ -811,7 +811,7 @@ functions:
- type: float
- type: int *
- name: remquol
- standards:
+ standards:
- stdc
return_type: long double
arguments:
@@ -819,272 +819,272 @@ functions:
- type: long double
- type: int *
- name: round
- standards:
+ standards:
- stdc
return_type: double
arguments:
- type: double
- name: roundf
- standards:
+ standards:
- stdc
return_type: float
arguments:
- type: float
- name: roundl
- standards:
+ standards:
- stdc
return_type: long double
arguments:
- type: long double
- name: roundeven
- standards:
+ standards:
- stdc
return_type: double
arguments:
- type: double
- name: roundevenf
- standards:
+ standards:
- stdc
return_type: float
arguments:
- type: float
- name: roundevenl
- standards:
+ standards:
- stdc
return_type: long double
arguments:
- type: long double
- name: lround
- standards:
+ standards:
- stdc
return_type: long
arguments:
- type: double
- name: lroundf
- standards:
+ standards:
- stdc
return_type: long
arguments:
- type: float
- name: lroundl
- standards:
+ standards:
- stdc
return_type: long
arguments:
- type: long double
- name: llround
- standards:
+ standards:
- stdc
return_type: long long
arguments:
- type: double
- name: llroundf
- standards:
+ standards:
- stdc
return_type: long long
arguments:
- type: float
- name: llroundl
- standards:
+ standards:
- stdc
return_type: long long
arguments:
- type: long double
- name: rint
- standards:
+ standards:
- stdc
return_type: double
arguments:
- type: double
- name: rintf
- standards:
+ standards:
- stdc
return_type: float
arguments:
- type: float
- name: rintl
- standards:
+ standards:
- stdc
return_type: long double
arguments:
- type: long double
- name: lrint
- standards:
+ standards:
- stdc
return_type: long
arguments:
- type: double
- name: lrintf
- standards:
+ standards:
- stdc
return_type: long
arguments:
- type: float
- name: lrintl
- standards:
+ standards:
- stdc
return_type: long
arguments:
- type: long double
- name: llrint
- standards:
+ standards:
- stdc
return_type: long long
arguments:
- type: double
- name: llrintf
- standards:
+ standards:
- stdc
return_type: long long
arguments:
- type: float
- name: llrintl
- standards:
+ standards:
- stdc
return_type: long long
arguments:
- type: long double
- name: sqrt
- standards:
+ standards:
- stdc
return_type: double
arguments:
- type: double
- name: sqrtf
- standards:
+ standards:
- stdc
return_type: float
arguments:
- type: float
- name: sqrtl
- standards:
+ standards:
- stdc
return_type: long double
arguments:
- type: long double
- name: trunc
- standards:
+ standards:
- stdc
return_type: double
arguments:
- type: double
- name: truncf
- standards:
+ standards:
- stdc
return_type: float
arguments:
- type: float
- name: truncl
- standards:
+ standards:
- stdc
return_type: long double
arguments:
- type: long double
- name: nearbyint
- standards:
+ standards:
- stdc
return_type: double
arguments:
- type: double
- name: nearbyintf
- standards:
+ standards:
- stdc
return_type: float
arguments:
- type: float
- name: nearbyintl
- standards:
+ standards:
- stdc
return_type: long double
arguments:
- type: long double
- name: nextafterf
- standards:
+ standards:
- stdc
return_type: float
arguments:
- type: float
- type: float
- name: nextafter
- standards:
+ standards:
- stdc
return_type: double
arguments:
- type: double
- type: double
- name: nextafterl
- standards:
+ standards:
- stdc
return_type: long double
arguments:
- type: long double
- type: long double
- name: nexttowardf
- standards:
+ standards:
- stdc
return_type: float
arguments:
- type: float
- type: long double
- name: nexttoward
- standards:
+ standards:
- stdc
return_type: double
arguments:
- type: double
- type: long double
- name: nexttowardl
- standards:
+ standards:
- stdc
return_type: long double
arguments:
- type: long double
- type: long double
- name: nextdown
- standards:
+ standards:
- stdc
return_type: double
arguments:
- type: double
- name: nextdownf
- standards:
+ standards:
- stdc
return_type: float
arguments:
- type: float
- name: nextdownl
- standards:
+ standards:
- stdc
return_type: long double
arguments:
- type: long double
- name: nextup
- standards:
+ standards:
- stdc
return_type: double
arguments:
- type: double
- name: nextupf
- standards:
+ standards:
- stdc
return_type: float
arguments:
- type: float
- name: nextupl
- standards:
+ standards:
- stdc
return_type: long double
arguments:
- type: long double
- name: powf
- standards:
+ standards:
- stdc
return_type: float
arguments:
- type: float
- type: float
- name: pow
- standards:
+ standards:
- stdc
return_type: double
arguments:
@@ -1103,134 +1103,134 @@ functions:
- type: float
- type: int
- name: coshf
- standards:
+ standards:
- stdc
return_type: float
arguments:
- type: float
- name: sinhf
- standards:
+ standards:
- stdc
return_type: float
arguments:
- type: float
- name: tanhf
- standards:
+ standards:
- stdc
return_type: float
arguments:
- type: float
- name: acosf
- standards:
+ standards:
- stdc
return_type: float
arguments:
- type: float
- name: asinf
- standards:
+ standards:
- stdc
return_type: float
arguments:
- type: float
- name: asin
- standards:
+ standards:
- stdc
return_type: double
arguments:
- type: double
- name: atanf
- standards:
+ standards:
- stdc
return_type: float
arguments:
- type: float
- name: atan2f
- standards:
+ standards:
- stdc
return_type: float
arguments:
- type: float
- type: float
- name: acoshf
- standards:
+ standards:
- stdc
return_type: float
arguments:
- type: float
- name: asinhf
- standards:
+ standards:
- stdc
return_type: float
arguments:
- type: float
- name: atanhf
- standards:
+ standards:
- stdc
return_type: float
arguments:
- type: float
- name: scalbn
- standards:
+ standards:
- stdc
return_type: double
arguments:
- type: double
- type: int
- name: scalbnf
- standards:
+ standards:
- stdc
return_type: float
arguments:
- type: float
- type: int
- name: scalbnl
- standards:
+ standards:
- stdc
return_type: long double
arguments:
- type: long double
- type: int
- name: nanf
- standards:
+ standards:
- stdc
return_type: float
arguments:
- type: const char *
- name: nan
- standards:
+ standards:
- stdc
return_type: double
arguments:
- type: const char *
- name: nanl
- standards:
+ standards:
- stdc
return_type: long double
arguments:
- type: const char *
- name: canonicalize
- standards:
+ standards:
- stdc
return_type: int
arguments:
- type: double
- type: double
- name: canonicalizef
- standards:
+ standards:
- stdc
return_type: int
arguments:
- type: float
- type: float
- name: canonicalizel
- standards:
+ standards:
- stdc
return_type: int
arguments:
- type: long double
- type: long double
- name: canonicalizef128
- standards:
+ standards:
- stdc
return_type: int
arguments:
@@ -1238,7 +1238,7 @@ functions:
- type: float128
guard: LIBC_TYPES_HAS_FLOAT128
- name: canonicalizef16
- standards:
+ standards:
- stdc
return_type: int
arguments:
@@ -1246,14 +1246,14 @@ functions:
- type: _Float16
guard: LIBC_TYPES_HAS_FLOAT16
- name: ceilf16
- standards:
+ standards:
- stdc
return_type: _Float16
arguments:
- type: _Float16
guard: LIBC_TYPES_HAS_FLOAT16
- name: copysignf16
- standards:
+ standards:
- stdc
return_type: _Float16
arguments:
@@ -1261,7 +1261,7 @@ functions:
- type: _Float16
guard: LIBC_TYPES_HAS_FLOAT16
- name: f16add
- standards:
+ standards:
- llvm_libc_ext
return_type: _Float16
arguments:
@@ -1269,7 +1269,7 @@ functions:
- type: double
guard: LIBC_TYPES_HAS_FLOAT16
- name: f16addf
- standards:
+ standards:
- llvm_libc_ext
return_type: _Float16
arguments:
@@ -1277,7 +1277,7 @@ functions:
- type: float
guard: LIBC_TYPES_HAS_FLOAT16
- name: f16addl
- standards:
+ standards:
- llvm_libc_ext
return_type: _Float16
arguments:
@@ -1285,7 +1285,7 @@ functions:
- type: long double
guard: LIBC_TYPES_HAS_FLOAT16
- name: f16div
- standards:
+ standards:
- llvm_libc_ext
return_type: _Float16
arguments:
@@ -1301,7 +1301,7 @@ functions:
- type: float
guard: LIBC_TYPES_HAS_FLOAT16
- name: f16divl
- standards:
+ standards:
- llvm_libc_ext
return_type: _Float16
arguments:
@@ -1309,7 +1309,7 @@ functions:
- type: long double
guard: LIBC_TYPES_HAS_FLOAT16
- name: f16fma
- standards:
+ standards:
- llvm_libc_ext
return_type: _Float16
arguments:
@@ -1318,7 +1318,7 @@ functions:
- type: double
guard: LIBC_TYPES_HAS_FLOAT16
- name: f16fmaf
- standards:
+ standards:
- llvm_libc_ext
return_type: _Float16
arguments:
@@ -1327,7 +1327,7 @@ functions:
- type: float
guard: LIBC_TYPES_HAS_FLOAT16
- name: f16fmal
- standards:
+ standards:
- llvm_libc_ext
return_type: _Float16
arguments:
@@ -1360,28 +1360,28 @@ functions:
- type: long double
guard: LIBC_TYPES_HAS_FLOAT16
- name: f16sqrt
- standards:
+ standards:
- llvm_libc_ext
return_type: _Float16
arguments:
- type: double
guard: LIBC_TYPES_HAS_FLOAT16
- name: f16sqrtf
- standards:
+ standards:
- llvm_libc_ext
return_type: _Float16
arguments:
- type: float
guard: LIBC_TYPES_HAS_FLOAT16
- name: f16sqrtl
- standards:
+ standards:
- llvm_libc_ext
return_type: _Float16
arguments:
- type: long double
guard: LIBC_TYPES_HAS_FLOAT16
- name: f16sub
- standards:
+ standards:
- llvm_libc_ext
return_type: _Float16
arguments:
@@ -1389,7 +1389,7 @@ functions:
- type: double
guard: LIBC_TYPES_HAS_FLOAT16
- name: f16subf
- standards:
+ standards:
- llvm_libc_ext
return_type: _Float16
arguments:
@@ -1397,7 +1397,7 @@ functions:
- type: float
guard: LIBC_TYPES_HAS_FLOAT16
- name: f16subl
- standards:
+ standards:
- llvm_libc_ext
return_type: _Float16
arguments:
@@ -1405,14 +1405,14 @@ functions:
- type: long double
guard: LIBC_TYPES_HAS_FLOAT16
- name: fabsf16
- standards:
+ standards:
- stdc
return_type: _Float16
arguments:
- type: _Float16
guard: LIBC_TYPES_HAS_FLOAT16
- name: fdimf16
- standards:
+ standards:
- stdc
return_type: _Float16
arguments:
@@ -1420,14 +1420,14 @@ functions:
- type: _Float16
guard: LIBC_TYPES_HAS_FLOAT16
- name: floorf16
- standards:
+ standards:
- stdc
return_type: _Float16
arguments:
- type: _Float16
guard: LIBC_TYPES_HAS_FLOAT16
- name: fmaxf16
- standards:
+ standards:
- stdc
return_type: _Float16
arguments:
@@ -1435,7 +1435,7 @@ functions:
- type: _Float16
guard: LIBC_TYPES_HAS_FLOAT16
- name: fmaximum_mag_numf16
- standards:
+ standards:
- stdc
return_type: _Float16
arguments:
@@ -1443,7 +1443,7 @@ functions:
- type: _Float16
guard: LIBC_TYPES_HAS_FLOAT16
- name: fmaximum_magf16
- standards:
+ standards:
- stdc
return_type: _Float16
arguments:
@@ -1451,7 +1451,7 @@ functions:
- type: _Float16
guard: LIBC_TYPES_HAS_FLOAT16
- name: fmaximum_numf16
- standards:
+ standards:
- stdc
return_type: _Float16
arguments:
@@ -1459,7 +1459,7 @@ functions:
- type: _Float16
guard: LIBC_TYPES_HAS_FLOAT16
- name: fmaximumf16
- standards:
+ standards:
- stdc
return_type: _Float16
arguments:
@@ -1467,7 +1467,7 @@ functions:
- type: _Float16
guard: LIBC_TYPES_HAS_FLOAT16
- name: fminf16
- standards:
+ standards:
- stdc
return_type: _Float16
arguments:
@@ -1475,7 +1475,7 @@ functions:
- type: _Float16
guard: LIBC_TYPES_HAS_FLOAT16
- name: fminimum_mag_numf16
- standards:
+ standards:
- stdc
return_type: _Float16
arguments:
@@ -1483,7 +1483,7 @@ functions:
- type: _Float16
guard: LIBC_TYPES_HAS_FLOAT16
- name: fminimum_magf16
- standards:
+ standards:
- stdc
return_type: _Float16
arguments:
@@ -1491,7 +1491,7 @@ functions:
- type: _Float16
guard: LIBC_TYPES_HAS_FLOAT16
- name: fminimum_numf16
- standards:
+ standards:
- stdc
return_type: _Float16
arguments:
@@ -1499,7 +1499,7 @@ functions:
- type: _Float16
guard: LIBC_TYPES_HAS_FLOAT16
- name: fminimumf16
- standards:
+ standards:
- stdc
return_type: _Float16
arguments:
@@ -1507,7 +1507,7 @@ functions:
- type: _Float16
guard: LIBC_TYPES_HAS_FLOAT16
- name: fmodf16
- standards:
+ standards:
- stdc
return_type: _Float16
arguments:
@@ -1515,7 +1515,7 @@ functions:
- type: _Float16
guard: LIBC_TYPES_HAS_FLOAT16
- name: frexpf16
- standards:
+ standards:
- stdc
return_type: _Float16
arguments:
@@ -1523,7 +1523,7 @@ functions:
- type: int *
guard: LIBC_TYPES_HAS_FLOAT16
- name: fromfpf16
- standards:
+ standards:
- stdc
return_type: _Float16
arguments:
@@ -1532,7 +1532,7 @@ functions:
- type: unsigned int
guard: LIBC_TYPES_HAS_FLOAT16
- name: fromfpxf16
- standards:
+ standards:
- stdc
return_type: _Float16
arguments:
@@ -1541,21 +1541,21 @@ functions:
- type: unsigned int
guard: LIBC_TYPES_HAS_FLOAT16
- name: getpayloadf16
- standards:
+ standards:
- stdc
return_type: _Float16
arguments:
- type: _Float16 *
guard: LIBC_TYPES_HAS_FLOAT16
- name: ilogbf16
- standards:
+ standards:
- stdc
return_type: int
arguments:
- type: _Float16
guard: LIBC_TYPES_HAS_FLOAT16
- name: ldexpf16
- standards:
+ standards:
- stdc
return_type: _Float16
arguments:
@@ -1563,49 +1563,49 @@ functions:
- type: int
guard: LIBC_TYPES_HAS_FLOAT16
- name: llogbf16
- standards:
+ standards:
- stdc
return_type: long
arguments:
- type: _Float16
guard: LIBC_TYPES_HAS_FLOAT16
- name: llrintf16
- standards:
+ standards:
- stdc
return_type: long long
arguments:
- type: _Float16
guard: LIBC_TYPES_HAS_FLOAT16
- name: llroundf16
- standards:
+ standards:
- stdc
return_type: long long
arguments:
- type: _Float16
guard: LIBC_TYPES_HAS_FLOAT16
- name: logbf16
- standards:
+ standards:
- stdc
return_type: _Float16
arguments:
- type: _Float16
guard: LIBC_TYPES_HAS_FLOAT16
- name: lrintf16
- standards:
+ standards:
- stdc
return_type: long
arguments:
- type: _Float16
guard: LIBC_TYPES_HAS_FLOAT16
- name: lroundf16
- standards:
+ standards:
- stdc
return_type: long
arguments:
- type: _Float16
guard: LIBC_TYPES_HAS_FLOAT16
- name: modff16
- standards:
+ standards:
- stdc
return_type: _Float16
arguments:
@@ -1613,21 +1613,21 @@ functions:
- type: _Float16 *
guard: LIBC_TYPES_HAS_FLOAT16
- name: nanf16
- standards:
+ standards:
- stdc
return_type: _Float16
arguments:
- type: const char *
guard: LIBC_TYPES_HAS_FLOAT16
- name: nearbyintf16
- standards:
+ standards:
- stdc
return_type: _Float16
arguments:
- type: _Float16
guard: LIBC_TYPES_HAS_FLOAT16
- name: nextafterf16
- standards:
+ standards:
- stdc
return_type: _Float16
arguments:
@@ -1635,14 +1635,14 @@ functions:
- type: _Float16
guard: LIBC_TYPES_HAS_FLOAT16
- name: nextdownf16
- standards:
+ standards:
- stdc
return_type: _Float16
arguments:
- type: _Float16
guard: LIBC_TYPES_HAS_FLOAT16
- name: nexttowardf16
- standards:
+ standards:
- stdc
return_type: _Float16
arguments:
@@ -1650,14 +1650,14 @@ functions:
- type: _Float16
guard: LIBC_TYPES_HAS_FLOAT16
- name: nextupf16
- standards:
+ standards:
- stdc
return_type: _Float16
arguments:
- type: _Float16
guard: LIBC_TYPES_HAS_FLOAT16
- name: remainderf16
- standards:
+ standards:
- stdc
return_type: _Float16
arguments:
@@ -1665,7 +1665,7 @@ functions:
- type: _Float16
guard: LIBC_TYPES_HAS_FLOAT16
- name: remquof16
- standards:
+ standards:
- stdc
return_type: _Float16
arguments:
@@ -1674,28 +1674,28 @@ functions:
- type: int *
guard: LIBC_TYPES_HAS_FLOAT16
- name: rintf16
- standards:
+ standards:
- stdc
return_type: _Float16
arguments:
- type: _Float16
guard: LIBC_TYPES_HAS_FLOAT16
- name: roundevenf16
- standards:
+ standards:
- stdc
return_type: _Float16
arguments:
- type: _Float16
guard: LIBC_TYPES_HAS_FLOAT16
- name: roundf16
- standards:
+ standards:
- stdc
return_type: _Float16
arguments:
- type: _Float16
guard: LIBC_TYPES_HAS_FLOAT16
- name: scalblnf16
- standards:
+ standards:
- stdc
return_type: _Float16
arguments:
@@ -1703,7 +1703,7 @@ functions:
- type: long
guard: LIBC_TYPES_HAS_FLOAT16
- name: scalbnf16
- standards:
+ standards:
- stdc
return_type: _Float16
arguments:
@@ -1711,7 +1711,7 @@ functions:
- type: int
guard: LIBC_TYPES_HAS_FLOAT16
- name: setpayloadf16
- standards:
+ standards:
- stdc
return_type: int
arguments:
@@ -1719,7 +1719,7 @@ functions:
- type: _Float16
guard: LIBC_TYPES_HAS_FLOAT16
- name: setpayloadsigf16
- standards:
+ standards:
- stdc
return_type: int
arguments:
@@ -1727,7 +1727,7 @@ functions:
- type: _Float16
guard: LIBC_TYPES_HAS_FLOAT16
- name: totalorderf16
- standards:
+ standards:
- stdc
return_type: int
arguments:
@@ -1735,7 +1735,7 @@ functions:
- type: _Float16 *
guard: LIBC_TYPES_HAS_FLOAT16
- name: totalordermagf16
- standards:
+ standards:
- stdc
return_type: int
arguments:
@@ -1743,14 +1743,14 @@ functions:
- type: _Float16 *
guard: LIBC_TYPES_HAS_FLOAT16
- name: truncf16
- standards:
+ standards:
- stdc
return_type: _Float16
arguments:
- type: _Float16
guard: LIBC_TYPES_HAS_FLOAT16
- name: ufromfpf16
- standards:
+ standards:
- stdc
return_type: _Float16
arguments:
@@ -1759,7 +1759,7 @@ functions:
- type: unsigned int
guard: LIBC_TYPES_HAS_FLOAT16
- name: ufromfpxf16
- standards:
+ standards:
- stdc
return_type: _Float16
arguments:
@@ -1768,7 +1768,7 @@ functions:
- type: unsigned int
guard: LIBC_TYPES_HAS_FLOAT16
- name: f16addf128
- standards:
+ standards:
- stdc
return_type: _Float16
arguments:
@@ -1784,7 +1784,7 @@ functions:
- type: float128
guard: LIBC_TYPES_HAS_FLOAT16_AND_FLOAT128
- name: f16fmaf128
- standards:
+ standards:
- stdc
return_type: _Float16
arguments:
@@ -1801,14 +1801,14 @@ functions:
- type: float128
guard: LIBC_TYPES_HAS_FLOAT16_AND_FLOAT128
- name: f16sqrtf128
- standards:
+ standards:
- llvm_libc_ext
return_type: _Float16
arguments:
- type: float128
guard: LIBC_TYPES_HAS_FLOAT16_AND_FLOAT128
- name: f16subf128
- standards:
+ standards:
- stdc
return_type: _Float16
arguments:
@@ -1816,14 +1816,14 @@ functions:
- type: float128
guard: LIBC_TYPES_HAS_FLOAT16_AND_FLOAT128
- name: ceilf128
- standards:
+ standards:
- stdc
return_type: float128
arguments:
- type: float128
guard: LIBC_TYPES_HAS_FLOAT128
- name: copysignf128
- standards:
+ standards:
- stdc
return_type: float128
arguments:
@@ -1831,14 +1831,14 @@ functions:
- type: float128
guard: LIBC_TYPES_HAS_FLOAT128
- name: fabsf128
- standards:
+ standards:
- stdc
return_type: float128
arguments:
- type: float128
guard: LIBC_TYPES_HAS_FLOAT128
- name: fdimf128
- standards:
+ standards:
- stdc
return_type: float128
arguments:
@@ -1846,14 +1846,14 @@ functions:
- type: float128
guard: LIBC_TYPES_HAS_FLOAT128
- name: floorf128
- standards:
+ standards:
- stdc
return_type: float128
arguments:
- type: float128
guard: LIBC_TYPES_HAS_FLOAT128
- name: fmaxf128
- standards:
+ standards:
- stdc
return_type: float128
arguments:
@@ -1861,7 +1861,7 @@ functions:
- type: float128
guard: LIBC_TYPES_HAS_FLOAT128
- name: fmaximum_mag_numf128
- standards:
+ standards:
- stdc
return_type: float128
arguments:
@@ -1869,7 +1869,7 @@ functions:
- type: float128
guard: LIBC_TYPES_HAS_FLOAT128
- name: fmaximum_magf128
- standards:
+ standards:
- stdc
return_type: float128
arguments:
@@ -1877,7 +1877,7 @@ functions:
- type: float128
guard: LIBC_TYPES_HAS_FLOAT128
- name: fmaximum_numf128
- standards:
+ standards:
- stdc
return_type: float128
arguments:
@@ -1885,7 +1885,7 @@ functions:
- type: float128
guard: LIBC_TYPES_HAS_FLOAT128
- name: fmaximumf128
- standards:
+ standards:
- stdc
return_type: float128
arguments:
@@ -1893,7 +1893,7 @@ functions:
- type: float128
guard: LIBC_TYPES_HAS_FLOAT128
- name: fminf128
- standards:
+ standards:
- stdc
return_type: float128
arguments:
@@ -1901,7 +1901,7 @@ functions:
- type: float128
guard: LIBC_TYPES_HAS_FLOAT128
- name: fminimum_mag_numf128
- standards:
+ standards:
- stdc
return_type: float128
arguments:
@@ -1909,7 +1909,7 @@ functions:
- type: float128
guard: LIBC_TYPES_HAS_FLOAT128
- name: fminimum_magf128
- standards:
+ standards:
- stdc
return_type: float128
arguments:
@@ -1917,7 +1917,7 @@ functions:
- type: float128
guard: LIBC_TYPES_HAS_FLOAT128
- name: fminimum_numf128
- standards:
+ standards:
- stdc
return_type: float128
arguments:
@@ -1925,7 +1925,7 @@ functions:
- type: float128
guard: LIBC_TYPES_HAS_FLOAT128
- name: fminimumf128
- standards:
+ standards:
- stdc
return_type: float128
arguments:
@@ -1933,7 +1933,7 @@ functions:
- type: float128
guard: LIBC_TYPES_HAS_FLOAT128
- name: fmodf128
- standards:
+ standards:
- stdc
return_type: float128
arguments:
@@ -1957,7 +1957,7 @@ functions:
- type: float128
guard: LIBC_TYPES_HAS_FLOAT128
- name: frexpf128
- standards:
+ standards:
- stdc
return_type: float128
arguments:
@@ -1965,7 +1965,7 @@ functions:
- type: int *
guard: LIBC_TYPES_HAS_FLOAT128
- name: fromfpf128
- standards:
+ standards:
- stdc
return_type: float128
arguments:
@@ -1974,7 +1974,7 @@ functions:
- type: unsigned int
guard: LIBC_TYPES_HAS_FLOAT128
- name: fromfpxf128
- standards:
+ standards:
- stdc
return_type: float128
arguments:
@@ -1983,14 +1983,14 @@ functions:
- type: unsigned int
guard: LIBC_TYPES_HAS_FLOAT128
- name: ilogbf128
- standards:
+ standards:
- stdc
return_type: int
arguments:
- type: float128
guard: LIBC_TYPES_HAS_FLOAT128
- name: ldexpf128
- standards:
+ standards:
- stdc
return_type: float128
arguments:
@@ -1998,49 +1998,49 @@ functions:
- type: int
guard: LIBC_TYPES_HAS_FLOAT128
- name: llogbf128
- standards:
+ standards:
- stdc
return_type: long
arguments:
- type: float128
guard: LIBC_TYPES_HAS_FLOAT128
- name: llrintf128
- standards:
+ standards:
- stdc
return_type: long long
arguments:
- type: float128
guard: LIBC_TYPES_HAS_FLOAT128
- name: llroundf128
- standards:
+ standards:
- stdc
return_type: long long
arguments:
- type: float128
guard: LIBC_TYPES_HAS_FLOAT128
- name: logbf128
- standards:
+ standards:
- stdc
return_type: float128
arguments:
- type: float128
guard: LIBC_TYPES_HAS_FLOAT128
- name: lrintf128
- standards:
+ standards:
- stdc
return_type: long
arguments:
- type: float128
guard: LIBC_TYPES_HAS_FLOAT128
- name: lroundf128
- standards:
+ standards:
- stdc
return_type: long
arguments:
- type: float128
guard: LIBC_TYPES_HAS_FLOAT128
- name: modff128
- standards:
+ standards:
- stdc
return_type: float128
arguments:
@@ -2048,21 +2048,21 @@ functions:
- type: float128 *
guard: LIBC_TYPES_HAS_FLOAT128
- name: nanf128
- standards:
+ standards:
- stdc
return_type: float128
arguments:
- type: const char *
guard: LIBC_TYPES_HAS_FLOAT128
- name: nearbyintf128
- standards:
+ standards:
- stdc
return_type: float128
arguments:
- type: float128
guard: LIBC_TYPES_HAS_FLOAT128
- name: nextafterf128
- standards:
+ standards:
- stdc
return_type: float128
arguments:
@@ -2070,21 +2070,21 @@ functions:
- type: float128
guard: LIBC_TYPES_HAS_FLOAT128
- name: nextdownf128
- standards:
+ standards:
- stdc
return_type: float128
arguments:
- type: float128
guard: LIBC_TYPES_HAS_FLOAT128
- name: nextupf128
- standards:
+ standards:
- stdc
return_type: float128
arguments:
- type: float128
guard: LIBC_TYPES_HAS_FLOAT128
- name: remquof128
- standards:
+ standards:
- stdc
return_type: float128
arguments:
@@ -2093,28 +2093,28 @@ functions:
- type: int *
guard: LIBC_TYPES_HAS_FLOAT128
- name: rintf128
- standards:
+ standards:
- stdc
return_type: float128
arguments:
- type: float128
guard: LIBC_TYPES_HAS_FLOAT128
- name: roundevenf128
- standards:
+ standards:
- stdc
return_type: float128
arguments:
- type: float128
guard: LIBC_TYPES_HAS_FLOAT128
- name: roundf128
- standards:
+ standards:
- stdc
return_type: float128
arguments:
- type: float128
guard: LIBC_TYPES_HAS_FLOAT128
- name: scalbnf128
- standards:
+ standards:
- stdc
return_type: float128
arguments:
@@ -2122,21 +2122,21 @@ functions:
- type: int
guard: LIBC_TYPES_HAS_FLOAT128
- name: sqrtf128
- standards:
+ standards:
- stdc
return_type: float128
arguments:
- type: float128
guard: LIBC_TYPES_HAS_FLOAT128
- name: truncf128
- standards:
+ standards:
- stdc
return_type: float128
arguments:
- type: float128
guard: LIBC_TYPES_HAS_FLOAT128
- name: ufromfpf128
- standards:
+ standards:
- stdc
return_type: float128
arguments:
@@ -2145,7 +2145,7 @@ functions:
- type: unsigned int
guard: LIBC_TYPES_HAS_FLOAT128
- name: ufromfpxf128
- standards:
+ standards:
- stdc
return_type: float128
arguments:
@@ -2153,3 +2153,40 @@ functions:
- type: int
- type: unsigned int
guard: LIBC_TYPES_HAS_FLOAT128
+ - name: scalbln
+ standards:
+ - stdc
+ return_type: double
+ arguments:
+ - type: double
+ - type: long
+ - name: scalblnl
+ standards:
+ - stdc
+ return_type: long double
+ arguments:
+ - type: long double
+ - type: long
+ - name: scalblnf
+ standards:
+ - stdc
+ return_type: long double
+ arguments:
+ - type: float
+ - type: long
+ - name: scalblnf16
+ standards:
+ - stdc
+ return_type: float16
+ arguments:
+ - type: float16
+ - type: long
+ guard: LIBC_HAS_TYPES_FLOAT16
+ - name: scalblnf128
+ standards:
+ - llvm_libc_ext
+ return_type: float128
+ arguments:
+ - type: float128
+ - type: long
+ guard: LIBC_HAS_TYPES_FLOAT128
diff --git a/libc/spec/llvm_libc_ext.td b/libc/spec/llvm_libc_ext.td
index f86a8c1c6c1066..6e3efda25b3c67 100644
--- a/libc/spec/llvm_libc_ext.td
+++ b/libc/spec/llvm_libc_ext.td
@@ -96,6 +96,9 @@ def LLVMLibcExt : StandardSpec<"llvm_libc_ext"> {
FunctionSpec<"powi", RetValSpec<DoubleType>, [ArgSpec<DoubleType>, ArgSpec<IntType>]>,
FunctionSpec<"powif", RetValSpec<FloatType>, [ArgSpec<FloatType>, ArgSpec<IntType>]>,
+
+ GuardedFunctionSpec<"scalblnf128", RetValSpec<Float128Type>, [ArgSpec<Float128Type>, ArgSpec<LongType>], "LIBC_TYPES_HAS_FLOAT128">,
+
]
>;
diff --git a/libc/spec/stdc.td b/libc/spec/stdc.td
index 3f68eeb7853ad1..7c985d0ab5dac2 100644
--- a/libc/spec/stdc.td
+++ b/libc/spec/stdc.td
@@ -704,7 +704,10 @@ def StdC : StandardSpec<"stdc"> {
FunctionSpec<"acoshf", RetValSpec<FloatType>, [ArgSpec<FloatType>]>,
FunctionSpec<"asinhf", RetValSpec<FloatType>, [ArgSpec<FloatType>]>,
FunctionSpec<"atanhf", RetValSpec<FloatType>, [ArgSpec<FloatType>]>,
-
+
+ FunctionSpec<"scalbln", RetValSpec<DoubleType>, [ArgSpec<DoubleType>, ArgSpec<LongType>]>,
+ FunctionSpec<"scalblnl", RetValSpec<LongDoubleType>, [ArgSpec<LongDoubleType>, ArgSpec<LongType>]>,
+ FunctionSpec<"scalblnf", RetValSpec<FloatType>, [ArgSpec<FloatType>, ArgSpec<LongType>]>,
GuardedFunctionSpec<"scalblnf16", RetValSpec<Float16Type>, [ArgSpec<Float16Type>, ArgSpec<LongType>], "LIBC_TYPES_HAS_FLOAT16">,
FunctionSpec<"scalbn", RetValSpec<DoubleType>, [ArgSpec<DoubleType>, ArgSpec<IntType>]>,
diff --git a/libc/src/math/CMakeLists.txt b/libc/src/math/CMakeLists.txt
index e513d72260fb12..cda26be876ca1e 100644
--- a/libc/src/math/CMakeLists.txt
+++ b/libc/src/math/CMakeLists.txt
@@ -410,7 +410,11 @@ add_math_entrypoint_object(roundevenl)
add_math_entrypoint_object(roundevenf16)
add_math_entrypoint_object(roundevenf128)
+add_math_entrypoint_object(scalbln)
+add_math_entrypoint_object(scalblnl)
+add_math_entrypoint_object(scalblnf)
add_math_entrypoint_object(scalblnf16)
+add_math_entrypoint_object(scalblnf128)
add_math_entrypoint_object(scalbn)
add_math_entrypoint_object(scalbnf)
diff --git a/libc/src/math/generic/CMakeLists.txt b/libc/src/math/generic/CMakeLists.txt
index 58daffaf4e932c..edb90aca7ae890 100644
--- a/libc/src/math/generic/CMakeLists.txt
+++ b/libc/src/math/generic/CMakeLists.txt
@@ -3979,6 +3979,47 @@ add_entrypoint_object(
libc.src.__support.macros.optimization
)
+
+add_entrypoint_object(
+ scalbln
+ SRCS
+ scalbln.cpp
+ HDRS
+ ../scalbln.h
+ DEPENDS
+ libc.hdr.float_macros
+ libc.src.__support.FPUtil.manipulation_functions
+ COMPILE_OPTIONS
+ -O3
+)
+
+add_entrypoint_object(
+ scalblnl
+ SRCS
+ scalblnl.cpp
+ HDRS
+ ../scalblnl.h
+ DEPENDS
+ libc.hdr.float_macros
+ libc.src.__support.FPUtil.manipulation_functions
+ COMPILE_OPTIONS
+ -O3
+)
+
+add_entrypoint_object(
+ scalblnf
+ SRCS
+ scalblnf.cpp
+ HDRS
+ ../scalblnf.h
+ DEPENDS
+ libc.hdr.float_macros
+ libc.src.__support.macros.properties.types
+ libc.src.__support.FPUtil.manipulation_functions
+ COMPILE_OPTIONS
+ -O3
+)
+
add_entrypoint_object(
scalblnf16
SRCS
@@ -3993,6 +4034,20 @@ add_entrypoint_object(
-O3
)
+add_entrypoint_object(
+ scalblnf128
+ SRCS
+ scalblnf128.cpp
+ HDRS
+ ../scalblnf128.h
+ DEPENDS
+ libc.hdr.float_macros
+ libc.src.__support.macros.properties.types
+ libc.src.__support.FPUtil.manipulation_functions
+ COMPILE_OPTIONS
+ -O3
+)
+
add_entrypoint_object(
scalbn
SRCS
diff --git a/libc/src/math/generic/scalbln.cpp b/libc/src/math/generic/scalbln.cpp
index 564d5e21ced137..f97619954237ee 100644
--- a/libc/src/math/generic/scalbln.cpp
+++ b/libc/src/math/generic/scalbln.cpp
@@ -7,13 +7,19 @@
//===----------------------------------------------------------------------===//
#include "src/math/scalbln.h"
+#include "hdr/float_macros.h"
+#include "src/__support/FPUtil/ManipulationFunctions.h"
#include "src/__support/common.h"
#include "src/__support/macros/config.h"
+#if FLT_RADIX != 2
+#error "FLT_RADIX != 2 is not supported."
+#endif
+
namespace LIBC_NAMESPACE_DECL {
-LLVM_LIBC_FUNCTION(float, scalbln, (double x, long n)) {
- // TODO: Implement function.
+LLVM_LIBC_FUNCTION(double, scalbln, (double x, long n)) {
+ return fputil::ldexp(x, n);
}
} // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/math/generic/scalblnf.cpp b/libc/src/math/generic/scalblnf.cpp
index 60189c6832cd8e..e4de63b4def9cd 100644
--- a/libc/src/math/generic/scalblnf.cpp
+++ b/libc/src/math/generic/scalblnf.cpp
@@ -7,13 +7,19 @@
//===----------------------------------------------------------------------===//
#include "src/math/scalblnf.h"
+#include "hdr/float_macros.h"
+#include "src/__support/FPUtil/ManipulationFunctions.h"
#include "src/__support/common.h"
#include "src/__support/macros/config.h"
+#include "src/__support/macros/properties/types.h"
+#if FLT_RADIX != 2
+#error "FLT_RADIX != 2 is not supported."
+#endif
namespace LIBC_NAMESPACE_DECL {
LLVM_LIBC_FUNCTION(float, scalblnf, (float x, long n)) {
- // TODO: Implement function.
+ return fputil::ldexp(x, n);
}
} // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/math/generic/scalblnf128.cpp b/libc/src/math/generic/scalblnf128.cpp
index 760febb0f5d6f7..fda6ea0bfe0305 100644
--- a/libc/src/math/generic/scalblnf128.cpp
+++ b/libc/src/math/generic/scalblnf128.cpp
@@ -7,13 +7,19 @@
//===----------------------------------------------------------------------===//
#include "src/math/scalblnf128.h"
+#include "hdr/float_macros.h"
+#include "src/__support/FPUtil/ManipulationFunctions.h"
#include "src/__support/common.h"
#include "src/__support/macros/config.h"
+#if FLT_RADIX != 2
+#error "FLT_RADIX != 2 is not supported."
+#endif
+
namespace LIBC_NAMESPACE_DECL {
-LLVM_LIBC_FUNCTION(float, scalblnf128, (float128 x, long n)) {
- // TODO: Implement function.
+LLVM_LIBC_FUNCTION(float128, scalblnf128, (float128 x, long n)) {
+ return fputil::ldexp(x, n);
}
} // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/math/generic/scalblnl.cpp b/libc/src/math/generic/scalblnl.cpp
index b7f9028bb114ed..5823c498ba3ecc 100644
--- a/libc/src/math/generic/scalblnl.cpp
+++ b/libc/src/math/generic/scalblnl.cpp
@@ -7,13 +7,19 @@
//===----------------------------------------------------------------------===//
#include "src/math/scalblnl.h"
+#include "hdr/float_macros.h"
+#include "src/__support/FPUtil/ManipulationFunctions.h"
#include "src/__support/common.h"
#include "src/__support/macros/config.h"
+#if FLT_RADIX != 2
+#error "FLT_RADIX != 2 is not supported."
+#endif
+
namespace LIBC_NAMESPACE_DECL {
-LLVM_LIBC_FUNCTION(float, scalblnl, (long double x, long n)) {
- // TODO: Implement function.
+LLVM_LIBC_FUNCTION(long double, scalblnl, (long double x, long n)) {
+ return fputil::ldexp(x, n);
}
} // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/math/scalbln.h b/libc/src/math/scalbln.h
index 80f44784aa589f..b99ba7683ebc4a 100644
--- a/libc/src/math/scalbln.h
+++ b/libc/src/math/scalbln.h
@@ -13,7 +13,7 @@
namespace LIBC_NAMESPACE_DECL {
-float scalbln(double x, long n);
+double scalbln(double x, long n);
} // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/math/scalblnf128.h b/libc/src/math/scalblnf128.h
index 626bcd20c43cf0..b9b7a862f66f68 100644
--- a/libc/src/math/scalblnf128.h
+++ b/libc/src/math/scalblnf128.h
@@ -10,10 +10,11 @@
#define LLVM_LIBC_SRC_MATH_SCALBLNF128_H
#include "src/__support/macros/config.h"
+#include "src/__support/macros/properties/types.h"
namespace LIBC_NAMESPACE_DECL {
-float scalblnf128(float128 x, long n);
+float128 scalblnf128(float128 x, long n);
} // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/math/scalblnl.h b/libc/src/math/scalblnl.h
index 4b1823d1faa7d2..12a13b0b738e05 100644
--- a/libc/src/math/scalblnl.h
+++ b/libc/src/math/scalblnl.h
@@ -10,10 +10,11 @@
#define LLVM_LIBC_SRC_MATH_SCALBLNL_H
#include "src/__support/macros/config.h"
+#include "src/__support/macros/properties/types.h"
namespace LIBC_NAMESPACE_DECL {
-float scalblnl(long double x, long n);
+long double scalblnl(long double x, long n);
} // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/test/src/math/smoke/CMakeLists.txt b/libc/test/src/math/smoke/CMakeLists.txt
index 2aba5abb5a4d83..cfa166bdd9c84a 100644
--- a/libc/test/src/math/smoke/CMakeLists.txt
+++ b/libc/test/src/math/smoke/CMakeLists.txt
@@ -3606,6 +3606,45 @@ add_fp_unittest(
libc.src.math.atan2
)
+add_fp_unittest(
+ scalbln_test
+ SUITE
+ libc-math-smoke-tests
+ SRCS
+ scalbln_test.cpp
+ HDRS
+ ScalbnTest.h
+ DEPENDS
+ libc.src.math.scalbln
+ libc.src.__support.FPUtil.fp_bits
+)
+
+add_fp_unittest(
+ scalblnf_test
+ SUITE
+ libc-math-smoke-tests
+ SRCS
+ scalblnf_test.cpp
+ HDRS
+ ScalbnTest.h
+ DEPENDS
+ libc.src.math.scalblnf
+ libc.src.__support.FPUtil.fp_bits
+)
+
+add_fp_unittest(
+ scalblnl_test
+ SUITE
+ libc-math-smoke-tests
+ SRCS
+ scalblnl_test.cpp
+ HDRS
+ ScalbnTest.h
+ DEPENDS
+ libc.src.math.scalblnl
+ libc.src.__support.FPUtil.fp_bits
+)
+
add_fp_unittest(
scalblnf16_test
SUITE
@@ -3619,6 +3658,19 @@ add_fp_unittest(
libc.src.__support.FPUtil.fp_bits
)
+add_fp_unittest(
+ scalblnf128_test
+ SUITE
+ libc-math-smoke-tests
+ SRCS
+ scalblnf128_test.cpp
+ HDRS
+ ScalbnTest.h
+ DEPENDS
+ libc.src.math.scalblnf128
+ libc.src.__support.FPUtil.fp_bits
+)
+
add_fp_unittest(
scalbn_test
SUITE
diff --git a/libc/test/src/math/smoke/scalbln_test.cpp b/libc/test/src/math/smoke/scalbln_test.cpp
index d163c9b6332eae..eaf7b8e47b41ce 100644
--- a/libc/test/src/math/smoke/scalbln_test.cpp
+++ b/libc/test/src/math/smoke/scalbln_test.cpp
@@ -10,4 +10,4 @@
#include "src/math/scalbln.h"
-LIST_SCALBN_TESTS(double, LIBC_NAMESPACE::scalbln)
+LIST_SCALBN_TESTS(double, long, LIBC_NAMESPACE::scalbln)
diff --git a/libc/test/src/math/smoke/scalblnf128_test.cpp b/libc/test/src/math/smoke/scalblnf128_test.cpp
index 6dfed0b894d027..9ee1b3816511e0 100644
--- a/libc/test/src/math/smoke/scalblnf128_test.cpp
+++ b/libc/test/src/math/smoke/scalblnf128_test.cpp
@@ -10,4 +10,4 @@
#include "src/math/scalblnf128.h"
-LIST_SCALBN_TESTS(float128, LIBC_NAMESPACE::scalblnf128)
+LIST_SCALBN_TESTS(float128, long, LIBC_NAMESPACE::scalblnf128)
diff --git a/libc/test/src/math/smoke/scalblnf_test.cpp b/libc/test/src/math/smoke/scalblnf_test.cpp
index b2790943f242a4..a40d7aa7886db1 100644
--- a/libc/test/src/math/smoke/scalblnf_test.cpp
+++ b/libc/test/src/math/smoke/scalblnf_test.cpp
@@ -10,4 +10,4 @@
#include "src/math/scalblnf.h"
-LIST_SCALBN_TESTS(float, LIBC_NAMESPACE::scalblnf)
+LIST_SCALBN_TESTS(float, long, LIBC_NAMESPACE::scalblnf)
diff --git a/libc/test/src/math/smoke/scalblnl_test.cpp b/libc/test/src/math/smoke/scalblnl_test.cpp
index e7870ea8dbfade..ccfbe1ebdeaf09 100644
--- a/libc/test/src/math/smoke/scalblnl_test.cpp
+++ b/libc/test/src/math/smoke/scalblnl_test.cpp
@@ -10,4 +10,4 @@
#include "src/math/scalblnl.h"
-LIST_SCALBN_TESTS(float, LIBC_NAMESPACE::scalblnl)
+LIST_SCALBN_TESTS(long double, long, LIBC_NAMESPACE::scalblnl)
>From 888dd24591c2f1cf58db2a7e2c35d597e1cf04b9 Mon Sep 17 00:00:00 2001
From: aaryanshukla <53713108+aaryanshukla at users.noreply.github.com>
Date: Wed, 7 Aug 2024 09:44:44 -0700
Subject: [PATCH 4/8] Update libc/src/math/scalblnl.h
Co-authored-by: OverMighty <its.overmighty at gmail.com>
---
libc/src/math/scalblnl.h | 1 -
1 file changed, 1 deletion(-)
diff --git a/libc/src/math/scalblnl.h b/libc/src/math/scalblnl.h
index 12a13b0b738e05..e2df840892e5e9 100644
--- a/libc/src/math/scalblnl.h
+++ b/libc/src/math/scalblnl.h
@@ -10,7 +10,6 @@
#define LLVM_LIBC_SRC_MATH_SCALBLNL_H
#include "src/__support/macros/config.h"
-#include "src/__support/macros/properties/types.h"
namespace LIBC_NAMESPACE_DECL {
>From 3c9cb18e2814dda39519e1b5b622eb772fa536d6 Mon Sep 17 00:00:00 2001
From: aaryanshukla <53713108+aaryanshukla at users.noreply.github.com>
Date: Wed, 7 Aug 2024 09:44:50 -0700
Subject: [PATCH 5/8] Update libc/src/math/generic/scalblnf.cpp
Co-authored-by: OverMighty <its.overmighty at gmail.com>
---
libc/src/math/generic/scalblnf.cpp | 1 +
1 file changed, 1 insertion(+)
diff --git a/libc/src/math/generic/scalblnf.cpp b/libc/src/math/generic/scalblnf.cpp
index e4de63b4def9cd..0ba3d93b0f8548 100644
--- a/libc/src/math/generic/scalblnf.cpp
+++ b/libc/src/math/generic/scalblnf.cpp
@@ -16,6 +16,7 @@
#if FLT_RADIX != 2
#error "FLT_RADIX != 2 is not supported."
#endif
+
namespace LIBC_NAMESPACE_DECL {
LLVM_LIBC_FUNCTION(float, scalblnf, (float x, long n)) {
>From d67e1fae32c67f1906f581cbacd022884a58a3e0 Mon Sep 17 00:00:00 2001
From: aaryanshukla <53713108+aaryanshukla at users.noreply.github.com>
Date: Wed, 7 Aug 2024 09:45:13 -0700
Subject: [PATCH 6/8] Update libc/src/math/generic/scalblnf.cpp
Co-authored-by: OverMighty <its.overmighty at gmail.com>
---
libc/src/math/generic/scalblnf.cpp | 1 -
1 file changed, 1 deletion(-)
diff --git a/libc/src/math/generic/scalblnf.cpp b/libc/src/math/generic/scalblnf.cpp
index 0ba3d93b0f8548..aa11a552a91940 100644
--- a/libc/src/math/generic/scalblnf.cpp
+++ b/libc/src/math/generic/scalblnf.cpp
@@ -11,7 +11,6 @@
#include "src/__support/FPUtil/ManipulationFunctions.h"
#include "src/__support/common.h"
#include "src/__support/macros/config.h"
-#include "src/__support/macros/properties/types.h"
#if FLT_RADIX != 2
#error "FLT_RADIX != 2 is not supported."
>From 298b17e94470daf432a47c5ea7a8e69997d370fd Mon Sep 17 00:00:00 2001
From: Aaryan Shukla <aaryanshukla at google.com>
Date: Wed, 7 Aug 2024 21:57:23 +0000
Subject: [PATCH 7/8] updated headers and depends
---
libc/config/linux/aarch64/entrypoints.txt | 2 +-
libc/newhdrgen/yaml/math.yaml | 4 ++--
libc/spec/llvm_libc_ext.td | 1 -
libc/spec/stdc.td | 3 ++-
libc/test/src/math/smoke/CMakeLists.txt | 21 +++++++++++++++++++++
5 files changed, 26 insertions(+), 5 deletions(-)
diff --git a/libc/config/linux/aarch64/entrypoints.txt b/libc/config/linux/aarch64/entrypoints.txt
index 90c6e18befcf0d..e0082b179ecc47 100644
--- a/libc/config/linux/aarch64/entrypoints.txt
+++ b/libc/config/linux/aarch64/entrypoints.txt
@@ -721,8 +721,8 @@ if(LIBC_TYPES_HAS_FLOAT128)
libc.src.math.remquof128
libc.src.math.rintf128
libc.src.math.roundevenf128
- libc.src.math.scalblnf128
libc.src.math.roundf128
+ libc.src.math.scalblnf128
libc.src.math.scalbnf128
libc.src.math.setpayloadf128
libc.src.math.sqrtf128
diff --git a/libc/newhdrgen/yaml/math.yaml b/libc/newhdrgen/yaml/math.yaml
index e28560e559ed46..66b7e72641d197 100644
--- a/libc/newhdrgen/yaml/math.yaml
+++ b/libc/newhdrgen/yaml/math.yaml
@@ -2206,7 +2206,7 @@ functions:
- type: float128
- type: int
- type: unsigned int
- guard: LIBC_TYPES_HAS_FLOAT128scalbln
+ guard: LIBC_TYPES_HAS_FLOAT128
- name: scalbln
standards:
- stdc
@@ -2238,7 +2238,7 @@ functions:
guard: LIBC_HAS_TYPES_FLOAT16
- name: scalblnf128
standards:
- - llvm_libc_ext
+ - stdc
return_type: float128
arguments:
- type: float128
diff --git a/libc/spec/llvm_libc_ext.td b/libc/spec/llvm_libc_ext.td
index dc479876755a74..7cc85de10244f3 100644
--- a/libc/spec/llvm_libc_ext.td
+++ b/libc/spec/llvm_libc_ext.td
@@ -101,7 +101,6 @@ def LLVMLibcExt : StandardSpec<"llvm_libc_ext"> {
FunctionSpec<"powi", RetValSpec<DoubleType>, [ArgSpec<DoubleType>, ArgSpec<IntType>]>,
FunctionSpec<"powif", RetValSpec<FloatType>, [ArgSpec<FloatType>, ArgSpec<IntType>]>,
- GuardedFunctionSpec<"scalblnf128", RetValSpec<Float128Type>, [ArgSpec<Float128Type>, ArgSpec<LongType>], "LIBC_TYPES_HAS_FLOAT128">,
]
>;
diff --git a/libc/spec/stdc.td b/libc/spec/stdc.td
index a738ecebedad62..d39557712cd2b9 100644
--- a/libc/spec/stdc.td
+++ b/libc/spec/stdc.td
@@ -711,11 +711,12 @@ def StdC : StandardSpec<"stdc"> {
FunctionSpec<"acoshf", RetValSpec<FloatType>, [ArgSpec<FloatType>]>,
FunctionSpec<"asinhf", RetValSpec<FloatType>, [ArgSpec<FloatType>]>,
FunctionSpec<"atanhf", RetValSpec<FloatType>, [ArgSpec<FloatType>]>,
-
+
FunctionSpec<"scalbln", RetValSpec<DoubleType>, [ArgSpec<DoubleType>, ArgSpec<LongType>]>,
FunctionSpec<"scalblnl", RetValSpec<LongDoubleType>, [ArgSpec<LongDoubleType>, ArgSpec<LongType>]>,
FunctionSpec<"scalblnf", RetValSpec<FloatType>, [ArgSpec<FloatType>, ArgSpec<LongType>]>,
GuardedFunctionSpec<"scalblnf16", RetValSpec<Float16Type>, [ArgSpec<Float16Type>, ArgSpec<LongType>], "LIBC_TYPES_HAS_FLOAT16">,
+ GuardedFunctionSpec<"scalblnf128", RetValSpec<Float128Type>, [ArgSpec<Float128Type>, ArgSpec<LongType>], "LIBC_TYPES_HAS_FLOAT128">,
FunctionSpec<"scalbn", RetValSpec<DoubleType>, [ArgSpec<DoubleType>, ArgSpec<IntType>]>,
FunctionSpec<"scalbnf", RetValSpec<FloatType>, [ArgSpec<FloatType>, ArgSpec<IntType>]>,
diff --git a/libc/test/src/math/smoke/CMakeLists.txt b/libc/test/src/math/smoke/CMakeLists.txt
index 8f41e50e107eaf..c74eb0f813b81e 100644
--- a/libc/test/src/math/smoke/CMakeLists.txt
+++ b/libc/test/src/math/smoke/CMakeLists.txt
@@ -1633,6 +1633,7 @@ add_fp_unittest(
libc.src.__support.CPP.limits
libc.src.__support.FPUtil.fp_bits
libc.src.__support.FPUtil.normal_float
+
)
add_fp_unittest(
@@ -3629,6 +3630,8 @@ add_fp_unittest(
DEPENDS
libc.src.math.scalbln
libc.src.__support.FPUtil.fp_bits
+ libc.src.__support.CPP.limits
+ libc.src.__support.FPUtil.normal_float
)
add_fp_unittest(
@@ -3642,6 +3645,8 @@ add_fp_unittest(
DEPENDS
libc.src.math.scalblnf
libc.src.__support.FPUtil.fp_bits
+ libc.src.__support.CPP.limits
+ libc.src.__support.FPUtil.normal_float
)
add_fp_unittest(
@@ -3655,6 +3660,8 @@ add_fp_unittest(
DEPENDS
libc.src.math.scalblnl
libc.src.__support.FPUtil.fp_bits
+ libc.src.__support.CPP.limits
+ libc.src.__support.FPUtil.normal_float
)
add_fp_unittest(
@@ -3668,6 +3675,8 @@ add_fp_unittest(
DEPENDS
libc.src.math.scalblnf16
libc.src.__support.FPUtil.fp_bits
+ libc.src.__support.CPP.limits
+ libc.src.__support.FPUtil.normal_float
)
add_fp_unittest(
@@ -3681,6 +3690,8 @@ add_fp_unittest(
DEPENDS
libc.src.math.scalblnf128
libc.src.__support.FPUtil.fp_bits
+ libc.src.__support.CPP.limits
+ libc.src.__support.FPUtil.normal_float
)
add_fp_unittest(
@@ -3694,6 +3705,8 @@ add_fp_unittest(
DEPENDS
libc.src.math.scalbn
libc.src.__support.FPUtil.fp_bits
+ libc.src.__support.CPP.limits
+ libc.src.__support.FPUtil.normal_float
)
add_fp_unittest(
@@ -3707,6 +3720,8 @@ add_fp_unittest(
DEPENDS
libc.src.math.scalbnf
libc.src.__support.FPUtil.fp_bits
+ libc.src.__support.CPP.limits
+ libc.src.__support.FPUtil.normal_float
)
add_fp_unittest(
@@ -3720,6 +3735,8 @@ add_fp_unittest(
DEPENDS
libc.src.math.scalbnl
libc.src.__support.FPUtil.fp_bits
+ libc.src.__support.CPP.limits
+ libc.src.__support.FPUtil.normal_float
)
add_fp_unittest(
@@ -3733,6 +3750,8 @@ add_fp_unittest(
DEPENDS
libc.src.math.scalbnf16
libc.src.__support.FPUtil.fp_bits
+ libc.src.__support.CPP.limits
+ libc.src.__support.FPUtil.normal_float
)
add_fp_unittest(
@@ -3746,6 +3765,8 @@ add_fp_unittest(
DEPENDS
libc.src.math.scalbnf128
libc.src.__support.FPUtil.fp_bits
+ libc.src.__support.CPP.limits
+ libc.src.__support.FPUtil.normal_float
)
add_fp_unittest(
>From 500b22e166764059da7ba9a7eb11d551cf860fd9 Mon Sep 17 00:00:00 2001
From: aaryanshukla <53713108+aaryanshukla at users.noreply.github.com>
Date: Wed, 7 Aug 2024 14:59:30 -0700
Subject: [PATCH 8/8] Update math.yaml
---
libc/newhdrgen/yaml/math.yaml | 21 +++++++--------------
1 file changed, 7 insertions(+), 14 deletions(-)
diff --git a/libc/newhdrgen/yaml/math.yaml b/libc/newhdrgen/yaml/math.yaml
index 66b7e72641d197..0f020c91648e20 100644
--- a/libc/newhdrgen/yaml/math.yaml
+++ b/libc/newhdrgen/yaml/math.yaml
@@ -115,6 +115,13 @@ functions:
return_type: long double
arguments:
- type: long double
+ - name: floorf128
+ standards:
+ - stdc
+ return_type: float128
+ arguments:
+ - type: float128
+ guard: LIBC_TYPES_HAS_FLOAT12
- name: fmin
standards:
- stdc
@@ -1845,13 +1852,6 @@ functions:
- type: float128
- type: float128
guard: LIBC_TYPES_HAS_FLOAT128
- - name: floorf128
- standards:
- - stdc
- return_type: float128
- arguments:
- - type: float128
- guard: LIBC_TYPES_HAS_FLOAT128
- name: fdiv
standards:
- stdc
@@ -1899,13 +1899,6 @@ functions:
- type: float128
- type: float128
guards: LIBC_TYPES_HAS_FLOAT128
- - name: floorf128
- standards:
- - stdc
- return_type: float128
- arguments:
- - type: float128
- guard: LIBC_TYPES_HAS_FLOAT128
- name: fmaxf128
standards:
- stdc
More information about the libc-commits
mailing list