i965/fs: Misc simplification.
authorFrancisco Jerez <currojerez@riseup.net>
Fri, 2 Sep 2016 04:19:29 +0000 (21:19 -0700)
committerFrancisco Jerez <currojerez@riseup.net>
Wed, 14 Sep 2016 21:50:57 +0000 (14:50 -0700)
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 <itoral@igalia.com>
src/mesa/drivers/dri/i965/brw_fs_combine_constants.cpp
src/mesa/drivers/dri/i965/brw_fs_nir.cpp
src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
src/mesa/drivers/dri/i965/brw_schedule_instructions.cpp

index fcf2fe2f1e4c668e172c0adab391d6fa1391a41d..e0c95d379b88a45044271ecc300bddf73e50a79e 100644 (file)
@@ -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)) {
index 1e1840bf7ee1b7e70b42b984a8438f2d441ba3e1..042203d244daafc0a7556b724764cd0565e0a21f 100644 (file)
@@ -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));
index 2b2e21e786d3dba661233465491cf240287658c0..e96a3e8f3b4abe22b8bb92f2b0138334cb1a02bb 100644 (file)
@@ -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++) {
index 5e1e61683a22b5d49c13899b0629918f40628f8e..98e08d7cb987bf2c7bc42b7030e874795d891585 100644 (file)
@@ -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) {