src_reg::src_reg(struct ::brw_reg reg) :
backend_reg(reg)
{
- this->reg_offset = 0;
+ this->offset = 0;
this->reladdr = NULL;
}
dst_reg::dst_reg(struct ::brw_reg reg) :
backend_reg(reg)
{
- this->reg_offset = 0;
+ this->offset = 0;
this->reladdr = NULL;
}
* sequence. Combine anything we've accumulated so far.
*/
if (last_reg != inst->dst.nr ||
- last_reg_offset != inst->dst.reg_offset ||
+ last_reg_offset != inst->dst.offset / REG_SIZE ||
last_reg_file != inst->dst.file ||
(vf > 0 && dest_type != need_type)) {
imm_inst[inst_count++] = inst;
last_reg = inst->dst.nr;
- last_reg_offset = inst->dst.reg_offset;
+ last_reg_offset = inst->dst.offset / REG_SIZE;
last_reg_file = inst->dst.file;
if (vf > 0)
dest_type = need_type;
assert(!inst->src[i].reladdr);
- inst->src[i].nr += inst->src[i].reg_offset;
- inst->src[i].reg_offset = 0;
+ inst->src[i].nr += inst->src[i].offset / 16;
+ inst->src[i].offset %= 16;
}
}
}
inst->src[i].file = temp.file;
inst->src[i].nr = temp.nr;
- inst->src[i].reg_offset = temp.reg_offset;
+ inst->src[i].offset %= 16;
inst->src[i].reladdr = NULL;
}
}
* on, don't do dependency control across the read.
*/
for (int i = 0; i < 3; i++) {
- int reg = inst->src[i].nr + inst->src[i].reg_offset;
+ int reg = inst->src[i].nr + inst->src[i].offset / REG_SIZE;
if (inst->src[i].file == VGRF) {
last_grf_write[reg] = NULL;
} else if (inst->src[i].file == FIXED_GRF) {
/* Now, see if we can do dependency control for this instruction
* against a previous one writing to its destination.
*/
- int reg = inst->dst.nr + inst->dst.reg_offset;
+ int reg = inst->dst.nr + inst->dst.offset / REG_SIZE;
if (inst->dst.file == VGRF || inst->dst.file == FIXED_GRF) {
if (last_grf_write[reg] &&
!(inst->dst.writemask & grf_channels_written[reg])) {
/* Remove no-op MOVs */
if (inst->dst.file == inst->src[0].file &&
inst->dst.nr == inst->src[0].nr &&
- inst->dst.reg_offset == inst->src[0].reg_offset) {
+ inst->dst.offset / REG_SIZE == inst->src[0].offset / REG_SIZE) {
bool is_nop_mov = true;
for (unsigned c = 0; c < 4; c++) {
while (scan_inst != inst) {
if (scan_inst->dst.file == VGRF &&
scan_inst->dst.nr == inst->src[0].nr &&
- scan_inst->dst.reg_offset == inst->src[0].reg_offset) {
+ scan_inst->dst.offset / REG_SIZE ==
+ inst->src[0].offset / REG_SIZE) {
scan_inst->reswizzle(inst->dst.writemask,
inst->src[0].swizzle);
scan_inst->dst.file = inst->dst.file;
scan_inst->dst.nr = inst->dst.nr;
- scan_inst->dst.reg_offset = inst->dst.reg_offset;
+ scan_inst->dst.offset = scan_inst->dst.offset % REG_SIZE +
+ ROUND_DOWN_TO(inst->dst.offset, REG_SIZE);
if (inst->saturate &&
inst->dst.type != scan_inst->dst.type) {
/* If we have reached this point, scan_inst is a non
foreach_block_and_inst(block, vec4_instruction, inst, cfg) {
if (inst->dst.file == VGRF && split_grf[inst->dst.nr] &&
- inst->dst.reg_offset != 0) {
+ inst->dst.offset / REG_SIZE != 0) {
inst->dst.nr = (new_virtual_grf[inst->dst.nr] +
- inst->dst.reg_offset - 1);
- inst->dst.reg_offset = 0;
+ inst->dst.offset / REG_SIZE - 1);
+ inst->dst.offset %= REG_SIZE;
}
for (int i = 0; i < 3; i++) {
if (inst->src[i].file == VGRF && split_grf[inst->src[i].nr] &&
- inst->src[i].reg_offset != 0) {
+ inst->src[i].offset / REG_SIZE != 0) {
inst->src[i].nr = (new_virtual_grf[inst->src[i].nr] +
- inst->src[i].reg_offset - 1);
- inst->src[i].reg_offset = 0;
+ inst->src[i].offset / REG_SIZE - 1);
+ inst->src[i].offset %= REG_SIZE;
}
}
}
switch (inst->dst.file) {
case VGRF:
- fprintf(file, "vgrf%d.%d", inst->dst.nr, inst->dst.reg_offset);
+ fprintf(file, "vgrf%d.%d", inst->dst.nr, inst->dst.offset / REG_SIZE);
break;
case FIXED_GRF:
fprintf(file, "g%d", inst->dst.nr);
}
/* Don't print .0; and only VGRFs have reg_offsets and sizes */
- if (inst->src[i].reg_offset != 0 &&
+ if (inst->src[i].offset / REG_SIZE != 0 &&
inst->src[i].file == VGRF &&
alloc.sizes[inst->src[i].nr] != 1)
- fprintf(file, ".%d", inst->src[i].reg_offset);
+ fprintf(file, ".%d", inst->src[i].offset / REG_SIZE);
if (inst->src[i].file != IMM) {
static const char *chans[4] = {"x", "y", "z", "w"};
if (inst->src[i].file != ATTR)
continue;
- int grf = attribute_map[inst->src[i].nr + inst->src[i].reg_offset];
+ int grf = attribute_map[inst->src[i].nr +
+ inst->src[i].offset / REG_SIZE];
/* All attributes used in the shader need to have been assigned a
* hardware register by the caller
dst_reg offset = dst;
dst_reg time = dst;
- time.reg_offset++;
+ time.offset += REG_SIZE;
offset.type = BRW_REGISTER_TYPE_UD;
int index = shader_time_index * 3 + shader_time_subindex;
struct brw_reg reg;
switch (src.file) {
case VGRF:
- reg = brw_vec8_grf(src.nr + src.reg_offset, 0);
+ reg = brw_vec8_grf(src.nr + src.offset / REG_SIZE, 0);
reg.type = src.type;
reg.swizzle = src.swizzle;
reg.abs = src.abs;
case UNIFORM:
reg = stride(brw_vec4_grf(prog_data->base.dispatch_grf_start_reg +
- (src.nr + src.reg_offset) / 2,
- ((src.nr + src.reg_offset) % 2) * 4),
+ (src.nr + src.offset / 16) / 2,
+ ((src.nr + src.offset / 16) % 2) * 4),
0, 4, 1);
reg.type = src.type;
reg.swizzle = src.swizzle;
switch (inst->dst.file) {
case VGRF:
- reg = brw_vec8_grf(dst.nr + dst.reg_offset, 0);
+ reg = brw_vec8_grf(dst.nr + dst.offset / REG_SIZE, 0);
reg.type = dst.type;
reg.writemask = dst.writemask;
break;
case MRF:
- assert(((dst.nr + dst.reg_offset) & ~BRW_MRF_COMPR4) < BRW_MAX_MRF(devinfo->gen));
- reg = brw_message_reg(dst.nr + dst.reg_offset);
+ assert(((dst.nr + dst.offset / REG_SIZE) & ~BRW_MRF_COMPR4) < BRW_MAX_MRF(devinfo->gen));
+ reg = brw_message_reg(dst.nr + dst.offset / REG_SIZE);
reg.type = dst.type;
reg.writemask = dst.writemask;
break;
dst_reg temp, src_reg orig_src,
int base_offset)
{
- int reg_offset = base_offset + orig_src.reg_offset;
+ int reg_offset = base_offset + orig_src.offset / REG_SIZE;
src_reg index = get_scratch_offset(block, inst, orig_src.reladdr,
reg_offset);
vec4_visitor::emit_scratch_write(bblock_t *block, vec4_instruction *inst,
int base_offset)
{
- int reg_offset = base_offset + inst->dst.reg_offset;
+ int reg_offset = base_offset + inst->dst.offset / REG_SIZE;
src_reg index = get_scratch_offset(block, inst, inst->dst.reladdr,
reg_offset);
inst->dst.file = temp.file;
inst->dst.nr = temp.nr;
- inst->dst.reg_offset = temp.reg_offset;
+ inst->dst.offset %= REG_SIZE;
inst->dst.reladdr = NULL;
}
dst_reg temp = dst_reg(this, glsl_type::vec4_type);
emit_scratch_read(block, inst, temp, src, scratch_loc[src.nr]);
src.nr = temp.nr;
- src.reg_offset = temp.reg_offset;
+ src.offset %= REG_SIZE;
src.reladdr = NULL;
}
dst_reg temp, src_reg orig_src,
int base_offset, src_reg indirect)
{
- int reg_offset = base_offset + orig_src.reg_offset;
+ int reg_offset = base_offset + orig_src.offset / 16;
const unsigned index = prog_data->base.binding_table.pull_constants_start;
src_reg offset;
inst->src[0].file != UNIFORM)
continue;
- int uniform_nr = inst->src[0].nr + inst->src[0].reg_offset;
+ int uniform_nr = inst->src[0].nr + inst->src[0].offset / 16;
for (unsigned j = 0; j < DIV_ROUND_UP(inst->src[2].ud, 16); j++)
pull_constant_loc[uniform_nr + j] = 0;
inst->src[0].file != UNIFORM)
continue;
- int uniform_nr = inst->src[0].nr + inst->src[0].reg_offset;
+ int uniform_nr = inst->src[0].nr + inst->src[0].offset / 16;
assert(inst->src[0].swizzle == BRW_SWIZZLE_NOOP);