+ inst->src[arg].stride *= entry->src.stride;
+ inst->saturate = inst->saturate || entry->saturate;
+
+ switch (entry->src.file) {
+ case UNIFORM:
+ assert(entry->src.width == 1);
+ case BAD_FILE:
+ case HW_REG:
+ inst->src[arg].width = entry->src.width;
+ inst->src[arg].reg_offset = entry->src.reg_offset;
+ inst->src[arg].subreg_offset = entry->src.subreg_offset;
+ break;
+ case GRF:
+ {
+ assert(entry->src.width % inst->src[arg].width == 0);
+ /* In this case, we'll just leave the width alone. The source
+ * register could have different widths depending on how it is
+ * being used. For instance, if only half of the register was
+ * used then we want to preserve that and continue to only use
+ * half.
+ *
+ * Also, we have to deal with mapping parts of vgrfs to other
+ * parts of vgrfs so we have to do some reg_offset magic.
+ */
+
+ /* Compute the offset of inst->src[arg] relative to inst->dst */
+ assert(entry->dst.subreg_offset == 0);
+ int rel_offset = inst->src[arg].reg_offset - entry->dst.reg_offset;
+ int rel_suboffset = inst->src[arg].subreg_offset;
+
+ /* Compute the final register offset (in bytes) */
+ int offset = entry->src.reg_offset * 32 + entry->src.subreg_offset;
+ offset += rel_offset * 32 + rel_suboffset;
+ inst->src[arg].reg_offset = offset / 32;
+ inst->src[arg].subreg_offset = offset % 32;
+ }
+ break;
+ default:
+ unreachable("Invalid register file");
+ break;
+ }