[Beignet] [PATCH] fix 8-bit version of "clz"

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


LGTM, thanks.

On Mon, Sep 02, 2013 at 04:21:25PM +0800, Homer Hsing wrote:
> fix a typo in ocl_stdlib.tmpl.h
> fix instruction type of 8-bit moving
> 
> this patch is tested by piglit
> following two test cases has passed:
>   piglit/framework/../bin/cl-program-tester generated_tests/cl/builtin/int/builtin-char-clz-1.0.generated.cl
>   piglit/framework/../bin/cl-program-tester generated_tests/cl/builtin/int/builtin-uchar-clz-1.0.generated.cl
> 
> Signed-off-by: Homer Hsing <homer.xing at intel.com>
> ---
>  backend/src/backend/gen_insn_selection.cpp | 2 +-
>  backend/src/ocl_stdlib.tmpl.h              | 4 ++--
>  2 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/backend/src/backend/gen_insn_selection.cpp b/backend/src/backend/gen_insn_selection.cpp
> index 94d0993..b417024 100644
> --- a/backend/src/backend/gen_insn_selection.cpp
> +++ b/backend/src/backend/gen_insn_selection.cpp
> @@ -1387,7 +1387,7 @@ namespace gbe
>    DECL_PATTERN(UnaryInstruction)
>    {
>      static ir::Type getType(const ir::Opcode opcode, const ir::Type insnType) {
> -      if (insnType == ir::TYPE_S64 || insnType == ir::TYPE_U64)
> +      if (insnType == ir::TYPE_S64 || insnType == ir::TYPE_U64 || insnType == ir::TYPE_S8 || insnType == ir::TYPE_U8)
>          return insnType;
>        if (opcode == ir::OP_FBH || opcode == ir::OP_FBL)
>          return ir::TYPE_U32;
> diff --git a/backend/src/ocl_stdlib.tmpl.h b/backend/src/ocl_stdlib.tmpl.h
> index a7b63ca..0a6a937 100644
> --- a/backend/src/ocl_stdlib.tmpl.h
> +++ b/backend/src/ocl_stdlib.tmpl.h
> @@ -275,13 +275,13 @@ INLINE_OVERLOADABLE char clz(char x) {
>      return 0;
>    if (x == 0)
>      return 8;
> -  return __gen_ocl_fbl(x) - 24;
> +  return __gen_ocl_fbh(x) - 24;
>  }
>  
>  INLINE_OVERLOADABLE uchar clz(uchar x) {
>    if (x == 0)
>      return 8;
> -  return __gen_ocl_fbl(x) - 24;
> +  return __gen_ocl_fbh(x) - 24;
>  }
>  
>  INLINE_OVERLOADABLE short clz(short x) {
> -- 
> 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