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