[libc-commits] [libc] Ab 233205 (PR #235422)

via libc-commits libc-commits at lists.llvm.org
Sun Oct 25 04:52:01 PDT 2026


https://github.com/albertbolt1 updated https://github.com/llvm/llvm-project/pull/235422

>From 8d71c297b2e657845708181c807eb2ef86dfd651 Mon Sep 17 00:00:00 2001
From: albertbolt <albertboltinfinity at gmail.com>
Date: Sat, 24 Oct 2026 17:52:12 +0530
Subject: [PATCH 1/3] checkpoint 1, added the needed code, need to check and
 run

---
 libc/config/baremetal/aarch64/entrypoints.txt |  1 +
 libc/config/baremetal/arm/entrypoints.txt     |  1 +
 libc/config/baremetal/hexagon/entrypoints.txt |  1 +
 libc/config/baremetal/riscv/entrypoints.txt   |  1 +
 libc/config/darwin/aarch64/entrypoints.txt    |  1 +
 libc/config/darwin/x86_64/entrypoints.txt     |  1 +
 libc/config/freebsd/x86_64/entrypoints.txt    |  1 +
 libc/config/gpu/amdgpu/entrypoints.txt        |  1 +
 libc/config/gpu/nvptx/entrypoints.txt         |  1 +
 libc/config/linux/aarch64/entrypoints.txt     |  1 +
 libc/config/linux/arm/entrypoints.txt         |  1 +
 libc/config/linux/riscv/entrypoints.txt       |  1 +
 libc/config/linux/x86_64/entrypoints.txt      |  1 +
 libc/config/windows/entrypoints.txt           |  1 +
 libc/src/__support/math/rsqrtbf16.h           | 30 +++++++++++
 libc/src/math/CMakeLists.txt                  |  1 +
 libc/src/math/generic/CMakeLists.txt          | 11 ++++
 libc/src/math/generic/rsqrtbf16.cpp           | 18 +++++++
 libc/src/math/rsqrtbf16.h                     | 21 ++++++++
 libc/test/src/math/smoke/CMakeLists.txt       | 13 +++++
 libc/test/src/math/smoke/RsqrtTest.h          | 50 +++++++++++++++++++
 libc/test/src/math/smoke/rsqrtbf16_test.cpp   | 14 ++++++
 22 files changed, 172 insertions(+)
 create mode 100644 libc/src/__support/math/rsqrtbf16.h
 create mode 100644 libc/src/math/generic/rsqrtbf16.cpp
 create mode 100644 libc/src/math/rsqrtbf16.h
 create mode 100644 libc/test/src/math/smoke/RsqrtTest.h
 create mode 100644 libc/test/src/math/smoke/rsqrtbf16_test.cpp

diff --git a/libc/config/baremetal/aarch64/entrypoints.txt b/libc/config/baremetal/aarch64/entrypoints.txt
index 0202bc7a2dc56b..545225b9910e75 100644
--- a/libc/config/baremetal/aarch64/entrypoints.txt
+++ b/libc/config/baremetal/aarch64/entrypoints.txt
@@ -877,6 +877,7 @@ list(APPEND TARGET_LIBM_ENTRYPOINTS
   libc.src.math.setpayloadbf16
   libc.src.math.setpayloadsigbf16
   libc.src.math.sqrtbf16
+  libc.src.math.rsqrtbf16
   libc.src.math.tanbf16
   libc.src.math.truncbf16
   libc.src.math.totalorderbf16
diff --git a/libc/config/baremetal/arm/entrypoints.txt b/libc/config/baremetal/arm/entrypoints.txt
index b7322502d570d4..36a0a2d6e64333 100644
--- a/libc/config/baremetal/arm/entrypoints.txt
+++ b/libc/config/baremetal/arm/entrypoints.txt
@@ -888,6 +888,7 @@ list(APPEND TARGET_LIBM_ENTRYPOINTS
   libc.src.math.setpayloadbf16
   libc.src.math.setpayloadsigbf16
   libc.src.math.sqrtbf16
+  libc.src.math.rsqrtbf16
   libc.src.math.tanbf16
   libc.src.math.truncbf16
   libc.src.math.totalorderbf16
diff --git a/libc/config/baremetal/hexagon/entrypoints.txt b/libc/config/baremetal/hexagon/entrypoints.txt
index 61f869457b3282..e3a62c24dcd3c8 100644
--- a/libc/config/baremetal/hexagon/entrypoints.txt
+++ b/libc/config/baremetal/hexagon/entrypoints.txt
@@ -877,6 +877,7 @@ list(APPEND TARGET_LIBM_ENTRYPOINTS
   libc.src.math.setpayloadbf16
   libc.src.math.setpayloadsigbf16
   libc.src.math.sqrtbf16
+  libc.src.math.rsqrtbf16
   libc.src.math.tanbf16
   libc.src.math.truncbf16
   libc.src.math.totalorderbf16
diff --git a/libc/config/baremetal/riscv/entrypoints.txt b/libc/config/baremetal/riscv/entrypoints.txt
index 7e68a3c374249d..0df24dccd6c7ad 100644
--- a/libc/config/baremetal/riscv/entrypoints.txt
+++ b/libc/config/baremetal/riscv/entrypoints.txt
@@ -880,6 +880,7 @@ list(APPEND TARGET_LIBM_ENTRYPOINTS
   libc.src.math.setpayloadbf16
   libc.src.math.setpayloadsigbf16
   libc.src.math.sqrtbf16
+  libc.src.math.rsqrtbf16
   libc.src.math.tanbf16
   libc.src.math.truncbf16
   libc.src.math.totalorderbf16
diff --git a/libc/config/darwin/aarch64/entrypoints.txt b/libc/config/darwin/aarch64/entrypoints.txt
index c0ce5870c862ec..cbeba962d89b07 100644
--- a/libc/config/darwin/aarch64/entrypoints.txt
+++ b/libc/config/darwin/aarch64/entrypoints.txt
@@ -699,6 +699,7 @@ list(APPEND TARGET_LIBM_ENTRYPOINTS
   libc.src.math.setpayloadbf16
   libc.src.math.setpayloadsigbf16
   libc.src.math.sqrtbf16
+  libc.src.math.rsqrtbf16
   libc.src.math.tanbf16
   libc.src.math.truncbf16
   libc.src.math.totalorderbf16
diff --git a/libc/config/darwin/x86_64/entrypoints.txt b/libc/config/darwin/x86_64/entrypoints.txt
index e3fc845d2ed3af..b18206e83b6a4b 100644
--- a/libc/config/darwin/x86_64/entrypoints.txt
+++ b/libc/config/darwin/x86_64/entrypoints.txt
@@ -335,6 +335,7 @@ list(APPEND TARGET_LIBM_ENTRYPOINTS
   libc.src.math.setpayloadbf16
   libc.src.math.setpayloadsigbf16
   libc.src.math.sqrtbf16
+  libc.src.math.rsqrtbf16
   libc.src.math.tanbf16
   libc.src.math.truncbf16
   libc.src.math.totalorderbf16
diff --git a/libc/config/freebsd/x86_64/entrypoints.txt b/libc/config/freebsd/x86_64/entrypoints.txt
index 42d52b3ebc6c2c..6e3d15aa2aa831 100644
--- a/libc/config/freebsd/x86_64/entrypoints.txt
+++ b/libc/config/freebsd/x86_64/entrypoints.txt
@@ -631,6 +631,7 @@ list(APPEND TARGET_LIBM_ENTRYPOINTS
   libc.src.math.setpayloadbf16
   libc.src.math.setpayloadsigbf16
   libc.src.math.sqrtbf16
+  libc.src.math.rsqrtbf16
   libc.src.math.tanbf16
   libc.src.math.truncbf16
   libc.src.math.totalorderbf16
diff --git a/libc/config/gpu/amdgpu/entrypoints.txt b/libc/config/gpu/amdgpu/entrypoints.txt
index ffbcc4b1672403..24a9f51c1c1857 100644
--- a/libc/config/gpu/amdgpu/entrypoints.txt
+++ b/libc/config/gpu/amdgpu/entrypoints.txt
@@ -752,6 +752,7 @@ list(APPEND TARGET_LIBM_ENTRYPOINTS
   libc.src.math.setpayloadbf16
   libc.src.math.setpayloadsigbf16
   libc.src.math.sqrtbf16
+  libc.src.math.rsqrtbf16
   libc.src.math.tanbf16
   libc.src.math.truncbf16
   libc.src.math.totalorderbf16
diff --git a/libc/config/gpu/nvptx/entrypoints.txt b/libc/config/gpu/nvptx/entrypoints.txt
index ff31536073543e..82d552e1326a0e 100644
--- a/libc/config/gpu/nvptx/entrypoints.txt
+++ b/libc/config/gpu/nvptx/entrypoints.txt
@@ -768,6 +768,7 @@ list(APPEND TARGET_LIBM_ENTRYPOINTS
   libc.src.math.setpayloadbf16
   libc.src.math.setpayloadsigbf16
   libc.src.math.sqrtbf16
+  libc.src.math.rsqrtbf16
   libc.src.math.tanbf16
   libc.src.math.truncbf16
   libc.src.math.totalorderbf16
diff --git a/libc/config/linux/aarch64/entrypoints.txt b/libc/config/linux/aarch64/entrypoints.txt
index b193733a02dc5f..2534263a198683 100644
--- a/libc/config/linux/aarch64/entrypoints.txt
+++ b/libc/config/linux/aarch64/entrypoints.txt
@@ -1109,6 +1109,7 @@ list(APPEND TARGET_LIBM_ENTRYPOINTS
   libc.src.math.setpayloadbf16
   libc.src.math.setpayloadsigbf16
   libc.src.math.sqrtbf16
+  libc.src.math.rsqrtbf16
   libc.src.math.tanbf16
   libc.src.math.truncbf16
   libc.src.math.totalorderbf16
diff --git a/libc/config/linux/arm/entrypoints.txt b/libc/config/linux/arm/entrypoints.txt
index 8c7ebf61d5786d..cef5ab1db05349 100644
--- a/libc/config/linux/arm/entrypoints.txt
+++ b/libc/config/linux/arm/entrypoints.txt
@@ -714,6 +714,7 @@ list(APPEND TARGET_LIBM_ENTRYPOINTS
   libc.src.math.setpayloadbf16
   libc.src.math.setpayloadsigbf16
   libc.src.math.sqrtbf16
+  libc.src.math.rsqrtbf16
   libc.src.math.tanbf16
   libc.src.math.truncbf16
   libc.src.math.totalorderbf16
diff --git a/libc/config/linux/riscv/entrypoints.txt b/libc/config/linux/riscv/entrypoints.txt
index 273b865173bcec..2983d1be83f580 100644
--- a/libc/config/linux/riscv/entrypoints.txt
+++ b/libc/config/linux/riscv/entrypoints.txt
@@ -1187,6 +1187,7 @@ list(APPEND TARGET_LIBM_ENTRYPOINTS
   libc.src.math.setpayloadbf16
   libc.src.math.setpayloadsigbf16
   libc.src.math.sqrtbf16
+  libc.src.math.rsqrtbf16
   libc.src.math.tanbf16
   libc.src.math.truncbf16
   libc.src.math.totalorderbf16
diff --git a/libc/config/linux/x86_64/entrypoints.txt b/libc/config/linux/x86_64/entrypoints.txt
index 1769cfbfaa9b43..d90b5e344f8a56 100644
--- a/libc/config/linux/x86_64/entrypoints.txt
+++ b/libc/config/linux/x86_64/entrypoints.txt
@@ -1209,6 +1209,7 @@ list(APPEND TARGET_LIBM_ENTRYPOINTS
   libc.src.math.setpayloadbf16
   libc.src.math.setpayloadsigbf16
   libc.src.math.sqrtbf16
+  libc.src.math.rsqrtbf16
   libc.src.math.tanbf16
   libc.src.math.truncbf16
   libc.src.math.totalorderbf16
diff --git a/libc/config/windows/entrypoints.txt b/libc/config/windows/entrypoints.txt
index e0477cbf5a6f00..0c00188a51d33c 100644
--- a/libc/config/windows/entrypoints.txt
+++ b/libc/config/windows/entrypoints.txt
@@ -429,6 +429,7 @@ list(APPEND TARGET_LIBM_ENTRYPOINTS
   libc.src.math.setpayloadsigbf16
   libc.src.math.setpayloadsigf128
   libc.src.math.sqrtbf16
+  libc.src.math.rsqrtbf16
   libc.src.math.tanbf16
   libc.src.math.truncbf16
   libc.src.math.totalorderbf16
diff --git a/libc/src/__support/math/rsqrtbf16.h b/libc/src/__support/math/rsqrtbf16.h
new file mode 100644
index 00000000000000..f7cbac8fe5fd2f
--- /dev/null
+++ b/libc/src/__support/math/rsqrtbf16.h
@@ -0,0 +1,30 @@
+//===-- Implementation header for sqrtbf16 ----------------------*- 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___SUPPORT_MATH_RSQRTBF16_H
+#define LLVM_LIBC_SRC___SUPPORT_MATH_RSQRTBF16_H
+
+#include "src/__support/FPUtil/bfloat16.h"
+#include "src/__support/FPUtil/sqrt.h"
+#include "src/__support/common.h"
+#include "src/__support/macros/config.h"
+#include "src/__support/FPUtil/cast.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace math {
+
+LIBC_INLINE bfloat16 rsqrtbf16(bfloat16 x) { 
+
+    float xf = fputil::cast<float>(x);
+    return fputil::cast<bfloat16>(1.0f/fputil::sqrt<float>(xf));
+ }
+
+} // namespace math
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SRC___SUPPORT_MATH_RSQRTBF16_H
diff --git a/libc/src/math/CMakeLists.txt b/libc/src/math/CMakeLists.txt
index 4f1dd95a6993da..68cf32c9bf21be 100644
--- a/libc/src/math/CMakeLists.txt
+++ b/libc/src/math/CMakeLists.txt
@@ -590,6 +590,7 @@ add_math_entrypoint_object(sqrtl)
 add_math_entrypoint_object(sqrtf16)
 add_math_entrypoint_object(sqrtf128)
 add_math_entrypoint_object(sqrtbf16)
+add_math_entrypoint_object(rsqrtbf16)
 
 add_math_entrypoint_object(tan)
 add_math_entrypoint_object(tanbf16)
diff --git a/libc/src/math/generic/CMakeLists.txt b/libc/src/math/generic/CMakeLists.txt
index b4b2465b384b10..20bcafb6244a5c 100644
--- a/libc/src/math/generic/CMakeLists.txt
+++ b/libc/src/math/generic/CMakeLists.txt
@@ -2755,6 +2755,17 @@ add_entrypoint_object(
     libc.src.__support.math.sqrtbf16
 )
 
+add_entrypoint_object(
+  rsqrtbf16
+  SRCS
+    rsqrtbf16.cpp
+  HDRS
+    ../rsqrtbf16.h
+  DEPENDS
+    libc.src.__support.math.rsqrtbf16
+)
+
+
 add_entrypoint_object(
   remquof
   SRCS
diff --git a/libc/src/math/generic/rsqrtbf16.cpp b/libc/src/math/generic/rsqrtbf16.cpp
new file mode 100644
index 00000000000000..14675843a226c7
--- /dev/null
+++ b/libc/src/math/generic/rsqrtbf16.cpp
@@ -0,0 +1,18 @@
+//===-- Implementation of sqrtbf16 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/rsqrtbf16.h"
+#include "src/__support/math/rsqrtbf16.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+LLVM_LIBC_FUNCTION(bfloat16, rsqrtbf16, (bfloat16 x)) {
+  return math::rsqrtbf16(x);
+}
+
+} // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/math/rsqrtbf16.h b/libc/src/math/rsqrtbf16.h
new file mode 100644
index 00000000000000..4efa6a91cc1c5f
--- /dev/null
+++ b/libc/src/math/rsqrtbf16.h
@@ -0,0 +1,21 @@
+//===-- Implementation header for rsqrtbf16 ----------------------*- 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_RSQRTBF16_H
+#define LLVM_LIBC_SRC_MATH_RSQRTBF16_H
+
+#include "src/__support/macros/config.h"
+#include "src/__support/macros/properties/types.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+bfloat16 rsqrtbf16(bfloat16 x);
+
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SRC_MATH_RSQRTBF16_H
\ No newline at end of file
diff --git a/libc/test/src/math/smoke/CMakeLists.txt b/libc/test/src/math/smoke/CMakeLists.txt
index d68eb7786e3b58..82b674f7e030b5 100644
--- a/libc/test/src/math/smoke/CMakeLists.txt
+++ b/libc/test/src/math/smoke/CMakeLists.txt
@@ -3691,6 +3691,19 @@ add_fp_unittest(
     libc.src.__support.FPUtil.bfloat16
 )
 
+add_fp_unittest(
+  rsqrtbf16_test
+  SUITE
+    libc-math-smoke-tests
+  SRCS
+    rsqrtbf16_test.cpp
+  HDRS
+    SqrtTest.h
+  DEPENDS
+    libc.src.math.rsqrtbf16
+    libc.src.__support.FPUtil.bfloat16
+)
+
 add_fp_unittest(
   generic_sqrtf_test
   SUITE
diff --git a/libc/test/src/math/smoke/RsqrtTest.h b/libc/test/src/math/smoke/RsqrtTest.h
new file mode 100644
index 00000000000000..e8dda8a603931c
--- /dev/null
+++ b/libc/test/src/math/smoke/RsqrtTest.h
@@ -0,0 +1,50 @@
+//===-- Utility class to test rsqrt[f|l] ------------------------*- 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_TEST_SRC_MATH_SMOKE_RSQRTTEST_H
+#define LLVM_LIBC_TEST_SRC_MATH_SMOKE_RSQRTTEST_H
+
+#include "test/UnitTest/FEnvSafeTest.h"
+#include "test/UnitTest/FPMatcher.h"
+#include "test/UnitTest/Test.h"
+
+template <typename OutType, typename InType>
+class RsqrtTest : public LIBC_NAMESPACE::testing::FEnvSafeTest {
+
+  DECLARE_SPECIAL_CONSTANTS(OutType)
+
+  struct InConstants {
+    DECLARE_SPECIAL_CONSTANTS(InType)
+  };
+
+  InConstants in;
+
+public:
+  typedef OutType (*RsqrtFunc)(InType);
+
+  void test_special_numbers(RsqrtFunc func) {
+    ASSERT_FP_EQ(in.aNaN, func(in.aNaN));
+    ASSERT_FP_EQ(inf, func(in.zero));
+    ASSERT_FP_EQ(neg_inf, func(in.neg_zero));
+    ASSERT_FP_EQ(zero, func(in.inf));
+    ASSERT_FP_EQ(aNaN, func(in.neg_inf));
+    ASSERT_FP_EQ(aNaN, func(InType(-1.0)));
+    ASSERT_FP_EQ(OutType(1.0), func(InType(1.0)));
+    ASSERT_FP_EQ(OutType(0.5), func(InType(4.0)));
+    ASSERT_FP_EQ(OutType(0.70710677), func(InType(2.0)));
+  }
+};
+
+#define LIST_RSQRT_TESTS(Name, T, func)                                        \
+  using LlvmLibc##Name##Test = RsqrtTest<T, T>;                                \
+  TEST_F(LlvmLibc##Name##Test, SpecialNumbers) {                               \
+    test_special_numbers(&func);                                               \
+  }                                                                            \
+  static_assert(true, "Require semicolon.")
+
+#endif // LLVM_LIBC_TEST_SRC_MATH_SMOKE_RSQRTTEST_H
\ No newline at end of file
diff --git a/libc/test/src/math/smoke/rsqrtbf16_test.cpp b/libc/test/src/math/smoke/rsqrtbf16_test.cpp
new file mode 100644
index 00000000000000..7912ccf7682a0b
--- /dev/null
+++ b/libc/test/src/math/smoke/rsqrtbf16_test.cpp
@@ -0,0 +1,14 @@
+//===-- Unittests for sqrtbf16 --------------------------------------------===//
+//
+// 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 "RsqrtTest.h"
+
+#include "src/__support/FPUtil/bfloat16.h"
+#include "src/math/rsqrtbf16.h"
+
+LIST_RSQRT_TESTS(Rsqrtbf16, bfloat16, LIBC_NAMESPACE::rsqrtbf16);

>From 99c1a0c209d52ca79f85dbaad324a48b95d0821b Mon Sep 17 00:00:00 2001
From: albertbolt <albertboltinfinity at gmail.com>
Date: Sun, 25 Oct 2026 09:31:06 +0530
Subject: [PATCH 2/3] checkpoint 1, added the needed code, need to check and
 run

---
 libc/src/__support/math/CMakeLists.txt | 12 ++++++++++++
 libc/src/math/rsqrtbf16.h              |  2 +-
 2 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/libc/src/__support/math/CMakeLists.txt b/libc/src/__support/math/CMakeLists.txt
index 400e5e2d6aeaa8..aee00ceb2f0da7 100644
--- a/libc/src/__support/math/CMakeLists.txt
+++ b/libc/src/__support/math/CMakeLists.txt
@@ -5783,6 +5783,18 @@ add_header_library(
     libc.src.__support.macros.config
 )
 
+add_header_library(
+  rsqrtbf16
+  HDRS
+    rsqrtbf16.h
+  DEPENDS
+    libc.src.__support.FPUtil.bfloat16
+    libc.src.__support.FPUtil.sqrt
+    libc.src.__support.common
+    libc.src.__support.macros.config
+    libc.src.__support.FPUtil.cast.h
+)
+
 add_header_library(
   sqrtf
   HDRS
diff --git a/libc/src/math/rsqrtbf16.h b/libc/src/math/rsqrtbf16.h
index 4efa6a91cc1c5f..f25a10343078fa 100644
--- a/libc/src/math/rsqrtbf16.h
+++ b/libc/src/math/rsqrtbf16.h
@@ -18,4 +18,4 @@ bfloat16 rsqrtbf16(bfloat16 x);
 
 } // namespace LIBC_NAMESPACE_DECL
 
-#endif // LLVM_LIBC_SRC_MATH_RSQRTBF16_H
\ No newline at end of file
+#endif // LLVM_LIBC_SRC_MATH_RSQRTBF16_H

>From f2484f38e31b72df643497012c0c1b575a8844b4 Mon Sep 17 00:00:00 2001
From: albertbolt <albertboltinfinity at gmail.com>
Date: Sun, 25 Oct 2026 17:21:48 +0530
Subject: [PATCH 3/3] cleaning up

---
 libc/src/__support/math/rsqrtbf16.h | 10 +++++-----
 libc/src/math/rsqrtbf16.h           |  3 ++-
 2 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/libc/src/__support/math/rsqrtbf16.h b/libc/src/__support/math/rsqrtbf16.h
index f7cbac8fe5fd2f..1b5e581588de10 100644
--- a/libc/src/__support/math/rsqrtbf16.h
+++ b/libc/src/__support/math/rsqrtbf16.h
@@ -10,19 +10,19 @@
 #define LLVM_LIBC_SRC___SUPPORT_MATH_RSQRTBF16_H
 
 #include "src/__support/FPUtil/bfloat16.h"
+#include "src/__support/FPUtil/cast.h"
 #include "src/__support/FPUtil/sqrt.h"
 #include "src/__support/common.h"
 #include "src/__support/macros/config.h"
-#include "src/__support/FPUtil/cast.h"
 
 namespace LIBC_NAMESPACE_DECL {
 namespace math {
 
-LIBC_INLINE bfloat16 rsqrtbf16(bfloat16 x) { 
+LIBC_INLINE bfloat16 rsqrtbf16(bfloat16 x) {
 
-    float xf = fputil::cast<float>(x);
-    return fputil::cast<bfloat16>(1.0f/fputil::sqrt<float>(xf));
- }
+  float xf = fputil::cast<float>(x);
+  return fputil::cast<bfloat16>(1.0f / fputil::sqrt<float>(xf));
+}
 
 } // namespace math
 } // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/math/rsqrtbf16.h b/libc/src/math/rsqrtbf16.h
index f25a10343078fa..e6dfc28e5d549c 100644
--- a/libc/src/math/rsqrtbf16.h
+++ b/libc/src/math/rsqrtbf16.h
@@ -1,4 +1,5 @@
-//===-- Implementation header for rsqrtbf16 ----------------------*- C++ -*-===//
+//===-- Implementation header for rsqrtbf16 ----------------------*- C++
+//-*-===//
 //
 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
 // See https://llvm.org/LICENSE.txt for license information.



More information about the libc-commits mailing list