[Mesa-dev] [PATCH 35/51] intel/compiler/fs: Pad 16-bit payload lowering

Topi Pohjolainen topi.pohjolainen at gmail.com
Fri Nov 24 12:27:02 UTC 2017


Otherwise copy propagation fails when write sizes differ.

Signed-off-by: Topi Pohjolainen <topi.pohjolainen at intel.com>
---
 src/intel/compiler/brw_fs.cpp  |  5 ++++-
 src/intel/compiler/brw_ir_fs.h | 13 +++++++++++++
 2 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/src/intel/compiler/brw_fs.cpp b/src/intel/compiler/brw_fs.cpp
index 9c3410b698..8e77248470 100644
--- a/src/intel/compiler/brw_fs.cpp
+++ b/src/intel/compiler/brw_fs.cpp
@@ -3450,7 +3450,10 @@ fs_visitor::lower_load_payload()
 
       for (uint8_t i = inst->header_size; i < inst->sources; i++) {
          if (inst->src[i].file != BAD_FILE)
-            ibld.MOV(retype(dst, inst->src[i].type), inst->src[i]);
+            ibld.MOV(retype_pad_to_full_register(
+                        dst, dispatch_width, inst->src[i].type),
+                     inst->src[i]);
+
          if (type_sz(inst->src[i].type) == 2)
             dst = byte_offset(dst, REG_SIZE);
          else
diff --git a/src/intel/compiler/brw_ir_fs.h b/src/intel/compiler/brw_ir_fs.h
index b4a1d7ef5a..fe7f7c4be7 100644
--- a/src/intel/compiler/brw_ir_fs.h
+++ b/src/intel/compiler/brw_ir_fs.h
@@ -72,6 +72,19 @@ retype(fs_reg reg, enum brw_reg_type type)
 }
 
 static inline fs_reg
+retype_pad_to_full_register(fs_reg reg, unsigned dispatch_width,
+                            enum brw_reg_type type)
+{
+   reg.type = type;
+
+   assert(reg.pad_per_component == 0);
+   if (dispatch_width == 8 && type_sz(reg.type) == 2)
+      reg.pad_per_component = REG_SIZE / 2;
+
+   return reg;
+}
+
+static inline fs_reg
 byte_offset(fs_reg reg, unsigned delta)
 {
    switch (reg.file) {
-- 
2.11.0



More information about the mesa-dev mailing list