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
2 changes: 0 additions & 2 deletions libclc/clc/lib/amdgcn/SOURCES
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
math/clc_fmax.cl
math/clc_fmin.cl
math/clc_ldexp_override.cl
workitem/clc_get_global_offset.cl
workitem/clc_get_global_size.cl
Expand Down
47 changes: 2 additions & 45 deletions libclc/clc/lib/generic/math/clc_fmax.cl
Original file line number Diff line number Diff line change
Expand Up @@ -6,53 +6,10 @@
//
//===----------------------------------------------------------------------===//

#include <clc/clcmacro.h>
#include <clc/internal/clc.h>
#include <clc/relational/clc_isnan.h>

#define __FLOAT_ONLY
#define __CLC_MIN_VECSIZE 1
#define FUNCTION __clc_fmax
#define __IMPL_FUNCTION __builtin_fmaxf
#define __CLC_BODY <clc/shared/binary_def_scalarize.inc>
#include <clc/math/gentype.inc>
#undef __CLC_MIN_VECSIZE
#undef FUNCTION
#undef __IMPL_FUNCTION

#ifdef cl_khr_fp64

#pragma OPENCL EXTENSION cl_khr_fp64 : enable

#define __DOUBLE_ONLY
#define __CLC_MIN_VECSIZE 1
#define FUNCTION __clc_fmax
#define __IMPL_FUNCTION __builtin_fmax
#define __CLC_BODY <clc/shared/binary_def_scalarize.inc>
#include <clc/math/gentype.inc>
#undef __CLC_MIN_VECSIZE
#undef FUNCTION
#undef __IMPL_FUNCTION
#define __IMPL_FUNCTION(x) __builtin_elementwise_maximumnum
#define __CLC_BODY <clc/shared/binary_def.inc>

#endif

#ifdef cl_khr_fp16

#pragma OPENCL EXTENSION cl_khr_fp16 : enable

_CLC_DEF _CLC_OVERLOAD half __clc_fmax(half x, half y) {
if (__clc_isnan(x))
return y;
if (__clc_isnan(y))
return x;
return (x < y) ? y : x;
}

#define __HALF_ONLY
#define __CLC_SUPPORTED_VECSIZE_OR_1 2
#define FUNCTION __clc_fmax
#define __CLC_BODY <clc/shared/binary_def_scalarize.inc>
#include <clc/math/gentype.inc>
#undef FUNCTION

#endif
46 changes: 2 additions & 44 deletions libclc/clc/lib/generic/math/clc_fmin.cl
Original file line number Diff line number Diff line change
Expand Up @@ -6,52 +6,10 @@
//
//===----------------------------------------------------------------------===//

#include <clc/clcmacro.h>
#include <clc/internal/clc.h>
#include <clc/relational/clc_isnan.h>

#define __FLOAT_ONLY
#define __CLC_MIN_VECSIZE 1
#define FUNCTION __clc_fmin
#define __IMPL_FUNCTION __builtin_fminf
#define __CLC_BODY <clc/shared/binary_def_scalarize.inc>
#include <clc/math/gentype.inc>
#undef __CLC_MIN_VECSIZE
#undef FUNCTION
#undef __IMPL_FUNCTION

#ifdef cl_khr_fp64

#pragma OPENCL EXTENSION cl_khr_fp64 : enable

#define __DOUBLE_ONLY
#define __CLC_MIN_VECSIZE 1
#define FUNCTION __clc_fmin
#define __IMPL_FUNCTION __builtin_fmin
#define __CLC_BODY <clc/shared/binary_def_scalarize.inc>
#include <clc/math/gentype.inc>
#undef __CLC_MIN_VECSIZE
#undef FUNCTION
#undef __IMPL_FUNCTION
#define __IMPL_FUNCTION(x) __builtin_elementwise_minimumnum
#define __CLC_BODY <clc/shared/binary_def.inc>

#endif

#ifdef cl_khr_fp16

