diff options
author | Francisco Jerez <[email protected]> | 2014-01-15 22:21:30 +0100 |
---|---|---|
committer | Francisco Jerez <[email protected]> | 2014-02-12 23:07:57 +0100 |
commit | 019bf6ed8dd4843512e9d4924f4702ce36047ad5 (patch) | |
tree | b690ab98b2353462b2d0a90e4244c4ac6857567b | |
parent | 756d37b1d6d09ad7ee3b8835888a49d4256e427b (diff) |
i965/fs: Remove fs_reg::smear.
The same effect can be achieved using a combination of ::stride and
::subreg_offset. Remove the less flexible ::smear to keep the data
members of fs_reg orthogonal.
Reviewed-by: Matt Turner <[email protected]>
Reviewed-by: Paul Berry <[email protected]>
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_fs.cpp | 22 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_fs.h | 4 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_fs_copy_propagation.cpp | 4 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_fs_generator.cpp | 4 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_fs_live_variables.cpp | 2 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_fs_reg_allocate.cpp | 4 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_fs_visitor.cpp | 14 |
7 files changed, 30 insertions, 24 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp index b8f7cb41e31..d45d4cf5f0a 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp @@ -380,7 +380,6 @@ void fs_reg::init() { memset(this, 0, sizeof(*this)); - this->smear = -1; stride = 1; } @@ -440,7 +439,6 @@ fs_reg::equals(const fs_reg &r) const !reladdr && !r.reladdr && memcmp(&fixed_hw_reg, &r.fixed_hw_reg, sizeof(fixed_hw_reg)) == 0 && - smear == r.smear && stride == r.stride && imm.u == r.imm.u); } @@ -463,6 +461,15 @@ fs_reg::apply_stride(unsigned stride) return *this; } +fs_reg & +fs_reg::set_smear(unsigned subreg) +{ + assert(file != HW_REG && file != IMM); + subreg_offset = subreg * type_sz(type); + stride = 0; + return *this; +} + bool fs_reg::is_contiguous() const { @@ -567,7 +574,7 @@ fs_visitor::get_timestamp() * else that might disrupt timing) by setting smear to 2 and checking if * that field is != 0. */ - dst.smear = 0; + dst.set_smear(0); return dst; } @@ -602,7 +609,7 @@ fs_visitor::emit_shader_time_end() * were the only two timestamp reads that happened). */ fs_reg reset = shader_end_time; - reset.smear = 2; + reset.set_smear(2); fs_inst *test = emit(AND(reg_null_d, reset, fs_reg(1u))); test->conditional_mod = BRW_CONDITIONAL_Z; emit(IF(BRW_PREDICATE_NORMAL)); @@ -1973,7 +1980,7 @@ fs_visitor::setup_pull_constants() inst->src[i].file = GRF; inst->src[i].reg = dst.reg; inst->src[i].reg_offset = 0; - inst->src[i].smear = pull_index & 3; + inst->src[i].set_smear(pull_index & 3); } } } @@ -2334,8 +2341,7 @@ fs_visitor::register_coalesce() inst->src[0].file != GRF || inst->src[0].negate || inst->src[0].abs || - inst->src[0].smear != -1 || - !inst->src[0].is_contiguous() || + !inst->src[0].is_contiguous() || inst->dst.file != GRF || inst->dst.type != inst->src[0].type) { continue; @@ -2496,7 +2502,7 @@ fs_visitor::compute_to_mrf() inst->dst.file != MRF || inst->src[0].file != GRF || inst->dst.type != inst->src[0].type || inst->src[0].abs || inst->src[0].negate || - inst->src[0].smear != -1 || !inst->src[0].is_contiguous() || + !inst->src[0].is_contiguous() || inst->src[0].subreg_offset) continue; diff --git a/src/mesa/drivers/dri/i965/brw_fs.h b/src/mesa/drivers/dri/i965/brw_fs.h index 84bed9f4358..85d06ff214c 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.h +++ b/src/mesa/drivers/dri/i965/brw_fs.h @@ -107,7 +107,9 @@ public: bool abs; bool sechalf; struct brw_reg fixed_hw_reg; - int smear; /* -1, or a channel of the reg to smear to all channels. */ + + /** Smear a channel of the reg to all channels. */ + fs_reg &set_smear(unsigned subreg); /** Value for file == IMM */ union { diff --git a/src/mesa/drivers/dri/i965/brw_fs_copy_propagation.cpp b/src/mesa/drivers/dri/i965/brw_fs_copy_propagation.cpp index cdb7b80b7c1..a145923396d 100644 --- a/src/mesa/drivers/dri/i965/brw_fs_copy_propagation.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs_copy_propagation.cpp @@ -300,7 +300,7 @@ fs_visitor::try_copy_propagate(fs_inst *inst, int arg, acp_entry *entry) bool has_source_modifiers = entry->src.abs || entry->src.negate; if ((has_source_modifiers || entry->src.file == UNIFORM || - entry->src.smear != -1 || !entry->src.is_contiguous()) && + !entry->src.is_contiguous()) && !can_do_source_mods(inst)) return false; @@ -334,8 +334,6 @@ fs_visitor::try_copy_propagate(fs_inst *inst, int arg, acp_entry *entry) inst->src[arg].file = entry->src.file; inst->src[arg].reg = entry->src.reg; inst->src[arg].reg_offset = entry->src.reg_offset; - if (entry->src.smear != -1) - inst->src[arg].smear = entry->src.smear; inst->src[arg].subreg_offset = entry->src.subreg_offset; inst->src[arg].stride *= entry->src.stride; diff --git a/src/mesa/drivers/dri/i965/brw_fs_generator.cpp b/src/mesa/drivers/dri/i965/brw_fs_generator.cpp index 310f993be23..b79fcca01e7 100644 --- a/src/mesa/drivers/dri/i965/brw_fs_generator.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs_generator.cpp @@ -1030,8 +1030,8 @@ brw_reg_from_fs_reg(fs_reg *reg) switch (reg->file) { case GRF: case MRF: - if (reg->stride == 0 || reg->smear >= 0) { - brw_reg = brw_vec1_reg(brw_file_from_reg(reg), reg->reg, reg->smear); + if (reg->stride == 0) { + brw_reg = brw_vec1_reg(brw_file_from_reg(reg), reg->reg, 0); } else { brw_reg = brw_vec8_reg(brw_file_from_reg(reg), reg->reg, 0); brw_reg = stride(brw_reg, 8 * reg->stride, 8, reg->stride); diff --git a/src/mesa/drivers/dri/i965/brw_fs_live_variables.cpp b/src/mesa/drivers/dri/i965/brw_fs_live_variables.cpp index 2aeabadeb86..61517299247 100644 --- a/src/mesa/drivers/dri/i965/brw_fs_live_variables.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs_live_variables.cpp @@ -85,7 +85,7 @@ fs_live_variables::setup_one_read(bblock_t *block, fs_inst *inst, * would get stomped by the first decode as well. */ int end_ip = ip; - if (v->dispatch_width == 16 && (reg.smear != -1 || reg.stride == 0 || + if (v->dispatch_width == 16 && (reg.stride == 0 || (v->pixel_x.reg == reg.reg || v->pixel_y.reg == reg.reg))) { end_ip++; diff --git a/src/mesa/drivers/dri/i965/brw_fs_reg_allocate.cpp b/src/mesa/drivers/dri/i965/brw_fs_reg_allocate.cpp index fcd66d98352..5b1741acd78 100644 --- a/src/mesa/drivers/dri/i965/brw_fs_reg_allocate.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs_reg_allocate.cpp @@ -592,7 +592,7 @@ fs_visitor::choose_spill_reg(struct ra_graph *g) * loading pull constants, so spilling them is unlikely to reduce * register pressure anyhow. */ - if (inst->src[i].smear >= 0 || !inst->src[i].is_contiguous()) { + if (!inst->src[i].is_contiguous()) { no_spill[inst->src[i].reg] = true; } } @@ -601,7 +601,7 @@ fs_visitor::choose_spill_reg(struct ra_graph *g) if (inst->dst.file == GRF) { spill_costs[inst->dst.reg] += inst->regs_written * loop_scale; - if (inst->dst.smear >= 0 || !inst->dst.is_contiguous()) { + if (!inst->dst.is_contiguous()) { no_spill[inst->dst.reg] = true; } } diff --git a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp index fc8b44a0d09..b67ea302a03 100644 --- a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp @@ -744,8 +744,14 @@ fs_visitor::visit(ir_expression *ir) emit(fs_inst(FS_OPCODE_UNIFORM_PULL_CONSTANT_LOAD, packed_consts, surf_index, const_offset_reg)); - packed_consts.smear = const_offset->value.u[0] % 16 / 4; for (int i = 0; i < ir->type->vector_elements; i++) { + packed_consts.set_smear(const_offset->value.u[0] % 16 / 4 + i); + + /* The std140 packing rules don't allow vectors to cross 16-byte + * boundaries, and a reg is 32 bytes. + */ + assert(packed_consts.subreg_offset < 32); + /* UBO bools are any nonzero value. We consider bools to be * values with the low bit set to 1. Convert them using CMP. */ @@ -755,13 +761,7 @@ fs_visitor::visit(ir_expression *ir) emit(MOV(result, packed_consts)); } - packed_consts.smear++; result.reg_offset++; - - /* The std140 packing rules don't allow vectors to cross 16-byte - * boundaries, and a reg is 32 bytes. - */ - assert(packed_consts.smear < 8); } } else { /* Turn the byte offset into a dword offset. */ |