From bab84e268d5e155e74db8fe3e678d1cb4d00d9f1 Mon Sep 17 00:00:00 2001 From: Krishna Pandey Date: Sat, 9 Aug 2025 19:07:25 +0530 Subject: [PATCH 01/10] feat: implement f{maximum,minimum}bf16 functions Signed-off-by: Krishna Pandey --- libc/src/math/fmaximumbf16.h | 21 +++++++++++++++++++++ libc/src/math/fminimumbf16.h | 21 +++++++++++++++++++++ libc/src/math/generic/fmaximumbf16.cpp | 21 +++++++++++++++++++++ libc/src/math/generic/fminimumbf16.cpp | 20 ++++++++++++++++++++ 4 files changed, 83 insertions(+) create mode 100644 libc/src/math/fmaximumbf16.h create mode 100644 libc/src/math/fminimumbf16.h create mode 100644 libc/src/math/generic/fmaximumbf16.cpp create mode 100644 libc/src/math/generic/fminimumbf16.cpp diff --git a/libc/src/math/fmaximumbf16.h b/libc/src/math/fmaximumbf16.h new file mode 100644 index 0000000000000..9842e99d43a20 --- /dev/null +++ b/libc/src/math/fmaximumbf16.h @@ -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 diff --git a/libc/src/math/fminimumbf16.h b/libc/src/math/fminimumbf16.h new file mode 100644 index 0000000000000..07f1adaa4f075 --- /dev/null +++ b/libc/src/math/fminimumbf16.h @@ -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 diff --git a/libc/src/math/generic/fmaximumbf16.cpp b/libc/src/math/generic/fmaximumbf16.cpp new file mode 100644 index 0000000000000..e10830b4693d5 --- /dev/null +++ b/libc/src/math/generic/fmaximumbf16.cpp @@ -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 diff --git a/libc/src/math/generic/fminimumbf16.cpp b/libc/src/math/generic/fminimumbf16.cpp new file mode 100644 index 0000000000000..4f8f27a86199d --- /dev/null +++ b/libc/src/math/generic/fminimumbf16.cpp @@ -0,0 +1,20 @@ +//===-- 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/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 From 69bff8aaac6b8cad340efa26f5a63905d4b10b8a Mon Sep 17 00:00:00 2001 From: Krishna Pandey Date: Sat, 9 Aug 2025 19:10:24 +0530 Subject: [PATCH 02/10] feat: implement f{maximum,minimum}_magbf16 functions Signed-off-by: Krishna Pandey --- libc/src/math/fmaximum_magbf16.h | 21 +++++++++++++++++++++ libc/src/math/fminimum_magbf16.h | 21 +++++++++++++++++++++ libc/src/math/generic/fmaximum_magbf16.cpp | 20 ++++++++++++++++++++ libc/src/math/generic/fminimum_magbf16.cpp | 20 ++++++++++++++++++++ 4 files changed, 82 insertions(+) create mode 100644 libc/src/math/fmaximum_magbf16.h create mode 100644 libc/src/math/fminimum_magbf16.h create mode 100644 libc/src/math/generic/fmaximum_magbf16.cpp create mode 100644 libc/src/math/generic/fminimum_magbf16.cpp diff --git a/libc/src/math/fmaximum_magbf16.h b/libc/src/math/fmaximum_magbf16.h new file mode 100644 index 0000000000000..ff0ff1a33ff49 --- /dev/null +++ b/libc/src/math/fmaximum_magbf16.h @@ -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 diff --git a/libc/src/math/fminimum_magbf16.h b/libc/src/math/fminimum_magbf16.h new file mode 100644 index 0000000000000..fee5c4c8b1a1c --- /dev/null +++ b/libc/src/math/fminimum_magbf16.h @@ -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 diff --git a/libc/src/math/generic/fmaximum_magbf16.cpp b/libc/src/math/generic/fmaximum_magbf16.cpp new file mode 100644 index 0000000000000..c4734076fe922 --- /dev/null +++ b/libc/src/math/generic/fmaximum_magbf16.cpp @@ -0,0 +1,20 @@ +//===-- 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/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 diff --git a/libc/src/math/generic/fminimum_magbf16.cpp b/libc/src/math/generic/fminimum_magbf16.cpp new file mode 100644 index 0000000000000..3531191e16165 --- /dev/null +++ b/libc/src/math/generic/fminimum_magbf16.cpp @@ -0,0 +1,20 @@ +//===-- 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/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 From f724721d402311d4ecf9242375236480208f64fc Mon Sep 17 00:00:00 2001 From: Krishna Pandey Date: Sat, 9 Aug 2025 19:10:47 +0530 Subject: [PATCH 03/10] feat: implement f{maximum,minimum}_mag_numbf16 functions Signed-off-by: Krishna Pandey --- libc/src/math/fmaximum_mag_numbf16.h | 21 +++++++++++++++++++ libc/src/math/fminimum_mag_numbf16.h | 21 +++++++++++++++++++ .../src/math/generic/fmaximum_mag_numbf16.cpp | 20 ++++++++++++++++++ .../src/math/generic/fminimum_mag_numbf16.cpp | 20 ++++++++++++++++++ 4 files changed, 82 insertions(+) create mode 100644 libc/src/math/fmaximum_mag_numbf16.h create mode 100644 libc/src/math/fminimum_mag_numbf16.h create mode 100644 libc/src/math/generic/fmaximum_mag_numbf16.cpp create mode 100644 libc/src/math/generic/fminimum_mag_numbf16.cpp diff --git a/libc/src/math/fmaximum_mag_numbf16.h b/libc/src/math/fmaximum_mag_numbf16.h new file mode 100644 index 0000000000000..766352595e4f2 --- /dev/null +++ b/libc/src/math/fmaximum_mag_numbf16.h @@ -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 diff --git a/libc/src/math/fminimum_mag_numbf16.h b/libc/src/math/fminimum_mag_numbf16.h new file mode 100644 index 0000000000000..2773381efbcef --- /dev/null +++ b/libc/src/math/fminimum_mag_numbf16.h @@ -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 diff --git a/libc/src/math/generic/fmaximum_mag_numbf16.cpp b/libc/src/math/generic/fmaximum_mag_numbf16.cpp new file mode 100644 index 0000000000000..c2cd6cf10e8f3 --- /dev/null +++ b/libc/src/math/generic/fmaximum_mag_numbf16.cpp @@ -0,0 +1,20 @@ +//===-- 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/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 diff --git a/libc/src/math/generic/fminimum_mag_numbf16.cpp b/libc/src/math/generic/fminimum_mag_numbf16.cpp new file mode 100644 index 0000000000000..05eb5a5dd6f4c --- /dev/null +++ b/libc/src/math/generic/fminimum_mag_numbf16.cpp @@ -0,0 +1,20 @@ +//===-- 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/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 From 4b8fde8680ca3cb03d3b012567c2546a21343d01 Mon Sep 17 00:00:00 2001 From: Krishna Pandey Date: Sat, 9 Aug 2025 19:11:01 +0530 Subject: [PATCH 04/10] feat: implement f{maximum,minimum}_numbf16 functions Signed-off-by: Krishna Pandey --- libc/src/math/fmaximum_numbf16.h | 21 +++++++++++++++++++++ libc/src/math/fminimum_numbf16.h | 21 +++++++++++++++++++++ libc/src/math/generic/fmaximum_numbf16.cpp | 20 ++++++++++++++++++++ libc/src/math/generic/fminimum_numbf16.cpp | 20 ++++++++++++++++++++ 4 files changed, 82 insertions(+) create mode 100644 libc/src/math/fmaximum_numbf16.h create mode 100644 libc/src/math/fminimum_numbf16.h create mode 100644 libc/src/math/generic/fmaximum_numbf16.cpp create mode 100644 libc/src/math/generic/fminimum_numbf16.cpp diff --git a/libc/src/math/fmaximum_numbf16.h b/libc/src/math/fmaximum_numbf16.h new file mode 100644 index 0000000000000..f23bc525298a1 --- /dev/null +++ b/libc/src/math/fmaximum_numbf16.h @@ -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 diff --git a/libc/src/math/fminimum_numbf16.h b/libc/src/math/fminimum_numbf16.h new file mode 100644 index 0000000000000..a3fd47403c415 --- /dev/null +++ b/libc/src/math/fminimum_numbf16.h @@ -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 diff --git a/libc/src/math/generic/fmaximum_numbf16.cpp b/libc/src/math/generic/fmaximum_numbf16.cpp new file mode 100644 index 0000000000000..2c9a009f8ae47 --- /dev/null +++ b/libc/src/math/generic/fmaximum_numbf16.cpp @@ -0,0 +1,20 @@ +//===-- 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/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 diff --git a/libc/src/math/generic/fminimum_numbf16.cpp b/libc/src/math/generic/fminimum_numbf16.cpp new file mode 100644 index 0000000000000..a69864b401dda --- /dev/null +++ b/libc/src/math/generic/fminimum_numbf16.cpp @@ -0,0 +1,20 @@ +//===-- 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/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 From baee3dc3f99efe702f200230102cd0504fc9eb79 Mon Sep 17 00:00:00 2001 From: Krishna Pandey Date: Sat, 9 Aug 2025 19:11:18 +0530 Subject: [PATCH 05/10] chore: update CMakeLists Signed-off-by: Krishna Pandey --- libc/src/math/CMakeLists.txt | 8 ++ libc/src/math/generic/CMakeLists.txt | 120 +++++++++++++++++++++++++++ 2 files changed, 128 insertions(+) diff --git a/libc/src/math/CMakeLists.txt b/libc/src/math/CMakeLists.txt index 6b684f43c143d..5e531d9a7fb89 100644 --- a/libc/src/math/CMakeLists.txt +++ b/libc/src/math/CMakeLists.txt @@ -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) diff --git a/libc/src/math/generic/CMakeLists.txt b/libc/src/math/generic/CMakeLists.txt index 72301a1b374b6..f17d57551fe26 100644 --- a/libc/src/math/generic/CMakeLists.txt +++ b/libc/src/math/generic/CMakeLists.txt @@ -2509,6 +2509,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 @@ -2567,6 +2582,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 @@ -2625,6 +2655,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 @@ -2683,6 +2728,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 @@ -2741,6 +2801,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 @@ -2799,6 +2874,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 @@ -2857,6 +2947,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 @@ -2915,6 +3020,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 From f56664bef2ed0c78d584928dbe2ab76b4317cd01 Mon Sep 17 00:00:00 2001 From: Krishna Pandey Date: Sun, 10 Aug 2025 02:45:55 +0530 Subject: [PATCH 06/10] fix: add bfloat16 in includes Signed-off-by: Krishna Pandey --- libc/src/math/generic/fmaximum_mag_numbf16.cpp | 1 + libc/src/math/generic/fmaximum_magbf16.cpp | 1 + libc/src/math/generic/fmaximum_numbf16.cpp | 1 + libc/src/math/generic/fminimum_mag_numbf16.cpp | 1 + libc/src/math/generic/fminimum_magbf16.cpp | 1 + libc/src/math/generic/fminimumbf16.cpp | 1 + 6 files changed, 6 insertions(+) diff --git a/libc/src/math/generic/fmaximum_mag_numbf16.cpp b/libc/src/math/generic/fmaximum_mag_numbf16.cpp index c2cd6cf10e8f3..485e32959b53a 100644 --- a/libc/src/math/generic/fmaximum_mag_numbf16.cpp +++ b/libc/src/math/generic/fmaximum_mag_numbf16.cpp @@ -8,6 +8,7 @@ #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" diff --git a/libc/src/math/generic/fmaximum_magbf16.cpp b/libc/src/math/generic/fmaximum_magbf16.cpp index c4734076fe922..0654ed904e549 100644 --- a/libc/src/math/generic/fmaximum_magbf16.cpp +++ b/libc/src/math/generic/fmaximum_magbf16.cpp @@ -8,6 +8,7 @@ #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" diff --git a/libc/src/math/generic/fmaximum_numbf16.cpp b/libc/src/math/generic/fmaximum_numbf16.cpp index 2c9a009f8ae47..b058d50a7fd6b 100644 --- a/libc/src/math/generic/fmaximum_numbf16.cpp +++ b/libc/src/math/generic/fmaximum_numbf16.cpp @@ -8,6 +8,7 @@ #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" diff --git a/libc/src/math/generic/fminimum_mag_numbf16.cpp b/libc/src/math/generic/fminimum_mag_numbf16.cpp index 05eb5a5dd6f4c..5056fc7e0cad2 100644 --- a/libc/src/math/generic/fminimum_mag_numbf16.cpp +++ b/libc/src/math/generic/fminimum_mag_numbf16.cpp @@ -8,6 +8,7 @@ #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" diff --git a/libc/src/math/generic/fminimum_magbf16.cpp b/libc/src/math/generic/fminimum_magbf16.cpp index 3531191e16165..f61d2d27b4a60 100644 --- a/libc/src/math/generic/fminimum_magbf16.cpp +++ b/libc/src/math/generic/fminimum_magbf16.cpp @@ -8,6 +8,7 @@ #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" diff --git a/libc/src/math/generic/fminimumbf16.cpp b/libc/src/math/generic/fminimumbf16.cpp index 4f8f27a86199d..da976b96b987c 100644 --- a/libc/src/math/generic/fminimumbf16.cpp +++ b/libc/src/math/generic/fminimumbf16.cpp @@ -8,6 +8,7 @@ #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" From ba6cbf32d89c6197858c93d569ab09a7586464d2 Mon Sep 17 00:00:00 2001 From: Krishna Pandey Date: Sun, 10 Aug 2025 02:46:37 +0530 Subject: [PATCH 07/10] fix: add smoke tests for fmininum*bf16 and fmaximum*bf16 Signed-off-by: Krishna Pandey --- libc/test/src/math/smoke/CMakeLists.txt | 120 ++++++++++++++++++ .../math/smoke/fmaximum_mag_numbf16_test.cpp | 14 ++ .../src/math/smoke/fmaximum_magbf16_test.cpp | 14 ++ .../src/math/smoke/fmaximum_numbf16_test.cpp | 14 ++ .../test/src/math/smoke/fmaximumbf16_test.cpp | 14 ++ .../math/smoke/fminimum_mag_numbf16_test.cpp | 14 ++ .../src/math/smoke/fminimum_magbf16_test.cpp | 14 ++ .../src/math/smoke/fminimum_numbf16_test.cpp | 14 ++ .../test/src/math/smoke/fminimumbf16_test.cpp | 14 ++ 9 files changed, 232 insertions(+) create mode 100644 libc/test/src/math/smoke/fmaximum_mag_numbf16_test.cpp create mode 100644 libc/test/src/math/smoke/fmaximum_magbf16_test.cpp create mode 100644 libc/test/src/math/smoke/fmaximum_numbf16_test.cpp create mode 100644 libc/test/src/math/smoke/fmaximumbf16_test.cpp create mode 100644 libc/test/src/math/smoke/fminimum_mag_numbf16_test.cpp create mode 100644 libc/test/src/math/smoke/fminimum_magbf16_test.cpp create mode 100644 libc/test/src/math/smoke/fminimum_numbf16_test.cpp create mode 100644 libc/test/src/math/smoke/fminimumbf16_test.cpp diff --git a/libc/test/src/math/smoke/CMakeLists.txt b/libc/test/src/math/smoke/CMakeLists.txt index f060ef3abe0a4..574131739646a 100644 --- a/libc/test/src/math/smoke/CMakeLists.txt +++ b/libc/test/src/math/smoke/CMakeLists.txt @@ -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 diff --git a/libc/test/src/math/smoke/fmaximum_mag_numbf16_test.cpp b/libc/test/src/math/smoke/fmaximum_mag_numbf16_test.cpp new file mode 100644 index 0000000000000..dd9fe1c747680 --- /dev/null +++ b/libc/test/src/math/smoke/fmaximum_mag_numbf16_test.cpp @@ -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/math/fmaximum_mag_numbf16.h" +#include "src/__support/FPUtil/bfloat16.h" + +LIST_FMAXIMUM_MAG_NUM_TESTS(bfloat16, LIBC_NAMESPACE::fmaximum_mag_numbf16) diff --git a/libc/test/src/math/smoke/fmaximum_magbf16_test.cpp b/libc/test/src/math/smoke/fmaximum_magbf16_test.cpp new file mode 100644 index 0000000000000..bce0c4f45c644 --- /dev/null +++ b/libc/test/src/math/smoke/fmaximum_magbf16_test.cpp @@ -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/math/fmaximum_magbf16.h" +#include "src/__support/FPUtil/bfloat16.h" + +LIST_FMAXIMUM_MAG_TESTS(bfloat16, LIBC_NAMESPACE::fmaximum_magbf16) diff --git a/libc/test/src/math/smoke/fmaximum_numbf16_test.cpp b/libc/test/src/math/smoke/fmaximum_numbf16_test.cpp new file mode 100644 index 0000000000000..9845e0f028607 --- /dev/null +++ b/libc/test/src/math/smoke/fmaximum_numbf16_test.cpp @@ -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/math/fmaximum_numbf16.h" +#include "src/__support/FPUtil/bfloat16.h" + +LIST_FMAXIMUM_NUM_TESTS(bfloat16, LIBC_NAMESPACE::fmaximum_numbf16) diff --git a/libc/test/src/math/smoke/fmaximumbf16_test.cpp b/libc/test/src/math/smoke/fmaximumbf16_test.cpp new file mode 100644 index 0000000000000..e2cf56bcea64a --- /dev/null +++ b/libc/test/src/math/smoke/fmaximumbf16_test.cpp @@ -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) diff --git a/libc/test/src/math/smoke/fminimum_mag_numbf16_test.cpp b/libc/test/src/math/smoke/fminimum_mag_numbf16_test.cpp new file mode 100644 index 0000000000000..feac14adeaec4 --- /dev/null +++ b/libc/test/src/math/smoke/fminimum_mag_numbf16_test.cpp @@ -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/math/fminimum_mag_numbf16.h" +#include "src/__support/FPUtil/bfloat16.h" + +LIST_FMINIMUM_MAG_NUM_TESTS(bfloat16, LIBC_NAMESPACE::fminimum_mag_numbf16) diff --git a/libc/test/src/math/smoke/fminimum_magbf16_test.cpp b/libc/test/src/math/smoke/fminimum_magbf16_test.cpp new file mode 100644 index 0000000000000..a1566a9389757 --- /dev/null +++ b/libc/test/src/math/smoke/fminimum_magbf16_test.cpp @@ -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/math/fminimum_magbf16.h" +#include "src/__support/FPUtil/bfloat16.h" + +LIST_FMINIMUM_MAG_TESTS(bfloat16, LIBC_NAMESPACE::fminimum_magbf16) diff --git a/libc/test/src/math/smoke/fminimum_numbf16_test.cpp b/libc/test/src/math/smoke/fminimum_numbf16_test.cpp new file mode 100644 index 0000000000000..b28b6621fc944 --- /dev/null +++ b/libc/test/src/math/smoke/fminimum_numbf16_test.cpp @@ -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/math/fminimum_numbf16.h" +#include "src/__support/FPUtil/bfloat16.h" + +LIST_FMINIMUM_NUM_TESTS(bfloat16, LIBC_NAMESPACE::fminimum_numbf16) diff --git a/libc/test/src/math/smoke/fminimumbf16_test.cpp b/libc/test/src/math/smoke/fminimumbf16_test.cpp new file mode 100644 index 0000000000000..e9a2ad268348b --- /dev/null +++ b/libc/test/src/math/smoke/fminimumbf16_test.cpp @@ -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/math/fminimumbf16.h" +#include "src/__support/FPUtil/bfloat16.h" + +LIST_FMINIMUM_TESTS(bfloat16, LIBC_NAMESPACE::fminimumbf16) From 49b16ad1503d639c1f3cdd9526abb4d492f0a7ee Mon Sep 17 00:00:00 2001 From: Krishna Pandey Date: Sun, 10 Aug 2025 02:47:01 +0530 Subject: [PATCH 08/10] chore: update entrypoints Signed-off-by: Krishna Pandey --- libc/config/baremetal/aarch64/entrypoints.txt | 8 ++++++++ libc/config/baremetal/arm/entrypoints.txt | 8 ++++++++ libc/config/baremetal/riscv/entrypoints.txt | 8 ++++++++ libc/config/darwin/aarch64/entrypoints.txt | 8 ++++++++ libc/config/darwin/x86_64/entrypoints.txt | 9 +++++++++ libc/config/gpu/amdgpu/entrypoints.txt | 8 ++++++++ libc/config/gpu/nvptx/entrypoints.txt | 8 ++++++++ libc/config/linux/aarch64/entrypoints.txt | 8 ++++++++ libc/config/linux/arm/entrypoints.txt | 8 ++++++++ libc/config/linux/riscv/entrypoints.txt | 8 ++++++++ libc/config/linux/x86_64/entrypoints.txt | 8 ++++++++ libc/config/windows/entrypoints.txt | 8 ++++++++ 12 files changed, 97 insertions(+) diff --git a/libc/config/baremetal/aarch64/entrypoints.txt b/libc/config/baremetal/aarch64/entrypoints.txt index 82aa94b39f2f8..5c489576f8289 100644 --- a/libc/config/baremetal/aarch64/entrypoints.txt +++ b/libc/config/baremetal/aarch64/entrypoints.txt @@ -767,7 +767,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 diff --git a/libc/config/baremetal/arm/entrypoints.txt b/libc/config/baremetal/arm/entrypoints.txt index 603a97486bca6..4f05cc6825d7b 100644 --- a/libc/config/baremetal/arm/entrypoints.txt +++ b/libc/config/baremetal/arm/entrypoints.txt @@ -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 diff --git a/libc/config/baremetal/riscv/entrypoints.txt b/libc/config/baremetal/riscv/entrypoints.txt index 5c28a12a1caf9..bdf46cf2e5a2d 100644 --- a/libc/config/baremetal/riscv/entrypoints.txt +++ b/libc/config/baremetal/riscv/entrypoints.txt @@ -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 diff --git a/libc/config/darwin/aarch64/entrypoints.txt b/libc/config/darwin/aarch64/entrypoints.txt index e293db45e82e5..b785ae88f0ee7 100644 --- a/libc/config/darwin/aarch64/entrypoints.txt +++ b/libc/config/darwin/aarch64/entrypoints.txt @@ -600,7 +600,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 diff --git a/libc/config/darwin/x86_64/entrypoints.txt b/libc/config/darwin/x86_64/entrypoints.txt index 22c793272806d..3ec2bef0ff81b 100644 --- a/libc/config/darwin/x86_64/entrypoints.txt +++ b/libc/config/darwin/x86_64/entrypoints.txt @@ -243,7 +243,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 diff --git a/libc/config/gpu/amdgpu/entrypoints.txt b/libc/config/gpu/amdgpu/entrypoints.txt index c466225771785..03c4689a1d73b 100644 --- a/libc/config/gpu/amdgpu/entrypoints.txt +++ b/libc/config/gpu/amdgpu/entrypoints.txt @@ -626,7 +626,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 diff --git a/libc/config/gpu/nvptx/entrypoints.txt b/libc/config/gpu/nvptx/entrypoints.txt index 30f3090bacaa5..81ada2b6aaa00 100644 --- a/libc/config/gpu/nvptx/entrypoints.txt +++ b/libc/config/gpu/nvptx/entrypoints.txt @@ -627,7 +627,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 diff --git a/libc/config/linux/aarch64/entrypoints.txt b/libc/config/linux/aarch64/entrypoints.txt index 154e1b1c96f34..9ebdffc7228d2 100644 --- a/libc/config/linux/aarch64/entrypoints.txt +++ b/libc/config/linux/aarch64/entrypoints.txt @@ -854,7 +854,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 diff --git a/libc/config/linux/arm/entrypoints.txt b/libc/config/linux/arm/entrypoints.txt index 7b177fc7c8e30..3e51de0af944c 100644 --- a/libc/config/linux/arm/entrypoints.txt +++ b/libc/config/linux/arm/entrypoints.txt @@ -470,7 +470,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 diff --git a/libc/config/linux/riscv/entrypoints.txt b/libc/config/linux/riscv/entrypoints.txt index 5b0f90dc371b8..f33128e643c36 100644 --- a/libc/config/linux/riscv/entrypoints.txt +++ b/libc/config/linux/riscv/entrypoints.txt @@ -873,7 +873,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 diff --git a/libc/config/linux/x86_64/entrypoints.txt b/libc/config/linux/x86_64/entrypoints.txt index 66fa3c5668f9a..3d7974cfb7403 100644 --- a/libc/config/linux/x86_64/entrypoints.txt +++ b/libc/config/linux/x86_64/entrypoints.txt @@ -905,7 +905,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 diff --git a/libc/config/windows/entrypoints.txt b/libc/config/windows/entrypoints.txt index b4aa0a9ec2a54..3efd86d806ae4 100644 --- a/libc/config/windows/entrypoints.txt +++ b/libc/config/windows/entrypoints.txt @@ -316,7 +316,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 From 944d9973a66ce6c83940faa6bb8f4af85c1d5fe8 Mon Sep 17 00:00:00 2001 From: Krishna Pandey Date: Sun, 10 Aug 2025 03:03:57 +0530 Subject: [PATCH 09/10] fix: add missing include Signed-off-by: Krishna Pandey --- libc/src/math/generic/fminimum_numbf16.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/libc/src/math/generic/fminimum_numbf16.cpp b/libc/src/math/generic/fminimum_numbf16.cpp index a69864b401dda..be7497b578d29 100644 --- a/libc/src/math/generic/fminimum_numbf16.cpp +++ b/libc/src/math/generic/fminimum_numbf16.cpp @@ -8,6 +8,7 @@ #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" From f0e186723f4e21c53fe2de89811447e1a467b8fc Mon Sep 17 00:00:00 2001 From: Krishna Pandey Date: Sun, 10 Aug 2025 03:07:26 +0530 Subject: [PATCH 10/10] style: clang-format Signed-off-by: Krishna Pandey --- libc/src/math/generic/fminimum_numbf16.cpp | 2 +- libc/test/src/math/smoke/fmaximum_mag_numbf16_test.cpp | 2 +- libc/test/src/math/smoke/fmaximum_magbf16_test.cpp | 2 +- libc/test/src/math/smoke/fmaximum_numbf16_test.cpp | 2 +- libc/test/src/math/smoke/fminimum_mag_numbf16_test.cpp | 2 +- libc/test/src/math/smoke/fminimum_magbf16_test.cpp | 2 +- libc/test/src/math/smoke/fminimum_numbf16_test.cpp | 2 +- libc/test/src/math/smoke/fminimumbf16_test.cpp | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/libc/src/math/generic/fminimum_numbf16.cpp b/libc/src/math/generic/fminimum_numbf16.cpp index be7497b578d29..079a83011ec37 100644 --- a/libc/src/math/generic/fminimum_numbf16.cpp +++ b/libc/src/math/generic/fminimum_numbf16.cpp @@ -1,4 +1,4 @@ -//===-- Implementation of fminimum_numbf16 function ------------------------===// +//===-- 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. diff --git a/libc/test/src/math/smoke/fmaximum_mag_numbf16_test.cpp b/libc/test/src/math/smoke/fmaximum_mag_numbf16_test.cpp index dd9fe1c747680..9e435cc365080 100644 --- a/libc/test/src/math/smoke/fmaximum_mag_numbf16_test.cpp +++ b/libc/test/src/math/smoke/fmaximum_mag_numbf16_test.cpp @@ -8,7 +8,7 @@ #include "FMaximumMagNumTest.h" -#include "src/math/fmaximum_mag_numbf16.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) diff --git a/libc/test/src/math/smoke/fmaximum_magbf16_test.cpp b/libc/test/src/math/smoke/fmaximum_magbf16_test.cpp index bce0c4f45c644..22a0bc3380983 100644 --- a/libc/test/src/math/smoke/fmaximum_magbf16_test.cpp +++ b/libc/test/src/math/smoke/fmaximum_magbf16_test.cpp @@ -8,7 +8,7 @@ #include "FMaximumMagTest.h" -#include "src/math/fmaximum_magbf16.h" #include "src/__support/FPUtil/bfloat16.h" +#include "src/math/fmaximum_magbf16.h" LIST_FMAXIMUM_MAG_TESTS(bfloat16, LIBC_NAMESPACE::fmaximum_magbf16) diff --git a/libc/test/src/math/smoke/fmaximum_numbf16_test.cpp b/libc/test/src/math/smoke/fmaximum_numbf16_test.cpp index 9845e0f028607..25dbe9f54603e 100644 --- a/libc/test/src/math/smoke/fmaximum_numbf16_test.cpp +++ b/libc/test/src/math/smoke/fmaximum_numbf16_test.cpp @@ -8,7 +8,7 @@ #include "FMaximumNumTest.h" -#include "src/math/fmaximum_numbf16.h" #include "src/__support/FPUtil/bfloat16.h" +#include "src/math/fmaximum_numbf16.h" LIST_FMAXIMUM_NUM_TESTS(bfloat16, LIBC_NAMESPACE::fmaximum_numbf16) diff --git a/libc/test/src/math/smoke/fminimum_mag_numbf16_test.cpp b/libc/test/src/math/smoke/fminimum_mag_numbf16_test.cpp index feac14adeaec4..ed3d4474a743d 100644 --- a/libc/test/src/math/smoke/fminimum_mag_numbf16_test.cpp +++ b/libc/test/src/math/smoke/fminimum_mag_numbf16_test.cpp @@ -8,7 +8,7 @@ #include "FMinimumMagNumTest.h" -#include "src/math/fminimum_mag_numbf16.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) diff --git a/libc/test/src/math/smoke/fminimum_magbf16_test.cpp b/libc/test/src/math/smoke/fminimum_magbf16_test.cpp index a1566a9389757..94251e0f94501 100644 --- a/libc/test/src/math/smoke/fminimum_magbf16_test.cpp +++ b/libc/test/src/math/smoke/fminimum_magbf16_test.cpp @@ -8,7 +8,7 @@ #include "FMinimumMagTest.h" -#include "src/math/fminimum_magbf16.h" #include "src/__support/FPUtil/bfloat16.h" +#include "src/math/fminimum_magbf16.h" LIST_FMINIMUM_MAG_TESTS(bfloat16, LIBC_NAMESPACE::fminimum_magbf16) diff --git a/libc/test/src/math/smoke/fminimum_numbf16_test.cpp b/libc/test/src/math/smoke/fminimum_numbf16_test.cpp index b28b6621fc944..fe8bb51ffc67f 100644 --- a/libc/test/src/math/smoke/fminimum_numbf16_test.cpp +++ b/libc/test/src/math/smoke/fminimum_numbf16_test.cpp @@ -8,7 +8,7 @@ #include "FMinimumNumTest.h" -#include "src/math/fminimum_numbf16.h" #include "src/__support/FPUtil/bfloat16.h" +#include "src/math/fminimum_numbf16.h" LIST_FMINIMUM_NUM_TESTS(bfloat16, LIBC_NAMESPACE::fminimum_numbf16) diff --git a/libc/test/src/math/smoke/fminimumbf16_test.cpp b/libc/test/src/math/smoke/fminimumbf16_test.cpp index e9a2ad268348b..3667e90745cbb 100644 --- a/libc/test/src/math/smoke/fminimumbf16_test.cpp +++ b/libc/test/src/math/smoke/fminimumbf16_test.cpp @@ -8,7 +8,7 @@ #include "FMinimumTest.h" -#include "src/math/fminimumbf16.h" #include "src/__support/FPUtil/bfloat16.h" +#include "src/math/fminimumbf16.h" LIST_FMINIMUM_TESTS(bfloat16, LIBC_NAMESPACE::fminimumbf16)