File tree Expand file tree Collapse file tree 8 files changed +46
-43
lines changed Expand file tree Collapse file tree 8 files changed +46
-43
lines changed Original file line number Diff line number Diff line change
1
+ #ifndef __CLC_INTEGER_CLC_ROTATE_H__
2
+ #define __CLC_INTEGER_CLC_ROTATE_H__
3
+
4
+ #define __CLC_FUNCTION __clc_rotate
5
+ #define __CLC_BODY <clc/shared/binary_decl.inc>
6
+
7
+ #include <clc/integer/gentype.inc>
8
+
9
+ #undef __CLC_BODY
10
+ #undef __CLC_FUNCTION
11
+
12
+ #endif // __CLC_INTEGER_CLC_ROTATE_H__
Original file line number Diff line number Diff line change 7
7
../generic/integer/clc_mul_hi.cl
8
8
../generic/integer/clc_popcount.cl
9
9
../generic/integer/clc_rhadd.cl
10
+ ../generic/integer/clc_rotate.cl
10
11
../generic/integer/clc_sub_sat.cl
11
12
../generic/integer/clc_upsample.cl
12
13
../generic/math/clc_ceil.cl
Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ integer/clc_mul24.cl
13
13
integer/clc_mul_hi.cl
14
14
integer/clc_popcount.cl
15
15
integer/clc_rhadd.cl
16
+ integer/clc_rotate.cl
16
17
integer/clc_sub_sat.cl
17
18
integer/clc_upsample.cl
18
19
math/clc_ceil.cl
Original file line number Diff line number Diff line change
1
+ #include <clc/internal/clc.h>
2
+ #include <clc/utils.h>
3
+
4
+ #define __CLC_BODY <clc_rotate.inc>
5
+ #include <clc/integer/gentype.inc>
Original file line number Diff line number Diff line change
1
+ #define __CLC_AS_GENTYPE (x ) __CLC_XCONCAT(__clc_as_, __CLC_GENTYPE)(x)
2
+ #define __CLC_AS_U_GENTYPE (x ) __CLC_XCONCAT(__clc_as_, __CLC_U_GENTYPE)(x)
3
+
4
+ // The rotate(A, B) builtin left-shifts corresponding to the usual OpenCL shift
5
+ // modulo rules. These rules state that A is left-shifted by the log2(N) least
6
+ // significant bits in B when viewed as an unsigned integer value. Thus we don't
7
+ // have to worry about signed shift amounts, and can perform the computation in
8
+ // unsigned types.
9
+ _CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE __clc_rotate (__CLC_GENTYPE x,
10
+ __CLC_GENTYPE n) {
11
+ __CLC_U_GENTYPE x_as_u = __CLC_AS_U_GENTYPE (x);
12
+ __CLC_U_GENTYPE mask = (__CLC_U_GENTYPE)(__CLC_GENSIZE - 1 );
13
+
14
+ __CLC_U_GENTYPE lshift_amt = __CLC_AS_U_GENTYPE (n) & mask;
15
+
16
+ __CLC_U_GENTYPE rshift_amt =
17
+ (((__CLC_U_GENTYPE)__CLC_GENSIZE - lshift_amt) & mask);
18
+
19
+ __CLC_U_GENTYPE result = (x_as_u << lshift_amt) | (x_as_u >> rshift_amt);
20
+
21
+ return __CLC_AS_GENTYPE (result);
22
+ }
Original file line number Diff line number Diff line change 11
11
../generic/integer/clc_mul_hi.cl
12
12
../generic/integer/clc_popcount.cl
13
13
../generic/integer/clc_rhadd.cl
14
+ ../generic/integer/clc_rotate.cl
14
15
../generic/integer/clc_sub_sat.cl
15
16
../generic/integer/clc_upsample.cl
16
17
../generic/math/clc_ceil.cl
Original file line number Diff line number Diff line change 1
1
#include <clc/clc.h>
2
+ #include <clc/integer/clc_rotate.h>
3
+
4
+ #define FUNCTION rotate
5
+ #define __CLC_BODY <clc/shared/binary_def.inc>
2
6
3
- #define __CLC_BODY <rotate.inc>
4
7
#include <clc/integer/gentype.inc>
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments