1#include <clc/clc.h>
2#include "relational.h"
3
4_CLC_DEFINE_RELATIONAL_UNARY(int, isnan, __builtin_isnan, float)
5
6#ifdef cl_khr_fp64
7
8#pragma OPENCL EXTENSION cl_khr_fp64 : enable
9
10// The scalar version of isnan(double) returns an int, but the vector versions
11// return long.
12_CLC_DEF _CLC_OVERLOAD int isnan(double x) {
13  return __builtin_isnan(x);
14}
15
16_CLC_DEFINE_RELATIONAL_UNARY_VEC_ALL(long, isnan, double)
17
18#endif
19
20#ifdef cl_khr_fp16
21
22#pragma OPENCL EXTENSION cl_khr_fp16 : enable
23
24// The scalar version of isnan(half) returns an int, but the vector versions
25// return short.
26_CLC_DEF _CLC_OVERLOAD int isnan(half x) {
27  return __builtin_isnan(x);
28}
29
30_CLC_DEFINE_RELATIONAL_UNARY_VEC_ALL(short, isnan, half)
31
32#endif
33