[Libclc-dev] [PATCH 1/1] select: simplify implementation and fix fp16
Jeroen Ketema via Libclc-dev
libclc-dev at lists.llvm.org
Fri Apr 6 14:01:41 PDT 2018
LGTM!
Thanks.
Jeroen
> On 6 Apr 2018, at 20:38, Jan Vesely <jan.vesely at rutgers.edu> wrote:
>
> Fix half precision implementation
> Vector ?: operator should behave exactly as select
> Passes CTS on carrizo
>
> Signed-off-by: Jan Vesely <jan.vesely at rutgers.edu>
> ---
> the select test segfaults at the end, but I don't think that's related
> to libclc.
>
> generic/lib/relational/select.inc | 22 ++++------------------
> 1 file changed, 4 insertions(+), 18 deletions(-)
>
> diff --git a/generic/lib/relational/select.inc b/generic/lib/relational/select.inc
> index a9790d1..7691af2 100644
> --- a/generic/lib/relational/select.inc
> +++ b/generic/lib/relational/select.inc
> @@ -9,39 +9,25 @@
> #define __CLC_S_GENTYPE __CLC_XCONCAT(int, __CLC_VECSIZE)
> #define __CLC_U_GENTYPE __CLC_XCONCAT(uint, __CLC_VECSIZE)
> #elif __CLC_FPSIZE == 16
> -#define __CLC_S_GENTYPE __CLC_XCONCAT(char, __CLC_VECSIZE)
> -#define __CLC_U_GENTYPE __CLC_XCONCAT(uchar, __CLC_VECSIZE)
> -#endif
> -#ifdef __CLC_FPSIZE
> -#define __CLC_GENSIZE __CLC_FPSIZE
> +#define __CLC_S_GENTYPE __CLC_XCONCAT(short, __CLC_VECSIZE)
> +#define __CLC_U_GENTYPE __CLC_XCONCAT(ushort, __CLC_VECSIZE)
> #endif
>
> -#define __CLC_AS_S_GENTYPE __CLC_XCONCAT(as_, __CLC_S_GENTYPE)
> -#define __CLC_AS_GENTYPE __CLC_XCONCAT(as_, __CLC_GENTYPE)
> -
> _CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE select(__CLC_GENTYPE x, __CLC_GENTYPE y, __CLC_S_GENTYPE z)
> {
> -#ifdef __CLC_SCALAR
> return z ? y : x;
> -#else
> - __CLC_S_GENTYPE bitmask = z >> (__CLC_GENSIZE - 1);
> - return __CLC_AS_GENTYPE(bitselect(__CLC_AS_S_GENTYPE(x), __CLC_AS_S_GENTYPE(y), bitmask));
> -#endif
> }
>
> _CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE select(__CLC_GENTYPE x, __CLC_GENTYPE y, __CLC_U_GENTYPE z)
> {
> - return select(x, y, __CLC_AS_S_GENTYPE(z));
> + return z ? y : x;
> }
>
> -#undef __CLC_AS_S_GENTYPE
> -#undef __CLC_AS_GENTYPE
> -
> #ifdef __CLC_FPSIZE
> #undef __CLC_S_GENTYPE
> #undef __CLC_U_GENTYPE
> -#undef __CLC_GENSIZE
> #endif
> +
> #ifdef __CLC_SCALAR
> #undef __CLC_VECSIZE
> #endif
> --
> 2.14.3
>
More information about the Libclc-dev
mailing list