isequal.cl
1.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#include <clc/clc.h>
#define _CLC_DEFINE_ISEQUAL(RET_TYPE, FUNCTION, ARG1_TYPE, ARG2_TYPE) \
_CLC_DEF _CLC_OVERLOAD RET_TYPE FUNCTION(ARG1_TYPE x, ARG2_TYPE y) { \
return (x == y); \
} \
_CLC_DEFINE_ISEQUAL(int, isequal, float, float)
_CLC_DEFINE_ISEQUAL(int2, isequal, float2, float2)
_CLC_DEFINE_ISEQUAL(int3, isequal, float3, float3)
_CLC_DEFINE_ISEQUAL(int4, isequal, float4, float4)
_CLC_DEFINE_ISEQUAL(int8, isequal, float8, float8)
_CLC_DEFINE_ISEQUAL(int16, isequal, float16, float16)
#ifdef cl_khr_fp64
#pragma OPENCL EXTENSION cl_khr_fp64 : enable
// The scalar version of isequal(double) returns an int, but the vector versions
// return long.
_CLC_DEFINE_ISEQUAL(int, isequal, double, double)
_CLC_DEFINE_ISEQUAL(long2, isequal, double2, double2)
_CLC_DEFINE_ISEQUAL(long3, isequal, double3, double3)
_CLC_DEFINE_ISEQUAL(long4, isequal, double4, double4)
_CLC_DEFINE_ISEQUAL(long8, isequal, double8, double8)
_CLC_DEFINE_ISEQUAL(long16, isequal, double16, double16)
#endif
#ifdef cl_khr_fp16
#pragma OPENCL EXTENSION cl_khr_fp16 : enable
// The scalar version of isequal(half) returns an int, but the vector versions
// return short.
_CLC_DEFINE_ISEQUAL(int, isequal, half, half)
_CLC_DEFINE_ISEQUAL(short2, isequal, half2, half2)
_CLC_DEFINE_ISEQUAL(short3, isequal, half3, half3)
_CLC_DEFINE_ISEQUAL(short4, isequal, half4, half4)
_CLC_DEFINE_ISEQUAL(short8, isequal, half8, half8)
_CLC_DEFINE_ISEQUAL(short16, isequal, half16, half16)
#endif
#undef _CLC_DEFINE_ISEQUAL