[libc-commits] [libc] [libc][math] implement `signbit` (PR #97791)

via libc-commits libc-commits at lists.llvm.org
Sun Jul 7 22:02:24 PDT 2024


================
@@ -0,0 +1,87 @@
+//===-- Unittests for generic-math-macros ---------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDSList-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "test/UnitTest/Test.h"
+
+/*
+ * The intent of this test is validate that the generic math macros operate as
+ * intended
+ */
+#include "include/llvm-libc-macros/generic-math-macros.h"
+
+// INF can be defined as a number with zeroed out mantissa and 1s in the 
+// exponent
+static uint32_t pos_inf_bits = 0x7F800000;
----------------
akielaries wrote:

Also curious on the proper way to use the `LibcFPTestHelpers` lib that has `FAbsTest.h`. Looks like in the [`libc/test/src/math/CMakeLists.txt`](https://github.com/llvm/llvm-project/blob/main/libc/test/src/math/CMakeLists.txt) file the `add_fp_unittest` CMake function is used and I also saw some files just linking against `LibcFPTestHelpers`. So far using the latter is working in this case

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


More information about the libc-commits mailing list