i965: Add EU emit support for gen6's new IF instruction with comparison.
authorEric Anholt <eric@anholt.net>
Tue, 19 Oct 2010 19:55:04 +0000 (12:55 -0700)
committerEric Anholt <eric@anholt.net>
Wed, 20 Oct 2010 04:17:55 +0000 (21:17 -0700)
src/mesa/drivers/dri/i965/brw_eu.h
src/mesa/drivers/dri/i965/brw_eu_emit.c

index 7cac4a72e4ae3047307d67f2e978b7038c680cb3..8ffa7c760acbadc33edbc6d3da8f3807ea8087b3 100644 (file)
@@ -927,6 +927,8 @@ void brw_dp_WRITE_16( struct brw_compile *p,
  */
 struct brw_instruction *brw_IF(struct brw_compile *p, 
                               GLuint execute_size);
+struct brw_instruction *brw_IF_gen6(struct brw_compile *p, uint32_t conditional,
+                                   struct brw_reg src0, struct brw_reg src1);
 
 struct brw_instruction *brw_ELSE(struct brw_compile *p, 
                                 struct brw_instruction *if_insn);
index a1fead0a4fac06431fcb40dff7a4f7e70299a8b8..734892494c20fe377ff1645c512b82107e4c1adf 100644 (file)
@@ -831,6 +831,7 @@ struct brw_instruction *brw_IF(struct brw_compile *p, GLuint execute_size)
       brw_set_src1(insn, brw_imm_d(0x0));
    } else {
       brw_set_dest(insn, brw_imm_w(0));
+      insn->bits1.branch_gen6.jump_count = 0;
       brw_set_src0(insn, brw_null_reg());
       brw_set_src1(insn, brw_null_reg());
    }
@@ -847,6 +848,29 @@ struct brw_instruction *brw_IF(struct brw_compile *p, GLuint execute_size)
    return insn;
 }
 
+struct brw_instruction *
+brw_IF_gen6(struct brw_compile *p, uint32_t conditional,
+           struct brw_reg src0, struct brw_reg src1)
+{
+   struct brw_instruction *insn;
+
+   insn = next_insn(p, BRW_OPCODE_IF);
+
+   brw_set_dest(insn, brw_imm_w(0));
+   insn->header.execution_size = BRW_EXECUTE_8;
+   insn->bits1.branch_gen6.jump_count = 0;
+   brw_set_src0(insn, src0);
+   brw_set_src1(insn, src1);
+
+   assert(insn->header.compression_control == BRW_COMPRESSION_NONE);
+   assert(insn->header.predicate_control == BRW_PREDICATE_NONE);
+   insn->header.destreg__conditionalmod = conditional;
+
+   if (!p->single_program_flow)
+       insn->header.thread_control = BRW_THREAD_SWITCH;
+
+   return insn;
+}
 
 struct brw_instruction *brw_ELSE(struct brw_compile *p, 
                                 struct brw_instruction *if_insn)
@@ -872,6 +896,7 @@ struct brw_instruction *brw_ELSE(struct brw_compile *p,
       brw_set_src1(insn, brw_imm_d(0x0));
    } else {
       brw_set_dest(insn, brw_imm_w(0));
+      insn->bits1.branch_gen6.jump_count = 0;
       brw_set_src0(insn, brw_null_reg());
       brw_set_src1(insn, brw_null_reg());
    }
@@ -940,7 +965,10 @@ void brw_ENDIF(struct brw_compile *p,
       insn->header.mask_control = BRW_MASK_ENABLE;
       insn->header.thread_control = BRW_THREAD_SWITCH;
 
-      assert(patch_insn->bits3.if_else.jump_count == 0);
+      if (intel->gen < 6)
+        assert(patch_insn->bits3.if_else.jump_count == 0);
+      else
+        assert(patch_insn->bits1.branch_gen6.jump_count == 0);
 
       /* Patch the if or else instructions to point at this or the next
        * instruction respectively.