From: Francisco Jerez Date: Fri, 2 Sep 2016 04:19:29 +0000 (-0700) Subject: i965/fs: Misc simplification. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=950af5ed40895ba7eb664a64e869cf4ae1104fc7;p=mesa.git i965/fs: Misc simplification. Get rid of some leftover redundant arithmetic introduced during the conversion to byte offsets and sizes that can be simplified easily. Reviewed-by: Iago Toral Quiroga --- diff --git a/src/mesa/drivers/dri/i965/brw_fs_combine_constants.cpp b/src/mesa/drivers/dri/i965/brw_fs_combine_constants.cpp index fcf2fe2f1e4..e0c95d379b8 100644 --- a/src/mesa/drivers/dri/i965/brw_fs_combine_constants.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs_combine_constants.cpp @@ -280,7 +280,7 @@ fs_visitor::opt_combine_constants() ibld.MOV(reg, brw_imm_f(imm->val)); imm->nr = reg.nr; - imm->subreg_offset = reg.offset % REG_SIZE; + imm->subreg_offset = reg.offset; reg.offset += sizeof(float); if (reg.offset == 8 * sizeof(float)) { diff --git a/src/mesa/drivers/dri/i965/brw_fs_nir.cpp b/src/mesa/drivers/dri/i965/brw_fs_nir.cpp index 1e1840bf7ee..042203d244d 100644 --- a/src/mesa/drivers/dri/i965/brw_fs_nir.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs_nir.cpp @@ -3994,7 +3994,7 @@ fs_visitor::nir_emit_intrinsic(const fs_builder &bld, nir_intrinsic_instr *instr if (const_offset) { /* Offsets are in bytes but they should always be multiples of 4 */ assert(const_offset->u32[0] % 4 == 0); - src.offset = const_offset->u32[0] + src.offset % 4; + src.offset = const_offset->u32[0]; for (unsigned j = 0; j < instr->num_components; j++) { bld.MOV(offset(dest, bld, j), offset(src, bld, j)); diff --git a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp index 2b2e21e786d..e96a3e8f3b4 100644 --- a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp @@ -573,8 +573,8 @@ void fs_visitor::compute_clip_distance(gl_clip_plane *clip_planes) for (int i = 0; i < key->nr_userclip_plane_consts; i++) { fs_reg u = userplane[i]; - fs_reg output = outputs[VARYING_SLOT_CLIP_DIST0 + i / 4]; - output.offset = output.offset % REG_SIZE + (i & 3) * REG_SIZE; + const fs_reg output = offset(outputs[VARYING_SLOT_CLIP_DIST0 + i / 4], + bld, i & 3); abld.MUL(output, outputs[clip_vertex], u); for (int j = 1; j < 4; j++) { diff --git a/src/mesa/drivers/dri/i965/brw_schedule_instructions.cpp b/src/mesa/drivers/dri/i965/brw_schedule_instructions.cpp index 5e1e61683a2..98e08d7cb98 100644 --- a/src/mesa/drivers/dri/i965/brw_schedule_instructions.cpp +++ b/src/mesa/drivers/dri/i965/brw_schedule_instructions.cpp @@ -1494,8 +1494,8 @@ fs_instruction_scheduler::choose_instruction_to_schedule() * single-result send is probably actually reducing register * pressure. */ - if (inst->size_written <= inst->exec_size / 8 * REG_SIZE && - chosen_inst->size_written > chosen_inst->exec_size / 8 * REG_SIZE) { + if (inst->size_written <= 4 * inst->exec_size && + chosen_inst->size_written > 4 * chosen_inst->exec_size) { chosen = n; continue; } else if (inst->size_written > chosen_inst->size_written) {