intel/fs: Properly handle 64-bit types in LOAD_PAYLOAD
authorJason Ekstrand <jason.ekstrand@intel.com>
Thu, 15 Nov 2018 04:38:23 +0000 (22:38 -0600)
committerJason Ekstrand <jason.ekstrand@intel.com>
Fri, 1 Feb 2019 22:10:57 +0000 (16:10 -0600)
By just assigning dst.type to src[i].type, we ensure that the offset at
the end of the loop actually offsets it by the right number of
registers.  Otherwise, we'll get into a case where we copy with a Q type
and then offset with a D type and things get out of sync.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/intel/compiler/brw_fs.cpp
src/intel/compiler/brw_fs_cse.cpp

index 8dd3b94fbd513d29f5658f79c4dc6cbfb7dd495c..303b1c1b272e30d7c1eed90104219eb7c8717487 100644 (file)
@@ -3799,8 +3799,12 @@ 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]);
+         if (inst->src[i].file != BAD_FILE) {
+            dst.type = inst->src[i].type;
+            ibld.MOV(dst, inst->src[i]);
+         } else {
+            dst.type = BRW_REGISTER_TYPE_UD;
+         }
          dst = offset(dst, ibld, 1);
       }
 
index bd917baaa6d83bd45e325638404d137e94dbe907..6efa111b1a43b3480cb58df1374cae6f0a4b74a2 100644 (file)
@@ -216,6 +216,7 @@ create_copy_instr(const fs_builder &bld, fs_inst *inst, fs_reg src, bool negate)
          src.offset += REG_SIZE;
       }
       for (int i = inst->header_size; i < inst->sources; i++) {
+         src.type = inst->src[i].type;
          payload[i] = src;
          src = offset(src, bld, 1);
       }