diff options
author | Francisco Jerez <currojerez@riseup.net> | 2016-05-26 23:20:19 -0700 |
---|---|---|
committer | Francisco Jerez <currojerez@riseup.net> | 2016-05-29 23:41:38 -0700 |
commit | a9f00a9e535019747d041f4121c56404057465a3 (patch) | |
tree | 6ca9115a8ce7eee9ecca9f89f5dc22ef2f55390e /src/mesa/drivers/dri/i965/brw_fs_copy_propagation.cpp | |
parent | 4db93592de73d68ce38b3d64eddd451aa6c373cc (diff) | |
download | external_mesa3d-a9f00a9e535019747d041f4121c56404057465a3.zip external_mesa3d-a9f00a9e535019747d041f4121c56404057465a3.tar.gz external_mesa3d-a9f00a9e535019747d041f4121c56404057465a3.tar.bz2 |
i965/fs: Generalize regions_overlap() from copy propagation to handle non-VGRF files.
This will be useful in several places. The only externally visible
difference (other than non-VGRF files being supported now) is that the
region sizes are now passed in byte units instead of in GRF units
because the loss of precision would have become a problem in the SIMD
lowering pass.
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Diffstat (limited to 'src/mesa/drivers/dri/i965/brw_fs_copy_propagation.cpp')
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_fs_copy_propagation.cpp | 16 |
1 files changed, 4 insertions, 12 deletions
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 38103af..d88d62b 100644 --- a/src/mesa/drivers/dri/i965/brw_fs_copy_propagation.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs_copy_propagation.cpp @@ -757,14 +757,6 @@ can_propagate_from(fs_inst *inst) !inst->is_partial_write()); } -inline bool -regions_overlap(const fs_reg &r, unsigned n, const fs_reg &s, unsigned m) -{ - return r.file == s.file && r.nr == s.nr && - !(r.reg_offset + n <= s.reg_offset || - s.reg_offset + m <= r.reg_offset); -} - /* Walks a basic block and does copy propagation on it using the acp * list. */ @@ -791,8 +783,8 @@ fs_visitor::opt_copy_propagate_local(void *copy_prop_ctx, bblock_t *block, /* kill the destination from the ACP */ if (inst->dst.file == VGRF) { foreach_in_list_safe(acp_entry, entry, &acp[inst->dst.nr % ACP_HASH_SIZE]) { - if (regions_overlap(entry->dst, entry->regs_written, - inst->dst, inst->regs_written)) + if (regions_overlap(entry->dst, entry->regs_written * REG_SIZE, + inst->dst, inst->regs_written * REG_SIZE)) entry->remove(); } @@ -804,8 +796,8 @@ fs_visitor::opt_copy_propagate_local(void *copy_prop_ctx, bblock_t *block, /* Make sure we kill the entry if this instruction overwrites * _any_ of the registers that it reads */ - if (regions_overlap(entry->src, entry->regs_read, - inst->dst, inst->regs_written)) + if (regions_overlap(entry->src, entry->regs_read * REG_SIZE, + inst->dst, inst->regs_written * REG_SIZE)) entry->remove(); } } |