[libc][math][c23] Add {nextafter,nexttoward,nextup,nextdown}f16 C23 math functions (#94535)
#93566
This commit is contained in:
@@ -514,6 +514,10 @@ if(LIBC_TYPES_HAS_FLOAT16)
|
||||
libc.src.math.lrintf16
|
||||
libc.src.math.lroundf16
|
||||
libc.src.math.nearbyintf16
|
||||
libc.src.math.nextafterf16
|
||||
libc.src.math.nextdownf16
|
||||
libc.src.math.nexttowardf16
|
||||
libc.src.math.nextupf16
|
||||
libc.src.math.rintf16
|
||||
libc.src.math.roundf16
|
||||
libc.src.math.roundevenf16
|
||||
|
||||
@@ -547,6 +547,10 @@ if(LIBC_TYPES_HAS_FLOAT16)
|
||||
libc.src.math.lrintf16
|
||||
libc.src.math.lroundf16
|
||||
libc.src.math.nearbyintf16
|
||||
libc.src.math.nextafterf16
|
||||
libc.src.math.nextdownf16
|
||||
libc.src.math.nexttowardf16
|
||||
libc.src.math.nextupf16
|
||||
libc.src.math.rintf16
|
||||
libc.src.math.roundf16
|
||||
libc.src.math.roundevenf16
|
||||
|
||||
@@ -59,8 +59,8 @@ Additions:
|
||||
* ufromfp* |check|
|
||||
* fromfpx* |check|
|
||||
* ufromfpx* |check|
|
||||
* nextup*
|
||||
* nextdown*
|
||||
* nextup* |check|
|
||||
* nextdown* |check|
|
||||
* canonicalize* |check|
|
||||
* fmaximum*
|
||||
* fminimum*
|
||||
|
||||
@@ -190,13 +190,13 @@ Basic Operations
|
||||
+------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+
|
||||
| nearbyint | |check| | |check| | |check| | |check| | |check| | 7.12.9.3 | F.10.6.3 |
|
||||
+------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+
|
||||
| nextafter | |check| | |check| | |check| | | |check| | 7.12.11.3 | F.10.8.3 |
|
||||
| nextafter | |check| | |check| | |check| | |check| | |check| | 7.12.11.3 | F.10.8.3 |
|
||||
+------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+
|
||||
| nextdown | |check| | |check| | |check| | | |check| | 7.12.11.6 | F.10.8.6 |
|
||||
| nextdown | |check| | |check| | |check| | |check| | |check| | 7.12.11.6 | F.10.8.6 |
|
||||
+------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+
|
||||
| nexttoward | |check| | |check| | |check| | | N/A | 7.12.11.4 | F.10.8.4 |
|
||||
| nexttoward | |check| | |check| | |check| | |check| | N/A | 7.12.11.4 | F.10.8.4 |
|
||||
+------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+
|
||||
| nextup | |check| | |check| | |check| | | |check| | 7.12.11.5 | F.10.8.5 |
|
||||
| nextup | |check| | |check| | |check| | |check| | |check| | 7.12.11.5 | F.10.8.5 |
|
||||
+------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+
|
||||
| remainder | |check| | |check| | |check| | | | 7.12.10.2 | F.10.7.2 |
|
||||
+------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+
|
||||
|
||||
@@ -634,20 +634,24 @@ def StdC : StandardSpec<"stdc"> {
|
||||
FunctionSpec<"nextafterf", RetValSpec<FloatType>, [ArgSpec<FloatType>, ArgSpec<FloatType>]>,
|
||||
FunctionSpec<"nextafter", RetValSpec<DoubleType>, [ArgSpec<DoubleType>, ArgSpec<DoubleType>]>,
|
||||
FunctionSpec<"nextafterl", RetValSpec<LongDoubleType>, [ArgSpec<LongDoubleType>, ArgSpec<LongDoubleType>]>,
|
||||
GuardedFunctionSpec<"nextafterf16", RetValSpec<Float16Type>, [ArgSpec<Float16Type>, ArgSpec<Float16Type>], "LIBC_TYPES_HAS_FLOAT16">,
|
||||
GuardedFunctionSpec<"nextafterf128", RetValSpec<Float128Type>, [ArgSpec<Float128Type>, ArgSpec<Float128Type>], "LIBC_TYPES_HAS_FLOAT128">,
|
||||
|
||||
FunctionSpec<"nexttowardf", RetValSpec<FloatType>, [ArgSpec<FloatType>, ArgSpec<LongDoubleType>]>,
|
||||
FunctionSpec<"nexttoward", RetValSpec<DoubleType>, [ArgSpec<DoubleType>, ArgSpec<LongDoubleType>]>,
|
||||
FunctionSpec<"nexttowardl", RetValSpec<LongDoubleType>, [ArgSpec<LongDoubleType>, ArgSpec<LongDoubleType>]>,
|
||||
GuardedFunctionSpec<"nexttowardf16", RetValSpec<Float16Type>, [ArgSpec<Float16Type>, ArgSpec<Float16Type>], "LIBC_TYPES_HAS_FLOAT16">,
|
||||
|
||||
FunctionSpec<"nextdown", RetValSpec<DoubleType>, [ArgSpec<DoubleType>]>,
|
||||
FunctionSpec<"nextdownf", RetValSpec<FloatType>, [ArgSpec<FloatType>]>,
|
||||
FunctionSpec<"nextdownl", RetValSpec<LongDoubleType>, [ArgSpec<LongDoubleType>]>,
|
||||
GuardedFunctionSpec<"nextdownf16", RetValSpec<Float16Type>, [ArgSpec<Float16Type>], "LIBC_TYPES_HAS_FLOAT16">,
|
||||
GuardedFunctionSpec<"nextdownf128", RetValSpec<Float128Type>, [ArgSpec<Float128Type>], "LIBC_TYPES_HAS_FLOAT128">,
|
||||
|
||||
FunctionSpec<"nextup", RetValSpec<DoubleType>, [ArgSpec<DoubleType>]>,
|
||||
FunctionSpec<"nextupf", RetValSpec<FloatType>, [ArgSpec<FloatType>]>,
|
||||
FunctionSpec<"nextupl", RetValSpec<LongDoubleType>, [ArgSpec<LongDoubleType>]>,
|
||||
GuardedFunctionSpec<"nextupf16", RetValSpec<Float16Type>, [ArgSpec<Float16Type>], "LIBC_TYPES_HAS_FLOAT16">,
|
||||
GuardedFunctionSpec<"nextupf128", RetValSpec<Float128Type>, [ArgSpec<Float128Type>], "LIBC_TYPES_HAS_FLOAT128">,
|
||||
|
||||
FunctionSpec<"powf", RetValSpec<FloatType>, [ArgSpec<FloatType>, ArgSpec<FloatType>]>,
|
||||
|
||||
@@ -272,20 +272,24 @@ add_math_entrypoint_object(nearbyintf128)
|
||||
add_math_entrypoint_object(nextafter)
|
||||
add_math_entrypoint_object(nextafterf)
|
||||
add_math_entrypoint_object(nextafterl)
|
||||
add_math_entrypoint_object(nextafterf16)
|
||||
add_math_entrypoint_object(nextafterf128)
|
||||
|
||||
add_math_entrypoint_object(nexttoward)
|
||||
add_math_entrypoint_object(nexttowardf)
|
||||
add_math_entrypoint_object(nexttowardl)
|
||||
add_math_entrypoint_object(nexttowardf16)
|
||||
|
||||
add_math_entrypoint_object(nextdown)
|
||||
add_math_entrypoint_object(nextdownf)
|
||||
add_math_entrypoint_object(nextdownl)
|
||||
add_math_entrypoint_object(nextdownf16)
|
||||
add_math_entrypoint_object(nextdownf128)
|
||||
|
||||
add_math_entrypoint_object(nextup)
|
||||
add_math_entrypoint_object(nextupf)
|
||||
add_math_entrypoint_object(nextupl)
|
||||
add_math_entrypoint_object(nextupf16)
|
||||
add_math_entrypoint_object(nextupf128)
|
||||
|
||||
add_math_entrypoint_object(pow)
|
||||
|
||||
@@ -2550,6 +2550,19 @@ add_entrypoint_object(
|
||||
-O3
|
||||
)
|
||||
|
||||
add_entrypoint_object(
|
||||
nextafterf16
|
||||
SRCS
|
||||
nextafterf16.cpp
|
||||
HDRS
|
||||
../nextafterf16.h
|
||||
DEPENDS
|
||||
libc.src.__support.macros.properties.types
|
||||
libc.src.__support.FPUtil.manipulation_functions
|
||||
COMPILE_OPTIONS
|
||||
-O3
|
||||
)
|
||||
|
||||
add_entrypoint_object(
|
||||
nextafterf128
|
||||
SRCS
|
||||
@@ -2599,6 +2612,19 @@ add_entrypoint_object(
|
||||
-O3
|
||||
)
|
||||
|
||||
add_entrypoint_object(
|
||||
nexttowardf16
|
||||
SRCS
|
||||
nexttowardf16.cpp
|
||||
HDRS
|
||||
../nexttowardf16.h
|
||||
DEPENDS
|
||||
libc.src.__support.macros.properties.types
|
||||
libc.src.__support.FPUtil.manipulation_functions
|
||||
COMPILE_OPTIONS
|
||||
-O3
|
||||
)
|
||||
|
||||
add_entrypoint_object(
|
||||
nextdown
|
||||
SRCS
|
||||
@@ -2635,6 +2661,19 @@ add_entrypoint_object(
|
||||
-O3
|
||||
)
|
||||
|
||||
add_entrypoint_object(
|
||||
nextdownf16
|
||||
SRCS
|
||||
nextdownf16.cpp
|
||||
HDRS
|
||||
../nextdownf16.h
|
||||
DEPENDS
|
||||
libc.src.__support.macros.properties.types
|
||||
libc.src.__support.FPUtil.manipulation_functions
|
||||
COMPILE_OPTIONS
|
||||
-O3
|
||||
)
|
||||
|
||||
add_entrypoint_object(
|
||||
nextdownf128
|
||||
SRCS
|
||||
@@ -2684,6 +2723,19 @@ add_entrypoint_object(
|
||||
-O3
|
||||
)
|
||||
|
||||
add_entrypoint_object(
|
||||
nextupf16
|
||||
SRCS
|
||||
nextupf16.cpp
|
||||
HDRS
|
||||
../nextupf16.h
|
||||
DEPENDS
|
||||
libc.src.__support.macros.properties.types
|
||||
libc.src.__support.FPUtil.manipulation_functions
|
||||
COMPILE_OPTIONS
|
||||
-O3
|
||||
)
|
||||
|
||||
add_entrypoint_object(
|
||||
nextupf128
|
||||
SRCS
|
||||
|
||||
19
libc/src/math/generic/nextafterf16.cpp
Normal file
19
libc/src/math/generic/nextafterf16.cpp
Normal file
@@ -0,0 +1,19 @@
|
||||
//===-- Implementation of nextafterf16 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/nextafterf16.h"
|
||||
#include "src/__support/FPUtil/ManipulationFunctions.h"
|
||||
#include "src/__support/common.h"
|
||||
|
||||
namespace LIBC_NAMESPACE {
|
||||
|
||||
LLVM_LIBC_FUNCTION(float16, nextafterf16, (float16 x, float16 y)) {
|
||||
return fputil::nextafter(x, y);
|
||||
}
|
||||
|
||||
} // namespace LIBC_NAMESPACE
|
||||
19
libc/src/math/generic/nextdownf16.cpp
Normal file
19
libc/src/math/generic/nextdownf16.cpp
Normal file
@@ -0,0 +1,19 @@
|
||||
//===-- Implementation of nextdownf16 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/nextdownf16.h"
|
||||
#include "src/__support/FPUtil/ManipulationFunctions.h"
|
||||
#include "src/__support/common.h"
|
||||
|
||||
namespace LIBC_NAMESPACE {
|
||||
|
||||
LLVM_LIBC_FUNCTION(float16, nextdownf16, (float16 x)) {
|
||||
return fputil::nextupdown</*IsDown=*/true>(x);
|
||||
}
|
||||
|
||||
} // namespace LIBC_NAMESPACE
|
||||
21
libc/src/math/generic/nexttowardf16.cpp
Normal file
21
libc/src/math/generic/nexttowardf16.cpp
Normal file
@@ -0,0 +1,21 @@
|
||||
//===-- Implementation of nexttowardf16 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/nexttowardf16.h"
|
||||
#include "src/__support/FPUtil/ManipulationFunctions.h"
|
||||
#include "src/__support/common.h"
|
||||
|
||||
namespace LIBC_NAMESPACE {
|
||||
|
||||
LLVM_LIBC_FUNCTION(float16, nexttowardf16, (float16 x, long double y)) {
|
||||
// We can reuse the nextafter implementation because the internal nextafter is
|
||||
// templated on the types of the arguments.
|
||||
return fputil::nextafter(x, y);
|
||||
}
|
||||
|
||||
} // namespace LIBC_NAMESPACE
|
||||
19
libc/src/math/generic/nextupf16.cpp
Normal file
19
libc/src/math/generic/nextupf16.cpp
Normal file
@@ -0,0 +1,19 @@
|
||||
//===-- Implementation of nextupf16 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/nextupf16.h"
|
||||
#include "src/__support/FPUtil/ManipulationFunctions.h"
|
||||
#include "src/__support/common.h"
|
||||
|
||||
namespace LIBC_NAMESPACE {
|
||||
|
||||
LLVM_LIBC_FUNCTION(float16, nextupf16, (float16 x)) {
|
||||
return fputil::nextupdown</*IsDown=*/false>(x);
|
||||
}
|
||||
|
||||
} // namespace LIBC_NAMESPACE
|
||||
20
libc/src/math/nextafterf16.h
Normal file
20
libc/src/math/nextafterf16.h
Normal file
@@ -0,0 +1,20 @@
|
||||
//===-- Implementation header for nextafterf16 ------------------*- 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_NEXTAFTERF16_H
|
||||
#define LLVM_LIBC_SRC_MATH_NEXTAFTERF16_H
|
||||
|
||||
#include "src/__support/macros/properties/types.h"
|
||||
|
||||
namespace LIBC_NAMESPACE {
|
||||
|
||||
float16 nextafterf16(float16 x, float16 y);
|
||||
|
||||
} // namespace LIBC_NAMESPACE
|
||||
|
||||
#endif // LLVM_LIBC_SRC_MATH_NEXTAFTERF16_H
|
||||
20
libc/src/math/nextdownf16.h
Normal file
20
libc/src/math/nextdownf16.h
Normal file
@@ -0,0 +1,20 @@
|
||||
//===-- Implementation header for nextdownf16 -------------------*- 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_NEXTDOWNF16_H
|
||||
#define LLVM_LIBC_SRC_MATH_NEXTDOWNF16_H
|
||||
|
||||
#include "src/__support/macros/properties/types.h"
|
||||
|
||||
namespace LIBC_NAMESPACE {
|
||||
|
||||
float16 nextdownf16(float16 x);
|
||||
|
||||
} // namespace LIBC_NAMESPACE
|
||||
|
||||
#endif // LLVM_LIBC_SRC_MATH_NEXTDOWNF16_H
|
||||
20
libc/src/math/nexttowardf16.h
Normal file
20
libc/src/math/nexttowardf16.h
Normal file
@@ -0,0 +1,20 @@
|
||||
//===-- Implementation header for nexttowardf16 -----------------*- 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_NEXTTOWARDF16_H
|
||||
#define LLVM_LIBC_SRC_MATH_NEXTTOWARDF16_H
|
||||
|
||||
#include "src/__support/macros/properties/types.h"
|
||||
|
||||
namespace LIBC_NAMESPACE {
|
||||
|
||||
float16 nexttowardf16(float16 x, long double y);
|
||||
|
||||
} // namespace LIBC_NAMESPACE
|
||||
|
||||
#endif // LLVM_LIBC_SRC_MATH_NEXTTOWARDF16_H
|
||||
20
libc/src/math/nextupf16.h
Normal file
20
libc/src/math/nextupf16.h
Normal file
@@ -0,0 +1,20 @@
|
||||
//===-- Implementation header for nextupf16 ---------------------*- 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_NEXTUPF16_H
|
||||
#define LLVM_LIBC_SRC_MATH_NEXTUPF16_H
|
||||
|
||||
#include "src/__support/macros/properties/types.h"
|
||||
|
||||
namespace LIBC_NAMESPACE {
|
||||
|
||||
float16 nextupf16(float16 x);
|
||||
|
||||
} // namespace LIBC_NAMESPACE
|
||||
|
||||
#endif // LLVM_LIBC_SRC_MATH_NEXTUPF16_H
|
||||
@@ -2541,8 +2541,10 @@ add_fp_unittest(
|
||||
HDRS
|
||||
NextAfterTest.h
|
||||
DEPENDS
|
||||
libc.hdr.fenv_macros
|
||||
libc.src.math.nextafter
|
||||
libc.src.__support.FPUtil.basic_operations
|
||||
libc.src.__support.CPP.bit
|
||||
libc.src.__support.FPUtil.fenv_impl
|
||||
libc.src.__support.FPUtil.fp_bits
|
||||
)
|
||||
|
||||
@@ -2555,8 +2557,10 @@ add_fp_unittest(
|
||||
HDRS
|
||||
NextAfterTest.h
|
||||
DEPENDS
|
||||
libc.hdr.fenv_macros
|
||||
libc.src.math.nextafterf
|
||||
libc.src.__support.FPUtil.basic_operations
|
||||
libc.src.__support.CPP.bit
|
||||
libc.src.__support.FPUtil.fenv_impl
|
||||
libc.src.__support.FPUtil.fp_bits
|
||||
)
|
||||
|
||||
@@ -2569,8 +2573,26 @@ add_fp_unittest(
|
||||
HDRS
|
||||
NextAfterTest.h
|
||||
DEPENDS
|
||||
libc.hdr.fenv_macros
|
||||
libc.src.math.nextafterl
|
||||
libc.src.__support.FPUtil.basic_operations
|
||||
libc.src.__support.CPP.bit
|
||||
libc.src.__support.FPUtil.fenv_impl
|
||||
libc.src.__support.FPUtil.fp_bits
|
||||
)
|
||||
|
||||
add_fp_unittest(
|
||||
nextafterf16_test
|
||||
SUITE
|
||||
libc-math-smoke-tests
|
||||
SRCS
|
||||
nextafterf16_test.cpp
|
||||
HDRS
|
||||
NextAfterTest.h
|
||||
DEPENDS
|
||||
libc.hdr.fenv_macros
|
||||
libc.src.math.nextafterf16
|
||||
libc.src.__support.CPP.bit
|
||||
libc.src.__support.FPUtil.fenv_impl
|
||||
libc.src.__support.FPUtil.fp_bits
|
||||
)
|
||||
|
||||
@@ -2583,8 +2605,10 @@ add_fp_unittest(
|
||||
HDRS
|
||||
NextAfterTest.h
|
||||
DEPENDS
|
||||
libc.hdr.fenv_macros
|
||||
libc.src.math.nextafterf128
|
||||
libc.src.__support.FPUtil.basic_operations
|
||||
libc.src.__support.CPP.bit
|
||||
libc.src.__support.FPUtil.fenv_impl
|
||||
libc.src.__support.FPUtil.fp_bits
|
||||
)
|
||||
|
||||
@@ -2599,8 +2623,10 @@ if(NOT LIBC_TARGET_OS_IS_GPU)
|
||||
HDRS
|
||||
NextTowardTest.h
|
||||
DEPENDS
|
||||
libc.hdr.fenv_macros
|
||||
libc.src.math.nexttoward
|
||||
libc.src.__support.FPUtil.basic_operations
|
||||
libc.src.__support.CPP.bit
|
||||
libc.src.__support.FPUtil.fenv_impl
|
||||
libc.src.__support.FPUtil.fp_bits
|
||||
)
|
||||
|
||||
@@ -2613,8 +2639,10 @@ if(NOT LIBC_TARGET_OS_IS_GPU)
|
||||
HDRS
|
||||
NextTowardTest.h
|
||||
DEPENDS
|
||||
libc.hdr.fenv_macros
|
||||
libc.src.math.nexttowardf
|
||||
libc.src.__support.FPUtil.basic_operations
|
||||
libc.src.__support.CPP.bit
|
||||
libc.src.__support.FPUtil.fenv_impl
|
||||
libc.src.__support.FPUtil.fp_bits
|
||||
)
|
||||
endif()
|
||||
@@ -2628,8 +2656,26 @@ add_fp_unittest(
|
||||
HDRS
|
||||
NextTowardTest.h
|
||||
DEPENDS
|
||||
libc.hdr.fenv_macros
|
||||
libc.src.math.nexttowardl
|
||||
libc.src.__support.FPUtil.basic_operations
|
||||
libc.src.__support.CPP.bit
|
||||
libc.src.__support.FPUtil.fenv_impl
|
||||
libc.src.__support.FPUtil.fp_bits
|
||||
)
|
||||
|
||||
add_fp_unittest(
|
||||
nexttowardf16_test
|
||||
SUITE
|
||||
libc-math-smoke-tests
|
||||
SRCS
|
||||
nexttowardf16_test.cpp
|
||||
HDRS
|
||||
NextTowardTest.h
|
||||
DEPENDS
|
||||
libc.hdr.fenv_macros
|
||||
libc.src.math.nexttowardf16
|
||||
libc.src.__support.CPP.bit
|
||||
libc.src.__support.FPUtil.fenv_impl
|
||||
libc.src.__support.FPUtil.fp_bits
|
||||
)
|
||||
|
||||
@@ -2643,7 +2689,6 @@ add_fp_unittest(
|
||||
NextDownTest.h
|
||||
DEPENDS
|
||||
libc.src.math.nextdown
|
||||
libc.src.__support.FPUtil.manipulation_functions
|
||||
)
|
||||
|
||||
add_fp_unittest(
|
||||
@@ -2656,7 +2701,6 @@ add_fp_unittest(
|
||||
NextDownTest.h
|
||||
DEPENDS
|
||||
libc.src.math.nextdownf
|
||||
libc.src.__support.FPUtil.manipulation_functions
|
||||
)
|
||||
|
||||
add_fp_unittest(
|
||||
@@ -2669,7 +2713,18 @@ add_fp_unittest(
|
||||
NextDownTest.h
|
||||
DEPENDS
|
||||
libc.src.math.nextdownl
|
||||
libc.src.__support.FPUtil.manipulation_functions
|
||||
)
|
||||
|
||||
add_fp_unittest(
|
||||
nextdownf16_test
|
||||
SUITE
|
||||
libc-math-smoke-tests
|
||||
SRCS
|
||||
nextdownf16_test.cpp
|
||||
HDRS
|
||||
NextDownTest.h
|
||||
DEPENDS
|
||||
libc.src.math.nextdownf16
|
||||
)
|
||||
|
||||
add_fp_unittest(
|
||||
@@ -2682,7 +2737,6 @@ add_fp_unittest(
|
||||
NextDownTest.h
|
||||
DEPENDS
|
||||
libc.src.math.nextdownf128
|
||||
libc.src.__support.FPUtil.manipulation_functions
|
||||
)
|
||||
|
||||
add_fp_unittest(
|
||||
@@ -2695,7 +2749,6 @@ add_fp_unittest(
|
||||
NextUpTest.h
|
||||
DEPENDS
|
||||
libc.src.math.nextup
|
||||
libc.src.__support.FPUtil.manipulation_functions
|
||||
)
|
||||
|
||||
add_fp_unittest(
|
||||
@@ -2708,7 +2761,6 @@ add_fp_unittest(
|
||||
NextUpTest.h
|
||||
DEPENDS
|
||||
libc.src.math.nextupf
|
||||
libc.src.__support.FPUtil.manipulation_functions
|
||||
)
|
||||
|
||||
add_fp_unittest(
|
||||
@@ -2721,7 +2773,18 @@ add_fp_unittest(
|
||||
NextUpTest.h
|
||||
DEPENDS
|
||||
libc.src.math.nextupl
|
||||
libc.src.__support.FPUtil.manipulation_functions
|
||||
)
|
||||
|
||||
add_fp_unittest(
|
||||
nextupf16_test
|
||||
SUITE
|
||||
libc-math-smoke-tests
|
||||
SRCS
|
||||
nextupf16_test.cpp
|
||||
HDRS
|
||||
NextUpTest.h
|
||||
DEPENDS
|
||||
libc.src.math.nextupf16
|
||||
)
|
||||
|
||||
add_fp_unittest(
|
||||
@@ -2734,7 +2797,6 @@ add_fp_unittest(
|
||||
NextUpTest.h
|
||||
DEPENDS
|
||||
libc.src.math.nextupf128
|
||||
libc.src.__support.FPUtil.manipulation_functions
|
||||
)
|
||||
|
||||
# TODO(lntue): The current implementation of fputil::general::fma<float> is only
|
||||
|
||||
@@ -9,15 +9,15 @@
|
||||
#ifndef LLVM_LIBC_TEST_SRC_MATH_NEXTAFTERTEST_H
|
||||
#define LLVM_LIBC_TEST_SRC_MATH_NEXTAFTERTEST_H
|
||||
|
||||
#include "hdr/math_macros.h"
|
||||
#include "src/__support/CPP/bit.h"
|
||||
#include "src/__support/CPP/type_traits.h"
|
||||
#include "src/__support/FPUtil/BasicOperations.h"
|
||||
#include "src/__support/FPUtil/FEnvImpl.h"
|
||||
#include "src/__support/FPUtil/FPBits.h"
|
||||
#include "test/UnitTest/FEnvSafeTest.h"
|
||||
#include "test/UnitTest/FPMatcher.h"
|
||||
#include "test/UnitTest/Test.h"
|
||||
|
||||
#include "hdr/fenv_macros.h"
|
||||
|
||||
// TODO: Strengthen errno,exception checks and remove these assert macros
|
||||
// after new matchers/test fixtures are added
|
||||
#define ASSERT_FP_EQ_WITH_EXCEPTION(result, expected, expected_exception) \
|
||||
@@ -181,7 +181,7 @@ public:
|
||||
result_bits = FPBits(result);
|
||||
ASSERT_EQ(result_bits.get_biased_exponent(), x_bits.get_biased_exponent());
|
||||
ASSERT_EQ(result_bits.get_mantissa(),
|
||||
x_bits.get_mantissa() + StorageType(1));
|
||||
static_cast<StorageType>(x_bits.get_mantissa() + StorageType(1)));
|
||||
|
||||
x = -x;
|
||||
|
||||
@@ -195,7 +195,7 @@ public:
|
||||
result_bits = FPBits(result);
|
||||
ASSERT_EQ(result_bits.get_biased_exponent(), x_bits.get_biased_exponent());
|
||||
ASSERT_EQ(result_bits.get_mantissa(),
|
||||
x_bits.get_mantissa() + StorageType(1));
|
||||
static_cast<StorageType>(x_bits.get_mantissa() + StorageType(1)));
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -9,16 +9,15 @@
|
||||
#ifndef LLVM_LIBC_TEST_SRC_MATH_NEXTTOWARDTEST_H
|
||||
#define LLVM_LIBC_TEST_SRC_MATH_NEXTTOWARDTEST_H
|
||||
|
||||
#include "hdr/fenv_macros.h"
|
||||
#include "hdr/math_macros.h"
|
||||
#include "src/__support/CPP/bit.h"
|
||||
#include "src/__support/CPP/type_traits.h"
|
||||
#include "src/__support/FPUtil/BasicOperations.h"
|
||||
#include "src/__support/FPUtil/FEnvImpl.h"
|
||||
#include "src/__support/FPUtil/FPBits.h"
|
||||
#include "test/UnitTest/FEnvSafeTest.h"
|
||||
#include "test/UnitTest/FPMatcher.h"
|
||||
#include "test/UnitTest/Test.h"
|
||||
|
||||
#include "hdr/fenv_macros.h"
|
||||
|
||||
// TODO: Strengthen errno,exception checks and remove these assert macros
|
||||
// after new matchers/test fixtures are added
|
||||
#define ASSERT_FP_EQ_WITH_EXCEPTION(result, expected, expected_exception) \
|
||||
@@ -194,7 +193,7 @@ public:
|
||||
result_bits = FPBits(result);
|
||||
ASSERT_EQ(result_bits.get_biased_exponent(), x_bits.get_biased_exponent());
|
||||
ASSERT_EQ(result_bits.get_mantissa(),
|
||||
x_bits.get_mantissa() + StorageType(1));
|
||||
static_cast<StorageType>(x_bits.get_mantissa() + StorageType(1)));
|
||||
|
||||
x = -x;
|
||||
|
||||
@@ -208,7 +207,7 @@ public:
|
||||
result_bits = FPBits(result);
|
||||
ASSERT_EQ(result_bits.get_biased_exponent(), x_bits.get_biased_exponent());
|
||||
ASSERT_EQ(result_bits.get_mantissa(),
|
||||
x_bits.get_mantissa() + StorageType(1));
|
||||
static_cast<StorageType>(x_bits.get_mantissa() + StorageType(1)));
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
13
libc/test/src/math/smoke/nextafterf16_test.cpp
Normal file
13
libc/test/src/math/smoke/nextafterf16_test.cpp
Normal file
@@ -0,0 +1,13 @@
|
||||
//===-- Unittests for nextafterf16 ----------------------------------------===//
|
||||
//
|
||||
// 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 "NextAfterTest.h"
|
||||
|
||||
#include "src/math/nextafterf16.h"
|
||||
|
||||
LIST_NEXTAFTER_TESTS(float16, LIBC_NAMESPACE::nextafterf16)
|
||||
13
libc/test/src/math/smoke/nextdownf16_test.cpp
Normal file
13
libc/test/src/math/smoke/nextdownf16_test.cpp
Normal file
@@ -0,0 +1,13 @@
|
||||
//===-- Unittests for nextdownf16 -----------------------------------------===//
|
||||
//
|
||||
// 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 "NextDownTest.h"
|
||||
|
||||
#include "src/math/nextdownf16.h"
|
||||
|
||||
LIST_NEXTDOWN_TESTS(float16, LIBC_NAMESPACE::nextdownf16)
|
||||
13
libc/test/src/math/smoke/nexttowardf16_test.cpp
Normal file
13
libc/test/src/math/smoke/nexttowardf16_test.cpp
Normal file
@@ -0,0 +1,13 @@
|
||||
//===-- Unittests for nexttowardf16 ---------------------------------------===//
|
||||
//
|
||||
// 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 "NextTowardTest.h"
|
||||
|
||||
#include "src/math/nexttowardf16.h"
|
||||
|
||||
LIST_NEXTTOWARD_TESTS(float16, LIBC_NAMESPACE::nexttowardf16)
|
||||
13
libc/test/src/math/smoke/nextupf16_test.cpp
Normal file
13
libc/test/src/math/smoke/nextupf16_test.cpp
Normal file
@@ -0,0 +1,13 @@
|
||||
//===-- Unittests for nextupf16 -------------------------------------------===//
|
||||
//
|
||||
// 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 "NextUpTest.h"
|
||||
|
||||
#include "src/math/nextupf16.h"
|
||||
|
||||
LIST_NEXTUP_TESTS(float16, LIBC_NAMESPACE::nextupf16)
|
||||
Reference in New Issue
Block a user