Merge pull request #88 from THU-DSP-LAB/ctz
[VENTUS][fix] Add ctz function implementation
This commit is contained in:
commit
5b0ffc2cfa
|
@ -142,6 +142,7 @@
|
|||
#include <clc/integer/abs_diff.h>
|
||||
#include <clc/integer/add_sat.h>
|
||||
#include <clc/integer/clz.h>
|
||||
#include <clc/integer/ctz.h>
|
||||
#include <clc/integer/hadd.h>
|
||||
#include <clc/integer/mad24.h>
|
||||
#include <clc/integer/mad_hi.h>
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
#define __CLC_BODY <clc/integer/ctz.inc>
|
||||
#include <clc/integer/gentype.inc>
|
|
@ -0,0 +1 @@
|
|||
_CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE ctz(__CLC_GENTYPE x);
|
|
@ -67,6 +67,7 @@ integer/abs.cl
|
|||
integer/abs_diff.cl
|
||||
integer/add_sat.cl
|
||||
integer/clz.cl
|
||||
integer/ctz.cl
|
||||
integer/hadd.cl
|
||||
integer/mad24.cl
|
||||
integer/mad_sat.cl
|
||||
|
|
|
@ -0,0 +1,42 @@
|
|||
#include <clc/clc.h>
|
||||
#include "../clcmacro.h"
|
||||
|
||||
_CLC_OVERLOAD _CLC_DEF char ctz(char x) {
|
||||
return x ? ctz((ushort)(uchar)x) : 8;
|
||||
}
|
||||
_CLC_OVERLOAD _CLC_DEF uchar ctz(uchar x) {
|
||||
return x ? ctz((ushort)x) : 8;
|
||||
}
|
||||
|
||||
_CLC_OVERLOAD _CLC_DEF short ctz(short x) {
|
||||
return x ? __builtin_ctzs(x) : 16;
|
||||
}
|
||||
|
||||
_CLC_OVERLOAD _CLC_DEF ushort ctz(ushort x) {
|
||||
return x ? __builtin_ctzs(x) : 16;
|
||||
}
|
||||
|
||||
_CLC_OVERLOAD _CLC_DEF int ctz(int x) {
|
||||
return x ? __builtin_ctz(x) : 32;
|
||||
}
|
||||
|
||||
_CLC_OVERLOAD _CLC_DEF uint ctz(uint x) {
|
||||
return x ? __builtin_ctz(x) : 32;
|
||||
}
|
||||
|
||||
_CLC_OVERLOAD _CLC_DEF long ctz(long x) {
|
||||
return x ? __builtin_ctzl(x) : 64;
|
||||
}
|
||||
|
||||
_CLC_OVERLOAD _CLC_DEF ulong ctz(ulong x) {
|
||||
return x ? __builtin_ctzl(x) : 64;
|
||||
}
|
||||
|
||||
_CLC_UNARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, char, ctz, char)
|
||||
_CLC_UNARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, uchar, ctz, uchar)
|
||||
_CLC_UNARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, short, ctz, short)
|
||||
_CLC_UNARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, ushort, ctz, ushort)
|
||||
_CLC_UNARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, int, ctz, int)
|
||||
_CLC_UNARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, uint, ctz, uint)
|
||||
_CLC_UNARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, long, ctz, long)
|
||||
_CLC_UNARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, ulong, ctz, ulong)
|
Loading…
Reference in New Issue