[Mesa-dev] [PATCH 3/4] i965/vec4/cse: adapt to changes in offset() helper

Iago Toral Quiroga itoral at igalia.com
Mon Aug 22 09:53:16 UTC 2016


---
 src/mesa/drivers/dri/i965/brw_vec4_cse.cpp | 19 +++++++++++++------
 1 file changed, 13 insertions(+), 6 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_vec4_cse.cpp b/src/mesa/drivers/dri/i965/brw_vec4_cse.cpp
index 0c1f0c3..eaf95c8 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_cse.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_cse.cpp
@@ -181,9 +181,13 @@ vec4_visitor::opt_cse_local(bblock_t *block)
                                               entry->generator->regs_written),
                                            NULL), inst->dst.type);
 
-               for (unsigned i = 0; i < entry->generator->regs_written; ++i) {
-                  vec4_instruction *copy = MOV(offset(entry->generator->dst, i),
-                                               offset(entry->tmp, i));
+               unsigned bytes = entry->generator->regs_written * REG_SIZE;
+               unsigned num_copies =
+                  DIV_ROUND_UP(bytes, 8 * type_sz(entry->tmp.type));
+               for (unsigned i = 0; i < num_copies; ++i) {
+                  vec4_instruction *copy =
+                     MOV(offset(entry->generator->dst, 8, i),
+                         offset(entry->tmp, 8, i));
                   copy->force_writemask_all =
                      entry->generator->force_writemask_all;
                   entry->generator->insert_after(block, copy);
@@ -196,9 +200,12 @@ vec4_visitor::opt_cse_local(bblock_t *block)
             if (!inst->dst.is_null()) {
                assert(inst->dst.type == entry->tmp.type);
 
-               for (unsigned i = 0; i < inst->regs_written; ++i) {
-                  vec4_instruction *copy = MOV(offset(inst->dst, i),
-                                               offset(entry->tmp, i));
+               unsigned bytes = inst->regs_written * REG_SIZE;
+               unsigned num_copies =
+                  DIV_ROUND_UP(bytes, 8 * type_sz(entry->tmp.type));
+               for (unsigned i = 0; i < num_copies; ++i) {
+                  vec4_instruction *copy = MOV(offset(inst->dst, 8, i),
+                                               offset(entry->tmp, 8, i));
                   copy->force_writemask_all = inst->force_writemask_all;
                   inst->insert_before(block, copy);
                }
-- 
2.7.4



More information about the mesa-dev mailing list