[Mesa-dev] [PATCH 20/95] i965/vec4: Fix DCE for VEC4_OPCODE_SET_{LOW, HIGH}_32BIT

Iago Toral Quiroga itoral at igalia.com
Tue Jul 19 10:40:17 UTC 2016


These opcodes do partial writes of 64-bit data. The problem is that we intend
to use them to write on the same register to implement packDouble2x32 and
from the point of view of DCE, since both opcodes write to the same register,
only the last one stands and decides to eliminate the first, which is
not correct, so prevent this from happening.
---
 src/mesa/drivers/dri/i965/brw_vec4_dead_code_eliminate.cpp | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

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 1f7cd49..9056cbf 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
@@ -36,6 +36,12 @@
 
 using namespace brw;
 
+static bool
+is_partial_df_write(vec4_instruction *inst) {
+   return inst->opcode == VEC4_OPCODE_SET_LOW_32BIT ||
+          inst->opcode == VEC4_OPCODE_SET_HIGH_32BIT;
+}
+
 bool
 vec4_visitor::dead_code_eliminate()
 {
@@ -115,7 +121,8 @@ vec4_visitor::dead_code_eliminate()
             }
          }
 
-         if (inst->dst.file == VGRF && !inst->predicate) {
+         if (inst->dst.file == VGRF && !inst->predicate &&
+             !is_partial_df_write(inst)) {
             const unsigned offs = type_sz(inst->dst.type) == 8 ?
                1 : (inst->exec_size == 4 ? 0 : 4);
             for (unsigned i = 0; i < inst->regs_written; i++) {
-- 
2.7.4



More information about the mesa-dev mailing list