mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 05:18:08 +02:00
i965/fs: Add a helper function for checking for partial register updates.
These checks were all over, and every time I wrote one I had to try to decide again what the cases were for partial updates. v2: Fix inadvertent reladdr check removal. Reviewed-by: Matt Turner <mattst88@gmail.com>
This commit is contained in:
parent
df25b4f3cf
commit
2cb7f1e766
5 changed files with 24 additions and 22 deletions
|
|
@ -710,6 +710,22 @@ fs_visitor::pop_force_sechalf()
|
|||
assert(force_sechalf_stack >= 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the instruction has a flag that means it won't
|
||||
* update an entire destination register.
|
||||
*
|
||||
* For example, dead code elimination and live variable analysis want to know
|
||||
* when a write to a variable screens off any preceding values that were in
|
||||
* it.
|
||||
*/
|
||||
bool
|
||||
fs_inst::is_partial_write()
|
||||
{
|
||||
return (this->predicate ||
|
||||
this->force_uncompressed ||
|
||||
this->force_sechalf);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns how many MRFs an FS opcode will write over.
|
||||
*
|
||||
|
|
@ -2065,22 +2081,14 @@ fs_visitor::compute_to_mrf()
|
|||
* into a compute-to-MRF.
|
||||
*/
|
||||
|
||||
/* If it's predicated, it (probably) didn't populate all
|
||||
* the channels. We might be able to rewrite everything
|
||||
/* If this one instruction didn't populate all the
|
||||
* channels, bail. We might be able to rewrite everything
|
||||
* that writes that reg, but it would require smarter
|
||||
* tracking to delay the rewriting until complete success.
|
||||
*/
|
||||
if (scan_inst->predicate)
|
||||
if (scan_inst->is_partial_write())
|
||||
break;
|
||||
|
||||
/* If it's half of register setup and not the same half as
|
||||
* our MOV we're trying to remove, bail for now.
|
||||
*/
|
||||
if (scan_inst->force_uncompressed != inst->force_uncompressed ||
|
||||
scan_inst->force_sechalf != inst->force_sechalf) {
|
||||
break;
|
||||
}
|
||||
|
||||
/* Things returning more than one register would need us to
|
||||
* understand coalescing out more than one MOV at a time.
|
||||
*/
|
||||
|
|
@ -2662,9 +2670,7 @@ fs_visitor::get_instruction_generating_reg(fs_inst *start,
|
|||
fs_reg reg)
|
||||
{
|
||||
if (end == start ||
|
||||
end->predicate ||
|
||||
end->force_uncompressed ||
|
||||
end->force_sechalf ||
|
||||
end->is_partial_write() ||
|
||||
reg.reladdr ||
|
||||
!reg.equals(end->dst)) {
|
||||
return NULL;
|
||||
|
|
|
|||
|
|
@ -179,6 +179,7 @@ public:
|
|||
bool is_math();
|
||||
bool is_control_flow();
|
||||
bool is_send_from_grf();
|
||||
bool is_partial_write();
|
||||
|
||||
fs_reg dst;
|
||||
fs_reg src[3];
|
||||
|
|
|
|||
|
|
@ -414,9 +414,7 @@ fs_visitor::opt_copy_propagate_local(void *mem_ctx, bblock_t *block,
|
|||
inst->src[0].file == IMM) &&
|
||||
inst->src[0].type == inst->dst.type &&
|
||||
!inst->saturate &&
|
||||
!inst->predicate &&
|
||||
!inst->force_uncompressed &&
|
||||
!inst->force_sechalf) {
|
||||
!inst->is_partial_write()) {
|
||||
acp_entry *entry = ralloc(mem_ctx, acp_entry);
|
||||
entry->dst = inst->dst;
|
||||
entry->src = inst->src[0];
|
||||
|
|
|
|||
|
|
@ -97,8 +97,7 @@ fs_visitor::opt_cse_local(bblock_t *block, exec_list *aeb)
|
|||
inst = (fs_inst *) inst->next) {
|
||||
|
||||
/* Skip some cases. */
|
||||
if (is_expression(inst) && !inst->predicate &&
|
||||
!inst->force_uncompressed && !inst->force_sechalf &&
|
||||
if (is_expression(inst) && !inst->is_partial_write() &&
|
||||
!inst->conditional_mod)
|
||||
{
|
||||
bool found = false;
|
||||
|
|
|
|||
|
|
@ -78,9 +78,7 @@ fs_live_variables::setup_def_use()
|
|||
*/
|
||||
if (inst->dst.file == GRF &&
|
||||
inst->regs_written == v->virtual_grf_sizes[inst->dst.reg] &&
|
||||
!inst->predicate &&
|
||||
!inst->force_uncompressed &&
|
||||
!inst->force_sechalf) {
|
||||
!inst->is_partial_write()) {
|
||||
int reg = inst->dst.reg;
|
||||
if (!BITSET_TEST(bd[b].use, reg))
|
||||
BITSET_SET(bd[b].def, reg);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue