[Mesa-dev] [PATCH 03/14] i965/compaction: Rework 3-src compaction logic.

Kenneth Graunke kenneth at whitecape.org
Sat Aug 30 14:40:27 PDT 2014


On Thursday, August 28, 2014 08:10:33 PM Matt Turner wrote:
> It may be possible to create a contrived example in which a 3-src
> instruction would have been compacted on Gen < 8. I'd rather not
> discover it in the wild.
> ---
>  src/mesa/drivers/dri/i965/brw_eu_compact.c | 14 +++++++++-----
>  1 file changed, 9 insertions(+), 5 deletions(-)
> 
> diff --git a/src/mesa/drivers/dri/i965/brw_eu_compact.c b/src/mesa/drivers/dri/i965/brw_eu_compact.c
> index 4f509dd..8c30809 100644
> --- a/src/mesa/drivers/dri/i965/brw_eu_compact.c
> +++ b/src/mesa/drivers/dri/i965/brw_eu_compact.c
> @@ -749,11 +749,15 @@ brw_try_compact_instruction(struct brw_context *brw, brw_compact_inst *dst,
>        return false;
>     }
>  
> -   if (brw->gen >= 8 && is_3src(brw_inst_opcode(brw, src))) {
> -      memset(&temp, 0, sizeof(temp));
> -      if (brw_try_compact_3src_instruction(brw, &temp, src)) {
> -         *dst = temp;
> -         return true;
> +   if (is_3src(brw_inst_opcode(brw, src))) {
> +      if (brw->gen >= 8) {
> +         memset(&temp, 0, sizeof(temp));
> +         if (brw_try_compact_3src_instruction(brw, &temp, src)) {
> +            *dst = temp;
> +            return true;
> +         } else {
> +            return false;
> +         }
>        } else {
>           return false;
>        }
> 

I think this would be a little cleaner as:

   if (is_3src(brw_inst_opcode(brw, src))) {
      if (brw->gen >= 8) {
         memset(&temp, 0, sizeof(temp));
         if (brw_try_compact_3src_instruction(brw, &temp, src)) {
            *dst = temp;
            return true;
         }
      }
      return false;
   }

Less "else return false else return false".

Either way, patches 1-4 are:
Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20140830/4efe10e2/attachment.sig>


More information about the mesa-dev mailing list