1#include <clc/clc.h>
2#include "relational.h"
3
4//Note: It would be nice to use __builtin_isunordered with vector inputs, but it seems to only take scalar values as
5//      input, which will produce incorrect output for vector input types.
6
7_CLC_DEFINE_RELATIONAL_BINARY(int, isunordered, __builtin_isunordered, float, float)
8
9#ifdef cl_khr_fp64
10
11#pragma OPENCL EXTENSION cl_khr_fp64 : enable
12
13// The scalar version of isunordered(double, double) returns an int, but the vector versions
14// return long.
15
16_CLC_DEF _CLC_OVERLOAD int isunordered(double x, double y){
17	return __builtin_isunordered(x, y);
18}
19
20_CLC_DEFINE_RELATIONAL_BINARY_VEC_ALL(long, isunordered, double, double)
21
22#endif
23#ifdef cl_khr_fp16
24
25#pragma OPENCL EXTENSION cl_khr_fp16 : enable
26
27// The scalar version of isunordered(half, half) returns an int, but the vector versions
28// return short.
29
30_CLC_DEF _CLC_OVERLOAD int isunordered(half x, half y){
31	return __builtin_isunordered(x, y);
32}
33
34_CLC_DEFINE_RELATIONAL_BINARY_VEC_ALL(short, isunordered, half, half)
35
36#endif
37