Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions libclc/clc/include/clc/clcfunc.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
#define _CLC_DEF __attribute__((always_inline))
#endif

#define _CLC_DEF_WEAK _CLC_DEF __attribute__((weak))

#if __OPENCL_C_VERSION__ == CL_VERSION_2_0 || \
(__OPENCL_C_VERSION__ >= CL_VERSION_3_0 && \
defined(__opencl_c_generic_address_space))
Expand Down
10 changes: 4 additions & 6 deletions libclc/clc/lib/generic/math/clc_ldexp.cl
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@
#include <clc/relational/clc_isnan.h>
#include <clc/shared/clc_clamp.h>

#define _CLC_DEF_ldexp _CLC_DEF __attribute__((weak))

_CLC_DEF_ldexp _CLC_OVERLOAD float __clc_ldexp(float x, int n) {
_CLC_DEF_WEAK _CLC_OVERLOAD float __clc_ldexp(float x, int n) {

if (!__clc_fp32_subnormals_supported()) {
// This treats subnormals as zeros
Expand Down Expand Up @@ -90,7 +88,7 @@ _CLC_DEF_ldexp _CLC_OVERLOAD float __clc_ldexp(float x, int n) {

#pragma OPENCL EXTENSION cl_khr_fp64 : enable

_CLC_DEF_ldexp _CLC_OVERLOAD double __clc_ldexp(double x, int n) {
_CLC_DEF_WEAK _CLC_OVERLOAD double __clc_ldexp(double x, int n) {
long l = __clc_as_ulong(x);
int e = (l >> 52) & 0x7ff;
long s = l & 0x8000000000000000;
Expand Down Expand Up @@ -125,14 +123,14 @@ _CLC_DEF_ldexp _CLC_OVERLOAD double __clc_ldexp(double x, int n) {

#pragma OPENCL EXTENSION cl_khr_fp16 : enable

_CLC_OVERLOAD _CLC_DEF_ldexp half __clc_ldexp(half x, int n) {
_CLC_OVERLOAD _CLC_DEF_WEAK half __clc_ldexp(half x, int n) {
return (half)__clc_ldexp((float)x, n);
}

#endif

#define __CLC_FUNCTION __clc_ldexp
#define __CLC_DEF_SPEC _CLC_DEF_ldexp
#define __CLC_DEF_SPEC _CLC_DEF_WEAK
#define __CLC_ARG2_TYPE int
#define __CLC_BODY <clc/shared/binary_def_scalarize.inc>
#include <clc/math/gentype.inc>
Loading