[libc][math][c++23] Add f{max,min}imum{,_mag,_mag_num,_num}bf16 math functions (#152881)

This PR adds the following basic math functions for BFloat16 type along
with the tests:
- fmaximumbf16
- fmaximum_magbf16
- fmaximum_mag_numbf16
- fmaximum_numbf16
- fminimumbf16
- fminimum_magbf16
- fminimum_mag_numbf16
- fminimum_numbf16

---------

Signed-off-by: Krishna Pandey <kpandey81930@gmail.com>
This commit is contained in:
Krishna Pandey 2025-08-12 20:37:31 +05:30 committed by GitHub
parent d455d45654
commit 8c5e9399f6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
39 changed files with 793 additions and 0 deletions

View File

@ -770,7 +770,15 @@ list(APPEND TARGET_LIBM_ENTRYPOINTS
libc.src.math.fabsbf16
libc.src.math.floorbf16
libc.src.math.fmaxbf16
libc.src.math.fmaximumbf16
libc.src.math.fmaximum_magbf16
libc.src.math.fmaximum_mag_numbf16
libc.src.math.fmaximum_numbf16
libc.src.math.fminbf16
libc.src.math.fminimumbf16
libc.src.math.fminimum_magbf16
libc.src.math.fminimum_mag_numbf16
libc.src.math.fminimum_numbf16
libc.src.math.roundbf16
libc.src.math.roundevenbf16
libc.src.math.truncbf16

View File

@ -773,7 +773,15 @@ list(APPEND TARGET_LIBM_ENTRYPOINTS
libc.src.math.fabsbf16
libc.src.math.floorbf16
libc.src.math.fmaxbf16
libc.src.math.fmaximumbf16
libc.src.math.fmaximum_magbf16
libc.src.math.fmaximum_mag_numbf16
libc.src.math.fmaximum_numbf16
libc.src.math.fminbf16
libc.src.math.fminimumbf16
libc.src.math.fminimum_magbf16
libc.src.math.fminimum_mag_numbf16
libc.src.math.fminimum_numbf16
libc.src.math.roundbf16
libc.src.math.roundevenbf16
libc.src.math.truncbf16

View File

@ -773,7 +773,15 @@ list(APPEND TARGET_LIBM_ENTRYPOINTS
libc.src.math.fabsbf16
libc.src.math.floorbf16
libc.src.math.fmaxbf16
libc.src.math.fmaximumbf16
libc.src.math.fmaximum_magbf16
libc.src.math.fmaximum_mag_numbf16
libc.src.math.fmaximum_numbf16
libc.src.math.fminbf16
libc.src.math.fminimumbf16
libc.src.math.fminimum_magbf16
libc.src.math.fminimum_mag_numbf16
libc.src.math.fminimum_numbf16
libc.src.math.roundbf16
libc.src.math.roundevenbf16
libc.src.math.truncbf16

View File

@ -603,7 +603,15 @@ list(APPEND TARGET_LIBM_ENTRYPOINTS
libc.src.math.fabsbf16
libc.src.math.floorbf16
libc.src.math.fmaxbf16
libc.src.math.fmaximumbf16
libc.src.math.fmaximum_magbf16
libc.src.math.fmaximum_mag_numbf16
libc.src.math.fmaximum_numbf16
libc.src.math.fminbf16
libc.src.math.fminimumbf16
libc.src.math.fminimum_magbf16
libc.src.math.fminimum_mag_numbf16
libc.src.math.fminimum_numbf16
libc.src.math.roundbf16
libc.src.math.roundevenbf16
libc.src.math.truncbf16

View File

@ -246,7 +246,16 @@ list(APPEND TARGET_LIBM_ENTRYPOINTS
libc.src.math.fabsbf16
libc.src.math.floorbf16
libc.src.math.fmaxbf16
libc.src.math.fmaximumbf16
libc.src.math.fmaximum_magbf16
libc.src.math.fmaximum_mag_numbf16
libc.src.math.fmaximum_numbf16
libc.src.math.fminbf16
libc.src.math.fminimumbf16
libc.src.math.fminimum_magbf16
libc.src.math.fminimum_mag_numbf16
libc.src.math.fminimum_numbf16
libc.src.math.roundbf16
libc.src.math.roundevenbf16
libc.src.math.truncbf16

View File

@ -629,7 +629,15 @@ list(APPEND TARGET_LIBM_ENTRYPOINTS
libc.src.math.fabsbf16
libc.src.math.floorbf16
libc.src.math.fmaxbf16
libc.src.math.fmaximumbf16
libc.src.math.fmaximum_magbf16
libc.src.math.fmaximum_mag_numbf16
libc.src.math.fmaximum_numbf16
libc.src.math.fminbf16
libc.src.math.fminimumbf16
libc.src.math.fminimum_magbf16
libc.src.math.fminimum_mag_numbf16
libc.src.math.fminimum_numbf16
libc.src.math.roundbf16
libc.src.math.roundevenbf16
libc.src.math.truncbf16

View File

@ -630,7 +630,15 @@ list(APPEND TARGET_LIBM_ENTRYPOINTS
libc.src.math.fabsbf16
libc.src.math.floorbf16
libc.src.math.fmaxbf16
libc.src.math.fmaximumbf16
libc.src.math.fmaximum_magbf16
libc.src.math.fmaximum_mag_numbf16
libc.src.math.fmaximum_numbf16
libc.src.math.fminbf16
libc.src.math.fminimumbf16
libc.src.math.fminimum_magbf16
libc.src.math.fminimum_mag_numbf16
libc.src.math.fminimum_numbf16
libc.src.math.roundbf16
libc.src.math.roundevenbf16
libc.src.math.truncbf16

View File

@ -857,7 +857,15 @@ list(APPEND TARGET_LIBM_ENTRYPOINTS
libc.src.math.fabsbf16
libc.src.math.floorbf16
libc.src.math.fmaxbf16
libc.src.math.fmaximumbf16
libc.src.math.fmaximum_magbf16
libc.src.math.fmaximum_mag_numbf16
libc.src.math.fmaximum_numbf16
libc.src.math.fminbf16
libc.src.math.fminimumbf16
libc.src.math.fminimum_magbf16
libc.src.math.fminimum_mag_numbf16
libc.src.math.fminimum_numbf16
libc.src.math.roundbf16
libc.src.math.roundevenbf16
libc.src.math.truncbf16

View File

@ -473,7 +473,15 @@ list(APPEND TARGET_LIBM_ENTRYPOINTS
libc.src.math.fabsbf16
libc.src.math.floorbf16
libc.src.math.fmaxbf16
libc.src.math.fmaximumbf16
libc.src.math.fmaximum_magbf16
libc.src.math.fmaximum_mag_numbf16
libc.src.math.fmaximum_numbf16
libc.src.math.fminbf16
libc.src.math.fminimumbf16
libc.src.math.fminimum_magbf16
libc.src.math.fminimum_mag_numbf16
libc.src.math.fminimum_numbf16
libc.src.math.roundbf16
libc.src.math.roundevenbf16
libc.src.math.truncbf16

View File

@ -876,7 +876,15 @@ list(APPEND TARGET_LIBM_ENTRYPOINTS
libc.src.math.fabsbf16
libc.src.math.floorbf16
libc.src.math.fmaxbf16
libc.src.math.fmaximumbf16
libc.src.math.fmaximum_magbf16
libc.src.math.fmaximum_mag_numbf16
libc.src.math.fmaximum_numbf16
libc.src.math.fminbf16
libc.src.math.fminimumbf16
libc.src.math.fminimum_magbf16
libc.src.math.fminimum_mag_numbf16
libc.src.math.fminimum_numbf16
libc.src.math.roundbf16
libc.src.math.roundevenbf16
libc.src.math.truncbf16

View File

@ -908,7 +908,15 @@ list(APPEND TARGET_LIBM_ENTRYPOINTS
libc.src.math.fabsbf16
libc.src.math.floorbf16
libc.src.math.fmaxbf16
libc.src.math.fmaximumbf16
libc.src.math.fmaximum_magbf16
libc.src.math.fmaximum_mag_numbf16
libc.src.math.fmaximum_numbf16
libc.src.math.fminbf16
libc.src.math.fminimumbf16
libc.src.math.fminimum_magbf16
libc.src.math.fminimum_mag_numbf16
libc.src.math.fminimum_numbf16
libc.src.math.roundbf16
libc.src.math.roundevenbf16
libc.src.math.truncbf16

View File

@ -319,7 +319,15 @@ list(APPEND TARGET_LIBM_ENTRYPOINTS
libc.src.math.fabsbf16
libc.src.math.floorbf16
libc.src.math.fmaxbf16
libc.src.math.fmaximumbf16
libc.src.math.fmaximum_magbf16
libc.src.math.fmaximum_mag_numbf16
libc.src.math.fmaximum_numbf16
libc.src.math.fminbf16
libc.src.math.fminimumbf16
libc.src.math.fminimum_magbf16
libc.src.math.fminimum_mag_numbf16
libc.src.math.fminimum_numbf16
libc.src.math.roundbf16
libc.src.math.roundevenbf16
libc.src.math.truncbf16

View File

@ -240,48 +240,56 @@ add_math_entrypoint_object(fmaximumf)
add_math_entrypoint_object(fmaximuml)
add_math_entrypoint_object(fmaximumf16)
add_math_entrypoint_object(fmaximumf128)
add_math_entrypoint_object(fmaximumbf16)
add_math_entrypoint_object(fmaximum_num)
add_math_entrypoint_object(fmaximum_numf)
add_math_entrypoint_object(fmaximum_numl)
add_math_entrypoint_object(fmaximum_numf16)
add_math_entrypoint_object(fmaximum_numf128)
add_math_entrypoint_object(fmaximum_numbf16)
add_math_entrypoint_object(fmaximum_mag)
add_math_entrypoint_object(fmaximum_magf)
add_math_entrypoint_object(fmaximum_magl)
add_math_entrypoint_object(fmaximum_magf16)
add_math_entrypoint_object(fmaximum_magf128)
add_math_entrypoint_object(fmaximum_magbf16)
add_math_entrypoint_object(fmaximum_mag_num)
add_math_entrypoint_object(fmaximum_mag_numf)
add_math_entrypoint_object(fmaximum_mag_numl)
add_math_entrypoint_object(fmaximum_mag_numf16)
add_math_entrypoint_object(fmaximum_mag_numf128)
add_math_entrypoint_object(fmaximum_mag_numbf16)
add_math_entrypoint_object(fminimum)
add_math_entrypoint_object(fminimumf)
add_math_entrypoint_object(fminimuml)
add_math_entrypoint_object(fminimumf16)
add_math_entrypoint_object(fminimumf128)
add_math_entrypoint_object(fminimumbf16)
add_math_entrypoint_object(fminimum_num)
add_math_entrypoint_object(fminimum_numf)
add_math_entrypoint_object(fminimum_numl)
add_math_entrypoint_object(fminimum_numf16)
add_math_entrypoint_object(fminimum_numf128)
add_math_entrypoint_object(fminimum_numbf16)
add_math_entrypoint_object(fminimum_mag)
add_math_entrypoint_object(fminimum_magf)
add_math_entrypoint_object(fminimum_magl)
add_math_entrypoint_object(fminimum_magf16)
add_math_entrypoint_object(fminimum_magf128)
add_math_entrypoint_object(fminimum_magbf16)
add_math_entrypoint_object(fminimum_mag_num)
add_math_entrypoint_object(fminimum_mag_numf)
add_math_entrypoint_object(fminimum_mag_numl)
add_math_entrypoint_object(fminimum_mag_numf16)
add_math_entrypoint_object(fminimum_mag_numf128)
add_math_entrypoint_object(fminimum_mag_numbf16)
add_math_entrypoint_object(fmul)
add_math_entrypoint_object(fmull)

View File

@ -0,0 +1,21 @@
//===-- Implementation header for fmaximum_mag_numbf16 ----------*- 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_FMAXIMUM_MAG_NUMBF16_H
#define LLVM_LIBC_SRC_MATH_FMAXIMUM_MAG_NUMBF16_H
#include "src/__support/macros/config.h"
#include "src/__support/macros/properties/types.h"
namespace LIBC_NAMESPACE_DECL {
bfloat16 fmaximum_mag_numbf16(bfloat16 x, bfloat16 y);
} // namespace LIBC_NAMESPACE_DECL
#endif // LLVM_LIBC_SRC_MATH_FMAXIMUM_MAG_NUMBF16_H

View File

@ -0,0 +1,21 @@
//===-- Implementation header for fmaximum_magbf16 --------------*- 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_FMAXIMUM_MAGBF16_H
#define LLVM_LIBC_SRC_MATH_FMAXIMUM_MAGBF16_H
#include "src/__support/macros/config.h"
#include "src/__support/macros/properties/types.h"
namespace LIBC_NAMESPACE_DECL {
bfloat16 fmaximum_magbf16(bfloat16 x, bfloat16 y);
} // namespace LIBC_NAMESPACE_DECL
#endif // LLVM_LIBC_SRC_MATH_FMAXIMUM_MAGBF16_H

View File

@ -0,0 +1,21 @@
//===-- Implementation header for fmaximum_numbf16 --------------*- 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_FMAXIMUM_NUMBF16_H
#define LLVM_LIBC_SRC_MATH_FMAXIMUM_NUMBF16_H
#include "src/__support/macros/config.h"
#include "src/__support/macros/properties/types.h"
namespace LIBC_NAMESPACE_DECL {
bfloat16 fmaximum_numbf16(bfloat16 x, bfloat16 y);
} // namespace LIBC_NAMESPACE_DECL
#endif // LLVM_LIBC_SRC_MATH_FMAXIMUM_NUMBF16_H

View File

@ -0,0 +1,21 @@
//===-- Implementation header for fmaximumbf16 ------------------*- 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_FMAXIMUMBF16_H
#define LLVM_LIBC_SRC_MATH_FMAXIMUMBF16_H
#include "src/__support/macros/config.h"
#include "src/__support/macros/properties/types.h"
namespace LIBC_NAMESPACE_DECL {
bfloat16 fmaximumbf16(bfloat16 x, bfloat16 y);
} // namespace LIBC_NAMESPACE_DECL
#endif // LLVM_LIBC_SRC_MATH_FMAXIMUMBF16_H

View File

@ -0,0 +1,21 @@
//===-- Implementation header for fminimum_mag_numbf16 ----------*- 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_FMINIMUM_MAG_NUMBF16_H
#define LLVM_LIBC_SRC_MATH_FMINIMUM_MAG_NUMBF16_H
#include "src/__support/macros/config.h"
#include "src/__support/macros/properties/types.h"
namespace LIBC_NAMESPACE_DECL {
bfloat16 fminimum_mag_numbf16(bfloat16 x, bfloat16 y);
} // namespace LIBC_NAMESPACE_DECL
#endif // LLVM_LIBC_SRC_MATH_FMINIMUM_MAG_NUMBF16_H

View File

@ -0,0 +1,21 @@
//===-- Implementation header for fminimum_magbf16 --------------*- 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_FMINIMUM_MAGBF16_H
#define LLVM_LIBC_SRC_MATH_FMINIMUM_MAGBF16_H
#include "src/__support/macros/config.h"
#include "src/__support/macros/properties/types.h"
namespace LIBC_NAMESPACE_DECL {
bfloat16 fminimum_magbf16(bfloat16 x, bfloat16 y);
} // namespace LIBC_NAMESPACE_DECL
#endif // LLVM_LIBC_SRC_MATH_FMINIMUM_MAGBF16_H

View File

@ -0,0 +1,21 @@
//===-- Implementation header for fminimum_numbf16 --------------*- 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_FMINIMUM_NUMBF16_H
#define LLVM_LIBC_SRC_MATH_FMINIMUM_NUMBF16_H
#include "src/__support/macros/config.h"
#include "src/__support/macros/properties/types.h"
namespace LIBC_NAMESPACE_DECL {
bfloat16 fminimum_numbf16(bfloat16 x, bfloat16 y);
} // namespace LIBC_NAMESPACE_DECL
#endif // LLVM_LIBC_SRC_MATH_FMINIMUM_NUMBF16_H

View File

@ -0,0 +1,21 @@
//===-- Implementation header for fminimumbf16 ------------------*- 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_FMINIMUMBF16_H
#define LLVM_LIBC_SRC_MATH_FMINIMUMBF16_H
#include "src/__support/macros/config.h"
#include "src/__support/macros/properties/types.h"
namespace LIBC_NAMESPACE_DECL {
bfloat16 fminimumbf16(bfloat16 x, bfloat16 y);
} // namespace LIBC_NAMESPACE_DECL
#endif // LLVM_LIBC_SRC_MATH_FMINIMUMBF16_H

View File

@ -2439,6 +2439,21 @@ add_entrypoint_object(
libc.src.__support.FPUtil.basic_operations
)
add_entrypoint_object(
fmaximumbf16
SRCS
fmaximumbf16.cpp
HDRS
../fmaximumbf16.h
DEPENDS
libc.src.__support.FPUtil.basic_operations
libc.src.__support.FPUtil.bfloat16
libc.src.__support.macros.config
libc.src.__support.macros.properties.types
FLAGS
MISC_MATH_BASIC_OPS_OPT
)
add_entrypoint_object(
fmaximum_num
SRCS
@ -2497,6 +2512,21 @@ add_entrypoint_object(
libc.src.__support.FPUtil.basic_operations
)
add_entrypoint_object(
fmaximum_numbf16
SRCS
fmaximum_numbf16.cpp
HDRS
../fmaximum_numbf16.h
DEPENDS
libc.src.__support.FPUtil.basic_operations
libc.src.__support.FPUtil.bfloat16
libc.src.__support.macros.config
libc.src.__support.macros.properties.types
FLAGS
MISC_MATH_BASIC_OPS_OPT
)
add_entrypoint_object(
fmaximum_mag
SRCS
@ -2555,6 +2585,21 @@ add_entrypoint_object(
libc.src.__support.FPUtil.basic_operations
)
add_entrypoint_object(
fmaximum_magbf16
SRCS
fmaximum_magbf16.cpp
HDRS
../fmaximum_magbf16.h
DEPENDS
libc.src.__support.FPUtil.basic_operations
libc.src.__support.FPUtil.bfloat16
libc.src.__support.macros.config
libc.src.__support.macros.properties.types
FLAGS
MISC_MATH_BASIC_OPS_OPT
)
add_entrypoint_object(
fmaximum_mag_num
SRCS
@ -2613,6 +2658,21 @@ add_entrypoint_object(
libc.src.__support.FPUtil.basic_operations
)
add_entrypoint_object(
fmaximum_mag_numbf16
SRCS
fmaximum_mag_numbf16.cpp
HDRS
../fmaximum_mag_numbf16.h
DEPENDS
libc.src.__support.FPUtil.basic_operations
libc.src.__support.FPUtil.bfloat16
libc.src.__support.macros.config
libc.src.__support.macros.properties.types
FLAGS
MISC_MATH_BASIC_OPS_OPT
)
add_entrypoint_object(
fminimum
SRCS
@ -2671,6 +2731,21 @@ add_entrypoint_object(
libc.src.__support.FPUtil.basic_operations
)
add_entrypoint_object(
fminimumbf16
SRCS
fminimumbf16.cpp
HDRS
../fminimumbf16.h
DEPENDS
libc.src.__support.FPUtil.basic_operations
libc.src.__support.FPUtil.bfloat16
libc.src.__support.macros.config
libc.src.__support.macros.properties.types
FLAGS
MISC_MATH_BASIC_OPS_OPT
)
add_entrypoint_object(
fminimum_num
SRCS
@ -2729,6 +2804,21 @@ add_entrypoint_object(
libc.src.__support.FPUtil.basic_operations
)
add_entrypoint_object(
fminimum_numbf16
SRCS
fminimum_numbf16.cpp
HDRS
../fminimum_numbf16.h
DEPENDS
libc.src.__support.FPUtil.basic_operations
libc.src.__support.FPUtil.bfloat16
libc.src.__support.macros.config
libc.src.__support.macros.properties.types
FLAGS
MISC_MATH_BASIC_OPS_OPT
)
add_entrypoint_object(
fminimum_mag
SRCS
@ -2787,6 +2877,21 @@ add_entrypoint_object(
libc.src.__support.FPUtil.basic_operations
)
add_entrypoint_object(
fminimum_magbf16
SRCS
fminimum_magbf16.cpp
HDRS
../fminimum_magbf16.h
DEPENDS
libc.src.__support.FPUtil.basic_operations
libc.src.__support.FPUtil.bfloat16
libc.src.__support.macros.config
libc.src.__support.macros.properties.types
FLAGS
MISC_MATH_BASIC_OPS_OPT
)
add_entrypoint_object(
fminimum_mag_num
SRCS
@ -2845,6 +2950,21 @@ add_entrypoint_object(
libc.src.__support.FPUtil.basic_operations
)
add_entrypoint_object(
fminimum_mag_numbf16
SRCS
fminimum_mag_numbf16.cpp
HDRS
../fminimum_mag_numbf16.h
DEPENDS
libc.src.__support.FPUtil.basic_operations
libc.src.__support.FPUtil.bfloat16
libc.src.__support.macros.config
libc.src.__support.macros.properties.types
FLAGS
MISC_MATH_BASIC_OPS_OPT
)
add_entrypoint_object(
fmul
SRCS

View File

@ -0,0 +1,21 @@
//===-- Implementation of fmaximum_mag_numbf16 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/fmaximum_mag_numbf16.h"
#include "src/__support/FPUtil/BasicOperations.h"
#include "src/__support/FPUtil/bfloat16.h"
#include "src/__support/common.h"
#include "src/__support/macros/config.h"
namespace LIBC_NAMESPACE_DECL {
LLVM_LIBC_FUNCTION(bfloat16, fmaximum_mag_numbf16, (bfloat16 x, bfloat16 y)) {
return fputil::fmaximum_mag_num(x, y);
}
} // namespace LIBC_NAMESPACE_DECL

View File

@ -0,0 +1,21 @@
//===-- Implementation of fmaximum_magbf16 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/fmaximum_magbf16.h"
#include "src/__support/FPUtil/BasicOperations.h"
#include "src/__support/FPUtil/bfloat16.h"
#include "src/__support/common.h"
#include "src/__support/macros/config.h"
namespace LIBC_NAMESPACE_DECL {
LLVM_LIBC_FUNCTION(bfloat16, fmaximum_magbf16, (bfloat16 x, bfloat16 y)) {
return fputil::fmaximum_mag(x, y);
}
} // namespace LIBC_NAMESPACE_DECL

View File

@ -0,0 +1,21 @@
//===-- Implementation of fmaximum_numbf16 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/fmaximum_numbf16.h"
#include "src/__support/FPUtil/BasicOperations.h"
#include "src/__support/FPUtil/bfloat16.h"
#include "src/__support/common.h"
#include "src/__support/macros/config.h"
namespace LIBC_NAMESPACE_DECL {
LLVM_LIBC_FUNCTION(bfloat16, fmaximum_numbf16, (bfloat16 x, bfloat16 y)) {
return fputil::fmaximum_num(x, y);
}
} // namespace LIBC_NAMESPACE_DECL

View File

@ -0,0 +1,21 @@
//===-- Implementation of fmaximumbf16 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/fmaximumbf16.h"
#include "src/__support/FPUtil/BasicOperations.h"
#include "src/__support/FPUtil/bfloat16.h"
#include "src/__support/common.h"
#include "src/__support/macros/config.h"
namespace LIBC_NAMESPACE_DECL {
LLVM_LIBC_FUNCTION(bfloat16, fmaximumbf16, (bfloat16 x, bfloat16 y)) {
return fputil::fmaximum(x, y);
}
} // namespace LIBC_NAMESPACE_DECL

View File

@ -0,0 +1,21 @@
//===-- Implementation of fminimum_mag_numbf16 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/fminimum_mag_numbf16.h"
#include "src/__support/FPUtil/BasicOperations.h"
#include "src/__support/FPUtil/bfloat16.h"
#include "src/__support/common.h"
#include "src/__support/macros/config.h"
namespace LIBC_NAMESPACE_DECL {
LLVM_LIBC_FUNCTION(bfloat16, fminimum_mag_numbf16, (bfloat16 x, bfloat16 y)) {
return fputil::fminimum_mag_num(x, y);
}
} // namespace LIBC_NAMESPACE_DECL

View File

@ -0,0 +1,21 @@
//===-- Implementation of fminimum_magbf16 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/fminimum_magbf16.h"
#include "src/__support/FPUtil/BasicOperations.h"
#include "src/__support/FPUtil/bfloat16.h"
#include "src/__support/common.h"
#include "src/__support/macros/config.h"
namespace LIBC_NAMESPACE_DECL {
LLVM_LIBC_FUNCTION(bfloat16, fminimum_magbf16, (bfloat16 x, bfloat16 y)) {
return fputil::fminimum_mag(x, y);
}
} // namespace LIBC_NAMESPACE_DECL

View File

@ -0,0 +1,21 @@
//===-- Implementation of fminimum_numbf16 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/fminimum_numbf16.h"
#include "src/__support/FPUtil/BasicOperations.h"
#include "src/__support/FPUtil/bfloat16.h"
#include "src/__support/common.h"
#include "src/__support/macros/config.h"
namespace LIBC_NAMESPACE_DECL {
LLVM_LIBC_FUNCTION(bfloat16, fminimum_numbf16, (bfloat16 x, bfloat16 y)) {
return fputil::fminimum_num(x, y);
}
} // namespace LIBC_NAMESPACE_DECL

View File

@ -0,0 +1,21 @@
//===-- Implementation of fminimumbf16 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/fminimumbf16.h"
#include "src/__support/FPUtil/BasicOperations.h"
#include "src/__support/FPUtil/bfloat16.h"
#include "src/__support/common.h"
#include "src/__support/macros/config.h"
namespace LIBC_NAMESPACE_DECL {
LLVM_LIBC_FUNCTION(bfloat16, fminimumbf16, (bfloat16 x, bfloat16 y)) {
return fputil::fminimum(x, y);
}
} // namespace LIBC_NAMESPACE_DECL

View File

@ -2530,6 +2530,21 @@ add_fp_unittest(
libc.src.__support.FPUtil.fp_bits
)
add_fp_unittest(
fmaximumbf16_test
SUITE
libc-math-smoke-tests
SRCS
fmaximumbf16_test.cpp
HDRS
FMaximumTest.h
DEPENDS
libc.src.math.fmaximumbf16
libc.src.__support.CPP.algorithm
libc.src.__support.FPUtil.bfloat16
libc.src.__support.FPUtil.fp_bits
)
add_fp_unittest(
fmaximum_num_test
SUITE
@ -2586,6 +2601,21 @@ add_fp_unittest(
libc.src.__support.FPUtil.fp_bits
)
add_fp_unittest(
fmaximum_numbf16_test
SUITE
libc-math-smoke-tests
SRCS
fmaximum_numbf16_test.cpp
HDRS
FMaximumTest.h
DEPENDS
libc.src.math.fmaximum_numbf16
libc.src.__support.CPP.algorithm
libc.src.__support.FPUtil.bfloat16
libc.src.__support.FPUtil.fp_bits
)
add_fp_unittest(
fmaximum_magf_test
SUITE
@ -2661,6 +2691,21 @@ add_fp_unittest(
libc.src.__support.FPUtil.fp_bits
)
add_fp_unittest(
fmaximum_magbf16_test
SUITE
libc-math-smoke-tests
SRCS
fmaximum_magbf16_test.cpp
HDRS
FMaximumTest.h
DEPENDS
libc.src.math.fmaximum_magbf16
libc.src.__support.CPP.algorithm
libc.src.__support.FPUtil.bfloat16
libc.src.__support.FPUtil.fp_bits
)
add_fp_unittest(
fmaximum_mag_numf_test
SUITE
@ -2731,6 +2776,21 @@ add_fp_unittest(
libc.src.__support.FPUtil.fp_bits
)
add_fp_unittest(
fmaximum_mag_numbf16_test
SUITE
libc-math-smoke-tests
SRCS
fmaximum_mag_numbf16_test.cpp
HDRS
FMaximumTest.h
DEPENDS
libc.src.math.fmaximum_mag_numbf16
libc.src.__support.CPP.algorithm
libc.src.__support.FPUtil.bfloat16
libc.src.__support.FPUtil.fp_bits
)
add_fp_unittest(
fminimuml_test
SUITE
@ -2801,6 +2861,21 @@ add_fp_unittest(
libc.src.__support.FPUtil.fp_bits
)
add_fp_unittest(
fminimumbf16_test
SUITE
libc-math-smoke-tests
SRCS
fminimumbf16_test.cpp
HDRS
FMaximumTest.h
DEPENDS
libc.src.math.fminimumbf16
libc.src.__support.CPP.algorithm
libc.src.__support.FPUtil.bfloat16
libc.src.__support.FPUtil.fp_bits
)
add_fp_unittest(
fminimum_numf_test
SUITE
@ -2871,6 +2946,21 @@ add_fp_unittest(
libc.src.__support.FPUtil.fp_bits
)
add_fp_unittest(
fminimum_numbf16_test
SUITE
libc-math-smoke-tests
SRCS
fminimum_numf16_test.cpp
HDRS
FMaximumTest.h
DEPENDS
libc.src.math.fminimum_numf16
libc.src.__support.CPP.algorithm
libc.src.__support.FPUtil.bfloat16
libc.src.__support.FPUtil.fp_bits
)
add_fp_unittest(
fminimum_magf_test
SUITE
@ -2941,6 +3031,21 @@ add_fp_unittest(
libc.src.__support.FPUtil.fp_bits
)
add_fp_unittest(
fminimum_magbf16_test
SUITE
libc-math-smoke-tests
SRCS
fminimum_magbf16_test.cpp
HDRS
FMaximumTest.h
DEPENDS
libc.src.math.fminimum_magbf16
libc.src.__support.CPP.algorithm
libc.src.__support.FPUtil.bfloat16
libc.src.__support.FPUtil.fp_bits
)
add_fp_unittest(
fminimum_mag_numf_test
SUITE
@ -3011,6 +3116,21 @@ add_fp_unittest(
libc.src.__support.FPUtil.fp_bits
)
add_fp_unittest(
fminimum_mag_numbf16_test
SUITE
libc-math-smoke-tests
SRCS
fminimum_mag_numbf16_test.cpp
HDRS
FMaximumTest.h
DEPENDS
libc.src.math.fminimum_mag_numbf16
libc.src.__support.CPP.algorithm
libc.src.__support.FPUtil.bfloat16
libc.src.__support.FPUtil.fp_bits
)
add_fp_unittest(
fmul_test
SUITE

View File

@ -0,0 +1,14 @@
//===-- Unittests for fmaximum_mag_numbf16 --------------------------------===//
//
// 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 "FMaximumMagNumTest.h"
#include "src/__support/FPUtil/bfloat16.h"
#include "src/math/fmaximum_mag_numbf16.h"
LIST_FMAXIMUM_MAG_NUM_TESTS(bfloat16, LIBC_NAMESPACE::fmaximum_mag_numbf16)

View File

@ -0,0 +1,14 @@
//===-- Unittests for fmaximum_magbf16 ------------------------------------===//
//
// 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 "FMaximumMagTest.h"
#include "src/__support/FPUtil/bfloat16.h"
#include "src/math/fmaximum_magbf16.h"
LIST_FMAXIMUM_MAG_TESTS(bfloat16, LIBC_NAMESPACE::fmaximum_magbf16)

View File

@ -0,0 +1,14 @@
//===-- Unittests for fmaximum_numbf16 ------------------------------------===//
//
// 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 "FMaximumNumTest.h"
#include "src/__support/FPUtil/bfloat16.h"
#include "src/math/fmaximum_numbf16.h"
LIST_FMAXIMUM_NUM_TESTS(bfloat16, LIBC_NAMESPACE::fmaximum_numbf16)

View File

@ -0,0 +1,14 @@
//===-- Unittests for fmaximumbf16 ----------------------------------------===//
//
// 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 "FMaximumTest.h"
#include "src/__support/FPUtil/bfloat16.h"
#include "src/math/fmaximumbf16.h"
LIST_FMAXIMUM_TESTS(bfloat16, LIBC_NAMESPACE::fmaximumbf16)

View File

@ -0,0 +1,14 @@
//===-- Unittests for fminimum_mag_numbf16 --------------------------------===//
//
// 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 "FMinimumMagNumTest.h"
#include "src/__support/FPUtil/bfloat16.h"
#include "src/math/fminimum_mag_numbf16.h"
LIST_FMINIMUM_MAG_NUM_TESTS(bfloat16, LIBC_NAMESPACE::fminimum_mag_numbf16)

View File

@ -0,0 +1,14 @@
//===-- Unittests for fminimum_magbf16 ------------------------------------===//
//
// 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 "FMinimumMagTest.h"
#include "src/__support/FPUtil/bfloat16.h"
#include "src/math/fminimum_magbf16.h"
LIST_FMINIMUM_MAG_TESTS(bfloat16, LIBC_NAMESPACE::fminimum_magbf16)

View File

@ -0,0 +1,14 @@
//===-- Unittests for fminimum_numbf16 ------------------------------------===//
//
// 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 "FMinimumNumTest.h"
#include "src/__support/FPUtil/bfloat16.h"
#include "src/math/fminimum_numbf16.h"
LIST_FMINIMUM_NUM_TESTS(bfloat16, LIBC_NAMESPACE::fminimum_numbf16)

View File

@ -0,0 +1,14 @@
//===-- Unittests for fminimumbf16 ----------------------------------------===//
//
// 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 "FMinimumTest.h"
#include "src/__support/FPUtil/bfloat16.h"
#include "src/math/fminimumbf16.h"
LIST_FMINIMUM_TESTS(bfloat16, LIBC_NAMESPACE::fminimumbf16)