summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/dri/i965/brw_fs_live_variables.cpp
diff options
context:
space:
mode:
authorFrancisco Jerez <currojerez@riseup.net>2016-05-18 21:34:27 -0700
committerFrancisco Jerez <currojerez@riseup.net>2016-05-27 23:29:04 -0700
commit0fec265373f269d116f6d4de900b208fffabe2a1 (patch)
treef155e9c50dfdec45cf5202017742f2291ff16449 /src/mesa/drivers/dri/i965/brw_fs_live_variables.cpp
parentdf1aec763eb972c69bc5127be102a9f281ce94f6 (diff)
downloadexternal_mesa3d-0fec265373f269d116f6d4de900b208fffabe2a1.zip
external_mesa3d-0fec265373f269d116f6d4de900b208fffabe2a1.tar.gz
external_mesa3d-0fec265373f269d116f6d4de900b208fffabe2a1.tar.bz2
i965/fs: Track flag register liveness with byte granularity.
This is required for correctness in presence of multiple 8-wide flag writes (e.g. 8-wide instructions with a conditional mod set) which update a different portion of the same 16-bit flag subregister. Right now we keep track of flag dataflow with 16-bit granularity and consider flag writes to have killed any previous definition of the same subregister even if the write was less than 16 channels wide, which can cause live flag register updates to be dead code-eliminated incorrectly. Additionally this makes sure that we handle 32-wide flag writes and reads which may span multiple flag subregisters so the current approach of just setting/testing a single bit from the live set wouldn't have worked. Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Diffstat (limited to 'src/mesa/drivers/dri/i965/brw_fs_live_variables.cpp')
-rw-r--r--src/mesa/drivers/dri/i965/brw_fs_live_variables.cpp23
1 files changed, 5 insertions, 18 deletions
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 66b70a9..8bd4229 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_live_variables.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_live_variables.cpp
@@ -123,19 +123,8 @@ fs_live_variables::setup_def_use()
reg.reg_offset++;
}
}
- if (inst->reads_flag()) {
- /* The vertical combination predicates read f0.0 and f0.1. */
- if (inst->predicate == BRW_PREDICATE_ALIGN1_ANYV ||
- inst->predicate == BRW_PREDICATE_ALIGN1_ALLV) {
- assert(inst->flag_subreg == 0);
- if (!BITSET_TEST(bd->flag_def, 1)) {
- BITSET_SET(bd->flag_use, 1);
- }
- }
- if (!BITSET_TEST(bd->flag_def, inst->flag_subreg)) {
- BITSET_SET(bd->flag_use, inst->flag_subreg);
- }
- }
+
+ bd->flag_use[0] |= inst->flags_read(v->devinfo) & ~bd->flag_def[0];
/* Set def[] for this instruction */
if (inst->dst.file == VGRF) {
@@ -145,11 +134,9 @@ fs_live_variables::setup_def_use()
reg.reg_offset++;
}
}
- if (inst->writes_flag()) {
- if (!BITSET_TEST(bd->flag_use, inst->flag_subreg)) {
- BITSET_SET(bd->flag_def, inst->flag_subreg);
- }
- }
+
+ if (!inst->predicate && inst->exec_size >= 8)
+ bd->flag_def[0] |= inst->flags_written() & ~bd->flag_use[0];
ip++;
}