i965: Use next_offset() in instruction compaction code.
authorMatt Turner <mattst88@gmail.com>
Sat, 17 May 2014 20:03:59 +0000 (13:03 -0700)
committerMatt Turner <mattst88@gmail.com>
Sun, 25 May 2014 06:03:23 +0000 (23:03 -0700)
Reviewed-by: Eric Anholt <eric@anholt.net>
src/mesa/drivers/dri/i965/brw_eu_compact.c

index 40d1fc23ec855c625507dd4c3d5ef08e5172bb54..f6f055fd5fa8fea2ce36a2c47a19d245d4483cd5 100644 (file)
@@ -765,11 +765,7 @@ brw_compact_instructions(struct brw_compile *p, int start_offset,
          break;
       }
 
-      if (insn->header.cmpt_control) {
-         offset += 8;
-      } else {
-         offset += 16;
-      }
+      offset = next_offset(store, offset);
    }
 
    /* p->nr_insn is counting the number of uncompacted instructions still, so
@@ -792,22 +788,12 @@ brw_compact_instructions(struct brw_compile *p, int start_offset,
          while (start_offset + old_ip[offset / 8] * 8 != annotation[i].offset) {
             assert(start_offset + old_ip[offset / 8] * 8 <
                    annotation[i].offset);
-            struct brw_instruction *insn = store + offset;
-            if (insn->header.cmpt_control) {
-               offset += 8;
-            } else {
-               offset += 16;
-            }
+            offset = next_offset(store, offset);
          }
 
          annotation[i].offset = start_offset + offset;
 
-         struct brw_instruction *insn = store + offset;
-         if (insn->header.cmpt_control) {
-            offset += 8;
-         } else {
-            offset += 16;
-         }
+         offset = next_offset(store, offset);
       }
 
       annotation[num_annotations].offset = p->next_insn_offset;