Skip to content

Conversation

krishna2803
Copy link
Contributor

This PR adds the following basic math functions for BFloat16 type along with the tests:

  • modfbf16
  • remainderbf16
  • remquobf16

Signed-off-by: Krishna Pandey <[email protected]>
Signed-off-by: Krishna Pandey <[email protected]>
Signed-off-by: Krishna Pandey <[email protected]>
Signed-off-by: Krishna Pandey <[email protected]>
Signed-off-by: Krishna Pandey <[email protected]>
Signed-off-by: Krishna Pandey <[email protected]>
Signed-off-by: Krishna Pandey <[email protected]>
Signed-off-by: Krishna Pandey <[email protected]>
Signed-off-by: Krishna Pandey <[email protected]>
@llvmbot
Copy link
Member

llvmbot commented Aug 21, 2025

@llvm/pr-subscribers-backend-amdgpu

@llvm/pr-subscribers-backend-risc-v

Author: Krishna Pandey (krishna2803)

Changes

This PR adds the following basic math functions for BFloat16 type along with the tests:

  • modfbf16
  • remainderbf16
  • remquobf16

Patch is 24.35 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/154652.diff

25 Files Affected:

  • (modified) libc/config/baremetal/aarch64/entrypoints.txt (+3)
  • (modified) libc/config/baremetal/arm/entrypoints.txt (+3)
  • (modified) libc/config/baremetal/riscv/entrypoints.txt (+3)
  • (modified) libc/config/darwin/aarch64/entrypoints.txt (+3)
  • (modified) libc/config/darwin/x86_64/entrypoints.txt (+3)
  • (modified) libc/config/gpu/amdgpu/entrypoints.txt (+3)
  • (modified) libc/config/gpu/nvptx/entrypoints.txt (+3)
  • (modified) libc/config/linux/aarch64/entrypoints.txt (+3)
  • (modified) libc/config/linux/arm/entrypoints.txt (+3)
  • (modified) libc/config/linux/riscv/entrypoints.txt (+3)
  • (modified) libc/config/linux/x86_64/entrypoints.txt (+3)
  • (modified) libc/config/windows/entrypoints.txt (+3)
  • (modified) libc/docs/headers/math/index.rst (+3-3)
  • (modified) libc/src/math/CMakeLists.txt (+5-1)
  • (modified) libc/src/math/generic/CMakeLists.txt (+44)
  • (added) libc/src/math/generic/modfbf16.cpp (+21)
  • (added) libc/src/math/generic/remainderbf16.cpp (+22)
  • (added) libc/src/math/generic/remquobf16.cpp (+21)
  • (added) libc/src/math/modfbf16.h (+21)
  • (added) libc/src/math/remainderbf16.h (+21)
  • (added) libc/src/math/remquobf16.h (+21)
  • (modified) libc/test/src/math/smoke/CMakeLists.txt (+30)
  • (modified) libc/test/src/math/smoke/ModfTest.h (+8-2)
  • (added) libc/test/src/math/smoke/modfbf16_test.cpp (+14)
  • (added) libc/test/src/math/smoke/remquobf16_test.cpp (+14)
