[libc-commits] [libc] [libc][stdfix] Implement divifx functions in LLVM libc (PR #206115)

via libc-commits libc-commits at lists.llvm.org
Wed Jul 8 03:27:18 PDT 2026


================
@@ -0,0 +1,105 @@
+//===-- Utility class to test divifx functions ------------------*- 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
+//
+//===----------------------------------------------------------------------===//
+
+#include "test/UnitTest/Test.h"
+
+#include "hdr/signal_macros.h"
+#include "llvm-libc-macros/stdfix-macros.h"
+#include "src/__support/fixed_point/fx_bits.h"
+#include "src/__support/fixed_point/fx_rep.h"
+
+template <typename IntType, typename FXType>
+class DiviFxTest : public LIBC_NAMESPACE::testing::Test {
+
+  using FXRep = LIBC_NAMESPACE::fixed_point::FXRep<FXType>;
+
+  static constexpr FXType zero = FXRep::ZERO();
+  static constexpr FXType max = FXRep::MAX();
+  static constexpr FXType one_half = FXRep::ONE_HALF();
+  static constexpr FXType one_fourth = FXRep::ONE_FOURTH();
+
+public:
+  typedef IntType (*DiviFxFunc)(IntType, FXType);
+
+  void testBasicNumbers(DiviFxFunc func) {
----------------
sohail103 wrote:

thanks, added this test in the latest push.

https://github.com/llvm/llvm-project/pull/206115


More information about the libc-commits mailing list