diff --git a/libclc/clc/lib/amdgpu/CMakeLists.txt b/libclc/clc/lib/amdgpu/CMakeLists.txt index 3e3059570c18..1b7ad244e718 100644 --- a/libclc/clc/lib/amdgpu/CMakeLists.txt +++ b/libclc/clc/lib/amdgpu/CMakeLists.txt @@ -18,6 +18,9 @@ libclc_configure_source_list(CLC_AMDGPU_SOURCES math/clc_half_sqrt.cl math/clc_get_twobypi_bits.cl math/clc_ldexp.cl + math/clc_log.cl + math/clc_log10.cl + math/clc_log2.cl math/clc_log2_fast.cl math/clc_native_exp.cl math/clc_native_exp2.cl diff --git a/libclc/clc/lib/amdgpu/math/clc_amdgpu_log.inc b/libclc/clc/lib/amdgpu/math/clc_amdgpu_log.inc new file mode 100644 index 000000000000..7b0d75daca07 --- /dev/null +++ b/libclc/clc/lib/amdgpu/math/clc_amdgpu_log.inc @@ -0,0 +1,11 @@ +//===----------------------------------------------------------------------===// +// +// 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 +// +//===----------------------------------------------------------------------===// + +#ifdef __CLC_SCALAR +#include "clc_log_base.inc" +#endif diff --git a/libclc/clc/lib/amdgpu/math/clc_log.cl b/libclc/clc/lib/amdgpu/math/clc_log.cl new file mode 100644 index 000000000000..300e0dfdf3c4 --- /dev/null +++ b/libclc/clc/lib/amdgpu/math/clc_log.cl @@ -0,0 +1,41 @@ +//===----------------------------------------------------------------------===// +// +// 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_log.h" +#include "clc/math/clc_mad.h" +#include "clc/relational/clc_isinf.h" + +#define __CLC_FUNCTION __clc_log + +#define __CLC_FLOAT_ONLY +#define __CLC_IMPL_FUNCTION(x) __builtin_elementwise_log +#define __CLC_BODY "clc/shared/unary_def.inc" +#include "clc/math/gentype.inc" +#undef __CLC_IMPL_FUNCTION +#undef __CLC_FLOAT_ONLY + +#define __CLC_HALF_ONLY +#define __CLC_IMPL_FUNCTION(x) __builtin_elementwise_log +#define __CLC_BODY "clc/shared/unary_def.inc" +#include "clc/math/gentype.inc" +#undef __CLC_IMPL_FUNCTION +#undef __CLC_HALF_ONLY + +#define COMPILING_LOG +#define __CLC_DOUBLE_ONLY +#define __CLC_BODY "clc_amdgpu_log.inc" +#include "clc/math/gentype.inc" + +#define __CLC_DOUBLE_ONLY +#define __CLC_BODY "clc/shared/unary_def_scalarize_loop.inc" +#include "clc/math/gentype.inc" diff --git a/libclc/clc/lib/amdgpu/math/clc_log10.cl b/libclc/clc/lib/amdgpu/math/clc_log10.cl new file mode 100644 index 000000000000..2c01f791b62c --- /dev/null +++ b/libclc/clc/lib/amdgpu/math/clc_log10.cl @@ -0,0 +1,41 @@ +//===----------------------------------------------------------------------===// +// +// 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_FUNCTION __clc_log10 + +#define __CLC_FLOAT_ONLY +#define __CLC_IMPL_FUNCTION(x) __builtin_elementwise_log10 +#define __CLC_BODY "clc/shared/unary_def.inc" +#include "clc/math/gentype.inc" +#undef __CLC_IMPL_FUNCTION +#undef __CLC_FLOAT_ONLY + +#define __CLC_HALF_ONLY +#define __CLC_IMPL_FUNCTION(x) __builtin_elementwise_log10 +#define __CLC_BODY "clc/shared/unary_def.inc" +#include "clc/math/gentype.inc" +#undef __CLC_IMPL_FUNCTION +#undef __CLC_HALF_ONLY + +#define COMPILING_LOG10 +#define __CLC_DOUBLE_ONLY +#define __CLC_BODY "clc_amdgpu_log.inc" +#include "clc/math/gentype.inc" + +#define __CLC_DOUBLE_ONLY +#define __CLC_BODY "clc/shared/unary_def_scalarize_loop.inc" +#include "clc/math/gentype.inc" diff --git a/libclc/clc/lib/amdgpu/math/clc_log2.cl b/libclc/clc/lib/amdgpu/math/clc_log2.cl new file mode 100644 index 000000000000..e02e6fc375e2 --- /dev/null +++ b/libclc/clc/lib/amdgpu/math/clc_log2.cl @@ -0,0 +1,41 @@ +//===----------------------------------------------------------------------===// +// +// 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_log2.h" +#include "clc/math/clc_mad.h" +#include "clc/relational/clc_isinf.h" + +#define __CLC_FUNCTION __clc_log2 + +#define __CLC_FLOAT_ONLY +#define __CLC_IMPL_FUNCTION(x) __builtin_elementwise_log2 +#define __CLC_BODY "clc/shared/unary_def.inc" +#include "clc/math/gentype.inc" +#undef __CLC_IMPL_FUNCTION +#undef __CLC_FLOAT_ONLY + +#define __CLC_HALF_ONLY +#define __CLC_IMPL_FUNCTION(x) __builtin_elementwise_log2 +#define __CLC_BODY "clc/shared/unary_def.inc" +#include "clc/math/gentype.inc" +#undef __CLC_IMPL_FUNCTION +#undef __CLC_HALF_ONLY + +#define COMPILING_LOG2 +#define __CLC_DOUBLE_ONLY +#define __CLC_BODY "clc_amdgpu_log.inc" +#include "clc/math/gentype.inc" + +#define __CLC_DOUBLE_ONLY +#define __CLC_BODY "clc/shared/unary_def_scalarize_loop.inc" +#include "clc/math/gentype.inc"