[libc-commits] [libc] [libc] Clean up GPU math implementations (PR #83133)

Joseph Huber via libc-commits libc-commits at lists.llvm.org
Tue Feb 27 07:59:29 PST 2024


================
@@ -0,0 +1,16 @@
+//===-- Implementation of the GPU trunc 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/trunc.h"
+#include "src/__support/common.h"
+
+namespace LIBC_NAMESPACE {
+
+LLVM_LIBC_FUNCTION(double, trunc, (double x)) { return __builtin_trunc(x); }
----------------
jhuber6 wrote:

Laziness, the targets support different subsets of the math builtins so at a high level it makes sense to split them. The rest of the math library doesn't use built-ins so there's no point making some common `builtin/` directory I wouldn't think. The long term goal is to collapse a lot of this so I wasn't overly concerned with redundancy for now.

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


More information about the libc-commits mailing list