}
static inline src_reg
-offset(src_reg reg, unsigned delta)
+offset(src_reg reg, unsigned width, unsigned delta)
{
- assert(delta == 0 ||
- (reg.file != ARF && reg.file != FIXED_GRF && reg.file != IMM));
- reg.offset += delta * (reg.file == UNIFORM ? 16 : REG_SIZE);
- return reg;
+ const unsigned stride = (reg.file == UNIFORM ? 0 : 4);
+ const unsigned num_components = MAX2(width / 4 * stride, 4);
+ return byte_offset(reg, num_components * type_sz(reg.type) * delta);
}
/**
}
static inline dst_reg
-offset(dst_reg reg, unsigned delta)
+offset(dst_reg reg, unsigned width, unsigned delta)
{
- assert(delta == 0 ||
- (reg.file != ARF && reg.file != FIXED_GRF && reg.file != IMM));
- reg.offset += delta * (reg.file == UNIFORM ? 16 : REG_SIZE);
- return reg;
+ const unsigned stride = (reg.file == UNIFORM ? 0 : 4);
+ const unsigned num_components = MAX2(width / 4 * stride, 4);
+ return byte_offset(reg, num_components * type_sz(reg.type) * delta);
}
static inline dst_reg
DIV_ROUND_UP(size * dst_stride, 4));
for (unsigned i = 0; i < size; ++i)
- bld.MOV(writemask(offset(dst, i * dst_stride / 4),
+ bld.MOV(writemask(offset(dst, 8, i * dst_stride / 4),
1 << (i * dst_stride % 4)),
- swizzle(offset(src, i * src_stride / 4),
+ swizzle(offset(src, 8, i * src_stride / 4),
brw_swizzle_for_mask(1 << (i * src_stride % 4))));
return src_reg(dst);
unsigned n = 0;
if (header_sz)
- bld.exec_all().MOV(offset(payload, n++),
+ bld.exec_all().MOV(offset(payload, 8, n++),
retype(header, BRW_REGISTER_TYPE_UD));
for (unsigned i = 0; i < addr_sz; i++)
- bld.MOV(offset(payload, n++),
- offset(retype(addr, BRW_REGISTER_TYPE_UD), i));
+ bld.MOV(offset(payload, 8, n++),
+ offset(retype(addr, BRW_REGISTER_TYPE_UD), 8, i));
for (unsigned i = 0; i < src_sz; i++)
- bld.MOV(offset(payload, n++),
- offset(retype(src, BRW_REGISTER_TYPE_UD), i));
+ bld.MOV(offset(payload, 8, n++),
+ offset(retype(src, BRW_REGISTER_TYPE_UD), 8, i));
/* Reduce the dynamically uniform surface index to a single
* scalar.