[Mesa-dev] [PATCH 1/9] i965: Remove the dst and src0 parameters from brw_JMPI.

Kenneth Graunke kenneth at whitecape.org
Fri May 30 20:09:10 PDT 2014


In all cases, we set both dst and src0 to brw_ip_reg().  This is no
accident: according to the ISA reference, both are required to be the IP
register.  So, we may as well drop the parameters.

Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
---
 src/mesa/drivers/dri/i965/brw_eu.h      |  3 +--
 src/mesa/drivers/dri/i965/brw_eu_emit.c |  7 +++----
 src/mesa/drivers/dri/i965/brw_sf_emit.c | 19 ++++++++-----------
 3 files changed, 12 insertions(+), 17 deletions(-)

This series is available as 'euclean-v3' in my tree.  I ran Piglit on both
Haswell and Crestline (GM965) - no regressions.  I also diffed the assembly
generated during a Piglit run on Crestline - no changes.

diff --git a/src/mesa/drivers/dri/i965/brw_eu.h b/src/mesa/drivers/dri/i965/brw_eu.h
index ce78c6b..fb64bc5 100644
--- a/src/mesa/drivers/dri/i965/brw_eu.h
+++ b/src/mesa/drivers/dri/i965/brw_eu.h
@@ -152,7 +152,6 @@ ALU2(SHL)
 ALU2(ASR)
 ALU1(F32TO16)
 ALU1(F16TO32)
-ALU2(JMPI)
 ALU2(ADD)
 ALU2(AVG)
 ALU2(MUL)
@@ -336,7 +335,7 @@ struct brw_instruction *brw_CONT(struct brw_compile *p);
 struct brw_instruction *gen6_CONT(struct brw_compile *p);
 struct brw_instruction *gen6_HALT(struct brw_compile *p);
 
-
+struct brw_instruction *brw_JMPI(struct brw_compile *p, struct brw_reg index);
 
 void brw_NOP(struct brw_compile *p);
 
