summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/dri/i965/brw_vec4_dead_code_eliminate.cpp
diff options
context:
space:
mode:
authorFrancisco Jerez <currojerez@riseup.net>2015-03-18 21:06:28 +0200
committerFrancisco Jerez <currojerez@riseup.net>2015-03-23 14:52:57 +0200
commit3d1bba7c9be856ed4e7611ef92796430556a2f6d (patch)
tree1a9b8c26aa7556f04f8173af15cf9a3afec0eda0 /src/mesa/drivers/dri/i965/brw_vec4_dead_code_eliminate.cpp
parent2babde35b9a38a0561a87dc2d7cb431e9aabbd5a (diff)
downloadexternal_mesa3d-3d1bba7c9be856ed4e7611ef92796430556a2f6d.zip
external_mesa3d-3d1bba7c9be856ed4e7611ef92796430556a2f6d.tar.gz
external_mesa3d-3d1bba7c9be856ed4e7611ef92796430556a2f6d.tar.bz2
i965/vec4: Fix handling of multiple register reads and writes in dead_code_eliminate().
Reviewed-by: Matt Turner <mattst88@gmail.com>
Diffstat (limited to 'src/mesa/drivers/dri/i965/brw_vec4_dead_code_eliminate.cpp')
-rw-r--r--src/mesa/drivers/dri/i965/brw_vec4_dead_code_eliminate.cpp22
1 files changed, 15 insertions, 7 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_vec4_dead_code_eliminate.cpp b/src/mesa/drivers/dri/i965/brw_vec4_dead_code_eliminate.cpp
index e4ce496..980e266 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_dead_code_eliminate.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_dead_code_eliminate.cpp
@@ -80,8 +80,10 @@ vec4_visitor::dead_code_eliminate()
if (inst->dst.file == GRF && !inst->has_side_effects()) {
bool result_live[4] = { false };
- for (int c = 0; c < 4; c++) {
- result_live[c] = BITSET_TEST(live, var_from_reg(alloc, inst->dst, c));
+ for (unsigned i = 0; i < inst->regs_written; i++) {
+ for (int c = 0; c < 4; c++)
+ result_live[c] |= BITSET_TEST(
+ live, var_from_reg(alloc, offset(inst->dst, i), c));
}
/* If the instruction can't do writemasking, then it's all or
@@ -122,9 +124,12 @@ vec4_visitor::dead_code_eliminate()
}
if (inst->dst.file == GRF && !inst->predicate) {
- for (int c = 0; c < 4; c++) {
- if (inst->dst.writemask & (1 << c)) {
- BITSET_CLEAR(live, var_from_reg(alloc, inst->dst, c));
+ for (unsigned i = 0; i < inst->regs_written; i++) {
+ for (int c = 0; c < 4; c++) {
+ if (inst->dst.writemask & (1 << c)) {
+ BITSET_CLEAR(live, var_from_reg(alloc,
+ offset(inst->dst, i), c));
+ }
}
}
}
@@ -135,8 +140,11 @@ vec4_visitor::dead_code_eliminate()
for (int i = 0; i < 3; i++) {
if (inst->src[i].file == GRF) {
- for (int c = 0; c < 4; c++) {
- BITSET_SET(live, var_from_reg(alloc, inst->src[i], c));
+ for (unsigned j = 0; j < inst->regs_read(i); j++) {
+ for (int c = 0; c < 4; c++) {
+ BITSET_SET(live, var_from_reg(alloc,
+ offset(inst->src[i], j), c));
+ }
}
}
}