|
6 | 6 | // |
7 | 7 | //===----------------------------------------------------------------------===// |
8 | 8 |
|
9 | | -#include <clc/clcmacro.h> |
| 9 | +#include <clc/integer/clc_clz.h> |
10 | 10 | #include <libspirv/spirv.h> |
11 | 11 |
|
12 | | -_CLC_OVERLOAD _CLC_DEF char __spirv_ocl_clz(char x) { |
13 | | - return __spirv_ocl_clz((ushort)(uchar)x) - 8; |
14 | | -} |
| 12 | +#define FUNCTION __spirv_ocl_clz |
| 13 | +#define __CLC_FUNCTION(x) __clc_clz |
| 14 | +#define __CLC_BODY <clc/shared/unary_def.inc> |
15 | 15 |
|
16 | | -_CLC_OVERLOAD _CLC_DEF uchar __spirv_ocl_clz(uchar x) { |
17 | | - return __spirv_ocl_clz((ushort)x) - 8; |
18 | | -} |
19 | | - |
20 | | -_CLC_OVERLOAD _CLC_DEF short __spirv_ocl_clz(short x) { |
21 | | - return x ? __builtin_clzs(x) : 16; |
22 | | -} |
23 | | - |
24 | | -_CLC_OVERLOAD _CLC_DEF ushort __spirv_ocl_clz(ushort x) { |
25 | | - return x ? __builtin_clzs(x) : 16; |
26 | | -} |
27 | | - |
28 | | -_CLC_OVERLOAD _CLC_DEF int __spirv_ocl_clz(int x) { |
29 | | - return x ? __builtin_clz(x) : 32; |
30 | | -} |
31 | | - |
32 | | -_CLC_OVERLOAD _CLC_DEF uint __spirv_ocl_clz(uint x) { |
33 | | - return x ? __builtin_clz(x) : 32; |
34 | | -} |
35 | | - |
36 | | -_CLC_OVERLOAD _CLC_DEF long __spirv_ocl_clz(long x) { |
37 | | - return x ? __builtin_clzl(x) : 64; |
38 | | -} |
39 | | - |
40 | | -_CLC_OVERLOAD _CLC_DEF ulong __spirv_ocl_clz(ulong x) { |
41 | | - return x ? __builtin_clzl(x) : 64; |
42 | | -} |
43 | | - |
44 | | -_CLC_UNARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, char, __spirv_ocl_clz, char) |
45 | | -_CLC_UNARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, uchar, __spirv_ocl_clz, uchar) |
46 | | -_CLC_UNARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, short, __spirv_ocl_clz, short) |
47 | | -_CLC_UNARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, ushort, __spirv_ocl_clz, ushort) |
48 | | -_CLC_UNARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, int, __spirv_ocl_clz, int) |
49 | | -_CLC_UNARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, uint, __spirv_ocl_clz, uint) |
50 | | -_CLC_UNARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, long, __spirv_ocl_clz, long) |
51 | | -_CLC_UNARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, ulong, __spirv_ocl_clz, ulong) |
| 16 | +#include <clc/integer/gentype.inc> |
0 commit comments