diff --git a/libc/config/baremetal/aarch64/entrypoints.txt b/libc/config/baremetal/aarch64/entrypoints.txt
index 10d5b3a591d0d..f6f2740e52fe3 100644
--- a/libc/config/baremetal/aarch64/entrypoints.txt
+++ b/libc/config/baremetal/aarch64/entrypoints.txt
@@ -793,11 +793,14 @@ list(APPEND TARGET_LIBM_ENTRYPOINTS
   libc.src.math.ldexpbf16
   libc.src.math.llogbbf16
   libc.src.math.logbbf16
+  libc.src.math.modfbf16
   libc.src.math.nanbf16
   libc.src.math.nextafterbf16
   libc.src.math.nextdownbf16
   libc.src.math.nexttowardbf16
   libc.src.math.nextupbf16
+  libc.src.math.remainderbf16
+  libc.src.math.remquobf16
   libc.src.math.roundbf16
   libc.src.math.roundevenbf16
   libc.src.math.setpayloadbf16
diff --git a/libc/config/baremetal/arm/entrypoints.txt b/libc/config/baremetal/arm/entrypoints.txt
index 785b84163701f..6f9ce31e4bb45 100644
--- a/libc/config/baremetal/arm/entrypoints.txt
+++ b/libc/config/baremetal/arm/entrypoints.txt
@@ -796,11 +796,14 @@ list(APPEND TARGET_LIBM_ENTRYPOINTS
   libc.src.math.ldexpbf16
   libc.src.math.llogbbf16
   libc.src.math.logbbf16
+  libc.src.math.modfbf16
   libc.src.math.nanbf16
   libc.src.math.nextafterbf16
   libc.src.math.nextdownbf16
   libc.src.math.nexttowardbf16
   libc.src.math.nextupbf16
+  libc.src.math.remainderbf16
+  libc.src.math.remquobf16
   libc.src.math.roundbf16
   libc.src.math.roundevenbf16
   libc.src.math.setpayloadbf16
diff --git a/libc/config/baremetal/riscv/entrypoints.txt b/libc/config/baremetal/riscv/entrypoints.txt
index 2038f3e4952cf..ddca368e7175c 100644
--- a/libc/config/baremetal/riscv/entrypoints.txt
+++ b/libc/config/baremetal/riscv/entrypoints.txt
@@ -796,11 +796,14 @@ list(APPEND TARGET_LIBM_ENTRYPOINTS
   libc.src.math.ldexpbf16
   libc.src.math.llogbbf16
   libc.src.math.logbbf16
+  libc.src.math.modfbf16
   libc.src.math.nanbf16
   libc.src.math.nextafterbf16
   libc.src.math.nextdownbf16
   libc.src.math.nexttowardbf16
   libc.src.math.nextupbf16
+  libc.src.math.remainderbf16
+  libc.src.math.remquobf16
   libc.src.math.roundbf16
   libc.src.math.roundevenbf16
   libc.src.math.setpayloadbf16
diff --git a/libc/config/darwin/aarch64/entrypoints.txt b/libc/config/darwin/aarch64/entrypoints.txt
index 707e8b1d43658..22b291ac6c2b7 100644
--- a/libc/config/darwin/aarch64/entrypoints.txt
+++ b/libc/config/darwin/aarch64/entrypoints.txt
@@ -626,11 +626,14 @@ list(APPEND TARGET_LIBM_ENTRYPOINTS
   libc.src.math.ldexpbf16
   libc.src.math.llogbbf16
   libc.src.math.logbbf16
+  libc.src.math.modfbf16
   libc.src.math.nanbf16
   libc.src.math.nextafterbf16
   libc.src.math.nextdownbf16
   libc.src.math.nexttowardbf16
   libc.src.math.nextupbf16
+  libc.src.math.remainderbf16
+  libc.src.math.remquobf16
   libc.src.math.roundbf16
   libc.src.math.roundevenbf16
   libc.src.math.setpayloadbf16
diff --git a/libc/config/darwin/x86_64/entrypoints.txt b/libc/config/darwin/x86_64/entrypoints.txt
index db3b305d376b0..e69c24446403d 100644
--- a/libc/config/darwin/x86_64/entrypoints.txt
+++ b/libc/config/darwin/x86_64/entrypoints.txt
@@ -269,11 +269,14 @@ list(APPEND TARGET_LIBM_ENTRYPOINTS
   libc.src.math.ldexpbf16
   libc.src.math.llogbbf16
   libc.src.math.logbbf16
+  libc.src.math.modfbf16
   libc.src.math.nanbf16
   libc.src.math.nextafterbf16
   libc.src.math.nextdownbf16
   libc.src.math.nexttowardbf16
   libc.src.math.nextupbf16
+  libc.src.math.remainderbf16
+  libc.src.math.remquobf16
   libc.src.math.roundbf16
   libc.src.math.roundevenbf16
   libc.src.math.setpayloadbf16
diff --git a/libc/config/gpu/amdgpu/entrypoints.txt b/libc/config/gpu/amdgpu/entrypoints.txt
index 76bda91f3b229..5630538547485 100644
--- a/libc/config/gpu/amdgpu/entrypoints.txt
+++ b/libc/config/gpu/amdgpu/entrypoints.txt
@@ -652,11 +652,14 @@ list(APPEND TARGET_LIBM_ENTRYPOINTS
   libc.src.math.ldexpbf16
   libc.src.math.llogbbf16
   libc.src.math.logbbf16
+  libc.src.math.modfbf16
   libc.src.math.nanbf16
   libc.src.math.nextafterbf16
   libc.src.math.nextdownbf16
   libc.src.math.nexttowardbf16
   libc.src.math.nextupbf16
+  libc.src.math.remainderbf16
+  libc.src.math.remquobf16
   libc.src.math.roundbf16
   libc.src.math.roundevenbf16
   libc.src.math.setpayloadbf16
diff --git a/libc/config/gpu/nvptx/entrypoints.txt b/libc/config/gpu/nvptx/entrypoints.txt
index cae9d593b056d..c10cd8f454238 100644
--- a/libc/config/gpu/nvptx/entrypoints.txt
+++ b/libc/config/gpu/nvptx/entrypoints.txt
@@ -653,11 +653,14 @@ list(APPEND TARGET_LIBM_ENTRYPOINTS
   libc.src.math.ldexpbf16
   libc.src.math.llogbbf16
   libc.src.math.logbbf16
+  libc.src.math.modfbf16
   libc.src.math.nanbf16
   libc.src.math.nextafterbf16
   libc.src.math.nextdownbf16
   libc.src.math.nexttowardbf16
   libc.src.math.nextupbf16
+  libc.src.math.remainderbf16
+  libc.src.math.remquobf16
   libc.src.math.roundbf16
   libc.src.math.roundevenbf16
   libc.src.math.setpayloadbf16
diff --git a/libc/config/linux/aarch64/entrypoints.txt b/libc/config/linux/aarch64/entrypoints.txt
index 18853de2c13c1..ff4b3bdcbcdad 100644
--- a/libc/config/linux/aarch64/entrypoints.txt
+++ b/libc/config/linux/aarch64/entrypoints.txt
@@ -880,11 +880,14 @@ list(APPEND TARGET_LIBM_ENTRYPOINTS
   libc.src.math.ldexpbf16
   libc.src.math.llogbbf16
   libc.src.math.logbbf16
+  libc.src.math.modfbf16
   libc.src.math.nanbf16
   libc.src.math.nextafterbf16
   libc.src.math.nextdownbf16
   libc.src.math.nexttowardbf16
   libc.src.math.nextupbf16
+  libc.src.math.remainderbf16
+  libc.src.math.remquobf16
   libc.src.math.roundbf16
   libc.src.math.roundevenbf16
   libc.src.math.setpayloadbf16
diff --git a/libc/config/linux/arm/entrypoints.txt b/libc/config/linux/arm/entrypoints.txt
index 150e34a1fb195..8d81edf536b78 100644
--- a/libc/config/linux/arm/entrypoints.txt
+++ b/libc/config/linux/arm/entrypoints.txt
@@ -496,11 +496,14 @@ list(APPEND TARGET_LIBM_ENTRYPOINTS
   libc.src.math.ldexpbf16
   libc.src.math.llogbbf16
   libc.src.math.logbbf16
+  libc.src.math.modfbf16
   libc.src.math.nanbf16
   libc.src.math.nextafterbf16
   libc.src.math.nextdownbf16
   libc.src.math.nexttowardbf16
   libc.src.math.nextupbf16
+  libc.src.math.remainderbf16
+  libc.src.math.remquobf16
   libc.src.math.roundbf16
   libc.src.math.roundevenbf16
   libc.src.math.setpayloadbf16
diff --git a/libc/config/linux/riscv/entrypoints.txt b/libc/config/linux/riscv/entrypoints.txt
index 937ec4253299a..dbe7356510e2d 100644
--- a/libc/config/linux/riscv/entrypoints.txt
+++ b/libc/config/linux/riscv/entrypoints.txt
@@ -899,11 +899,14 @@ list(APPEND TARGET_LIBM_ENTRYPOINTS
   libc.src.math.ldexpbf16
   libc.src.math.llogbbf16
   libc.src.math.logbbf16
+  libc.src.math.modfbf16
   libc.src.math.nanbf16
   libc.src.math.nextafterbf16
   libc.src.math.nextdownbf16
   libc.src.math.nexttowardbf16
   libc.src.math.nextupbf16
+  libc.src.math.remainderbf16
+  libc.src.math.remquobf16
   libc.src.math.roundbf16
   libc.src.math.roundevenbf16
   libc.src.math.setpayloadbf16
diff --git a/libc/config/linux/x86_64/entrypoints.txt b/libc/config/linux/x86_64/entrypoints.txt
index 23871c406d236..a24af935fa6b2 100644
--- a/libc/config/linux/x86_64/entrypoints.txt
+++ b/libc/config/linux/x86_64/entrypoints.txt
@@ -931,11 +931,14 @@ list(APPEND TARGET_LIBM_ENTRYPOINTS
   libc.src.math.ldexpbf16
   libc.src.math.llogbbf16
   libc.src.math.logbbf16
+  libc.src.math.modfbf16
   libc.src.math.nanbf16
   libc.src.math.nextafterbf16
   libc.src.math.nextdownbf16
   libc.src.math.nexttowardbf16
   libc.src.math.nextupbf16
+  libc.src.math.remainderbf16
+  libc.src.math.remquobf16
   libc.src.math.roundbf16
   libc.src.math.roundevenbf16
   libc.src.math.setpayloadbf16
diff --git a/libc/config/windows/entrypoints.txt b/libc/config/windows/entrypoints.txt
index cc7c655280213..06868e1792dd4 100644
--- a/libc/config/windows/entrypoints.txt
+++ b/libc/config/windows/entrypoints.txt
@@ -342,11 +342,14 @@ list(APPEND TARGET_LIBM_ENTRYPOINTS
   libc.src.math.ldexpbf16
   libc.src.math.llogbbf16
   libc.src.math.logbbf16
+  libc.src.math.modfbf16
   libc.src.math.nanbf16
   libc.src.math.nextafterbf16
   libc.src.math.nextdownbf16
   libc.src.math.nexttowardbf16
   libc.src.math.nextupbf16
+  libc.src.math.remainderbf16
+  libc.src.math.remquobf16
   libc.src.math.roundbf16
   libc.src.math.roundevenbf16
   libc.src.math.setpayloadbf16
diff --git a/libc/docs/headers/math/index.rst b/libc/docs/headers/math/index.rst
index 5049ab65d00af..d4326665ea851 100644
--- a/libc/docs/headers/math/index.rst
+++ b/libc/docs/headers/math/index.rst
@@ -209,7 +209,7 @@ Basic Operations
 +------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+------------------------+----------------------------+
 | lround           | |check|          | |check|         | |check|                | |check|              | |check|                |                        | 7.12.9.7               | F.10.6.7                   |
 +------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+------------------------+----------------------------+
-| modf             | |check|          | |check|         | |check|                | |check|              | |check|                |                        | 7.12.6.18              | F.10.3.18                  |
+| modf             | |check|          | |check|         | |check|                | |check|              | |check|                | |check|                | 7.12.6.18              | F.10.3.18                  |
 +------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+------------------------+----------------------------+
 | nan              | |check|          | |check|         | |check|                | |check|              | |check|                | |check|                | 7.12.11.2              | F.10.8.2                   |
 +------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+------------------------+----------------------------+
@@ -223,9 +223,9 @@ Basic Operations
 +------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+------------------------+----------------------------+
 | nextup           | |check|          | |check|         | |check|                | |check|              | |check|                | |check|                | 7.12.11.5              | F.10.8.5                   |
 +------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+------------------------+----------------------------+
-| remainder        | |check|          | |check|         | |check|                | |check|              | |check|                |                        | 7.12.10.2              | F.10.7.2                   |
+| remainder        | |check|          | |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                   |
+| remquo           | |check|          | |check|         | |check|                | |check|              | |check|                | |check|                | 7.12.10.3              | F.10.7.3                   |
 +------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+------------------------+----------------------------+
 | rint             | |check|          | |check|         | |check|                | |check|              | |check|                |                        | 7.12.9.4               | F.10.6.4                   |
 +------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+------------------------+----------------------------+
diff --git a/libc/src/math/CMakeLists.txt b/libc/src/math/CMakeLists.txt
index b1d76c6008cf5..6cc221178df94 100644
--- a/libc/src/math/CMakeLists.txt
+++ b/libc/src/math/CMakeLists.txt
@@ -300,6 +300,7 @@ add_math_entrypoint_object(fmodf)
 add_math_entrypoint_object(fmodl)
 add_math_entrypoint_object(fmodf16)
 add_math_entrypoint_object(fmodf128)
+add_math_entrypoint_object(fmodbf16)
 
 add_math_entrypoint_object(frexp)
 add_math_entrypoint_object(frexpf)
@@ -419,6 +420,7 @@ add_math_entrypoint_object(modff)
 add_math_entrypoint_object(modfl)
 add_math_entrypoint_object(modff16)
 add_math_entrypoint_object(modff128)
+add_math_entrypoint_object(modfbf16)
 
 add_math_entrypoint_object(nan)
 add_math_entrypoint_object(nanf)
@@ -470,12 +472,14 @@ add_math_entrypoint_object(remainderf)
 add_math_entrypoint_object(remainderl)
 add_math_entrypoint_object(remainderf16)
 add_math_entrypoint_object(remainderf128)
+add_math_entrypoint_object(remainderbf16)
 
 add_math_entrypoint_object(remquo)
 add_math_entrypoint_object(remquof)
-add_math_entrypoint_object(remquof128)
 add_math_entrypoint_object(remquol)
 add_math_entrypoint_object(remquof16)
+add_math_entrypoint_object(remquof128)
+add_math_entrypoint_object(remquobf16)
 
 add_math_entrypoint_object(rint)
 add_math_entrypoint_object(rintf)
diff --git a/libc/src/math/generic/CMakeLists.txt b/libc/src/math/generic/CMakeLists.txt
index 3dbc54a819722..dc9d101cc76c8 100644
--- a/libc/src/math/generic/CMakeLists.txt
+++ b/libc/src/math/generic/CMakeLists.txt
@@ -2280,6 +2280,21 @@ add_entrypoint_object(
     libc.src.__support.FPUtil.manipulation_functions
 )
 
+add_entrypoint_object(
+  modfbf16
+  SRCS
+    modfbf16.cpp
+  HDRS
+    ../modfbf16.h
+  DEPENDS
+    libc.src.__support.common
+    libc.src.__support.FPUtil.bfloat16
+    libc.src.__support.FPUtil.manipulation_functions
+    libc.src.__support.macros.config
+    libc.src.__support.macros.properties.types
+)
+
+
 add_entrypoint_object(
   fmin
   SRCS
@@ -3184,6 +3199,21 @@ add_entrypoint_object(
     libc.src.__support.FPUtil.division_and_remainder_operations
 )
 
+add_entrypoint_object(
+  remquobf16
+  SRCS
+    remquobf16.cpp
+  HDRS
+    ../remquobf16.h
+  DEPENDS
+    libc.src.__support.common
+    libc.src.__support.FPUtil.bfloat16
+    libc.src.__support.FPUtil.division_and_remainder_operations
+    libc.src.__support.macros.properties.types
+    libc.src.__support.macros.config
+)
+
+
 add_entrypoint_object(
   remainderf
   SRCS
@@ -3236,6 +3266,20 @@ add_entrypoint_object(
     libc.src.__support.FPUtil.division_and_remainder_operations
 )
 
+add_entrypoint_object(
+  remainderbf16
+  SRCS
+    remainderbf16.cpp
+  HDRS
+    ../remainderbf16.h
+  DEPENDS
+    libc.src.__support.common
+    libc.src.__support.FPUtil.bfloat16
+    libc.src.__support.FPUtil.division_and_remainder_operations
+    libc.src.__support.macros.properties.types
+    libc.src.__support.macros.config
+)
+
 add_entrypoint_object(
   hypotf
   SRCS
diff --git a/libc/src/math/generic/modfbf16.cpp b/libc/src/math/generic/modfbf16.cpp
new file mode 100644
index 0000000000000..09458f6a2db40
--- /dev/null
+++ b/libc/src/math/generic/modfbf16.cpp
@@ -0,0 +1,21 @@
+//===-- Implementation of modfbf16 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/modfbf16.h"
+#include "src/__support/FPUtil/ManipulationFunctions.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, modfbf16, (bfloat16 x, bfloat16 *iptr)) {
+  return fputil::modf(x, *iptr);
+}
+
+} // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/math/generic/remainderbf16.cpp b/libc/src/math/generic/remainderbf16.cpp
new file mode 100644
index 0000000000000..e70726a6cbc55
--- /dev/null
+++ b/libc/src/math/generic/remainderbf16.cpp
@@ -0,0 +1,22 @@
+//===-- Implementation of remainderbf16 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/remainderbf16.h"
+#include "src/__support/FPUtil/DivisionAndRemainderOperations.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, remainderbf16, (bfloat16 x, bfloat16 y)) {
+  int quotient;
+  return fputil::remquo(x, y, quotient);
+}
+
+} // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/math/generic/remquobf16.cpp b/libc/src/math/generic/remquobf16.cpp
new file mode 100644
index 0000000000000..e1b13f8deb19a
--- /dev/null
+++ b/libc/src/math/generic/remquobf16.cpp
@@ -0,0 +1,21 @@
+//===-- Implementation of remquobf16 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/remquobf16.h"
+#include "src/__support/FPUtil/DivisionAndRemainderOperations.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, remquobf16, (bfloat16 x, bfloat16 y, int *exp)) {
+  return fputil::remquo(x, y, *exp);
+}
+
+} // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/math/modfbf16.h b/libc/src/math/modfbf16.h
new file mode 100644
index 0000000000000..df05b6c5b0aad
--- /dev/null
+++ b/libc/src/math/modfbf16.h
@@ -0,0 +1,21 @@
+//===-- Implementation header for modfbf16 ----------------------*- 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_MODFBF16_H
+#define LLVM_LIBC_SRC_MATH_MODFBF16_H
+
+#include "src/__support/macros/config.h"
+#include "src/__support/macros/properties/types.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+bfloat16 modfbf16(bfloat16 x, bfloat16 *iptr);
+
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SRC_MATH_MODFBF16_H
diff --git a/libc/src/math/remainderbf16.h b/libc/src/math/remainderbf16.h
new file mode 100644
index 0000000000000..a1a2eaa3a0efb
--- /dev/null
+++ b/libc/src/math/remainderbf16.h
@@ -0,0 +1,21 @@
+//===-- Implementation header for remainderbf16 -----------------*- 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_REMAINDERBF16_H
+#define LLVM_LIBC_SRC_MATH_REMAINDERBF16_H
+
+#include "src/__support/macros/config.h"
+#include "src/__support/macros/properties/types.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+bfloat16 remainderbf16(bfloat16 x, bfloat16 y);
+
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SRC_MATH_REMAINDERBF16_H
diff --git a/libc/src/math/remquobf16.h b/lib...
[truncated]

Co-authored-by: OverMighty <[email protected]>
Base automatically changed from users/krishna2803/frexpbf16 to main August 25, 2025 06:16
Signed-off-by: Krishna Pandey <[email protected]>
@krishna2803 krishna2803 merged commit f005e2c into main Aug 27, 2025
20 checks passed
@krishna2803 krishna2803 deleted the users/krishna2803/modfbf6 branch August 27, 2025 06:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants