[Beignet] [Patch V2] Enable built-in sub_sat/add_sat vector type.

Song, Ruiling ruiling.song at intel.com
Mon Jun 3 23:00:55 PDT 2013


Good. I will send a new patch.

-----Original Message-----
From: Zhigang Gong [mailto:zhigang.gong at linux.intel.com] 
Sent: Tuesday, June 04, 2013 1:58 PM
To: Song, Ruiling
Cc: beignet at lists.freedesktop.org
Subject: Re: [Beignet] [Patch V2] Enable built-in sub_sat/add_sat vector type.

One minor comment as below:

On Mon, Jun 03, 2013 at 12:31:49PM +0800, Ruiling Song wrote:
> also fix a typo in DECL_VECTOR_20P, DECL_VECTOR_30P macro.
> 
> Signed-off-by: Ruiling Song <ruiling.song at intel.com>
> ---
>  backend/src/ocl_stdlib.h |   23 ++++++++++++++++++++---
>  1 file changed, 20 insertions(+), 3 deletions(-)
> 
> diff --git a/backend/src/ocl_stdlib.h b/backend/src/ocl_stdlib.h index 
> 613b844..dfba0ba 100644
> --- a/backend/src/ocl_stdlib.h
> +++ b/backend/src/ocl_stdlib.h
> @@ -921,7 +921,7 @@ DECL_VECTOR_1OP(__gen_ocl_internal_erfc, float);
>  
>  #define DECL_VECTOR_2OP(NAME, TYPE) \
>    INLINE OVERLOADABLE TYPE##2 NAME(TYPE##2 v0, TYPE##2 v1) { \
> -    return (TYPE##2)(NAME(v0.x, v1.x), NAME(v1.y, v1.y)); \
> +    return (TYPE##2)(NAME(v0.x, v1.x), NAME(v0.y, v1.y)); \
>    }\
>    INLINE OVERLOADABLE TYPE##3 NAME(TYPE##3 v0, TYPE##3 v1) { \
>      return (TYPE##3)(NAME(v0.x, v1.x), NAME(v0.y, v1.y), NAME(v0.z, 
> v1.z)); \ @@ -954,11 +954,28 @@ DECL_VECTOR_2OP(native_divide, float);  
> DECL_VECTOR_2OP(copysign, float);  
> DECL_VECTOR_2OP(__gen_ocl_internal_maxmag, float);  
> DECL_VECTOR_2OP(__gen_ocl_internal_minmag, float);
> +
> +DECL_VECTOR_2OP(add_sat, char);
> +DECL_VECTOR_2OP(add_sat, short);
> +DECL_VECTOR_2OP(add_sat, int);
> +DECL_VECTOR_2OP(add_sat, long);
> +DECL_VECTOR_2OP(sub_sat, char);
> +DECL_VECTOR_2OP(sub_sat, short);
> +DECL_VECTOR_2OP(sub_sat, int);
> +DECL_VECTOR_2OP(sub_sat, long);
> +DECL_VECTOR_2OP(add_sat, uchar);
> +DECL_VECTOR_2OP(add_sat, ushort);
> +DECL_VECTOR_2OP(add_sat, uint);
> +DECL_VECTOR_2OP(add_sat, ulong);
> +DECL_VECTOR_2OP(sub_sat, uchar);
> +DECL_VECTOR_2OP(sub_sat, ushort);
> +DECL_VECTOR_2OP(sub_sat, uint);
> +DECL_VECTOR_2OP(sub_sat, ulong);
how about to use the following style macros?
#define DECL_VECTOR_NOP_ALL_INT_TYPES(NOP, NAME) \ NOP(NAME, char);\ NOP(NAME, uchar);\ NOP(NAME, short);\ NOP(NAME, ushort);\ NOP(NAME, int);\ NOP(NAME, uint);\ NOP(NAME, long);\ NOP(NAME, ulong);

DECL_VECTOR_NOP_ALL_INT_TYPES(DECL_VECTOR_2OP, add_sat); DECL_VECTOR_NOP_ALL_INT_TYPES(DECL_VECTOR_2OP, sub_sat); #undef DECL_VECTOR_NOP_ALL_INT_TYPES

The other parts are just fine for me.
>  #undef DECL_VECTOR_2OP
>  
>  #define DECL_VECTOR_2OP(NAME, TYPE, TYPE2) \
>    INLINE OVERLOADABLE TYPE##2 NAME(TYPE##2 v0, TYPE2##2 v1) { \
> -    return (TYPE##2)(NAME(v0.x, v1.x), NAME(v1.y, v1.y)); \
> +    return (TYPE##2)(NAME(v0.x, v1.x), NAME(v0.y, v1.y)); \
>    }\
>    INLINE OVERLOADABLE TYPE##3 NAME(TYPE##3 v0, TYPE2##3 v1) { \
>      return (TYPE##3)(NAME(v0.x, v1.x), NAME(v0.y, v1.y), NAME(v0.z, 
> v1.z)); \ @@ -985,7 +1002,7 @@ DECL_VECTOR_2OP(rootn, float, int);
>  
>  #define DECL_VECTOR_3OP(NAME, TYPE) \
>    INLINE OVERLOADABLE TYPE##2 NAME(TYPE##2 v0, TYPE##2 v1, TYPE##2 v2) { \
> -    return (TYPE##2)(NAME(v0.x, v1.x, v2.x), NAME(v1.y, v1.y, v2.y)); \
> +    return (TYPE##2)(NAME(v0.x, v1.x, v2.x), NAME(v0.y, v1.y, v2.y)); 
> + \
>    }\
>    INLINE OVERLOADABLE TYPE##3 NAME(TYPE##3 v0, TYPE##3 v1, TYPE##3 v2) { \
>      return (TYPE##3)(NAME(v0.x, v1.x, v2.x), NAME(v0.y, v1.y, v2.y), 
> NAME(v0.z, v1.z, v2.z)); \
> --
> 1.7.9.5
> 
> _______________________________________________
> Beignet mailing list
> Beignet at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/beignet


More information about the Beignet mailing list