Author: Matt Arsenault Date: 2026-03-12T06:54:55+01:00 New Revision: 7265d89ed6551fa871bc1c9bc64e811c758381fc
URL: https://github.com/llvm/llvm-project/commit/7265d89ed6551fa871bc1c9bc64e811c758381fc DIFF: https://github.com/llvm/llvm-project/commit/7265d89ed6551fa871bc1c9bc64e811c758381fc.diff LOG: libclc: Add frexp_exp utility function (#185872) Added: libclc/clc/include/clc/math/clc_frexp_exp.h libclc/clc/include/clc/shared/unary_decl_with_int_return.inc libclc/clc/lib/generic/math/clc_frexp_exp.cl libclc/clc/lib/generic/math/clc_frexp_exp.inc Modified: libclc/clc/lib/generic/CMakeLists.txt Removed: ################################################################################ diff --git a/libclc/clc/include/clc/math/clc_frexp_exp.h b/libclc/clc/include/clc/math/clc_frexp_exp.h new file mode 100644 index 0000000000000..a732b919726b2 --- /dev/null +++ b/libclc/clc/include/clc/math/clc_frexp_exp.h @@ -0,0 +1,22 @@ +//===----------------------------------------------------------------------===// +// +// 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 +// +//===----------------------------------------------------------------------===// +// +// Convenience function which returns the out argument value of frexp. +// +//===----------------------------------------------------------------------===// + +#ifndef __CLC_MATH_CLC_FREXP_EXP_H__ +#define __CLC_MATH_CLC_FREXP_EXP_H__ + +#define __CLC_FUNCTION __clc_frexp_exp +#define __CLC_BODY "clc/math/unary_decl_with_int_return.inc" +#include "clc/math/gentype.inc" + +#undef __CLC_FUNCTION + +#endif // __CLC_MATH_CLC_FREXP_EXP_H__ diff --git a/libclc/clc/include/clc/shared/unary_decl_with_int_return.inc b/libclc/clc/include/clc/shared/unary_decl_with_int_return.inc new file mode 100644 index 0000000000000..2e86a310b018b --- /dev/null +++ b/libclc/clc/include/clc/shared/unary_decl_with_int_return.inc @@ -0,0 +1,9 @@ +//===----------------------------------------------------------------------===// +// +// 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 +// +//===----------------------------------------------------------------------===// + +_CLC_OVERLOAD _CLC_CONST _CLC_DECL __CLC_INTN __CLC_FUNCTION(__CLC_GENTYPE x); diff --git a/libclc/clc/lib/generic/CMakeLists.txt b/libclc/clc/lib/generic/CMakeLists.txt index 7d7286de11f85..f9e3c91817cd2 100644 --- a/libclc/clc/lib/generic/CMakeLists.txt +++ b/libclc/clc/lib/generic/CMakeLists.txt @@ -91,6 +91,7 @@ libclc_configure_source_list(CLC_GENERIC_SOURCES math/clc_fmod.cl math/clc_fract.cl math/clc_frexp.cl + math/clc_frexp_exp.cl math/clc_half_cos.cl math/clc_half_divide.cl math/clc_half_exp.cl diff --git a/libclc/clc/lib/generic/math/clc_frexp_exp.cl b/libclc/clc/lib/generic/math/clc_frexp_exp.cl new file mode 100644 index 0000000000000..5a84725eccab8 --- /dev/null +++ b/libclc/clc/lib/generic/math/clc_frexp_exp.cl @@ -0,0 +1,13 @@ +//===----------------------------------------------------------------------===// +// +// 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/math/clc_frexp.h" +#include "clc/math/clc_frexp_exp.h" + +#define __CLC_BODY "clc_frexp_exp.inc" +#include "clc/math/gentype.inc" diff --git a/libclc/clc/lib/generic/math/clc_frexp_exp.inc b/libclc/clc/lib/generic/math/clc_frexp_exp.inc new file mode 100644 index 0000000000000..6878c9c9409b4 --- /dev/null +++ b/libclc/clc/lib/generic/math/clc_frexp_exp.inc @@ -0,0 +1,13 @@ +//===----------------------------------------------------------------------===// +// +// 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 +// +//===----------------------------------------------------------------------===// + +_CLC_DEF _CLC_OVERLOAD __CLC_INTN __clc_frexp_exp(__CLC_GENTYPE x) { + __CLC_INTN e; + (void)__clc_frexp(x, &e); + return e; +} _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
