[llvm-branch-commits] [libclc] libclc: Use log intrinsic for half and float cases for amdgpu (PR #187538)

Wenju He via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Thu Mar 19 16:09:15 PDT 2026


================
@@ -0,0 +1,44 @@
+//===----------------------------------------------------------------------===//
+//
+// 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 "clc/clc_convert.h"
+#include "clc/float/definitions.h"
+#include "clc/math/clc_ep.h"
+#include "clc/math/clc_frexp.h"
+#include "clc/math/clc_ldexp.h"
+#include "clc/math/clc_log10.h"
+#include "clc/math/clc_mad.h"
+#include "clc/relational/clc_isinf.h"
+
+#define __CLC_FLOAT_ONLY
+#define __CLC_FUNCTION __clc_log10
+#define __CLC_IMPL_FUNCTION(x) __builtin_elementwise_log10
+#define __CLC_BODY "clc/shared/unary_def.inc"
+#include "clc/math/gentype.inc"
+#undef __CLC_FUNCTION
+#undef __CLC_IMPL_FUNCTION
+#undef __CLC_FLOAT_ONLY
+
+#define __CLC_HALF_ONLY
+#define __CLC_FUNCTION __clc_log10
----------------
wenju-he wrote:

only need to define __CLC_FUNCTION once in this file. The macro won't be undef-ed by "clc/math/gentype.inc"

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


More information about the llvm-branch-commits mailing list