[docs] Update HowToReleaseLLVM documentation.
[llvm-project.git] / libclc / generic / include / clc / convert.h
blobf0ba796864d4dd6645582c802a3128f250ca46ed
1 #define _CLC_CONVERT_DECL(FROM_TYPE, TO_TYPE, SUFFIX) \
2 _CLC_OVERLOAD _CLC_DECL TO_TYPE convert_##TO_TYPE##SUFFIX(FROM_TYPE x);
4 #define _CLC_VECTOR_CONVERT_DECL(FROM_TYPE, TO_TYPE, SUFFIX) \
5 _CLC_CONVERT_DECL(FROM_TYPE, TO_TYPE, SUFFIX) \
6 _CLC_CONVERT_DECL(FROM_TYPE##2, TO_TYPE##2, SUFFIX) \
7 _CLC_CONVERT_DECL(FROM_TYPE##3, TO_TYPE##3, SUFFIX) \
8 _CLC_CONVERT_DECL(FROM_TYPE##4, TO_TYPE##4, SUFFIX) \
9 _CLC_CONVERT_DECL(FROM_TYPE##8, TO_TYPE##8, SUFFIX) \
10 _CLC_CONVERT_DECL(FROM_TYPE##16, TO_TYPE##16, SUFFIX)
12 #define _CLC_VECTOR_CONVERT_FROM1(FROM_TYPE, SUFFIX) \
13 _CLC_VECTOR_CONVERT_DECL(FROM_TYPE, char, SUFFIX) \
14 _CLC_VECTOR_CONVERT_DECL(FROM_TYPE, uchar, SUFFIX) \
15 _CLC_VECTOR_CONVERT_DECL(FROM_TYPE, int, SUFFIX) \
16 _CLC_VECTOR_CONVERT_DECL(FROM_TYPE, uint, SUFFIX) \
17 _CLC_VECTOR_CONVERT_DECL(FROM_TYPE, short, SUFFIX) \
18 _CLC_VECTOR_CONVERT_DECL(FROM_TYPE, ushort, SUFFIX) \
19 _CLC_VECTOR_CONVERT_DECL(FROM_TYPE, long, SUFFIX) \
20 _CLC_VECTOR_CONVERT_DECL(FROM_TYPE, ulong, SUFFIX) \
21 _CLC_VECTOR_CONVERT_DECL(FROM_TYPE, float, SUFFIX)
23 #ifdef cl_khr_fp64
24 #define _CLC_VECTOR_CONVERT_FROM(FROM_TYPE, SUFFIX) \
25 _CLC_VECTOR_CONVERT_FROM1(FROM_TYPE, SUFFIX) \
26 _CLC_VECTOR_CONVERT_DECL(FROM_TYPE, double, SUFFIX)
27 #else
28 #define _CLC_VECTOR_CONVERT_FROM(FROM_TYPE, SUFFIX) \
29 _CLC_VECTOR_CONVERT_FROM1(FROM_TYPE, SUFFIX)
30 #endif
32 #define _CLC_VECTOR_CONVERT_TO1(SUFFIX) \
33 _CLC_VECTOR_CONVERT_FROM(char, SUFFIX) \
34 _CLC_VECTOR_CONVERT_FROM(uchar, SUFFIX) \
35 _CLC_VECTOR_CONVERT_FROM(int, SUFFIX) \
36 _CLC_VECTOR_CONVERT_FROM(uint, SUFFIX) \
37 _CLC_VECTOR_CONVERT_FROM(short, SUFFIX) \
38 _CLC_VECTOR_CONVERT_FROM(ushort, SUFFIX) \
39 _CLC_VECTOR_CONVERT_FROM(long, SUFFIX) \
40 _CLC_VECTOR_CONVERT_FROM(ulong, SUFFIX) \
41 _CLC_VECTOR_CONVERT_FROM(float, SUFFIX)
43 #ifdef cl_khr_fp64
44 #define _CLC_VECTOR_CONVERT_TO(SUFFIX) \
45 _CLC_VECTOR_CONVERT_TO1(SUFFIX) \
46 _CLC_VECTOR_CONVERT_FROM(double, SUFFIX)
47 #else
48 #define _CLC_VECTOR_CONVERT_TO(SUFFIX) \
49 _CLC_VECTOR_CONVERT_TO1(SUFFIX)
50 #endif
52 #define _CLC_VECTOR_CONVERT_TO_SUFFIX(ROUND) \
53 _CLC_VECTOR_CONVERT_TO(_sat##ROUND) \
54 _CLC_VECTOR_CONVERT_TO(ROUND)
56 _CLC_VECTOR_CONVERT_TO_SUFFIX(_rtn)
57 _CLC_VECTOR_CONVERT_TO_SUFFIX(_rte)
58 _CLC_VECTOR_CONVERT_TO_SUFFIX(_rtz)
59 _CLC_VECTOR_CONVERT_TO_SUFFIX(_rtp)
60 _CLC_VECTOR_CONVERT_TO_SUFFIX()