diff --git a/libclc/generic/include/clc/clc.h b/libclc/generic/include/clc/clc.h index 148a83b7be0a..d868c5ecd783 100644 --- a/libclc/generic/include/clc/clc.h +++ b/libclc/generic/include/clc/clc.h @@ -120,6 +120,7 @@ #include #include #include +#include #include #include #include diff --git a/libclc/generic/include/clc/relational/islessgreater.h b/libclc/generic/include/clc/relational/islessgreater.h new file mode 100644 index 000000000000..005ba1090789 --- /dev/null +++ b/libclc/generic/include/clc/relational/islessgreater.h @@ -0,0 +1,7 @@ +#define __CLC_FUNCTION islessgreater +#define __CLC_BODY + +#include + +#undef __CLC_BODY +#undef __CLC_FUNCTION diff --git a/libclc/generic/lib/SOURCES b/libclc/generic/lib/SOURCES index 115cbee198eb..3ece265f82e8 100644 --- a/libclc/generic/lib/SOURCES +++ b/libclc/generic/lib/SOURCES @@ -55,6 +55,7 @@ relational/isgreaterequal.cl relational/isinf.cl relational/isless.cl relational/islessequal.cl +relational/islessgreater.cl relational/isnan.cl relational/isnormal.cl relational/isnotequal.cl diff --git a/libclc/generic/lib/relational/islessgreater.cl b/libclc/generic/lib/relational/islessgreater.cl new file mode 100644 index 000000000000..fc029f35b73a --- /dev/null +++ b/libclc/generic/lib/relational/islessgreater.cl @@ -0,0 +1,22 @@ +#include +#include "relational.h" + +//Note: It would be nice to use __builtin_islessgreater with vector inputs, but it seems to only take scalar values as +// input, which will produce incorrect output for vector input types. + +_CLC_DEFINE_RELATIONAL_BINARY(int, islessgreater, __builtin_islessgreater, float, float) + +#ifdef cl_khr_fp64 + +#pragma OPENCL EXTENSION cl_khr_fp64 : enable + +// The scalar version of islessgreater(double, double) returns an int, but the vector versions +// return long. + +_CLC_DEF _CLC_OVERLOAD int islessgreater(double x, double y){ + return __builtin_islessgreater(x, y); +} + +_CLC_DEFINE_RELATIONAL_BINARY_VEC_ALL(long, islessgreater, double, double) + +#endif