[Mesa-dev] [PATCH 08/11] intel/compiler: fix brw_negate_immediate for 16-bit types

Jason Ekstrand jason at jlekstrand.net
Tue Apr 24 21:55:20 UTC 2018


On Wed, Apr 11, 2018 at 12:20 AM, Iago Toral Quiroga <itoral at igalia.com>
wrote:

> From: Jose Maria Casanova Crespo <jmcasanova at igalia.com>
>
> 16-bit immediates are replicated in each word of a 32-bit value
> so we need to negate both.
> ---
>  src/intel/compiler/brw_shader.cpp | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/src/intel/compiler/brw_shader.cpp b/src/intel/compiler/brw_
> shader.cpp
> index 9cdf9fcb23d..c7edc60b63d 100644
> --- a/src/intel/compiler/brw_shader.cpp
> +++ b/src/intel/compiler/brw_shader.cpp
> @@ -581,7 +581,8 @@ brw_negate_immediate(enum brw_reg_type type, struct
> brw_reg *reg)
>        return true;
>     case BRW_REGISTER_TYPE_W:
>     case BRW_REGISTER_TYPE_UW:
> -      reg->d = -(int16_t)reg->ud;
> +   case BRW_REGISTER_TYPE_HF:
> +      reg->ud ^= 0x80008000;
>

This is not correct for integers.  We need to keep two separate cases.


>        return true;
>     case BRW_REGISTER_TYPE_F:
>        reg->f = -reg->f;
> @@ -602,8 +603,6 @@ brw_negate_immediate(enum brw_reg_type type, struct
> brw_reg *reg)
>     case BRW_REGISTER_TYPE_UV:
>     case BRW_REGISTER_TYPE_V:
>        assert(!"unimplemented: negate UV/V immediate");
> -   case BRW_REGISTER_TYPE_HF:
> -      assert(!"unimplemented: negate HF immediate");
>     case BRW_REGISTER_TYPE_NF:
>        unreachable("no NF immediates");
>     }
> --
> 2.14.1
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20180424/900a7122/attachment.html>


More information about the mesa-dev mailing list