[libc][math][c23] Add fsub{,l,f128} and remainderf128 C23 math functions (#101576)
Co-authored-by: OverMighty <its.overmighty@gmail.com>
This commit is contained in:
parent
07ddf19438
commit
2c74237c0f
@ -185,6 +185,8 @@ set(TARGET_LIBM_ENTRYPOINTS
|
||||
libc.src.math.frexp
|
||||
libc.src.math.frexpf
|
||||
libc.src.math.frexpl
|
||||
libc.src.math.fsub
|
||||
libc.src.math.fsubl
|
||||
libc.src.math.hypot
|
||||
libc.src.math.hypotf
|
||||
libc.src.math.ilogb
|
||||
|
@ -152,6 +152,8 @@ set(TARGET_LIBM_ENTRYPOINTS
|
||||
#libc.src.math.frexp
|
||||
#libc.src.math.frexpf
|
||||
#libc.src.math.frexpl
|
||||
#libc.src.math.fsub
|
||||
#libc.src.math.fsubl
|
||||
#libc.src.math.hypot
|
||||
#libc.src.math.hypotf
|
||||
#libc.src.math.ilogb
|
||||
|
@ -461,6 +461,8 @@ set(TARGET_LIBM_ENTRYPOINTS
|
||||
libc.src.math.fromfpxl
|
||||
libc.src.math.fsqrt
|
||||
libc.src.math.fsqrtl
|
||||
libc.src.math.fsub
|
||||
libc.src.math.fsubl
|
||||
libc.src.math.getpayload
|
||||
libc.src.math.getpayloadf
|
||||
libc.src.math.getpayloadl
|
||||
@ -701,6 +703,7 @@ if(LIBC_TYPES_HAS_FLOAT128)
|
||||
libc.src.math.fromfpf128
|
||||
libc.src.math.fromfpxf128
|
||||
libc.src.math.fsqrtf128
|
||||
libc.src.math.fsubf128
|
||||
libc.src.math.getpayloadf128
|
||||
libc.src.math.ilogbf128
|
||||
libc.src.math.ldexpf128
|
||||
@ -716,6 +719,7 @@ if(LIBC_TYPES_HAS_FLOAT128)
|
||||
libc.src.math.nextafterf128
|
||||
libc.src.math.nextdownf128
|
||||
libc.src.math.nextupf128
|
||||
libc.src.math.remainderf128
|
||||
libc.src.math.remquof128
|
||||
libc.src.math.rintf128
|
||||
libc.src.math.roundevenf128
|
||||
|
@ -297,6 +297,8 @@ set(TARGET_LIBM_ENTRYPOINTS
|
||||
libc.src.math.fromfpx
|
||||
libc.src.math.fromfpxf
|
||||
libc.src.math.fromfpxl
|
||||
libc.src.math.fsub
|
||||
libc.src.math.fsubl
|
||||
libc.src.math.getpayload
|
||||
libc.src.math.getpayloadf
|
||||
libc.src.math.getpayloadl
|
||||
|
@ -464,6 +464,8 @@ set(TARGET_LIBM_ENTRYPOINTS
|
||||
libc.src.math.fromfpxl
|
||||
libc.src.math.fsqrt
|
||||
libc.src.math.fsqrtl
|
||||
libc.src.math.fsub
|
||||
libc.src.math.fsubl
|
||||
libc.src.math.getpayload
|
||||
libc.src.math.getpayloadf
|
||||
libc.src.math.getpayloadl
|
||||
@ -608,6 +610,7 @@ if(LIBC_TYPES_HAS_FLOAT128)
|
||||
libc.src.math.fromfpf128
|
||||
libc.src.math.fromfpxf128
|
||||
libc.src.math.fsqrtf128
|
||||
libc.src.math.fsubf128
|
||||
libc.src.math.getpayloadf128
|
||||
libc.src.math.ilogbf128
|
||||
libc.src.math.ldexpf128
|
||||
@ -623,6 +626,7 @@ if(LIBC_TYPES_HAS_FLOAT128)
|
||||
libc.src.math.nextafterf128
|
||||
libc.src.math.nextdownf128
|
||||
libc.src.math.nextupf128
|
||||
libc.src.math.remainderf128
|
||||
libc.src.math.remquof128
|
||||
libc.src.math.rintf128
|
||||
libc.src.math.roundevenf128
|
||||
|
@ -464,6 +464,8 @@ set(TARGET_LIBM_ENTRYPOINTS
|
||||
libc.src.math.fromfpxl
|
||||
libc.src.math.fsqrt
|
||||
libc.src.math.fsqrtl
|
||||
libc.src.math.fsub
|
||||
libc.src.math.fsubl
|
||||
libc.src.math.getpayload
|
||||
libc.src.math.getpayloadf
|
||||
libc.src.math.getpayloadl
|
||||
@ -697,6 +699,7 @@ if(LIBC_TYPES_HAS_FLOAT128)
|
||||
libc.src.math.fromfpf128
|
||||
libc.src.math.fromfpxf128
|
||||
libc.src.math.fsqrtf128
|
||||
libc.src.math.fsubf128
|
||||
libc.src.math.getpayloadf128
|
||||
libc.src.math.ilogbf128
|
||||
libc.src.math.ldexpf128
|
||||
@ -712,6 +715,7 @@ if(LIBC_TYPES_HAS_FLOAT128)
|
||||
libc.src.math.nextafterf128
|
||||
libc.src.math.nextdownf128
|
||||
libc.src.math.nextupf128
|
||||
libc.src.math.remainderf128
|
||||
libc.src.math.remquof128
|
||||
libc.src.math.rintf128
|
||||
libc.src.math.roundevenf128
|
||||
|
@ -201,6 +201,8 @@ set(TARGET_LIBM_ENTRYPOINTS
|
||||
libc.src.math.frexp
|
||||
libc.src.math.frexpf
|
||||
libc.src.math.frexpl
|
||||
libc.src.math.fsub
|
||||
libc.src.math.fsubl
|
||||
libc.src.math.hypot
|
||||
libc.src.math.hypotf
|
||||
libc.src.math.ilogb
|
||||
|
@ -118,7 +118,7 @@ Basic Operations
|
||||
+------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+
|
||||
| ddiv | N/A | N/A | | N/A | |check|\* | 7.12.14.4 | F.10.11 |
|
||||
+------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+
|
||||
| dfma | N/A | N/A | |check| | N/A | |check|\* | 7.12.14.5 | F.10.11 |
|
||||
| dfma | N/A | N/A | |check| | N/A | |check|\* | 7.12.14.5 | F.10.11 |
|
||||
+------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+
|
||||
| dmul | N/A | N/A | |check| | N/A | |check|\* | 7.12.14.3 | F.10.11 |
|
||||
+------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+
|
||||
@ -176,7 +176,7 @@ Basic Operations
|
||||
+------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+
|
||||
| fromfpx | |check| | |check| | |check| | |check| | |check| | 7.12.9.11 | F.10.6.11 |
|
||||
+------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+
|
||||
| fsub | N/A | | | N/A | | 7.12.14.2 | F.10.11 |
|
||||
| fsub | N/A | |check| | |check| | N/A | |check|\* | 7.12.14.2 | F.10.11 |
|
||||
+------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+
|
||||
| getpayload | |check| | |check| | |check| | |check| | |check| | F.10.13.1 | N/A |
|
||||
+------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+
|
||||
@ -210,7 +210,7 @@ Basic Operations
|
||||
+------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+
|
||||
| nextup | |check| | |check| | |check| | |check| | |check| | 7.12.11.5 | F.10.8.5 |
|
||||
+------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+
|
||||
| remainder | |check| | |check| | |check| | |check| | | 7.12.10.2 | F.10.7.2 |
|
||||
| remainder | |check| | |check| | |check| | |check| | |check| | 7.12.10.2 | F.10.7.2 |
|
||||
+------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+
|
||||
| remquo | |check| | |check| | |check| | |check| | |check| | 7.12.10.3 | F.10.7.3 |
|
||||
+------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+
|
||||
|
@ -794,6 +794,14 @@ functions:
|
||||
arguments:
|
||||
- type: long double
|
||||
- type: long double
|
||||
- name: remainderf128
|
||||
standards:
|
||||
- stdc
|
||||
return_type: float128
|
||||
arguments:
|
||||
- type: float128
|
||||
- type: float128
|
||||
guard: LIBC_TYPES_HAS_FLOAT128
|
||||
- name: remquo
|
||||
standards:
|
||||
- stdc
|
||||
@ -1540,6 +1548,28 @@ functions:
|
||||
- type: int
|
||||
- type: unsigned int
|
||||
guard: LIBC_TYPES_HAS_FLOAT16
|
||||
- name: fsub
|
||||
standards:
|
||||
- stdc
|
||||
return_type: float
|
||||
arguments:
|
||||
- type: double
|
||||
- type: double
|
||||
- name: fsubl
|
||||
standards:
|
||||
- stdc
|
||||
return_type: float
|
||||
arguments:
|
||||
- type: long double
|
||||
- type: long double
|
||||
- name: fsubf128
|
||||
standards:
|
||||
- llvm_libc_ext
|
||||
return_type: float
|
||||
arguments:
|
||||
- type: float128
|
||||
- type: float128
|
||||
guard: LIBC_TYPES_HAS_FLOAT128
|
||||
- name: getpayload
|
||||
standards:
|
||||
- stdc
|
||||
@ -1557,7 +1587,7 @@ functions:
|
||||
- stdc
|
||||
return_type: float
|
||||
arguments:
|
||||
- type: float *
|
||||
- type: float *
|
||||
- name: getpayloadf16
|
||||
standards:
|
||||
- stdc
|
||||
|
@ -98,8 +98,10 @@ def LLVMLibcExt : StandardSpec<"llvm_libc_ext"> {
|
||||
|
||||
GuardedFunctionSpec<"fsqrtf128", RetValSpec<FloatType>, [ArgSpec<Float128Type>], "LIBC_TYPES_HAS_FLOAT128">,
|
||||
|
||||
FunctionSpec<"fsubf128", RetValSpec<FloatType>, [ArgSpec<Float128Type>, ArgSpec<Float128Type>], "LIBC_TYPES_HAS_FLOAT128">,
|
||||
|
||||
FunctionSpec<"powi", RetValSpec<DoubleType>, [ArgSpec<DoubleType>, ArgSpec<IntType>]>,
|
||||
FunctionSpec<"powif", RetValSpec<FloatType>, [ArgSpec<FloatType>, ArgSpec<IntType>]>,
|
||||
FunctionSpec<"powif", RetValSpec<FloatType>, [ArgSpec<FloatType>, ArgSpec<IntType>]>,
|
||||
]
|
||||
>;
|
||||
|
||||
|
@ -516,6 +516,9 @@ def StdC : StandardSpec<"stdc"> {
|
||||
GuardedFunctionSpec<"fromfpxf16", RetValSpec<Float16Type>, [ArgSpec<Float16Type>, ArgSpec<IntType>, ArgSpec<UnsignedIntType>], "LIBC_TYPES_HAS_FLOAT16">,
|
||||
GuardedFunctionSpec<"fromfpxf128", RetValSpec<Float128Type>, [ArgSpec<Float128Type>, ArgSpec<IntType>, ArgSpec<UnsignedIntType>], "LIBC_TYPES_HAS_FLOAT128">,
|
||||
|
||||
FunctionSpec<"fsub", RetValSpec<FloatType>, [ArgSpec<DoubleType>, ArgSpec<DoubleType>]>,
|
||||
FunctionSpec<"fsubl", RetValSpec<FloatType>, [ArgSpec<LongDoubleType>, ArgSpec<LongDoubleType>]>,
|
||||
|
||||
FunctionSpec<"ufromfp", RetValSpec<DoubleType>, [ArgSpec<DoubleType>, ArgSpec<IntType>, ArgSpec<UnsignedIntType>]>,
|
||||
FunctionSpec<"ufromfpf", RetValSpec<FloatType>, [ArgSpec<FloatType>, ArgSpec<IntType>, ArgSpec<UnsignedIntType>]>,
|
||||
FunctionSpec<"ufromfpl", RetValSpec<LongDoubleType>, [ArgSpec<LongDoubleType>, ArgSpec<IntType>, ArgSpec<UnsignedIntType>]>,
|
||||
@ -603,6 +606,7 @@ def StdC : StandardSpec<"stdc"> {
|
||||
FunctionSpec<"remainderf", RetValSpec<FloatType>, [ArgSpec<FloatType>, ArgSpec<FloatType>]>,
|
||||
FunctionSpec<"remainderl", RetValSpec<LongDoubleType>, [ArgSpec<LongDoubleType>, ArgSpec<LongDoubleType>]>,
|
||||
GuardedFunctionSpec<"remainderf16", RetValSpec<Float16Type>, [ArgSpec<Float16Type>, ArgSpec<Float16Type>], "LIBC_TYPES_HAS_FLOAT16">,
|
||||
GuardedFunctionSpec<"remainderf128", RetValSpec<Float128Type, [ArgSpec<Float128Type>, ArgSpec<Float128Type>], "LIBC_TYPES_HAS_FLOAT128">,
|
||||
|
||||
FunctionSpec<"remquo", RetValSpec<DoubleType>, [ArgSpec<DoubleType>, ArgSpec<DoubleType>, ArgSpec<IntPtr>]>,
|
||||
FunctionSpec<"remquof", RetValSpec<FloatType>, [ArgSpec<FloatType>, ArgSpec<FloatType>, ArgSpec<IntPtr>]>,
|
||||
@ -751,7 +755,7 @@ def StdC : StandardSpec<"stdc"> {
|
||||
FunctionSpec<"getpayloadl", RetValSpec<LongDoubleType>, [ArgSpec<LongDoublePtr>]>,
|
||||
GuardedFunctionSpec<"getpayloadf16", RetValSpec<Float16Type>, [ArgSpec<Float16Ptr>], "LIBC_TYPES_HAS_FLOAT16">,
|
||||
GuardedFunctionSpec<"getpayloadf128", RetValSpec<Float128Type>, [ArgSpec<Float128Ptr>], "LIBC_TYPES_HAS_FLOAT128">,
|
||||
|
||||
|
||||
FunctionSpec<"setpayload", RetValSpec<IntType>, [ArgSpec<DoublePtr>, ArgSpec<DoubleType>]>,
|
||||
FunctionSpec<"setpayloadf", RetValSpec<IntType>, [ArgSpec<FloatPtr>, ArgSpec<FloatType>]>,
|
||||
GuardedFunctionSpec<"setpayloadf16", RetValSpec<IntType>, [ArgSpec<Float16Ptr>, ArgSpec<Float16Type>], "LIBC_TYPES_HAS_FLOAT16">,
|
||||
|
@ -273,6 +273,10 @@ add_math_entrypoint_object(fromfpxl)
|
||||
add_math_entrypoint_object(fromfpxf16)
|
||||
add_math_entrypoint_object(fromfpxf128)
|
||||
|
||||
add_math_entrypoint_object(fsub)
|
||||
add_math_entrypoint_object(fsubl)
|
||||
add_math_entrypoint_object(fsubf128)
|
||||
|
||||
add_math_entrypoint_object(getpayload)
|
||||
add_math_entrypoint_object(getpayloadf)
|
||||
add_math_entrypoint_object(getpayloadl)
|
||||
@ -396,6 +400,7 @@ add_math_entrypoint_object(remainder)
|
||||
add_math_entrypoint_object(remainderf)
|
||||
add_math_entrypoint_object(remainderl)
|
||||
add_math_entrypoint_object(remainderf16)
|
||||
add_math_entrypoint_object(remainderf128)
|
||||
|
||||
add_math_entrypoint_object(remquo)
|
||||
add_math_entrypoint_object(remquof)
|
||||
|
20
libc/src/math/fsub.h
Normal file
20
libc/src/math/fsub.h
Normal file
@ -0,0 +1,20 @@
|
||||
//===-- Implementation header for fsub --------------------------*- 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_FSUB_H
|
||||
#define LLVM_LIBC_SRC_MATH_FSUB_H
|
||||
|
||||
#include "src/__support/macros/config.h"
|
||||
|
||||
namespace LIBC_NAMESPACE_DECL {
|
||||
|
||||
float fsub(double x, double y);
|
||||
|
||||
} // namespace LIBC_NAMESPACE_DECL
|
||||
|
||||
#endif // LLVM_LIBC_SRC_MATH_FSUB_H
|
21
libc/src/math/fsubf128.h
Normal file
21
libc/src/math/fsubf128.h
Normal file
@ -0,0 +1,21 @@
|
||||
//===-- Implementation header for fsubf128 ----------------------*- 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_FSUBF128_H
|
||||
#define LLVM_LIBC_SRC_MATH_FSUBF128_H
|
||||
|
||||
#include "src/__support/macros/config.h"
|
||||
#include "src/__support/macros/properties/types.h"
|
||||
|
||||
namespace LIBC_NAMESPACE_DECL {
|
||||
|
||||
float fsubf128(float128 x, float128 y);
|
||||
|
||||
} // namespace LIBC_NAMESPACE_DECL
|
||||
|
||||
#endif // LLVM_LIBC_SRC_MATH_FSUBF128_H
|
20
libc/src/math/fsubl.h
Normal file
20
libc/src/math/fsubl.h
Normal file
@ -0,0 +1,20 @@
|
||||
//===-- Implementation header for fsubl -------------------------*- 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_FSUBL_H
|
||||
#define LLVM_LIBC_SRC_MATH_FSUBL_H
|
||||
|
||||
#include "src/__support/macros/config.h"
|
||||
|
||||
namespace LIBC_NAMESPACE_DECL {
|
||||
|
||||
float fsubl(long double x, long double y);
|
||||
|
||||
} // namespace LIBC_NAMESPACE_DECL
|
||||
|
||||
#endif // LLVM_LIBC_SRC_MATH_FSUBL_H
|
@ -2931,6 +2931,43 @@ add_entrypoint_object(
|
||||
-O3
|
||||
)
|
||||
|
||||
add_entrypoint_object(
|
||||
fsub
|
||||
SRCS
|
||||
fsub.cpp
|
||||
HDRS
|
||||
../fsub.h
|
||||
DEPENDS
|
||||
libc.src.__support.FPUtil.generic.add_sub
|
||||
COMPILE_OPTIONS
|
||||
-O3
|
||||
)
|
||||
|
||||
add_entrypoint_object(
|
||||
fsubl
|
||||
SRCS
|
||||
fsubl.cpp
|
||||
HDRS
|
||||
../fsubl.h
|
||||
DEPENDS
|
||||
libc.src.__support.FPUtil.generic.add_sub
|
||||
COMPILE_OPTIONS
|
||||
-O3
|
||||
)
|
||||
|
||||
add_entrypoint_object(
|
||||
fsubf128
|
||||
SRCS
|
||||
fsubf128.cpp
|
||||
HDRS
|
||||
../fsubf128.h
|
||||
DEPENDS
|
||||
libc.src.__support.macros.properties.types
|
||||
libc.src.__support.FPUtil.generic.add_sub
|
||||
COMPILE_OPTIONS
|
||||
-O3
|
||||
)
|
||||
|
||||
add_entrypoint_object(
|
||||
sqrt
|
||||
SRCS
|
||||
@ -3091,6 +3128,19 @@ add_entrypoint_object(
|
||||
-O3
|
||||
)
|
||||
|
||||
add_entrypoint_object(
|
||||
remainderf128
|
||||
SRCS
|
||||
remainderf128.cpp
|
||||
HDRS
|
||||
../remainderf128.h
|
||||
DEPENDS
|
||||
libc.src.__support.macros.properties.types
|
||||
libc.src.__support.FPUtil.division_and_remainder_operations
|
||||
COMPILE_OPTIONS
|
||||
-O3
|
||||
)
|
||||
|
||||
add_entrypoint_object(
|
||||
hypotf
|
||||
SRCS
|
||||
|
20
libc/src/math/generic/fsub.cpp
Normal file
20
libc/src/math/generic/fsub.cpp
Normal file
@ -0,0 +1,20 @@
|
||||
//===-- Implementation of fsub 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/fsub.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, fsub, (double x, double y)) {
|
||||
return fputil::generic::sub<float>(x, y);
|
||||
}
|
||||
|
||||
} // namespace LIBC_NAMESPACE_DECL
|
20
libc/src/math/generic/fsubf128.cpp
Normal file
20
libc/src/math/generic/fsubf128.cpp
Normal file
@ -0,0 +1,20 @@
|
||||
//===-- Implementation of fsubf128 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/fsubf128.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, fsubf128, (float128 x, float128 y)) {
|
||||
return fputil::generic::sub<float>(x, y);
|
||||
}
|
||||
|
||||
} // namespace LIBC_NAMESPACE_DECL
|
20
libc/src/math/generic/fsubl.cpp
Normal file
20
libc/src/math/generic/fsubl.cpp
Normal file
@ -0,0 +1,20 @@
|
||||
//===-- Implementation of fsubl 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/fsubl.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, fsubl, (long double x, long double y)) {
|
||||
return fputil::generic::sub<float>(x, y);
|
||||
}
|
||||
|
||||
} // namespace LIBC_NAMESPACE_DECL
|
21
libc/src/math/generic/remainderf128.cpp
Normal file
21
libc/src/math/generic/remainderf128.cpp
Normal file
@ -0,0 +1,21 @@
|
||||
//===-- Implementation of remainderf128 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/remainderf128.h"
|
||||
#include "src/__support/FPUtil/DivisionAndRemainderOperations.h"
|
||||
#include "src/__support/common.h"
|
||||
#include "src/__support/macros/config.h"
|
||||
|
||||
namespace LIBC_NAMESPACE_DECL {
|
||||
|
||||
LLVM_LIBC_FUNCTION(float128, remainderf128, (float128 x, float128 y)) {
|
||||
int quotient;
|
||||
return fputil::remquo(x, y, quotient);
|
||||
}
|
||||
|
||||
} // namespace LIBC_NAMESPACE_DECL
|
21
libc/src/math/remainderf128.h
Normal file
21
libc/src/math/remainderf128.h
Normal file
@ -0,0 +1,21 @@
|
||||
//===-- Implementation header for remainderf128 -----------------*- 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_REMAINDERF128_H
|
||||
#define LLVM_LIBC_SRC_MATH_REMAINDERF128_H
|
||||
|
||||
#include "src/__support/macros/config.h"
|
||||
#include "src/__support/macros/properties/types.h"
|
||||
|
||||
namespace LIBC_NAMESPACE_DECL {
|
||||
|
||||
float128 remainderf128(float128 x, float128 y);
|
||||
|
||||
} // namespace LIBC_NAMESPACE_DECL
|
||||
|
||||
#endif // LLVM_LIBC_SRC_MATH_REMAINDERF128_H
|
@ -2341,6 +2341,32 @@ add_fp_unittest(
|
||||
libc.src.math.fsqrtl
|
||||
)
|
||||
|
||||
add_fp_unittest(
|
||||
fsub_test
|
||||
NEED_MPFR
|
||||
SUITE
|
||||
libc-math-unittests
|
||||
SRCS
|
||||
fsub_test.cpp
|
||||
HDRS
|
||||
SubTest.h
|
||||
DEPENDS
|
||||
libc.src.math.fsub
|
||||
)
|
||||
|
||||
add_fp_unittest(
|
||||
fsubl_test
|
||||
NEED_MPFR
|
||||
SUITE
|
||||
libc-math-unittests
|
||||
SRCS
|
||||
fsubl_test.cpp
|
||||
HDRS
|
||||
SubTest.h
|
||||
DEPENDS
|
||||
libc.src.math.fsubl
|
||||
)
|
||||
|
||||
add_fp_unittest(
|
||||
dsqrtl_test
|
||||
NEED_MPFR
|
||||
|
13
libc/test/src/math/fsub_test.cpp
Normal file
13
libc/test/src/math/fsub_test.cpp
Normal file
@ -0,0 +1,13 @@
|
||||
//===-- Unittests for fsub ------------------------------------------------===//
|
||||
//
|
||||
// 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 "SubTest.h"
|
||||
|
||||
#include "src/math/fsub.h"
|
||||
|
||||
LIST_SUB_TESTS(float, double, LIBC_NAMESPACE::fsub)
|
13
libc/test/src/math/fsubl_test.cpp
Normal file
13
libc/test/src/math/fsubl_test.cpp
Normal file
@ -0,0 +1,13 @@
|
||||
//===-- Unittests for fsubl -----------------------------------------------===//
|
||||
//
|
||||
// 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 "SubTest.h"
|
||||
|
||||
#include "src/math/fsubl.h"
|
||||
|
||||
LIST_SUB_TESTS(float, long double, LIBC_NAMESPACE::fsubl)
|
@ -4352,6 +4352,48 @@ add_fp_unittest(
|
||||
libc.src.math.fsqrtf128
|
||||
)
|
||||
|
||||
add_fp_unittest(
|
||||
fsub_test
|
||||
SUITE
|
||||
libc-math-smoke-tests
|
||||
SRCS
|
||||
fsub_test.cpp
|
||||
HDRS
|
||||
SubTest.h
|
||||
DEPENDS
|
||||
libc.hdr.errno_macros
|
||||
libc.hdr.fenv_macros
|
||||
libc.src.math.fsub
|
||||
)
|
||||
|
||||
add_fp_unittest(
|
||||
fsubl_test
|
||||
SUITE
|
||||
libc-math-smoke-tests
|
||||
SRCS
|
||||
fsubl_test.cpp
|
||||
HDRS
|
||||
SubTest.h
|
||||
DEPENDS
|
||||
libc.hdr.errno_macros
|
||||
libc.hdr.fenv_macros
|
||||
libc.src.math.fsubl
|
||||
)
|
||||
|
||||
add_fp_unittest(
|
||||
fsubf128_test
|
||||
SUITE
|
||||
libc-math-smoke-tests
|
||||
SRCS
|
||||
fsubf128_test.cpp
|
||||
HDRS
|
||||
SubTest.h
|
||||
DEPENDS
|
||||
libc.hdr.errno_macros
|
||||
libc.hdr.fenv_macros
|
||||
libc.src.math.fsubf128
|
||||
)
|
||||
|
||||
add_fp_unittest(
|
||||
dsqrtl_test
|
||||
SUITE
|
||||
|
13
libc/test/src/math/smoke/fsub_test.cpp
Normal file
13
libc/test/src/math/smoke/fsub_test.cpp
Normal file
@ -0,0 +1,13 @@
|
||||
//===-- Unittests for fsub ------------------------------------------------===//
|
||||
//
|
||||
// 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 "SubTest.h"
|
||||
|
||||
#include "src/math/fsub.h"
|
||||
|
||||
LIST_SUB_TESTS(float, double, LIBC_NAMESPACE::fsub)
|
13
libc/test/src/math/smoke/fsubf128_test.cpp
Normal file
13
libc/test/src/math/smoke/fsubf128_test.cpp
Normal file
@ -0,0 +1,13 @@
|
||||
//===-- Unittests for fsubf128 --------------------------------------------===//
|
||||
//
|
||||
// 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 "SubTest.h"
|
||||
|
||||
#include "src/math/fsubf128.h"
|
||||
|
||||
LIST_SUB_TESTS(float, float128, LIBC_NAMESPACE::fsubf128)
|
13
libc/test/src/math/smoke/fsubl_test.cpp
Normal file
13
libc/test/src/math/smoke/fsubl_test.cpp
Normal file
@ -0,0 +1,13 @@
|
||||
//===-- Unittests for fsubl -----------------------------------------------===//
|
||||
//
|
||||
// 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 "SubTest.h"
|
||||
|
||||
#include "src/math/fsubl.h"
|
||||
|
||||
LIST_SUB_TESTS(float, long double, LIBC_NAMESPACE::fsubl)
|
Loading…
x
Reference in New Issue
Block a user