From ef9d7304babe38de0aee3720fe1941eff2f9fd46 Mon Sep 17 00:00:00 2001 From: Aaryan Shukla Date: Thu, 8 Aug 2024 20:38:29 +0000 Subject: [PATCH 01/13] [libc][math][c23] functions --- libc/config/linux/aarch64/entrypoints.txt | 2 ++ libc/config/linux/arm/entrypoints.txt | 1 + libc/config/linux/riscv/entrypoints.txt | 2 ++ libc/config/linux/x86_64/entrypoints.txt | 2 ++ libc/config/windows/entrypoints.txt | 1 + libc/spec/stdc.td | 1 + libc/src/math/CMakeLists.txt | 3 +++ libc/src/math/fadd.h | 2 +- libc/src/math/faddf128.h | 22 +++++++++++++++++ libc/src/math/faddl.h | 20 ++++++++++++++++ libc/src/math/generic/CMakeLists.txt | 25 +++++++++++++++++++ libc/src/math/generic/fadd.cpp | 2 +- libc/src/math/generic/faddf128.cpp | 20 ++++++++++++++++ libc/src/math/generic/faddl.cpp | 20 ++++++++++++++++ libc/test/src/math/CMakeLists.txt | 14 +++++++++++ libc/test/src/math/faddl_test.cpp | 13 ++++++++++ libc/test/src/math/smoke/CMakeLists.txt | 28 ++++++++++++++++++++++ libc/test/src/math/smoke/faddf128_test.cpp | 13 ++++++++++ libc/test/src/math/smoke/faddl_test.cpp | 13 ++++++++++ 19 files changed, 202 insertions(+), 2 deletions(-) create mode 100644 libc/src/math/faddf128.h create mode 100644 libc/src/math/faddl.h create mode 100644 libc/src/math/generic/faddf128.cpp create mode 100644 libc/src/math/generic/faddl.cpp create mode 100644 libc/test/src/math/faddl_test.cpp create mode 100644 libc/test/src/math/smoke/faddf128_test.cpp create mode 100644 libc/test/src/math/smoke/faddl_test.cpp diff --git a/libc/config/linux/aarch64/entrypoints.txt b/libc/config/linux/aarch64/entrypoints.txt index b92b96c89315e..34bf671a27092 100644 --- a/libc/config/linux/aarch64/entrypoints.txt +++ b/libc/config/linux/aarch64/entrypoints.txt @@ -407,6 +407,7 @@ set(TARGET_LIBM_ENTRYPOINTS libc.src.math.fabsf libc.src.math.fabsl libc.src.math.fadd + libc.src.math.faddl libc.src.math.fdim libc.src.math.fdimf libc.src.math.fdiml @@ -683,6 +684,7 @@ if(LIBC_TYPES_HAS_FLOAT128) libc.src.math.dsqrtf128 libc.src.math.dsubf128 libc.src.math.fabsf128 + libc.src.math.faddf128 libc.src.math.fdimf128 libc.src.math.fdivf128 libc.src.math.ffmaf128 diff --git a/libc/config/linux/arm/entrypoints.txt b/libc/config/linux/arm/entrypoints.txt index c6b7b6cc9acfa..1f0fd4eb2481b 100644 --- a/libc/config/linux/arm/entrypoints.txt +++ b/libc/config/linux/arm/entrypoints.txt @@ -243,6 +243,7 @@ set(TARGET_LIBM_ENTRYPOINTS libc.src.math.fabsf libc.src.math.fabsl libc.src.math.fadd + libc.src.math.faddl libc.src.math.fdim libc.src.math.fdimf libc.src.math.fdiml diff --git a/libc/config/linux/riscv/entrypoints.txt b/libc/config/linux/riscv/entrypoints.txt index a90fdbef31bf2..1036774f8c702 100644 --- a/libc/config/linux/riscv/entrypoints.txt +++ b/libc/config/linux/riscv/entrypoints.txt @@ -406,6 +406,7 @@ set(TARGET_LIBM_ENTRYPOINTS libc.src.math.fabsf libc.src.math.fabsl libc.src.math.fadd + libc.src.math.faddl libc.src.math.fdim libc.src.math.fdimf libc.src.math.fdiml @@ -590,6 +591,7 @@ if(LIBC_TYPES_HAS_FLOAT128) libc.src.math.dsqrtf128 libc.src.math.dsubf128 libc.src.math.fabsf128 + libc.src.math.faddf128 libc.src.math.fdimf128 libc.src.math.fdivf128 libc.src.math.ffmaf128 diff --git a/libc/config/linux/x86_64/entrypoints.txt b/libc/config/linux/x86_64/entrypoints.txt index 9ec86f13850db..9294a57f99d9a 100644 --- a/libc/config/linux/x86_64/entrypoints.txt +++ b/libc/config/linux/x86_64/entrypoints.txt @@ -406,6 +406,7 @@ set(TARGET_LIBM_ENTRYPOINTS libc.src.math.fabsf libc.src.math.fabsl libc.src.math.fadd + libc.src.math.faddl libc.src.math.fdim libc.src.math.fdimf libc.src.math.fdiml @@ -679,6 +680,7 @@ if(LIBC_TYPES_HAS_FLOAT128) libc.src.math.dsqrtf128 libc.src.math.dsubf128 libc.src.math.fabsf128 + libc.src.math.faddf128 libc.src.math.fdimf128 libc.src.math.fdivf128 libc.src.math.ffmaf128 diff --git a/libc/config/windows/entrypoints.txt b/libc/config/windows/entrypoints.txt index d28183549647f..99d0307bfadd8 100644 --- a/libc/config/windows/entrypoints.txt +++ b/libc/config/windows/entrypoints.txt @@ -152,6 +152,7 @@ set(TARGET_LIBM_ENTRYPOINTS libc.src.math.fabsf libc.src.math.fabsl libc.src.math.fadd + libc.src.math.faddl libc.src.math.fdim libc.src.math.fdimf libc.src.math.fdiml diff --git a/libc/spec/stdc.td b/libc/spec/stdc.td index 5dde6ac67f5a8..d4f90f29cd1fe 100644 --- a/libc/spec/stdc.td +++ b/libc/spec/stdc.td @@ -408,6 +408,7 @@ def StdC : StandardSpec<"stdc"> { GuardedFunctionSpec<"fabsf16", RetValSpec, [ArgSpec], "LIBC_TYPES_HAS_FLOAT16">, GuardedFunctionSpec<"fabsf128", RetValSpec, [ArgSpec], "LIBC_TYPES_HAS_FLOAT128">, FunctionSpec<"fadd", RetValSpec, [ArgSpec, ArgSpec]>, + FunctionSpec<"faddl", RetValSpec, [ArgSpec, ArgSpec]>, FunctionSpec<"fdim", RetValSpec, [ArgSpec, ArgSpec]>, FunctionSpec<"fdimf", RetValSpec, [ArgSpec, ArgSpec]>, diff --git a/libc/src/math/CMakeLists.txt b/libc/src/math/CMakeLists.txt index a0bd5269169fa..c9e6a37952fee 100644 --- a/libc/src/math/CMakeLists.txt +++ b/libc/src/math/CMakeLists.txt @@ -160,7 +160,10 @@ add_math_entrypoint_object(fabsf) add_math_entrypoint_object(fabsl) add_math_entrypoint_object(fabsf16) add_math_entrypoint_object(fabsf128) + add_math_entrypoint_object(fadd) +add_math_entrypoint_object(faddl) +add_math_entrypoint_object(faddf128) add_math_entrypoint_object(fdim) add_math_entrypoint_object(fdimf) diff --git a/libc/src/math/fadd.h b/libc/src/math/fadd.h index ec3ce18bb676a..1dead013e3e5c 100644 --- a/libc/src/math/fadd.h +++ b/libc/src/math/fadd.h @@ -1,4 +1,4 @@ -//===-- Implementation of fadd function ----------------------------------===// +//===-- Implementation of fadd function -----------------------------------===// // // 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/src/math/faddf128.h b/libc/src/math/faddf128.h new file mode 100644 index 0000000000000..37886450e4fd1 --- /dev/null +++ b/libc/src/math/faddf128.h @@ -0,0 +1,22 @@ +//===-- Implementation of faddf128 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/__support/macros/config.h" +#include "src/__support/macros/properties/types.h" + + +#ifndef LLVM_LIBC_SRC_MATH_FADDF128_H +#define LLVM_LIBC_SRC_MATH_FADDF128_H + +namespace LIBC_NAMESPACE_DECL { + +float faddf128(float128 x, float128 y); + +} // namespace LIBC_NAMESPACE_DECL + +#endif // LLVM_LIBC_SRC_MATH_FADDF128_H diff --git a/libc/src/math/faddl.h b/libc/src/math/faddl.h new file mode 100644 index 0000000000000..9550f9c112cb0 --- /dev/null +++ b/libc/src/math/faddl.h @@ -0,0 +1,20 @@ +//===-- Implementation of faddl 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/__support/macros/config.h" + +#ifndef LLVM_LIBC_SRC_MATH_FADDL_H +#define LLVM_LIBC_SRC_MATH_FADDL_H + +namespace LIBC_NAMESPACE_DECL { + +float faddl(long double x, long double y); + +} // namespace LIBC_NAMESPACE_DECL + +#endif // LLVM_LIBC_SRC_MATH_FADDL_H diff --git a/libc/src/math/generic/CMakeLists.txt b/libc/src/math/generic/CMakeLists.txt index be5cc2e02635a..91e21194e1fb8 100644 --- a/libc/src/math/generic/CMakeLists.txt +++ b/libc/src/math/generic/CMakeLists.txt @@ -586,6 +586,31 @@ add_entrypoint_object( -O3 ) +add_entrypoint_object( + faddl + SRCS + faddl.cpp + HDRS + ../faddl.h + DEPENDS + libc.src.__support.FPUtil.basic_operations + COMPILE_OPTIONS + -O3 +) + +add_entrypoint_object( + faddf128 + SRCS + faddf128.cpp + HDRS + ../faddf128.h + DEPENDS + libc.src.__support.FPUtil.basic_operations + libc.src.__support.macros.properties.types + COMPILE_OPTIONS + -O3 +) + add_entrypoint_object( trunc SRCS diff --git a/libc/src/math/generic/fadd.cpp b/libc/src/math/generic/fadd.cpp index 66e5188cbcfd4..60460f8708657 100644 --- a/libc/src/math/generic/fadd.cpp +++ b/libc/src/math/generic/fadd.cpp @@ -1,4 +1,4 @@ -//===-- Implementation of fadd function ----------------------------------===// +//===-- Implementation of fadd function -----------------------------------===// // // 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/src/math/generic/faddf128.cpp b/libc/src/math/generic/faddf128.cpp new file mode 100644 index 0000000000000..953b1a1ce092e --- /dev/null +++ b/libc/src/math/generic/faddf128.cpp @@ -0,0 +1,20 @@ +//===-- Implementation of faddf128 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/faddf128.h" +#include "src/__support/FPUtil/generic/add_sub.h" +#include "src/__support/common.h" +#include "src/__support/macros/config.h" + +namespace LIBC_NAMESPACE_DECL { + +LLVM_LIBC_FUNCTION(float, faddf128, (float128 x, float128 y)) { + return fputil::generic::add(x, y); +} + +} // namespace LIBC_NAMESPACE_DECL diff --git a/libc/src/math/generic/faddl.cpp b/libc/src/math/generic/faddl.cpp new file mode 100644 index 0000000000000..b5c6ab4031c38 --- /dev/null +++ b/libc/src/math/generic/faddl.cpp @@ -0,0 +1,20 @@ +//===-- Implementation of faddl 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/faddl.h" +#include "src/__support/FPUtil/generic/add_sub.h" +#include "src/__support/common.h" +#include "src/__support/macros/config.h" + +namespace LIBC_NAMESPACE_DECL { + +LLVM_LIBC_FUNCTION(float, faddl, (long double x, long double y)) { + return fputil::generic::add(x, y); +} + +} // namespace LIBC_NAMESPACE_DECL diff --git a/libc/test/src/math/CMakeLists.txt b/libc/test/src/math/CMakeLists.txt index f3703eb59999b..e9be9f7dc815c 100644 --- a/libc/test/src/math/CMakeLists.txt +++ b/libc/test/src/math/CMakeLists.txt @@ -202,6 +202,20 @@ add_fp_unittest( libc.src.__support.FPUtil.basic_operations ) +add_fp_unittest( + faddl_test + NEED_MPFR + SUITE + libc-math-unittests + SRCS + faddl_test.cpp + HDRS + AddTest.h + DEPENDS + libc.src.math.faddl + libc.src.__support.FPUtil.basic_operations +) + add_fp_unittest( trunc_test NEED_MPFR diff --git a/libc/test/src/math/faddl_test.cpp b/libc/test/src/math/faddl_test.cpp new file mode 100644 index 0000000000000..9c99b32ee7c42 --- /dev/null +++ b/libc/test/src/math/faddl_test.cpp @@ -0,0 +1,13 @@ +//===-- Unittests for faddl -----------------------------------------------===// +// +// 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 "AddTest.h" + +#include "src/math/faddl.h" + +LIST_ADD_TESTS(float, long double, LIBC_NAMESPACE::faddl) diff --git a/libc/test/src/math/smoke/CMakeLists.txt b/libc/test/src/math/smoke/CMakeLists.txt index 21818e4734a68..d3b920b88b8b4 100644 --- a/libc/test/src/math/smoke/CMakeLists.txt +++ b/libc/test/src/math/smoke/CMakeLists.txt @@ -155,6 +155,34 @@ add_fp_unittest( ) +add_fp_unittest( + faddl_test + NEED_MPFR + SUITE + libc-math-unittests + SRCS + faddl_test.cpp + HDRS + AddTest.h + DEPENDS + libc.src.math.faddl + libc.src.__support.FPUtil.basic_operations +) + +add_fp_unittest( + faddf128_test + NEED_MPFR + SUITE + libc-math-unittests + SRCS + faddf128_test.cpp + HDRS + AddTest.h + DEPENDS + libc.src.math.faddf128 + libc.src.__support.FPUtil.basic_operations +) + add_fp_unittest( trunc_test SUITE diff --git a/libc/test/src/math/smoke/faddf128_test.cpp b/libc/test/src/math/smoke/faddf128_test.cpp new file mode 100644 index 0000000000000..5a11b5f419cad --- /dev/null +++ b/libc/test/src/math/smoke/faddf128_test.cpp @@ -0,0 +1,13 @@ +//===-- Unittests for faddf128 --------------------------------------------===// +// +// 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 "AddTest.h" + +#include "src/math/faddf128.h" + +LIST_ADD_TESTS(float, float128, LIBC_NAMESPACE::faddf128) diff --git a/libc/test/src/math/smoke/faddl_test.cpp b/libc/test/src/math/smoke/faddl_test.cpp new file mode 100644 index 0000000000000..9c99b32ee7c42 --- /dev/null +++ b/libc/test/src/math/smoke/faddl_test.cpp @@ -0,0 +1,13 @@ +//===-- Unittests for faddl -----------------------------------------------===// +// +// 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 "AddTest.h" + +#include "src/math/faddl.h" + +LIST_ADD_TESTS(float, long double, LIBC_NAMESPACE::faddl) From a31e0054f9e1d662d23ae9edb3d976e498896d0e Mon Sep 17 00:00:00 2001 From: Aaryan Shukla Date: Thu, 8 Aug 2024 20:48:49 +0000 Subject: [PATCH 02/13] added headers --- libc/newhdrgen/yaml/math.yaml | 22 ++++++++++++++++++++++ libc/spec/llvm_libc_ext.td | 2 ++ 2 files changed, 24 insertions(+) diff --git a/libc/newhdrgen/yaml/math.yaml b/libc/newhdrgen/yaml/math.yaml index d22546e50b3fe..8207b33521d34 100644 --- a/libc/newhdrgen/yaml/math.yaml +++ b/libc/newhdrgen/yaml/math.yaml @@ -76,6 +76,28 @@ functions: return_type: long double arguments: - type: long double + - name: fadd + standards: + - stdc + return_type: float + arguments: + - type: double + - type: double + - name: faddl + standards: + - faddl + return_type: float + arguments: + - type: long double + - type: long double + - name: faddf128 + standards: + - llvm_libc_ext + return_type: float + arguments: + - type: float128 + - type: float128 + guard: LIBC_TYPES_HAS_FLOAT128 - name: fdim standards: - stdc diff --git a/libc/spec/llvm_libc_ext.td b/libc/spec/llvm_libc_ext.td index c4cbca80072bf..38e9b64dccd94 100644 --- a/libc/spec/llvm_libc_ext.td +++ b/libc/spec/llvm_libc_ext.td @@ -72,6 +72,8 @@ def LLVMLibcExt : StandardSpec<"llvm_libc_ext"> { GuardedFunctionSpec<"f16subf", RetValSpec, [ArgSpec, ArgSpec], "LIBC_TYPES_HAS_FLOAT16">, GuardedFunctionSpec<"f16subl", RetValSpec, [ArgSpec, ArgSpec], "LIBC_TYPES_HAS_FLOAT16">, + GuardedFunctionSpec<"faddf128", RetValSpec, [ArgSpec, ArgSpec], "LIBC_TYPES_HAS_FLOAT128">, + GuardedFunctionSpec<"fdivf128", RetValSpec, [ArgSpec, ArgSpec], "LIBC_TYPES_HAS_FLOAT128">, GuardedFunctionSpec<"ffmaf128", RetValSpec, [ArgSpec, ArgSpec, ArgSpec], "LIBC_TYPES_HAS_FLOAT128">, From 0a4157e3374a59d3d9377efc3db35a07406be9e1 Mon Sep 17 00:00:00 2001 From: aaryanshukla <53713108+aaryanshukla@users.noreply.github.com> Date: Thu, 8 Aug 2024 14:39:45 -0700 Subject: [PATCH 03/13] Update llvm_libc_ext.td --- libc/spec/llvm_libc_ext.td | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libc/spec/llvm_libc_ext.td b/libc/spec/llvm_libc_ext.td index 42f1a51df8102..7ce48c3804b09 100644 --- a/libc/spec/llvm_libc_ext.td +++ b/libc/spec/llvm_libc_ext.td @@ -70,7 +70,7 @@ def LLVMLibcExt : StandardSpec<"llvm_libc_ext"> { GuardedFunctionSpec<"f16sub", RetValSpec, [ArgSpec, ArgSpec], "LIBC_TYPES_HAS_FLOAT16">, GuardedFunctionSpec<"f16subf", RetValSpec, [ArgSpec, ArgSpec], "LIBC_TYPES_HAS_FLOAT16">, - GuardedFunctionSpec<"f16subl", RetValSpec, [ArgSpec, ArgSpec], "LIBC_TYPES_HAS_FLOAT16">, + GuardedFunctionSpec<"f16subl", RetValSpec, [ArgSpec, ArgSpec], "LIBC_TYPES_HAS_FLOAT16">, GuardedFunctionSpec<"faddf128", RetValSpec, [ArgSpec, ArgSpec], "LIBC_TYPES_HAS_FLOAT128">, From 2d6098c095ac3a8b5730c244a527278d97a08e18 Mon Sep 17 00:00:00 2001 From: aaryanshukla <53713108+aaryanshukla@users.noreply.github.com> Date: Thu, 8 Aug 2024 14:40:41 -0700 Subject: [PATCH 04/13] Update faddf128.h --- libc/src/math/faddf128.h | 1 - 1 file changed, 1 deletion(-) diff --git a/libc/src/math/faddf128.h b/libc/src/math/faddf128.h index 37886450e4fd1..4260de08c1dd4 100644 --- a/libc/src/math/faddf128.h +++ b/libc/src/math/faddf128.h @@ -9,7 +9,6 @@ #include "src/__support/macros/config.h" #include "src/__support/macros/properties/types.h" - #ifndef LLVM_LIBC_SRC_MATH_FADDF128_H #define LLVM_LIBC_SRC_MATH_FADDF128_H From a9713550fba978af0b6c5f4f987ca946e3860158 Mon Sep 17 00:00:00 2001 From: Aaryan Shukla Date: Thu, 8 Aug 2024 22:59:45 +0000 Subject: [PATCH 05/13] updated .h --- libc/src/math/fadd.h | 3 +-- libc/src/math/faddf128.h | 5 ++--- libc/src/math/faddl.h | 3 +-- libc/src/math/generic/CMakeLists.txt | 4 ++-- 4 files changed, 6 insertions(+), 9 deletions(-) diff --git a/libc/src/math/fadd.h b/libc/src/math/fadd.h index 1dead013e3e5c..40c3f0fa7b4eb 100644 --- a/libc/src/math/fadd.h +++ b/libc/src/math/fadd.h @@ -6,11 +6,10 @@ // //===----------------------------------------------------------------------===// -#include "src/__support/macros/config.h" - #ifndef LLVM_LIBC_SRC_MATH_FADD_H #define LLVM_LIBC_SRC_MATH_FADD_H +#include "src/__support/macros/config.h" namespace LIBC_NAMESPACE_DECL { float fadd(double x, double y); diff --git a/libc/src/math/faddf128.h b/libc/src/math/faddf128.h index 4260de08c1dd4..24e6842b22a86 100644 --- a/libc/src/math/faddf128.h +++ b/libc/src/math/faddf128.h @@ -6,12 +6,11 @@ // //===----------------------------------------------------------------------===// -#include "src/__support/macros/config.h" -#include "src/__support/macros/properties/types.h" - #ifndef LLVM_LIBC_SRC_MATH_FADDF128_H #define LLVM_LIBC_SRC_MATH_FADDF128_H +#include "src/__support/macros/config.h" +#include "src/__support/macros/properties/types.h" namespace LIBC_NAMESPACE_DECL { float faddf128(float128 x, float128 y); diff --git a/libc/src/math/faddl.h b/libc/src/math/faddl.h index 9550f9c112cb0..d50632b0e2ed3 100644 --- a/libc/src/math/faddl.h +++ b/libc/src/math/faddl.h @@ -6,11 +6,10 @@ // //===----------------------------------------------------------------------===// -#include "src/__support/macros/config.h" - #ifndef LLVM_LIBC_SRC_MATH_FADDL_H #define LLVM_LIBC_SRC_MATH_FADDL_H +#include "src/__support/macros/config.h" namespace LIBC_NAMESPACE_DECL { float faddl(long double x, long double y); diff --git a/libc/src/math/generic/CMakeLists.txt b/libc/src/math/generic/CMakeLists.txt index 4d1356562f29c..0828cd6dee120 100644 --- a/libc/src/math/generic/CMakeLists.txt +++ b/libc/src/math/generic/CMakeLists.txt @@ -593,7 +593,7 @@ add_entrypoint_object( HDRS ../fadd.h DEPENDS - libc.src.__support.FPUtil.basic_operations + libc.src.__support.FPUtil.generic.add_sub COMPILE_OPTIONS -O3 ) @@ -605,7 +605,7 @@ add_entrypoint_object( HDRS ../faddl.h DEPENDS - libc.src.__support.FPUtil.basic_operations + libc.src.__support.FPUtil.generic.add_sub COMPILE_OPTIONS -O3 ) From 06b7a7a00a38df2bd6f403e90ca6893f7ae464cf Mon Sep 17 00:00:00 2001 From: aaryanshukla <53713108+aaryanshukla@users.noreply.github.com> Date: Thu, 8 Aug 2024 16:00:57 -0700 Subject: [PATCH 06/13] Update fadd.h --- libc/src/math/fadd.h | 1 + 1 file changed, 1 insertion(+) diff --git a/libc/src/math/fadd.h b/libc/src/math/fadd.h index 40c3f0fa7b4eb..fe795687f9ac5 100644 --- a/libc/src/math/fadd.h +++ b/libc/src/math/fadd.h @@ -10,6 +10,7 @@ #define LLVM_LIBC_SRC_MATH_FADD_H #include "src/__support/macros/config.h" + namespace LIBC_NAMESPACE_DECL { float fadd(double x, double y); From 1465b787eae7f24598f6afe74e001b44a5f258e7 Mon Sep 17 00:00:00 2001 From: aaryanshukla <53713108+aaryanshukla@users.noreply.github.com> Date: Thu, 8 Aug 2024 16:01:46 -0700 Subject: [PATCH 07/13] Update faddf128.h --- libc/src/math/faddf128.h | 1 + 1 file changed, 1 insertion(+) diff --git a/libc/src/math/faddf128.h b/libc/src/math/faddf128.h index 24e6842b22a86..73e5ff11f7a81 100644 --- a/libc/src/math/faddf128.h +++ b/libc/src/math/faddf128.h @@ -11,6 +11,7 @@ #include "src/__support/macros/config.h" #include "src/__support/macros/properties/types.h" + namespace LIBC_NAMESPACE_DECL { float faddf128(float128 x, float128 y); From aab06fad8bb8f63fdc73111a4db9e40b24e5946d Mon Sep 17 00:00:00 2001 From: aaryanshukla <53713108+aaryanshukla@users.noreply.github.com> Date: Thu, 8 Aug 2024 16:10:36 -0700 Subject: [PATCH 08/13] Update faddl.h --- libc/src/math/faddl.h | 1 + 1 file changed, 1 insertion(+) diff --git a/libc/src/math/faddl.h b/libc/src/math/faddl.h index d50632b0e2ed3..b1dc2069e3956 100644 --- a/libc/src/math/faddl.h +++ b/libc/src/math/faddl.h @@ -10,6 +10,7 @@ #define LLVM_LIBC_SRC_MATH_FADDL_H #include "src/__support/macros/config.h" + namespace LIBC_NAMESPACE_DECL { float faddl(long double x, long double y); From cd024ea5c5b74d5c67485092beef64ea6edf952e Mon Sep 17 00:00:00 2001 From: aaryanshukla <53713108+aaryanshukla@users.noreply.github.com> Date: Thu, 8 Aug 2024 16:26:27 -0700 Subject: [PATCH 09/13] Update libc/spec/stdc.td Co-authored-by: OverMighty --- libc/spec/stdc.td | 1 + 1 file changed, 1 insertion(+) diff --git a/libc/spec/stdc.td b/libc/spec/stdc.td index 7643679c97f8b..449625b8cab3e 100644 --- a/libc/spec/stdc.td +++ b/libc/spec/stdc.td @@ -407,6 +407,7 @@ def StdC : StandardSpec<"stdc"> { FunctionSpec<"fabsl", RetValSpec, [ArgSpec]>, GuardedFunctionSpec<"fabsf16", RetValSpec, [ArgSpec], "LIBC_TYPES_HAS_FLOAT16">, GuardedFunctionSpec<"fabsf128", RetValSpec, [ArgSpec], "LIBC_TYPES_HAS_FLOAT128">, + FunctionSpec<"fadd", RetValSpec, [ArgSpec, ArgSpec]>, FunctionSpec<"faddl", RetValSpec, [ArgSpec, ArgSpec]>, From 7bd3be7016992ceff56f638e9b753dedf80a3d22 Mon Sep 17 00:00:00 2001 From: aaryanshukla <53713108+aaryanshukla@users.noreply.github.com> Date: Thu, 8 Aug 2024 16:26:33 -0700 Subject: [PATCH 10/13] Update libc/test/src/math/CMakeLists.txt Co-authored-by: OverMighty --- libc/test/src/math/CMakeLists.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/libc/test/src/math/CMakeLists.txt b/libc/test/src/math/CMakeLists.txt index 8994a58b1bca1..a8da72fb01be6 100644 --- a/libc/test/src/math/CMakeLists.txt +++ b/libc/test/src/math/CMakeLists.txt @@ -213,7 +213,6 @@ add_fp_unittest( AddTest.h DEPENDS libc.src.math.faddl - libc.src.__support.FPUtil.basic_operations ) add_fp_unittest( From b131345263b0d32cca26048c42119469bc2a250d Mon Sep 17 00:00:00 2001 From: aaryanshukla <53713108+aaryanshukla@users.noreply.github.com> Date: Thu, 8 Aug 2024 16:26:42 -0700 Subject: [PATCH 11/13] Update libc/src/math/generic/CMakeLists.txt Co-authored-by: OverMighty --- libc/src/math/generic/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libc/src/math/generic/CMakeLists.txt b/libc/src/math/generic/CMakeLists.txt index 0828cd6dee120..ea62bc5380585 100644 --- a/libc/src/math/generic/CMakeLists.txt +++ b/libc/src/math/generic/CMakeLists.txt @@ -617,7 +617,7 @@ add_entrypoint_object( HDRS ../faddf128.h DEPENDS - libc.src.__support.FPUtil.basic_operations + libc.src.__support.FPUtil.generic.add_sub libc.src.__support.macros.properties.types COMPILE_OPTIONS -O3 From fb96bd1ebcb54bcfcd13ebd134f2b3673c45e248 Mon Sep 17 00:00:00 2001 From: Aaryan Shukla Date: Thu, 8 Aug 2024 23:54:55 +0000 Subject: [PATCH 12/13] updated --- libc/spec/llvm_libc_ext.td | 2 +- libc/test/src/math/smoke/CMakeLists.txt | 8 -------- 2 files changed, 1 insertion(+), 9 deletions(-) diff --git a/libc/spec/llvm_libc_ext.td b/libc/spec/llvm_libc_ext.td index 7ce48c3804b09..cd63e34a44ef0 100644 --- a/libc/spec/llvm_libc_ext.td +++ b/libc/spec/llvm_libc_ext.td @@ -70,7 +70,7 @@ def LLVMLibcExt : StandardSpec<"llvm_libc_ext"> { GuardedFunctionSpec<"f16sub", RetValSpec, [ArgSpec, ArgSpec], "LIBC_TYPES_HAS_FLOAT16">, GuardedFunctionSpec<"f16subf", RetValSpec, [ArgSpec, ArgSpec], "LIBC_TYPES_HAS_FLOAT16">, - GuardedFunctionSpec<"f16subl", RetValSpec, [ArgSpec, ArgSpec], "LIBC_TYPES_HAS_FLOAT16">, + GuardedFunctionSpec<"f16subl", RetValSpec, [ArgSpec, ArgSpec], "LIBC_TYPES_HAS_FLOAT16">, GuardedFunctionSpec<"faddf128", RetValSpec, [ArgSpec, ArgSpec], "LIBC_TYPES_HAS_FLOAT128">, diff --git a/libc/test/src/math/smoke/CMakeLists.txt b/libc/test/src/math/smoke/CMakeLists.txt index b7327c3dd1940..a16994caa178a 100644 --- a/libc/test/src/math/smoke/CMakeLists.txt +++ b/libc/test/src/math/smoke/CMakeLists.txt @@ -151,8 +151,6 @@ add_fp_unittest( AddTest.h DEPENDS libc.src.math.fadd - libc.src.__support.FPUtil.basic_operations - ) add_fp_unittest( @@ -166,7 +164,6 @@ add_fp_unittest( AddTest.h DEPENDS libc.src.math.faddl - libc.src.__support.FPUtil.basic_operations ) add_fp_unittest( @@ -180,7 +177,6 @@ add_fp_unittest( AddTest.h DEPENDS libc.src.math.faddf128 - libc.src.__support.FPUtil.basic_operations ) add_fp_unittest( @@ -4069,7 +4065,6 @@ add_fp_unittest( DEPENDS libc.hdr.errno_macros libc.hdr.fenv_macros - libc.src.__support.FPUtil.basic_operations libc.src.math.f16add ) @@ -4084,7 +4079,6 @@ add_fp_unittest( DEPENDS libc.hdr.errno_macros libc.hdr.fenv_macros - libc.src.__support.FPUtil.basic_operations libc.src.math.f16addf ) @@ -4099,7 +4093,6 @@ add_fp_unittest( DEPENDS libc.hdr.errno_macros libc.hdr.fenv_macros - libc.src.__support.FPUtil.basic_operations libc.src.math.f16addl ) @@ -4114,7 +4107,6 @@ add_fp_unittest( DEPENDS libc.hdr.errno_macros libc.hdr.fenv_macros - libc.src.__support.FPUtil.basic_operations libc.src.math.f16addf128 ) From 2de030061b94398fcd6d514010f234841b523c76 Mon Sep 17 00:00:00 2001 From: Aaryan Shukla Date: Fri, 9 Aug 2024 16:52:25 +0000 Subject: [PATCH 13/13] updated AddTest with libc.hdr --- libc/test/src/math/smoke/CMakeLists.txt | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/libc/test/src/math/smoke/CMakeLists.txt b/libc/test/src/math/smoke/CMakeLists.txt index a16994caa178a..e3c96eac4ce10 100644 --- a/libc/test/src/math/smoke/CMakeLists.txt +++ b/libc/test/src/math/smoke/CMakeLists.txt @@ -150,6 +150,8 @@ add_fp_unittest( HDRS AddTest.h DEPENDS + libc.hdr.errno_macros + libc.hdr.fenv_macros libc.src.math.fadd ) @@ -163,6 +165,8 @@ add_fp_unittest( HDRS AddTest.h DEPENDS + libc.hdr.errno_macros + libc.hdr.fenv_macros libc.src.math.faddl ) @@ -176,6 +180,8 @@ add_fp_unittest( HDRS AddTest.h DEPENDS + libc.hdr.errno_macros + libc.hdr.fenv_macros libc.src.math.faddf128 ) @@ -4643,6 +4649,8 @@ add_fp_unittest( HDRS AddTest.h DEPENDS + libc.hdr.errno_macros + libc.hdr.fenv_macros libc.src.math.daddl ) @@ -4655,6 +4663,8 @@ add_fp_unittest( HDRS AddTest.h DEPENDS + libc.hdr.errno_macros + libc.hdr.fenv_macros libc.src.math.daddf128 )