[libc-commits] [libc] [libc][math][c23] add entry points and tests for fsqrt (PR #99669)
Job Henandez Lara via libc-commits
libc-commits at lists.llvm.org
Sat Jul 20 14:46:12 PDT 2024
https://github.com/Jobhdez updated https://github.com/llvm/llvm-project/pull/99669
>From 10214f2b388a074d85f12d363c95136abde911dc Mon Sep 17 00:00:00 2001
From: Job Hernandez <hj93 at protonmail.com>
Date: Fri, 19 Jul 2024 10:19:42 -0700
Subject: [PATCH 1/6] add entrypoints and functions
---
libc/config/linux/x86_64/entrypoints.txt | 3 ++
libc/src/math/CMakeLists.txt | 4 +++
libc/src/math/fsqrt.h | 21 +++++++++++++
libc/src/math/fsqrtf128.h | 21 +++++++++++++
libc/src/math/fsqrtl.h | 21 +++++++++++++
libc/src/math/generic/CMakeLists.txt | 39 ++++++++++++++++++++++++
libc/src/math/generic/fsqrt.cpp | 20 ++++++++++++
libc/src/math/generic/fsqrtf128.cpp | 20 ++++++++++++
libc/src/math/generic/fsqrtl.cpp | 20 ++++++++++++
9 files changed, 169 insertions(+)
create mode 100644 libc/src/math/fsqrt.h
create mode 100644 libc/src/math/fsqrtf128.h
create mode 100644 libc/src/math/fsqrtl.h
create mode 100644 libc/src/math/generic/fsqrt.cpp
create mode 100644 libc/src/math/generic/fsqrtf128.cpp
create mode 100644 libc/src/math/generic/fsqrtl.cpp
diff --git a/libc/config/linux/x86_64/entrypoints.txt b/libc/config/linux/x86_64/entrypoints.txt
index f2029da83ee71..dea3e8878a924 100644
--- a/libc/config/linux/x86_64/entrypoints.txt
+++ b/libc/config/linux/x86_64/entrypoints.txt
@@ -450,6 +450,8 @@ set(TARGET_LIBM_ENTRYPOINTS
libc.src.math.fromfpx
libc.src.math.fromfpxf
libc.src.math.fromfpxl
+ libc.src.math.fsqrt
+ libc.src.math.fsqrtl
libc.src.math.hypot
libc.src.math.hypotf
libc.src.math.ilogb
@@ -661,6 +663,7 @@ if(LIBC_TYPES_HAS_FLOAT128)
libc.src.math.frexpf128
libc.src.math.fromfpf128
libc.src.math.fromfpxf128
+ libc.src.math.fsqrtf128
libc.src.math.ilogbf128
libc.src.math.ldexpf128
libc.src.math.llogbf128
diff --git a/libc/src/math/CMakeLists.txt b/libc/src/math/CMakeLists.txt
index 050bf0f1ebf22..82dd23186187b 100644
--- a/libc/src/math/CMakeLists.txt
+++ b/libc/src/math/CMakeLists.txt
@@ -131,6 +131,10 @@ add_math_entrypoint_object(f16sqrtf)
add_math_entrypoint_object(f16sqrtl)
add_math_entrypoint_object(f16sqrtf128)
+add_math_entrypoint_object(fsqrt)
+add_math_entrypoint_object(fsqrtl)
+add_math_entrypoint_object(fsqrtf128)
+
add_math_entrypoint_object(f16sub)
add_math_entrypoint_object(f16subf)
add_math_entrypoint_object(f16subl)
diff --git a/libc/src/math/fsqrt.h b/libc/src/math/fsqrt.h
new file mode 100644
index 0000000000000..1063d2e38db75
--- /dev/null
+++ b/libc/src/math/fsqrt.h
@@ -0,0 +1,21 @@
+//===-- Implementation header for fsqrt -------------------------*- 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_FSQRT_H
+#define LLVM_LIBC_SRC_MATH_FSQRT_H
+
+#include "src/__support/macros/config.h"
+#include "src/__support/macros/properties/types.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+float fsqrt(double x);
+
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SRC_MATH_F16SQRT_H
diff --git a/libc/src/math/fsqrtf128.h b/libc/src/math/fsqrtf128.h
new file mode 100644
index 0000000000000..5286cbc33116d
--- /dev/null
+++ b/libc/src/math/fsqrtf128.h
@@ -0,0 +1,21 @@
+//===-- Implementation header for fsqrtf128 ---------------------*- 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_FSQRTF128_H
+#define LLVM_LIBC_SRC_MATH_FSQRTF128_H
+
+#include "src/__support/macros/config.h"
+#include "src/__support/macros/properties/types.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+float fsqrtf128(float128 x);
+
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SRC_MATH_FSQRTF128_H
diff --git a/libc/src/math/fsqrtl.h b/libc/src/math/fsqrtl.h
new file mode 100644
index 0000000000000..a857bab1d1ed6
--- /dev/null
+++ b/libc/src/math/fsqrtl.h
@@ -0,0 +1,21 @@
+//===-- Implementation header for fsqrtl ------------------------*- 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_FSQRTL_H
+#define LLVM_LIBC_SRC_MATH_FSQRTL_H
+
+#include "src/__support/macros/config.h"
+#include "src/__support/macros/properties/types.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+float fsqrtl(long double x);
+
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SRC_MATH_FSQRTL_H
diff --git a/libc/src/math/generic/CMakeLists.txt b/libc/src/math/generic/CMakeLists.txt
index 8e8ffb01adf60..ccda7691d07bc 100644
--- a/libc/src/math/generic/CMakeLists.txt
+++ b/libc/src/math/generic/CMakeLists.txt
@@ -4201,6 +4201,45 @@ add_entrypoint_object(
-O3
)
+add_entrypoint_object(
+ fsqrt
+ SRCS
+ fsqrt.cpp
+ HDRS
+ ../fsqrt.h
+ DEPENDS
+ libc.src.__support.macros.properties.types
+ libc.src.__support.FPUtil.generic.sqrt
+ COMPILE_OPTIONS
+ -O3
+)
+
+add_entrypoint_object(
+ fsqrtl
+ SRCS
+ fsqrtl.cpp
+ HDRS
+ ../fsqrtl.h
+ DEPENDS
+ libc.src.__support.macros.properties.types
+ libc.src.__support.FPUtil.generic.sqrt
+ COMPILE_OPTIONS
+ -O3
+)
+
+add_entrypoint_object(
+ fsqrtf128
+ SRCS
+ fsqrtf128.cpp
+ HDRS
+ ../fsqrtf128.h
+ DEPENDS
+ libc.src.__support.macros.properties.types
+ libc.src.__support.FPUtil.generic.sqrt
+ COMPILE_OPTIONS
+ -O3
+)
+
add_entrypoint_object(
cbrtf
SRCS
diff --git a/libc/src/math/generic/fsqrt.cpp b/libc/src/math/generic/fsqrt.cpp
new file mode 100644
index 0000000000000..0aabb4652a1c0
--- /dev/null
+++ b/libc/src/math/generic/fsqrt.cpp
@@ -0,0 +1,20 @@
+//===-- Implementation of fsqrt 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/fsqrt.h"
+#include "src/__support/FPUtil/generic/sqrt.h"
+#include "src/__support/common.h"
+#include "src/__support/macros/config.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+LLVM_LIBC_FUNCTION(float, fsqrt, (double x)) {
+ return fputil::sqrt<float>(x);
+}
+
+} // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/math/generic/fsqrtf128.cpp b/libc/src/math/generic/fsqrtf128.cpp
new file mode 100644
index 0000000000000..f2c049529d6cd
--- /dev/null
+++ b/libc/src/math/generic/fsqrtf128.cpp
@@ -0,0 +1,20 @@
+//===-- Implementation of fsqrt128 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/fsqrtf128.h"
+#include "src/__support/FPUtil/generic/sqrt.h"
+#include "src/__support/common.h"
+#include "src/__support/macros/config.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+LLVM_LIBC_FUNCTION(float, fsqrtf128, (float128 x)) {
+ return fputil::sqrt<float>(x);
+}
+
+} // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/math/generic/fsqrtl.cpp b/libc/src/math/generic/fsqrtl.cpp
new file mode 100644
index 0000000000000..b896a84aeded8
--- /dev/null
+++ b/libc/src/math/generic/fsqrtl.cpp
@@ -0,0 +1,20 @@
+//===-- Implementation of fsqrtl 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/fsqrtl.h"
+#include "src/__support/FPUtil/generic/sqrt.h"
+#include "src/__support/common.h"
+#include "src/__support/macros/config.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+LLVM_LIBC_FUNCTION(float, fsqrtl, (long double x)) {
+ return fputil::sqrt<float>(x);
+}
+
+} // namespace LIBC_NAMESPACE_DECL
>From 8be52c2d081ddfa2d8ff1b5fa61bfd81bd10638c Mon Sep 17 00:00:00 2001
From: Job Hernandez <hj93 at protonmail.com>
Date: Fri, 19 Jul 2024 10:20:19 -0700
Subject: [PATCH 2/6] format code
---
libc/src/math/generic/fsqrt.cpp | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/libc/src/math/generic/fsqrt.cpp b/libc/src/math/generic/fsqrt.cpp
index 0aabb4652a1c0..d54471fd067bf 100644
--- a/libc/src/math/generic/fsqrt.cpp
+++ b/libc/src/math/generic/fsqrt.cpp
@@ -13,8 +13,6 @@
namespace LIBC_NAMESPACE_DECL {
-LLVM_LIBC_FUNCTION(float, fsqrt, (double x)) {
- return fputil::sqrt<float>(x);
-}
+LLVM_LIBC_FUNCTION(float, fsqrt, (double x)) { return fputil::sqrt<float>(x); }
} // namespace LIBC_NAMESPACE_DECL
>From e2f1047e388e218c4a14f90c480fad8ada4c7ade Mon Sep 17 00:00:00 2001
From: Job Hernandez <hj93 at protonmail.com>
Date: Sat, 20 Jul 2024 11:07:24 -0700
Subject: [PATCH 3/6] add tests
---
libc/spec/stdc.td | 4 ++
libc/test/src/math/CMakeLists.txt | 26 +++++++++++++
libc/test/src/math/fsqrt_test.cpp | 13 +++++++
libc/test/src/math/fsqrtl_test.cpp | 13 +++++++
libc/test/src/math/smoke/CMakeLists.txt | 37 +++++++++++++++++++
libc/test/src/math/smoke/f16sqrtf128_test.cpp | 2 +-
libc/test/src/math/smoke/fsqrt_test.cpp | 13 +++++++
libc/test/src/math/smoke/fsqrtf128_test.cpp | 13 +++++++
libc/test/src/math/smoke/fsqrtl_test.cpp | 13 +++++++
9 files changed, 133 insertions(+), 1 deletion(-)
create mode 100644 libc/test/src/math/fsqrt_test.cpp
create mode 100644 libc/test/src/math/fsqrtl_test.cpp
create mode 100644 libc/test/src/math/smoke/fsqrt_test.cpp
create mode 100644 libc/test/src/math/smoke/fsqrtf128_test.cpp
create mode 100644 libc/test/src/math/smoke/fsqrtl_test.cpp
diff --git a/libc/spec/stdc.td b/libc/spec/stdc.td
index 285166ef0be78..af01684dc0365 100644
--- a/libc/spec/stdc.td
+++ b/libc/spec/stdc.td
@@ -739,6 +739,10 @@ def StdC : StandardSpec<"stdc"> {
GuardedFunctionSpec<"f16mulf128", RetValSpec<Float16Type>, [ArgSpec<Float128Type>, ArgSpec<Float128Type>], "LIBC_TYPES_HAS_FLOAT16_AND_FLOAT128">,
+ FunctionSpec<"fsqrt", RetValSpec<FloatType>, [ArgSpec<DoubleType>]>,
+ FunctionSpec<"fsqrtl", RetValSpec<FloatType>, [ArgSpec<LongDoubleType>]>,
+ GuardedFunctionSpec<"f16sqrtf128", RetValSpec<FloatType>, [ArgSpec<Float128Type>]>,
+
GuardedFunctionSpec<"f16divf128", RetValSpec<Float16Type>, [ArgSpec<Float128Type>, ArgSpec<Float128Type>], "LIBC_TYPES_HAS_FLOAT16_AND_FLOAT128">,
GuardedFunctionSpec<"f16sqrtf128", RetValSpec<Float16Type>, [ArgSpec<Float128Type>], "LIBC_TYPES_HAS_FLOAT16_AND_FLOAT128">,
diff --git a/libc/test/src/math/CMakeLists.txt b/libc/test/src/math/CMakeLists.txt
index f69b0d9b1b666..586338b2213de 100644
--- a/libc/test/src/math/CMakeLists.txt
+++ b/libc/test/src/math/CMakeLists.txt
@@ -2245,6 +2245,32 @@ add_fp_unittest(
libc.src.math.f16sqrtl
)
+add_fp_unittest(
+ fsqrt_test
+ NEED_MPFR
+ SUITE
+ libc-math-unittests
+ SRCS
+ fsqrt_test.cpp
+ HDRS
+ SqrtTest.h
+ DEPENDS
+ libc.src.math.fsqrt
+)
+
+add_fp_unittest(
+ fsqrtl_test
+ NEED_MPFR
+ SUITE
+ libc-math-unittests
+ SRCS
+ fsqrtl_test.cpp
+ HDRS
+ SqrtTest.h
+ DEPENDS
+ libc.src.math.fsqrtl
+)
+
add_fp_unittest(
cbrtf_test
NEED_MPFR
diff --git a/libc/test/src/math/fsqrt_test.cpp b/libc/test/src/math/fsqrt_test.cpp
new file mode 100644
index 0000000000000..8471e3c9365e9
--- /dev/null
+++ b/libc/test/src/math/fsqrt_test.cpp
@@ -0,0 +1,13 @@
+//===-- Unittests for fsqrt -----------------------------------------------===//
+//
+// 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 "SqrtTest.h"
+
+#include "src/math/fsqrt.h"
+
+LIST_NARROWING_SQRT_TESTS(float, double, LIBC_NAMESPACE::fsqrt)
diff --git a/libc/test/src/math/fsqrtl_test.cpp b/libc/test/src/math/fsqrtl_test.cpp
new file mode 100644
index 0000000000000..1082a33466857
--- /dev/null
+++ b/libc/test/src/math/fsqrtl_test.cpp
@@ -0,0 +1,13 @@
+//===-- Unittests for fsqrtl ----------------------------------------------===//
+//
+// 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 "SqrtTest.h"
+
+#include "src/math/fsqrtl.h"
+
+LIST_NARROWING_SQRT_TESTS(float, long double, LIBC_NAMESPACE::fsqrtl)
diff --git a/libc/test/src/math/smoke/CMakeLists.txt b/libc/test/src/math/smoke/CMakeLists.txt
index 69f53c5d27f15..f7caa03d11646 100644
--- a/libc/test/src/math/smoke/CMakeLists.txt
+++ b/libc/test/src/math/smoke/CMakeLists.txt
@@ -3959,6 +3959,43 @@ add_fp_unittest(
libc.src.math.f16sqrtf128
)
+add_fp_unittest(
+ fsqrt_test
+ SUITE
+ libc-math-smoke-tests
+ SRCS
+ fsqrt_test.cpp
+ HDRS
+ SqrtTest.h
+ DEPENDS
+ libc.src.math.fsqrt
+)
+
+
+add_fp_unittest(
+ fsqrtl_test
+ SUITE
+ libc-math-smoke-tests
+ SRCS
+ fsqrtl_test.cpp
+ HDRS
+ SqrtTest.h
+ DEPENDS
+ libc.src.math.fsqrtl
+)
+
+add_fp_unittest(
+ fsqrtf128_test
+ SUITE
+ libc-math-smoke-tests
+ SRCS
+ fsqrtf128_test.cpp
+ HDRS
+ SqrtTest.h
+ DEPENDS
+ libc.src.math.fsqrtf128
+)
+
add_fp_unittest(
sin_test
SUITE
diff --git a/libc/test/src/math/smoke/f16sqrtf128_test.cpp b/libc/test/src/math/smoke/f16sqrtf128_test.cpp
index 31c994860dcd8..b3d5db635a21c 100644
--- a/libc/test/src/math/smoke/f16sqrtf128_test.cpp
+++ b/libc/test/src/math/smoke/f16sqrtf128_test.cpp
@@ -1,4 +1,4 @@
-//===-- Unittests for f16sqrtf128 -----------------------------------------===//
+//===-- Unittests for f16sqrtf128 -------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
diff --git a/libc/test/src/math/smoke/fsqrt_test.cpp b/libc/test/src/math/smoke/fsqrt_test.cpp
new file mode 100644
index 0000000000000..b8d99d3af0cf6
--- /dev/null
+++ b/libc/test/src/math/smoke/fsqrt_test.cpp
@@ -0,0 +1,13 @@
+//===-- Unittests for fsqrt -------------------------------------------===//
+//
+// 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 "SqrtTest.h"
+
+#include "src/math/fsqrt.h"
+
+LIST_NARROWING_SQRT_TESTS(float, double, LIBC_NAMESPACE::fsqrt)
diff --git a/libc/test/src/math/smoke/fsqrtf128_test.cpp b/libc/test/src/math/smoke/fsqrtf128_test.cpp
new file mode 100644
index 0000000000000..b125a35b09b9e
--- /dev/null
+++ b/libc/test/src/math/smoke/fsqrtf128_test.cpp
@@ -0,0 +1,13 @@
+//===-- Unittests for fsqrtf128 -------------------------------------------===//
+//
+// 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 "SqrtTest.h"
+
+#include "src/math/fsqrtf128.h"
+
+LIST_NARROWING_SQRT_TESTS(float, float128, LIBC_NAMESPACE::fsqrtf128)
diff --git a/libc/test/src/math/smoke/fsqrtl_test.cpp b/libc/test/src/math/smoke/fsqrtl_test.cpp
new file mode 100644
index 0000000000000..dca975dac97dd
--- /dev/null
+++ b/libc/test/src/math/smoke/fsqrtl_test.cpp
@@ -0,0 +1,13 @@
+//===-- Unittests for fsqrtl ------------------------------------------===//
+//
+// 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 "SqrtTest.h"
+
+#include "src/math/fsqrtl.h"
+
+LIST_NARROWING_SQRT_TESTS(float, long double, LIBC_NAMESPACE::fsqrtl)
>From 4c226d60d740f9e8516fdc7b3dd2c4cda07dac8f Mon Sep 17 00:00:00 2001
From: Job Hernandez <hj93 at protonmail.com>
Date: Sat, 20 Jul 2024 14:16:59 -0700
Subject: [PATCH 4/6] add template for explain and compare
---
libc/utils/MPFRWrapper/MPFRUtils.cpp | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/libc/utils/MPFRWrapper/MPFRUtils.cpp b/libc/utils/MPFRWrapper/MPFRUtils.cpp
index bb63e0b9f4de0..535824a0da1e8 100644
--- a/libc/utils/MPFRWrapper/MPFRUtils.cpp
+++ b/libc/utils/MPFRWrapper/MPFRUtils.cpp
@@ -887,6 +887,9 @@ template void explain_unary_operation_single_output_error(Operation op,
long double,
long double, double,
RoundingMode);
+template void explain_unary_operation_single_output_error(Operation op, double, float, double, RoundingMode);
+template void explain_unary_operation_single_output_error(Operation op, long double, float, double, RoundingMode);
+
#ifdef LIBC_TYPES_HAS_FLOAT16
template void explain_unary_operation_single_output_error(Operation op, float16,
float16, double,
@@ -1106,6 +1109,11 @@ template bool compare_unary_operation_single_output(Operation, double, double,
template bool compare_unary_operation_single_output(Operation, long double,
long double, double,
RoundingMode);
+template bool compare_unary_operation_single_output(Operation, double, float,
+ double, RoundingMode);
+template bool compare_unary_operation_single_output(Operation, long double,
+ float, double,
+ RoundingMode);
#ifdef LIBC_TYPES_HAS_FLOAT16
template bool compare_unary_operation_single_output(Operation, float16, float16,
double, RoundingMode);
>From d72ce9d72b4917682e54872ed30d71fff40576ad Mon Sep 17 00:00:00 2001
From: Job Hernandez <hj93 at protonmail.com>
Date: Sat, 20 Jul 2024 14:17:27 -0700
Subject: [PATCH 5/6] format code
---
libc/utils/MPFRWrapper/MPFRUtils.cpp | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/libc/utils/MPFRWrapper/MPFRUtils.cpp b/libc/utils/MPFRWrapper/MPFRUtils.cpp
index 535824a0da1e8..d2c28c19ab176 100644
--- a/libc/utils/MPFRWrapper/MPFRUtils.cpp
+++ b/libc/utils/MPFRWrapper/MPFRUtils.cpp
@@ -887,9 +887,13 @@ template void explain_unary_operation_single_output_error(Operation op,
long double,
long double, double,
RoundingMode);
-template void explain_unary_operation_single_output_error(Operation op, double, float, double, RoundingMode);
-template void explain_unary_operation_single_output_error(Operation op, long double, float, double, RoundingMode);
-
+template void explain_unary_operation_single_output_error(Operation op, double,
+ float, double,
+ RoundingMode);
+template void explain_unary_operation_single_output_error(Operation op,
+ long double, float,
+ double, RoundingMode);
+
#ifdef LIBC_TYPES_HAS_FLOAT16
template void explain_unary_operation_single_output_error(Operation op, float16,
float16, double,
>From 9180d3e3eccb52315dc4ef10b4f8c88b133be79a Mon Sep 17 00:00:00 2001
From: Job Hernandez <hj93 at protonmail.com>
Date: Sat, 20 Jul 2024 14:45:46 -0700
Subject: [PATCH 6/6] address review
---
libc/spec/stdc.td | 2 +-
libc/src/math/fsqrt.h | 3 +--
libc/src/math/fsqrtf128.h | 1 -
libc/src/math/fsqrtl.h | 1 -
libc/src/math/generic/CMakeLists.txt | 3 ---
libc/test/src/math/smoke/f16sqrtf128_test.cpp | 2 +-
6 files changed, 3 insertions(+), 9 deletions(-)
diff --git a/libc/spec/stdc.td b/libc/spec/stdc.td
index af01684dc0365..d71eef24e2aba 100644
--- a/libc/spec/stdc.td
+++ b/libc/spec/stdc.td
@@ -741,7 +741,7 @@ def StdC : StandardSpec<"stdc"> {
FunctionSpec<"fsqrt", RetValSpec<FloatType>, [ArgSpec<DoubleType>]>,
FunctionSpec<"fsqrtl", RetValSpec<FloatType>, [ArgSpec<LongDoubleType>]>,
- GuardedFunctionSpec<"f16sqrtf128", RetValSpec<FloatType>, [ArgSpec<Float128Type>]>,
+ GuardedFunctionSpec<"fsqrtf128", RetValSpec<FloatType>, [ArgSpec<Float128Type>], "LIBC_TYPES_HAS_FLOAT128">,
GuardedFunctionSpec<"f16divf128", RetValSpec<Float16Type>, [ArgSpec<Float128Type>, ArgSpec<Float128Type>], "LIBC_TYPES_HAS_FLOAT16_AND_FLOAT128">,
diff --git a/libc/src/math/fsqrt.h b/libc/src/math/fsqrt.h
index 1063d2e38db75..e6a8c3179f811 100644
--- a/libc/src/math/fsqrt.h
+++ b/libc/src/math/fsqrt.h
@@ -10,7 +10,6 @@
#define LLVM_LIBC_SRC_MATH_FSQRT_H
#include "src/__support/macros/config.h"
-#include "src/__support/macros/properties/types.h"
namespace LIBC_NAMESPACE_DECL {
@@ -18,4 +17,4 @@ float fsqrt(double x);
} // namespace LIBC_NAMESPACE_DECL
-#endif // LLVM_LIBC_SRC_MATH_F16SQRT_H
+#endif // LLVM_LIBC_SRC_MATH_FSQRT_H
diff --git a/libc/src/math/fsqrtf128.h b/libc/src/math/fsqrtf128.h
index 5286cbc33116d..fa907af3bd81e 100644
--- a/libc/src/math/fsqrtf128.h
+++ b/libc/src/math/fsqrtf128.h
@@ -10,7 +10,6 @@
#define LLVM_LIBC_SRC_MATH_FSQRTF128_H
#include "src/__support/macros/config.h"
-#include "src/__support/macros/properties/types.h"
namespace LIBC_NAMESPACE_DECL {
diff --git a/libc/src/math/fsqrtl.h b/libc/src/math/fsqrtl.h
index a857bab1d1ed6..a50eea3335458 100644
--- a/libc/src/math/fsqrtl.h
+++ b/libc/src/math/fsqrtl.h
@@ -10,7 +10,6 @@
#define LLVM_LIBC_SRC_MATH_FSQRTL_H
#include "src/__support/macros/config.h"
-#include "src/__support/macros/properties/types.h"
namespace LIBC_NAMESPACE_DECL {
diff --git a/libc/src/math/generic/CMakeLists.txt b/libc/src/math/generic/CMakeLists.txt
index ccda7691d07bc..557bd9c193b0b 100644
--- a/libc/src/math/generic/CMakeLists.txt
+++ b/libc/src/math/generic/CMakeLists.txt
@@ -4208,7 +4208,6 @@ add_entrypoint_object(
HDRS
../fsqrt.h
DEPENDS
- libc.src.__support.macros.properties.types
libc.src.__support.FPUtil.generic.sqrt
COMPILE_OPTIONS
-O3
@@ -4221,7 +4220,6 @@ add_entrypoint_object(
HDRS
../fsqrtl.h
DEPENDS
- libc.src.__support.macros.properties.types
libc.src.__support.FPUtil.generic.sqrt
COMPILE_OPTIONS
-O3
@@ -4234,7 +4232,6 @@ add_entrypoint_object(
HDRS
../fsqrtf128.h
DEPENDS
- libc.src.__support.macros.properties.types
libc.src.__support.FPUtil.generic.sqrt
COMPILE_OPTIONS
-O3
diff --git a/libc/test/src/math/smoke/f16sqrtf128_test.cpp b/libc/test/src/math/smoke/f16sqrtf128_test.cpp
index b3d5db635a21c..31c994860dcd8 100644
--- a/libc/test/src/math/smoke/f16sqrtf128_test.cpp
+++ b/libc/test/src/math/smoke/f16sqrtf128_test.cpp
@@ -1,4 +1,4 @@
-//===-- Unittests for f16sqrtf128 -------------------------------------===//
+//===-- Unittests for f16sqrtf128 -----------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
More information about the libc-commits
mailing list