[Beignet] [PATCH] add 64-bit version of "rotate"

Zhigang Gong zhigang.gong at linux.intel.com
Tue Sep 3 00:57:41 PDT 2013


LGTM, thanks.

On Tue, Sep 03, 2013 at 08:20:35AM +0800, Homer Hsing wrote:
> tested by piglit. following test cases pass.
>  piglit/framework/../bin/cl-program-tester generated_tests/cl/builtin/int/builtin-long-rotate-1.0.generated.cl
>  piglit/framework/../bin/cl-program-tester generated_tests/cl/builtin/int/builtin-ulong-rotate-1.0.generated.cl
> 
> Signed-off-by: Homer Hsing <homer.xing at intel.com>
> ---
>  backend/src/ocl_stdlib.tmpl.h | 10 ++++------
>  1 file changed, 4 insertions(+), 6 deletions(-)
> 
> diff --git a/backend/src/ocl_stdlib.tmpl.h b/backend/src/ocl_stdlib.tmpl.h
> index f209b52..6bf28ac 100644
> --- a/backend/src/ocl_stdlib.tmpl.h
> +++ b/backend/src/ocl_stdlib.tmpl.h
> @@ -430,6 +430,8 @@ INLINE_OVERLOADABLE ushort __rotate_left(ushort x, ushort y) { return (x << y) |
>  INLINE_OVERLOADABLE short __rotate_left(short x, short y) { return __rotate_left((ushort)x, (ushort)y); }
>  INLINE_OVERLOADABLE uint __rotate_left(uint x, uint y) { return (x << y) | (x >> (32 - y)); }
>  INLINE_OVERLOADABLE int __rotate_left(int x, int y) { return __rotate_left((uint)x, (uint)y); }
> +INLINE_OVERLOADABLE ulong __rotate_left(ulong x, ulong y) { return (x << y) | (x >> (64 - y)); }
> +INLINE_OVERLOADABLE long __rotate_left(long x, long y) { return __rotate_left((ulong)x, (ulong)y); }
>  #define DEF(type, m) INLINE_OVERLOADABLE type rotate(type x, type y) { return __rotate_left(x, (type)(y & m)); }
>  DEF(char, 7)
>  DEF(uchar, 7)
> @@ -437,13 +439,9 @@ DEF(short, 15)
>  DEF(ushort, 15)
>  DEF(int, 31)
>  DEF(uint, 31)
> +DEF(long, 63)
> +DEF(ulong, 63)
>  #undef DEF
> -INLINE_OVERLOADABLE long rotate(long x, long y) {
> -  return 0;
> -}
> -INLINE_OVERLOADABLE ulong rotate(ulong x, ulong y) {
> -  return 0;
> -}
>  
>  OVERLOADABLE short __gen_ocl_upsample(short hi, short lo);
>  OVERLOADABLE int __gen_ocl_upsample(int hi, int lo);
> -- 
> 1.8.1.2
> 
> _______________________________________________
> Beignet mailing list
> Beignet at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/beignet


More information about the Beignet mailing list