From: Eric Anholt Date: Thu, 22 Jul 2010 08:27:15 +0000 (-0700) Subject: i965: Avoid extra MOV in VS indirect register reads. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=86fb92f59c98168d41c7d827f60c12b244f26382;p=mesa.git i965: Avoid extra MOV in VS indirect register reads. --- diff --git a/src/mesa/drivers/dri/i965/brw_vs_emit.c b/src/mesa/drivers/dri/i965/brw_vs_emit.c index bb82147464d..ae6cdcb81f3 100644 --- a/src/mesa/drivers/dri/i965/brw_vs_emit.c +++ b/src/mesa/drivers/dri/i965/brw_vs_emit.c @@ -969,34 +969,35 @@ static struct brw_reg deref( struct brw_vs_compile *c, GLuint reg_size ) { struct brw_compile *p = &c->func; - struct brw_reg tmp = vec4(get_tmp(c)); + struct brw_reg tmp = get_tmp(c); struct brw_reg addr_reg = c->regs[PROGRAM_ADDRESS][0]; - struct brw_reg vp_address = retype(vec1(addr_reg), BRW_REGISTER_TYPE_UW); + struct brw_reg vp_address = retype(vec1(addr_reg), BRW_REGISTER_TYPE_D); GLuint byte_offset = arg.nr * 32 + arg.subnr + offset * reg_size; struct brw_reg indirect = brw_vec4_indirect(0,0); - struct brw_reg acc = retype(brw_acc_reg(), BRW_REGISTER_TYPE_D); + struct brw_reg acc = retype(vec1(get_tmp(c)), BRW_REGISTER_TYPE_UW); + + /* Set the vertical stride on the register access so that the first + * 4 components come from a0.0 and the second 4 from a0.1. + */ + indirect.vstride = BRW_VERTICAL_STRIDE_ONE_DIMENSIONAL; { brw_push_insn_state(p); brw_set_access_mode(p, BRW_ALIGN_1); - /* This is pretty clunky - load the address register twice and - * fetch each 4-dword value in turn. There must be a way to do - * this in a single pass, but I couldn't get it to work. - */ - brw_MUL(p, acc, vp_address, brw_imm_d(reg_size)); - brw_ADD(p, brw_address_reg(0), acc, brw_imm_d(byte_offset)); - brw_MOV(p, tmp, indirect); + brw_MUL(p, acc, vp_address, brw_imm_uw(reg_size)); + brw_ADD(p, brw_address_reg(0), acc, brw_imm_uw(byte_offset)); - brw_MUL(p, acc, suboffset(vp_address, 8), brw_imm_d(reg_size)); - brw_ADD(p, brw_address_reg(0), acc, brw_imm_d(byte_offset)); - brw_MOV(p, suboffset(tmp, 4), indirect); + brw_MUL(p, acc, suboffset(vp_address, 4), brw_imm_uw(reg_size)); + brw_ADD(p, brw_address_reg(1), acc, brw_imm_uw(byte_offset)); + + brw_MOV(p, tmp, indirect); brw_pop_insn_state(p); } - + /* NOTE: tmp not released */ - return vec8(tmp); + return tmp; }