#pragma OPENCL EXTENSION cl_khr_fp16 : enable

_CLC_DEF _CLC_OVERLOAD half __clc_fmin(half x, half y) {
if (__clc_isnan(x))
return y;
if (__clc_isnan(y))
return x;
return (y < x) ? y : x;
}

#define __HALF_ONLY
#define __CLC_SUPPORTED_VECSIZE_OR_1 2
#define FUNCTION __clc_fmin
#define __CLC_BODY <clc/shared/binary_def_scalarize.inc>
#include <clc/math/gentype.inc>

#endif
2 changes: 0 additions & 2 deletions libclc/clc/lib/r600/SOURCES
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
math/clc_fmax.cl
math/clc_fmin.cl
math/clc_native_rsqrt.cl
math/clc_rsqrt_override.cl
41 changes: 0 additions & 41 deletions libclc/clc/lib/r600/math/clc_fmax.cl

This file was deleted.

42 changes: 0 additions & 42 deletions libclc/clc/lib/r600/math/clc_fmin.cl

This file was deleted.

2 changes: 2 additions & 0 deletions libclc/clc/lib/spirv/SOURCES
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
math/clc_fmax.cl
math/clc_fmin.cl
math/clc_runtime_has_hw_fma32.cl
Original file line number Diff line number Diff line change
Expand Up @@ -8,40 +8,23 @@

#include <clc/clcmacro.h>
#include <clc/internal/clc.h>
#include <clc/relational/clc_isnan.h>

_CLC_DEF _CLC_OVERLOAD float __clc_fmax(float x, float y) {
// fcanonicalize removes sNaNs and flushes denormals if not enabled. Otherwise
// fmax instruction flushes the values for comparison, but outputs original
// denormal
x = __builtin_canonicalizef(x);
y = __builtin_canonicalizef(y);
return __builtin_fmaxf(x, y);
}

#ifdef cl_khr_fp64

#pragma OPENCL EXTENSION cl_khr_fp64 : enable

_CLC_DEF _CLC_OVERLOAD double __clc_fmax(double x, double y) {
x = __builtin_canonicalize(x);
y = __builtin_canonicalize(y);
return __builtin_fmax(x, y);
}

#endif
#ifdef cl_khr_fp16

#ifdef cl_khr_fp16
#pragma OPENCL EXTENSION cl_khr_fp16 : enable

_CLC_DEF _CLC_OVERLOAD half __clc_fmax(half x, half y) {
if (__clc_isnan(x))
return y;
if (__clc_isnan(y))
return x;
return (y < x) ? x : y;
return __builtin_fmaxf16(x, y);
}

#endif

#define FUNCTION __clc_fmax
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,41 +8,23 @@

#include <clc/clcmacro.h>
#include <clc/internal/clc.h>
#include <clc/relational/clc_isnan.h>

_CLC_DEF _CLC_OVERLOAD float __clc_fmin(float x, float y) {
// fcanonicalize removes sNaNs and flushes denormals if not enabled. Otherwise
// fmin instruction flushes the values for comparison, but outputs original
// denormal
x = __builtin_canonicalizef(x);
y = __builtin_canonicalizef(y);
return __builtin_fminf(x, y);
}

#ifdef cl_khr_fp64

#pragma OPENCL EXTENSION cl_khr_fp64 : enable

_CLC_DEF _CLC_OVERLOAD double __clc_fmin(double x, double y) {
x = __builtin_canonicalize(x);
y = __builtin_canonicalize(y);
return __builtin_fmin(x, y);
}

#endif

#ifdef cl_khr_fp16

#pragma OPENCL EXTENSION cl_khr_fp16 : enable

_CLC_DEF _CLC_OVERLOAD half __clc_fmin(half x, half y) {
if (__clc_isnan(x))
return y;
if (__clc_isnan(y))
return x;
return (y < x) ? y : x;
return __builtin_fminf16(x, y);
}

#endif

#define FUNCTION __clc_fmin
Expand Down
Loading