backend_reg(reg)
{
this->offset = 0;
- this->subreg_offset = 0;
this->stride = 1;
if (this->file == IMM &&
(this->type != BRW_REGISTER_TYPE_V &&
fs_reg::equals(const fs_reg &r) const
{
return (this->backend_reg::equals(r) &&
- subreg_offset == r.subreg_offset &&
stride == r.stride);
}
fs_reg::set_smear(unsigned subreg)
{
assert(file != ARF && file != FIXED_GRF && file != IMM);
- subreg_offset = subreg * type_sz(type);
+ offset = ROUND_DOWN_TO(offset, REG_SIZE) + subreg * type_sz(type);
stride = 0;
return *this;
}
return ((this->predicate && this->opcode != BRW_OPCODE_SEL) ||
(this->exec_size * type_sz(this->dst.type)) < 32 ||
!this->dst.is_contiguous() ||
- this->dst.subreg_offset > 0);
+ this->dst.offset % REG_SIZE != 0);
}
unsigned
assert(inst->src[i].stride == 0);
inst->src[i] = byte_offset(
retype(brw_reg, inst->src[i].type),
- inst->src[i].subreg_offset);
+ inst->src[i].offset % 4);
}
}
}
unsigned width = inst->src[i].stride == 0 ? 1 : exec_size;
struct brw_reg reg =
stride(byte_offset(retype(brw_vec8_grf(grf, 0), inst->src[i].type),
- inst->src[i].subreg_offset),
+ inst->src[i].offset % REG_SIZE),
exec_size * inst->src[i].stride,
width, inst->src[i].stride);
reg.abs = inst->src[i].abs;
inst->dst.type != inst->src[0].type ||
inst->src[0].abs || inst->src[0].negate ||
!inst->src[0].is_contiguous() ||
- inst->src[0].subreg_offset)
+ inst->src[0].offset % REG_SIZE != 0)
continue;
/* Can't compute-to-MRF this GRF if someone else was going to
assert(src1_1_w.stride == 1);
src1_1_w.stride = 2;
}
- src1_1_w.subreg_offset += type_sz(BRW_REGISTER_TYPE_UW);
+ src1_1_w.offset += type_sz(BRW_REGISTER_TYPE_UW);
}
ibld.MUL(low, inst->src[0], src1_0_w);
ibld.MUL(high, inst->src[0], src1_1_w);
assert(src0_1_w.stride == 1);
src0_1_w.stride = 2;
}
- src0_1_w.subreg_offset += type_sz(BRW_REGISTER_TYPE_UW);
+ src0_1_w.offset += type_sz(BRW_REGISTER_TYPE_UW);
ibld.MUL(low, src0_0_w, inst->src[1]);
ibld.MUL(high, src0_1_w, inst->src[1]);
fs_reg dst = inst->dst;
dst.type = BRW_REGISTER_TYPE_UW;
- dst.subreg_offset = 2;
+ dst.offset = ROUND_DOWN_TO(dst.offset, REG_SIZE) + 2;
dst.stride = 2;
high.type = BRW_REGISTER_TYPE_UW;
high.stride = 2;
low.type = BRW_REGISTER_TYPE_UW;
- low.subreg_offset = 2;
+ low.offset = ROUND_DOWN_TO(low.offset, REG_SIZE) + 2;
low.stride = 2;
ibld.ADD(dst, low, high);
case VGRF:
fprintf(file, "vgrf%d", inst->dst.nr);
if (alloc.sizes[inst->dst.nr] != inst->regs_written ||
- inst->dst.subreg_offset)
+ inst->dst.offset % REG_SIZE)
fprintf(file, "+%d.%d",
- inst->dst.offset / REG_SIZE, inst->dst.subreg_offset);
+ inst->dst.offset / REG_SIZE, inst->dst.offset % REG_SIZE);
break;
case FIXED_GRF:
fprintf(file, "g%d", inst->dst.nr);
case VGRF:
fprintf(file, "vgrf%d", inst->src[i].nr);
if (alloc.sizes[inst->src[i].nr] != (unsigned)inst->regs_read(i) ||
- inst->src[i].subreg_offset)
+ inst->src[i].offset % REG_SIZE != 0)
fprintf(file, "+%d.%d", inst->src[i].offset / REG_SIZE,
- inst->src[i].subreg_offset);
+ inst->src[i].offset % REG_SIZE);
break;
case FIXED_GRF:
fprintf(file, "g%d", inst->src[i].nr);
break;
case UNIFORM:
fprintf(file, "u%d", inst->src[i].nr + inst->src[i].offset / 4);
- if (inst->src[i].subreg_offset) {
+ if (inst->src[i].offset % 4 != 0) {
fprintf(file, "+%d.%d", inst->src[i].offset / 4,
- inst->src[i].subreg_offset);
+ inst->src[i].offset % 4);
}
break;
case BAD_FILE:
const fs_reg &dst, unsigned regs_written)
{
return src.file == dst.file && src.nr == dst.nr &&
- (src.offset + src.subreg_offset >= dst.offset + dst.subreg_offset) &&
+ src.offset >= dst.offset &&
src.offset / REG_SIZE + regs_read <= dst.offset / REG_SIZE + regs_written;
}
inst->saturate = inst->saturate || entry->saturate;
/* Compute the offset of inst->src[arg] relative to entry->dst */
- const unsigned rel_offset = inst->src[arg].offset - entry->dst.offset +
- inst->src[arg].subreg_offset;
+ const unsigned rel_offset = inst->src[arg].offset - entry->dst.offset;
/* Compute the first component of the copy that the instruction is
* reading, and the base byte offset within that component.
*/
- assert(entry->dst.subreg_offset == 0 && entry->dst.stride == 1);
+ assert(entry->dst.offset % REG_SIZE == 0 && entry->dst.stride == 1);
const unsigned component = rel_offset / type_sz(entry->dst.type);
const unsigned suboffset = rel_offset % type_sz(entry->dst.type);
- /* Account for the inconsistent units reg_offset is expressed in.
- * FINISHME -- Make the units of reg_offset consistent (e.g. bytes?) for
- * all register files.
- */
- const unsigned reg_size = (entry->src.file == UNIFORM ? 4 : REG_SIZE);
-
/* Calculate the byte offset at the origin of the copy of the given
* component and suboffset.
*/
- const unsigned offset = suboffset +
+ inst->src[arg].offset = suboffset +
component * entry->src.stride * type_sz(entry->src.type) +
- entry->src.offset + entry->src.subreg_offset;
- inst->src[arg].offset = ROUND_DOWN_TO(offset, reg_size);
- inst->src[arg].subreg_offset = offset % reg_size;
+ entry->src.offset;
if (has_source_modifiers) {
if (entry->dst.type != inst->src[arg].type) {
/** Smear a channel of the reg to all channels. */
fs_reg &set_smear(unsigned subreg);
- /**
- * Offset in bytes from the start of the register. Values up to a
- * backend_reg::reg_offset unit are valid.
- */
- int subreg_offset;
-
/** Register region horizontal stride */
uint8_t stride;
};
case ATTR:
case UNIFORM: {
const unsigned reg_size = (reg.file == UNIFORM ? 4 : REG_SIZE);
- const unsigned suboffset = reg.subreg_offset + delta;
+ const unsigned suboffset = reg.offset % reg_size + delta;
reg.offset += ROUND_DOWN_TO(suboffset, reg_size);
- reg.subreg_offset = suboffset % reg_size;
+ reg.offset = ROUND_DOWN_TO(reg.offset, reg_size) + suboffset % reg_size;
break;
}
case MRF: {
- const unsigned suboffset = reg.subreg_offset + delta;
+ const unsigned suboffset = reg.offset % REG_SIZE + delta;
reg.nr += suboffset / REG_SIZE;
- reg.subreg_offset = suboffset % REG_SIZE;
+ reg.offset = ROUND_DOWN_TO(reg.offset, REG_SIZE) + suboffset % REG_SIZE;
break;
}
case ARF:
reg_offset(const fs_reg &r)
{
return (r.file == VGRF || r.file == IMM ? 0 : r.nr) *
- (r.file == UNIFORM ? 4 : REG_SIZE) + r.offset + r.subreg_offset;
+ (r.file == UNIFORM ? 4 : REG_SIZE) + r.offset;
}
/**