fs_reg::init()
{
memset(this, 0, sizeof(*this));
- this->smear = -1;
stride = 1;
}
!reladdr && !r.reladdr &&
memcmp(&fixed_hw_reg, &r.fixed_hw_reg,
sizeof(fixed_hw_reg)) == 0 &&
- smear == r.smear &&
stride == r.stride &&
imm.u == r.imm.u);
}
return *this;
}
+fs_reg &
+fs_reg::set_smear(unsigned subreg)
+{
+ assert(file != HW_REG && file != IMM);
+ subreg_offset = subreg * type_sz(type);
+ stride = 0;
+ return *this;
+}
+
bool
fs_reg::is_contiguous() const
{
* else that might disrupt timing) by setting smear to 2 and checking if
* that field is != 0.
*/
- dst.smear = 0;
+ dst.set_smear(0);
return dst;
}
* were the only two timestamp reads that happened).
*/
fs_reg reset = shader_end_time;
- reset.smear = 2;
+ reset.set_smear(2);
fs_inst *test = emit(AND(reg_null_d, reset, fs_reg(1u)));
test->conditional_mod = BRW_CONDITIONAL_Z;
emit(IF(BRW_PREDICATE_NORMAL));
inst->src[i].file = GRF;
inst->src[i].reg = dst.reg;
inst->src[i].reg_offset = 0;
- inst->src[i].smear = pull_index & 3;
+ inst->src[i].set_smear(pull_index & 3);
}
}
}
inst->src[0].file != GRF ||
inst->src[0].negate ||
inst->src[0].abs ||
- inst->src[0].smear != -1 ||
- !inst->src[0].is_contiguous() ||
+ !inst->src[0].is_contiguous() ||
inst->dst.file != GRF ||
inst->dst.type != inst->src[0].type) {
continue;
inst->dst.file != MRF || inst->src[0].file != GRF ||
inst->dst.type != inst->src[0].type ||
inst->src[0].abs || inst->src[0].negate ||
- inst->src[0].smear != -1 || !inst->src[0].is_contiguous() ||
+ !inst->src[0].is_contiguous() ||
inst->src[0].subreg_offset)
continue;
bool abs;
bool sechalf;
struct brw_reg fixed_hw_reg;
- int smear; /* -1, or a channel of the reg to smear to all channels. */
+
+ /** Smear a channel of the reg to all channels. */
+ fs_reg &set_smear(unsigned subreg);
/** Value for file == IMM */
union {
bool has_source_modifiers = entry->src.abs || entry->src.negate;
if ((has_source_modifiers || entry->src.file == UNIFORM ||
- entry->src.smear != -1 || !entry->src.is_contiguous()) &&
+ !entry->src.is_contiguous()) &&
!can_do_source_mods(inst))
return false;
inst->src[arg].file = entry->src.file;
inst->src[arg].reg = entry->src.reg;
inst->src[arg].reg_offset = entry->src.reg_offset;
- if (entry->src.smear != -1)
- inst->src[arg].smear = entry->src.smear;
inst->src[arg].subreg_offset = entry->src.subreg_offset;
inst->src[arg].stride *= entry->src.stride;
switch (reg->file) {
case GRF:
case MRF:
- if (reg->stride == 0 || reg->smear >= 0) {
- brw_reg = brw_vec1_reg(brw_file_from_reg(reg), reg->reg, reg->smear);
+ if (reg->stride == 0) {
+ brw_reg = brw_vec1_reg(brw_file_from_reg(reg), reg->reg, 0);
} else {
brw_reg = brw_vec8_reg(brw_file_from_reg(reg), reg->reg, 0);
brw_reg = stride(brw_reg, 8 * reg->stride, 8, reg->stride);
* would get stomped by the first decode as well.
*/
int end_ip = ip;
- if (v->dispatch_width == 16 && (reg.smear != -1 || reg.stride == 0 ||
+ if (v->dispatch_width == 16 && (reg.stride == 0 ||
(v->pixel_x.reg == reg.reg ||
v->pixel_y.reg == reg.reg))) {
end_ip++;
* loading pull constants, so spilling them is unlikely to reduce
* register pressure anyhow.
*/
- if (inst->src[i].smear >= 0 || !inst->src[i].is_contiguous()) {
+ if (!inst->src[i].is_contiguous()) {
no_spill[inst->src[i].reg] = true;
}
}
if (inst->dst.file == GRF) {
spill_costs[inst->dst.reg] += inst->regs_written * loop_scale;
- if (inst->dst.smear >= 0 || !inst->dst.is_contiguous()) {
+ if (!inst->dst.is_contiguous()) {
no_spill[inst->dst.reg] = true;
}
}
emit(fs_inst(FS_OPCODE_UNIFORM_PULL_CONSTANT_LOAD,
packed_consts, surf_index, const_offset_reg));
- packed_consts.smear = const_offset->value.u[0] % 16 / 4;
for (int i = 0; i < ir->type->vector_elements; i++) {
+ packed_consts.set_smear(const_offset->value.u[0] % 16 / 4 + i);
+
+ /* The std140 packing rules don't allow vectors to cross 16-byte
+ * boundaries, and a reg is 32 bytes.
+ */
+ assert(packed_consts.subreg_offset < 32);
+
/* UBO bools are any nonzero value. We consider bools to be
* values with the low bit set to 1. Convert them using CMP.
*/
emit(MOV(result, packed_consts));
}
- packed_consts.smear++;
result.reg_offset++;
-
- /* The std140 packing rules don't allow vectors to cross 16-byte
- * boundaries, and a reg is 32 bytes.
- */
- assert(packed_consts.smear < 8);
}
} else {
/* Turn the byte offset into a dword offset. */