[libclc] libclc: Add ep utility (PR #186047)
Wenju He via cfe-commits
cfe-commits at lists.llvm.org
Thu Mar 12 01:54:06 PDT 2026
================
@@ -0,0 +1,34 @@
+//===----------------------------------------------------------------------===//
+//
+// 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/math/clc_div_fast.h"
+#include "clc/math/clc_ep.h"
+#include "clc/math/clc_fma.h"
+#include "clc/math/clc_ldexp.h"
+#include "clc/math/clc_recip_fast.h"
+#include "clc/math/clc_sqrt_fast.h"
+#include "clc/relational/clc_isinf.h"
+#include "clc/relational/clc_signbit.h"
+
+#ifdef cl_khr_fp16
+_CLC_DEF _CLC_OVERLOAD _CLC_CONST static half ep_high_fp_bits(half x) {
+ return __clc_as_half((ushort)(__clc_as_ushort(x) & (ushort)0xffc0U));
+}
+#endif
+
+_CLC_DEF _CLC_OVERLOAD _CLC_CONST static float ep_high_fp_bits(float x) {
+ return __clc_as_float(__clc_as_uint(x) & 0xfffff000U);
+}
+
+_CLC_DEF _CLC_OVERLOAD _CLC_CONST static double ep_high_fp_bits(double x) {
----------------
wenju-he wrote:
this is generic file, probably need to guard with
```
#ifdef cl_khr_fp64
```
https://github.com/llvm/llvm-project/pull/186047
More information about the cfe-commits
mailing list