diff --git a/src/mesa/drivers/dri/i965/brw_eu_emit.c b/src/mesa/drivers/dri/i965/brw_eu_emit.c
index 2fa65e9..9178888 100644
--- a/src/mesa/drivers/dri/i965/brw_eu_emit.c
+++ b/src/mesa/drivers/dri/i965/brw_eu_emit.c
@@ -1189,11 +1189,10 @@ void brw_NOP(struct brw_compile *p)
  */
 
 struct brw_instruction *brw_JMPI(struct brw_compile *p,
-                                 struct brw_reg dest,
-                                 struct brw_reg src0,
-                                 struct brw_reg src1)
+                                 struct brw_reg index)
 {
-   struct brw_instruction *insn = brw_alu2(p, BRW_OPCODE_JMPI, dest, src0, src1);
+   struct brw_reg ip = brw_ip_reg();
+   struct brw_instruction *insn = brw_alu2(p, BRW_OPCODE_JMPI, ip, ip, index);
 
    insn->header.execution_size = 1;
    insn->header.compression_control = BRW_COMPRESSION_NONE;
diff --git a/src/mesa/drivers/dri/i965/brw_sf_emit.c b/src/mesa/drivers/dri/i965/brw_sf_emit.c
index 01c734e..d8180a2 100644
--- a/src/mesa/drivers/dri/i965/brw_sf_emit.c
+++ b/src/mesa/drivers/dri/i965/brw_sf_emit.c
@@ -193,7 +193,6 @@ static void do_flatshade_triangle( struct brw_sf_compile *c )
 {
    struct brw_compile *p = &c->func;
    struct brw_context *brw = p->brw;
-   struct brw_reg ip = brw_ip_reg();
    GLuint nr;
    GLuint jmpi = 1;
 
@@ -208,15 +207,15 @@ static void do_flatshade_triangle( struct brw_sf_compile *c )
    nr = count_flatshaded_attributes(c);
 
    brw_MUL(p, c->pv, c->pv, brw_imm_d(jmpi*(nr*2+1)));
-   brw_JMPI(p, ip, ip, c->pv);
+   brw_JMPI(p, c->pv);
 
    copy_flatshaded_attributes(c, c->vert[1], c->vert[0]);
    copy_flatshaded_attributes(c, c->vert[2], c->vert[0]);
-   brw_JMPI(p, ip, ip, brw_imm_d(jmpi*(nr*4+1)));
+   brw_JMPI(p, brw_imm_d(jmpi*(nr*4+1)));
 
    copy_flatshaded_attributes(c, c->vert[0], c->vert[1]);
    copy_flatshaded_attributes(c, c->vert[2], c->vert[1]);
-   brw_JMPI(p, ip, ip, brw_imm_d(jmpi*nr*2));
+   brw_JMPI(p, brw_imm_d(jmpi*nr*2));
 
    copy_flatshaded_attributes(c, c->vert[0], c->vert[2]);
    copy_flatshaded_attributes(c, c->vert[1], c->vert[2]);
@@ -227,7 +226,6 @@ static void do_flatshade_line( struct brw_sf_compile *c )
 {
    struct brw_compile *p = &c->func;
    struct brw_context *brw = p->brw;
-   struct brw_reg ip = brw_ip_reg();
    GLuint nr;
    GLuint jmpi = 1;
 
@@ -242,10 +240,10 @@ static void do_flatshade_line( struct brw_sf_compile *c )
    nr = count_flatshaded_attributes(c);
 
    brw_MUL(p, c->pv, c->pv, brw_imm_d(jmpi*(nr+1)));
-   brw_JMPI(p, ip, ip, c->pv);
+   brw_JMPI(p, c->pv);
    copy_flatshaded_attributes(c, c->vert[1], c->vert[0]);
 
-   brw_JMPI(p, ip, ip, brw_imm_ud(jmpi*nr));
+   brw_JMPI(p, brw_imm_ud(jmpi*nr));
    copy_flatshaded_attributes(c, c->vert[0], c->vert[1]);
 }
 
@@ -750,7 +748,6 @@ brw_land_fwd_jump(struct brw_compile *p, int jmp_insn_idx)
 void brw_emit_anyprim_setup( struct brw_sf_compile *c )
 {
    struct brw_compile *p = &c->func;
-   struct brw_reg ip = brw_ip_reg();
    struct brw_reg payload_prim = brw_uw1_reg(BRW_GENERAL_REGISTER_FILE, 1, 0);
    struct brw_reg payload_attr = get_element_ud(brw_vec1_reg(BRW_GENERAL_REGISTER_FILE, 1, 0), 0);
    struct brw_reg primmask;
@@ -773,7 +770,7 @@ void brw_emit_anyprim_setup( struct brw_sf_compile *c )
 					       (1<<_3DPRIM_POLYGON) |
 					       (1<<_3DPRIM_RECTLIST) |
 					       (1<<_3DPRIM_TRIFAN_NOSTIPPLE)));
-   jmp = brw_JMPI(p, ip, ip, brw_imm_d(0)) - p->store;
+   jmp = brw_JMPI(p, brw_imm_d(0)) - p->store;
    brw_emit_tri_setup(c, false);
    brw_land_fwd_jump(p, jmp);
 
@@ -784,13 +781,13 @@ void brw_emit_anyprim_setup( struct brw_sf_compile *c )
 					       (1<<_3DPRIM_LINESTRIP_CONT) |
 					       (1<<_3DPRIM_LINESTRIP_BF) |
 					       (1<<_3DPRIM_LINESTRIP_CONT_BF)));
-   jmp = brw_JMPI(p, ip, ip, brw_imm_d(0)) - p->store;
+   jmp = brw_JMPI(p, brw_imm_d(0)) - p->store;
    brw_emit_line_setup(c, false);
    brw_land_fwd_jump(p, jmp);
 
    brw_set_conditionalmod(p, BRW_CONDITIONAL_Z);
    brw_AND(p, v1_null_ud, payload_attr, brw_imm_ud(1<<BRW_SPRITE_POINT_ENABLE));
-   jmp = brw_JMPI(p, ip, ip, brw_imm_d(0)) - p->store;
+   jmp = brw_JMPI(p, brw_imm_d(0)) - p->store;
    brw_emit_point_sprite_setup(c, false);
    brw_land_fwd_jump(p, jmp);
 
-- 
1.9.3



More information about the mesa-dev mailing list