i965/compaction: Rework 3-src compaction logic.
authorMatt Turner <mattst88@gmail.com>
Thu, 28 Aug 2014 02:44:02 +0000 (19:44 -0700)
committerMatt Turner <mattst88@gmail.com>
Thu, 25 Sep 2014 18:02:36 +0000 (11:02 -0700)
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.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
src/mesa/drivers/dri/i965/brw_eu_compact.c

index 4f509dde135c4c4a0fe2c7e487a763e4ec04b911..8c30809f1d580a59af454c61b38df078e61bf82d 100644 (file)
@@ -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;
       }