i965: Set JumpCount, not JIP, on ENDIF on Gen 6.
authorMatt Turner <mattst88@gmail.com>
Thu, 28 Aug 2014 20:34:22 +0000 (13:34 -0700)
committerMatt Turner <mattst88@gmail.com>
Thu, 25 Sep 2014 18:02:36 +0000 (11:02 -0700)
Despite what the Sandybridge PRM says, ENDIF has Jump Count in <dst>,
not JIP in <src1>. (The same mistake appears about WHILE as well).

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

index 39f94e960592e26bdbcc5616bab0a075d616d2e3..937257b20a520641b1b4f29142e8869921d9b4e2 100644 (file)
@@ -2557,12 +2557,15 @@ brw_set_uip_jip(struct brw_compile *p)
          assert(brw_inst_jip(brw, insn) != 0);
         break;
 
-      case BRW_OPCODE_ENDIF:
-         if (block_end_offset == 0)
-            brw_inst_set_jip(brw, insn, 1 * br);
+      case BRW_OPCODE_ENDIF: {
+         int32_t jump = (block_end_offset == 0) ?
+                        1 * br : (block_end_offset - offset) / scale;
+         if (brw->gen >= 7)
+            brw_inst_set_jip(brw, insn, jump);
          else
-            brw_inst_set_jip(brw, insn, (block_end_offset - offset) / scale);
+            brw_inst_set_gen6_jump_count(brw, insn, jump);
         break;
+      }
 
       case BRW_OPCODE_HALT:
         /* From the Sandy Bridge PRM (volume 4, part 2, section 8.3.19):