[Mesa-dev] [PATCH] i965/fs: Support register coalescing on LOAD_PAYLOAD operands.

Matt Turner mattst88 at gmail.com
Tue Jun 10 16:30:03 PDT 2014


---
I'm planning to squash this in to address review comments.

 src/mesa/drivers/dri/i965/brw_fs_register_coalesce.cpp | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_fs_register_coalesce.cpp b/src/mesa/drivers/dri/i965/brw_fs_register_coalesce.cpp
index 0aa4b3e..a740c58 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_register_coalesce.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_register_coalesce.cpp
@@ -47,8 +47,10 @@ static bool
 is_nop_mov(const fs_inst *inst)
 {
    if (inst->opcode == SHADER_OPCODE_LOAD_PAYLOAD) {
+      fs_reg dst = inst->dst;
       for (int i = 0; i < inst->sources; i++) {
-         if (!inst->dst.equals(inst->src[i])) {
+         dst.reg_offset = i;
+         if (!dst.equals(inst->src[i])) {
             return false;
          }
       }
@@ -61,8 +63,11 @@ is_nop_mov(const fs_inst *inst)
 }
 
 static bool
-is_copy_payload(const fs_inst *inst)
+is_copy_payload(const fs_inst *inst, int src_size)
 {
+   if (src_size != inst->sources)
+      return false;
+
    const int reg = inst->src[0].reg;
    if (inst->src[0].reg_offset != 0)
       return false;
@@ -97,7 +102,7 @@ is_coalesce_candidate(const fs_inst *inst, const int *virtual_grf_sizes)
       return false;
 
    if (inst->opcode == SHADER_OPCODE_LOAD_PAYLOAD) {
-      if (!is_copy_payload(inst)) {
+      if (!is_copy_payload(inst, virtual_grf_sizes[inst->src[0].reg])) {
          return false;
       }
    }
-- 
1.8.3.2



More information about the mesa-dev mailing list