Skip to content
Merged
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
9 changes: 3 additions & 6 deletions libclc/clc/lib/generic/math/clc_ldexp.cl
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,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 _CLC_OVERLOAD float __clc_ldexp(float x, int n) {

if (!__clc_fp32_subnormals_supported()) {
// This treats subnormals as zeros
Expand Down Expand Up @@ -89,7 +87,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 _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 @@ -124,14 +122,13 @@ _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 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_ARG2_TYPE int
#define __CLC_BODY <clc/shared/binary_def_scalarize.inc>
#include <clc/math/gentype.inc>
3 changes: 1 addition & 2 deletions libclc/clc/lib/generic/math/clc_rsqrt.inc
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
//
//===----------------------------------------------------------------------===//

__attribute__((weak)) _CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE
__clc_rsqrt(__CLC_GENTYPE val) {
_CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE __clc_rsqrt(__CLC_GENTYPE val) {
#pragma clang fp contract(fast)
return __CLC_FP_LIT(1.0) / __builtin_elementwise_sqrt(val);
}
3 changes: 1 addition & 2 deletions libclc/clc/lib/generic/math/clc_sqrt.inc
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
//
//===----------------------------------------------------------------------===//

__attribute__((weak)) _CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE
__clc_sqrt(__CLC_GENTYPE val) {
_CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE __clc_sqrt(__CLC_GENTYPE val) {
return __builtin_elementwise_sqrt(val);
}
20 changes: 18 additions & 2 deletions libclc/cmake/modules/AddLibclc.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -92,19 +92,35 @@ function(link_bc)
${ARGN}
)

set( LINK_INPUT_ARG ${ARG_INPUTS} )
if( ARG_INTERNALIZE )
set( inputs_with_flag ${ARG_INPUTS} )
else()
# Add the --override flag for non-generic bitcode files so that their
# symbols can override definitions in generic bitcode files.
set( inputs_with_flag )
foreach( file IN LISTS ARG_INPUTS )
string( FIND ${file} "/generic/" is_generic )
if( is_generic LESS 0 )
list( APPEND inputs_with_flag "--override" )
endif()
list( APPEND inputs_with_flag ${file} )
endforeach()
endif()

if( WIN32 OR CYGWIN )
# Create a response file in case the number of inputs exceeds command-line
# character limits on certain platforms.
file( TO_CMAKE_PATH ${LIBCLC_ARCH_OBJFILE_DIR}/${ARG_TARGET}.rsp RSP_FILE )
# Turn it into a space-separate list of input files
list( JOIN ARG_INPUTS " " RSP_INPUT )
list( JOIN inputs_with_flag " " RSP_INPUT )
file( GENERATE OUTPUT ${RSP_FILE} CONTENT ${RSP_INPUT} )
# Ensure that if this file is removed, we re-run CMake
set_property( DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS
${RSP_FILE}
)
set( LINK_INPUT_ARG "@${RSP_FILE}" )
else()
set( LINK_INPUT_ARG ${inputs_with_flag} )
endif()

if( ARG_INTERNALIZE )
Expand Down
Loading