[Mesa-dev] [PATCH 42/57] i965/fs: Misc simplification.
Francisco Jerez
currojerez at riseup.net
Thu Sep 8 01:49:09 UTC 2016
Get rid of some leftover redundant arithmetic introduced during the
conversion to byte offsets and sizes that can be simplified easily.
---
src/mesa/drivers/dri/i965/brw_fs_combine_constants.cpp | 2 +-
src/mesa/drivers/dri/i965/brw_fs_nir.cpp | 2 +-
src/mesa/drivers/dri/i965/brw_fs_visitor.cpp | 4 ++--
src/mesa/drivers/dri/i965/brw_schedule_instructions.cpp | 4 ++--
4 files changed, 6 insertions(+), 6 deletions(-)
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 fcf2fe2..e0c95d3 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 6c9354b..327e1b9 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 2b2e21e..e96a3e8 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 5e1e616..98e08d7 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) {
--
2.9.0
More information about the mesa-dev
mailing list