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