[clang][modules] Don't prevent translation of FW_Private includes when explicitly...
[llvm-project.git] / libclc / generic / lib / integer / clz.cl
blobe2080b5dd18ba6a22fb8b3a42973d13b9291b5ae
1 #include <clc/clc.h>
2 #include "../clcmacro.h"
4 _CLC_OVERLOAD _CLC_DEF char clz(char x) {
5 return clz((ushort)(uchar)x) - 8;
8 _CLC_OVERLOAD _CLC_DEF uchar clz(uchar x) {
9 return clz((ushort)x) - 8;
12 _CLC_OVERLOAD _CLC_DEF short clz(short x) {
13 return x ? __builtin_clzs(x) : 16;
16 _CLC_OVERLOAD _CLC_DEF ushort clz(ushort x) {
17 return x ? __builtin_clzs(x) : 16;
20 _CLC_OVERLOAD _CLC_DEF int clz(int x) {
21 return x ? __builtin_clz(x) : 32;
24 _CLC_OVERLOAD _CLC_DEF uint clz(uint x) {
25 return x ? __builtin_clz(x) : 32;
28 _CLC_OVERLOAD _CLC_DEF long clz(long x) {
29 return x ? __builtin_clzl(x) : 64;
32 _CLC_OVERLOAD _CLC_DEF ulong clz(ulong x) {
33 return x ? __builtin_clzl(x) : 64;
36 _CLC_UNARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, char, clz, char)
37 _CLC_UNARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, uchar, clz, uchar)
38 _CLC_UNARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, short, clz, short)
39 _CLC_UNARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, ushort, clz, ushort)
40 _CLC_UNARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, int, clz, int)
41 _CLC_UNARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, uint, clz, uint)
42 _CLC_UNARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, long, clz, long)
43 _CLC_UNARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, ulong, clz, ulong)