Skip to content

[libc][math][c23] add entrypoints and tests for totalordermag{f,l,f128} #100159

New issue

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

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

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from Jul 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions libc/config/darwin/arm/entrypoints.txt
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,9 @@ set(TARGET_LIBM_ENTRYPOINTS
libc.src.math.tan
libc.src.math.tanf
libc.src.math.tanhf
libc.src.math.totalordermag
libc.src.math.totalordermagf
libc.src.math.totalordermagl
libc.src.math.trunc
libc.src.math.truncf
libc.src.math.truncl
Expand Down
3 changes: 3 additions & 0 deletions libc/config/darwin/x86_64/entrypoints.txt
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,9 @@ set(TARGET_LIBM_ENTRYPOINTS
#libc.src.math.sqrtl
#libc.src.math.tanf
#libc.src.math.tanhf
#libc.src.math.totalordermag
#libc.src.math.totalordermagf
#libc.src.math.totalordermagl
#libc.src.math.trunc
#libc.src.math.truncf
#libc.src.math.truncl
Expand Down
4 changes: 4 additions & 0 deletions libc/config/linux/aarch64/entrypoints.txt
Original file line number Diff line number Diff line change
Expand Up @@ -514,6 +514,9 @@ set(TARGET_LIBM_ENTRYPOINTS
libc.src.math.tan
libc.src.math.tanf
libc.src.math.tanhf
libc.src.math.totalordermag
libc.src.math.totalordermagf
libc.src.math.totalordermagl
libc.src.math.trunc
libc.src.math.truncf
libc.src.math.truncl
Expand Down Expand Up @@ -637,6 +640,7 @@ if(LIBC_TYPES_HAS_FLOAT128)
libc.src.math.roundevenf128
libc.src.math.scalbnf128
libc.src.math.sqrtf128
libc.src.math.totalordermagf128
libc.src.math.truncf128
libc.src.math.ufromfpf128
libc.src.math.ufromfpxf128
Expand Down
3 changes: 3 additions & 0 deletions libc/config/linux/arm/entrypoints.txt
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,9 @@ set(TARGET_LIBM_ENTRYPOINTS
libc.src.math.tan
libc.src.math.tanf
libc.src.math.tanhf
libc.src.math.totalordermag
libc.src.math.totalordermagf
libc.src.math.totalordermagl
libc.src.math.trunc
libc.src.math.truncf
libc.src.math.truncl
Expand Down
4 changes: 4 additions & 0 deletions libc/config/linux/riscv/entrypoints.txt
Original file line number Diff line number Diff line change
Expand Up @@ -542,6 +542,9 @@ set(TARGET_LIBM_ENTRYPOINTS
libc.src.math.tan
libc.src.math.tanf
libc.src.math.tanhf
libc.src.math.totalordermag
libc.src.math.totalordermagf
libc.src.math.totalordermagl
libc.src.math.trunc
libc.src.math.truncf
libc.src.math.truncl
Expand Down Expand Up @@ -600,6 +603,7 @@ if(LIBC_TYPES_HAS_FLOAT128)
libc.src.math.roundf128
libc.src.math.scalbnf128
libc.src.math.sqrtf128
libc.src.math.totalordermagf128
libc.src.math.truncf128
libc.src.math.ufromfpf128
libc.src.math.ufromfpxf128
Expand Down
4 changes: 4 additions & 0 deletions libc/config/linux/x86_64/entrypoints.txt
Original file line number Diff line number Diff line change
Expand Up @@ -542,6 +542,9 @@ set(TARGET_LIBM_ENTRYPOINTS
libc.src.math.tan
libc.src.math.tanf
libc.src.math.tanhf
libc.src.math.totalordermag
libc.src.math.totalordermagf
libc.src.math.totalordermagl
libc.src.math.trunc
libc.src.math.truncf
libc.src.math.truncl
Expand Down Expand Up @@ -686,6 +689,7 @@ if(LIBC_TYPES_HAS_FLOAT128)
libc.src.math.roundf128
libc.src.math.scalbnf128
libc.src.math.sqrtf128
libc.src.math.totalordermagf128
libc.src.math.truncf128
libc.src.math.ufromfpf128
libc.src.math.ufromfpxf128
Expand Down
2 changes: 1 addition & 1 deletion libc/docs/math/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ Basic Operations
+------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+
| totalorder | | | | |check| | | F.10.12.1 | N/A |
+------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+
| totalordermag | | | | |check| | | F.10.12.2 | N/A |
| totalordermag | |check| | |check| | |check| | |check| | |check| | F.10.12.2 | N/A |
+------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+
| trunc | |check| | |check| | |check| | |check| | |check| | 7.12.9.9 | F.10.6.9 |
+------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+
Expand Down
9 changes: 6 additions & 3 deletions libc/spec/stdc.td
Original file line number Diff line number Diff line change
Expand Up @@ -720,10 +720,13 @@ def StdC : StandardSpec<"stdc"> {

FunctionSpec<"dsqrtl", RetValSpec<DoubleType>, [ArgSpec<LongDoubleType>]>,

GuardedFunctionSpec<"totalorderf16", RetValSpec<IntType>, [ArgSpec<Float16Ptr>, ArgSpec<Float16Ptr>], "LIBC_TYPES_HAS_FLOAT16">,

GuardedFunctionSpec<"totalorderf16", RetValSpec<IntType>, [ArgSpec<Float16Ptr>, ArgSpec<Float16Ptr>], "LIBC_TYPES_HAS_FLOAT16">,

GuardedFunctionSpec<"totalordermagf16", RetValSpec<IntType>, [ArgSpec<Float16Ptr>, ArgSpec<Float16Ptr>], "LIBC_TYPES_HAS_FLOAT16">,
FunctionSpec<"totalordermag", RetValSpec<IntType>, [ArgSpec<DoublePtr>, ArgSpec<DoublePtr>]>,
FunctionSpec<"totalordermagf", RetValSpec<IntType>, [ArgSpec<FloatPtr>, ArgSpec<FloatPtr>]>,
FunctionSpec<"totalordermagl", RetValSpec<IntType>, [ArgSpec<LongDoublePtr>, ArgSpec<LongDoublePtr>]>,
GuardedFunctionSpec<"totalordermagf16", RetValSpec<IntType>, [ArgSpec<Float16Ptr>, ArgSpec<Float16Ptr>], "LIBC_TYPES_HAS_FLOAT16">,
GuardedFunctionSpec<"totalordermagf128", RetValSpec<IntType>, [ArgSpec<Float128Ptr>, ArgSpec<Float128Ptr>], "LIBC_TYPES_HAS_FLOAT128">,

GuardedFunctionSpec<"getpayloadf16", RetValSpec<Float16Type>, [ArgSpec<Float16Ptr>], "LIBC_TYPES_HAS_FLOAT16">,

Expand Down
4 changes: 4 additions & 0 deletions libc/src/math/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,11 @@ add_math_entrypoint_object(tgammaf)

add_math_entrypoint_object(totalorderf16)

add_math_entrypoint_object(totalordermag)
add_math_entrypoint_object(totalordermagf)
add_math_entrypoint_object(totalordermagl)
add_math_entrypoint_object(totalordermagf16)
add_math_entrypoint_object(totalordermagf128)

add_math_entrypoint_object(trunc)
add_math_entrypoint_object(truncf)
Expand Down
49 changes: 49 additions & 0 deletions libc/src/math/generic/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3965,6 +3965,42 @@ add_entrypoint_object(
-O3
)

add_entrypoint_object(
totalordermag
SRCS
totalordermag.cpp
HDRS
../totalordermag.h
DEPENDS
libc.src.__support.FPUtil.basic_operations
COMPILE_OPTIONS
-O3
)

add_entrypoint_object(
totalordermagf
SRCS
totalordermagf.cpp
HDRS
../totalordermagf.h
DEPENDS
libc.src.__support.FPUtil.basic_operations
COMPILE_OPTIONS
-O3
)

add_entrypoint_object(
totalordermagl
SRCS
totalordermagl.cpp
HDRS
../totalordermagl.h
DEPENDS
libc.src.__support.FPUtil.basic_operations
COMPILE_OPTIONS
-O3
)

add_entrypoint_object(
totalordermagf16
SRCS
Expand All @@ -3977,6 +4013,19 @@ add_entrypoint_object(
-O3
)

add_entrypoint_object(
totalordermagf128
SRCS
totalordermagf128.cpp
HDRS
../totalordermagf128.h
DEPENDS
libc.src.__support.FPUtil.basic_operations
libc.src.__support.macros.properties.types
COMPILE_OPTIONS
-O3
)

add_entrypoint_object(
getpayloadf16
SRCS
Expand Down
20 changes: 20 additions & 0 deletions libc/src/math/generic/totalordermag.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
//===-- Implementation of totalordermag 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/totalordermag.h"
#include "src/__support/FPUtil/BasicOperations.h"
#include "src/__support/common.h"
#include "src/__support/macros/config.h"

namespace LIBC_NAMESPACE_DECL {

LLVM_LIBC_FUNCTION(int, totalordermag, (const double *x, const double *y)) {
return static_cast<int>(fputil::totalordermag(*x, *y));
}

} // namespace LIBC_NAMESPACE_DECL
20 changes: 20 additions & 0 deletions libc/src/math/generic/totalordermagf.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
//===-- Implementation of totalordermagf 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/totalordermagf.h"
#include "src/__support/FPUtil/BasicOperations.h"
#include "src/__support/common.h"
#include "src/__support/macros/config.h"

namespace LIBC_NAMESPACE_DECL {

LLVM_LIBC_FUNCTION(int, totalordermagf, (const float *x, const float *y)) {
return static_cast<int>(fputil::totalordermag(*x, *y));
}

} // namespace LIBC_NAMESPACE_DECL
21 changes: 21 additions & 0 deletions libc/src/math/generic/totalordermagf128.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
//===-- Implementation of totalordermagf128 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/totalordermagf128.h"
#include "src/__support/FPUtil/BasicOperations.h"
#include "src/__support/common.h"
#include "src/__support/macros/config.h"

namespace LIBC_NAMESPACE_DECL {

LLVM_LIBC_FUNCTION(int, totalordermagf128,
(const float128 *x, const float128 *y)) {
return static_cast<int>(fputil::totalordermag(*x, *y));
}

} // namespace LIBC_NAMESPACE_DECL
21 changes: 21 additions & 0 deletions libc/src/math/generic/totalordermagl.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
//===-- Implementation of totalordermagl 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/totalordermagl.h"
#include "src/__support/FPUtil/BasicOperations.h"
#include "src/__support/common.h"
#include "src/__support/macros/config.h"

namespace LIBC_NAMESPACE_DECL {

LLVM_LIBC_FUNCTION(int, totalordermagl,
(const long double *x, const long double *y)) {
return static_cast<int>(fputil::totalordermag(*x, *y));
}

} // namespace LIBC_NAMESPACE_DECL
20 changes: 20 additions & 0 deletions libc/src/math/totalordermag.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
//===-- Implementation header for totalordermag -----------------*- 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_TOTALORDERMAG_H
#define LLVM_LIBC_SRC_MATH_TOTALORDERMAG_H

#include "src/__support/macros/config.h"

namespace LIBC_NAMESPACE_DECL {

int totalordermag(const double *x, const double *y);

} // namespace LIBC_NAMESPACE_DECL

#endif // LLVM_LIBC_SRC_MATH_TOTALORDERMAG_H
20 changes: 20 additions & 0 deletions libc/src/math/totalordermagf.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
//===-- Implementation header for totalordermagf ----------------*- 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_TOTALORDERMAGF_H
#define LLVM_LIBC_SRC_MATH_TOTALORDERMAGF_H

#include "src/__support/macros/config.h"

namespace LIBC_NAMESPACE_DECL {

int totalordermagf(const float *x, const float *y);

} // namespace LIBC_NAMESPACE_DECL

#endif // LLVM_LIBC_SRC_MATH_TOTALORDERMAGF_H
21 changes: 21 additions & 0 deletions libc/src/math/totalordermagf128.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
//===-- Implementation header for totalordermagf128 -------------*- 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_TOTALORDERMAGF128_H
#define LLVM_LIBC_SRC_MATH_TOTALORDERMAGF128_H

#include "src/__support/macros/config.h"
#include "src/__support/macros/properties/types.h"

namespace LIBC_NAMESPACE_DECL {

int totalordermagf128(const float128 *x, const float128 *y);

} // namespace LIBC_NAMESPACE_DECL

#endif // LLVM_LIBC_SRC_MATH_TOTALORDERMAGF128_H
20 changes: 20 additions & 0 deletions libc/src/math/totalordermagl.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
//===-- Implementation header for totalordermag -----------------*- 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_TOTALORDERMAGL_H
#define LLVM_LIBC_SRC_MATH_TOTALORDERMAGL_H

#include "src/__support/macros/config.h"

namespace LIBC_NAMESPACE_DECL {

int totalordermagl(const long double *x, const long double *y);

} // namespace LIBC_NAMESPACE_DECL

#endif // LLVM_LIBC_SRC_MATH_TOTALORDERMAGl_H
Loading
Loading