}
static bool
-try_constant_propagate(struct brw_context *brw, vec4_instruction *inst,
+try_constant_propagate(const struct brw_device_info *devinfo,
+ vec4_instruction *inst,
int arg, struct copy_entry *entry)
{
/* For constant propagation, we only handle the same constant
}
if (inst->src[arg].abs) {
- if ((brw->gen >= 8 && is_logic_op(inst->opcode)) ||
+ if ((devinfo->gen >= 8 && is_logic_op(inst->opcode)) ||
!brw_abs_immediate(value.type, &value.fixed_hw_reg)) {
return false;
}
}
if (inst->src[arg].negate) {
- if ((brw->gen >= 8 && is_logic_op(inst->opcode)) ||
+ if ((devinfo->gen >= 8 && is_logic_op(inst->opcode)) ||
!brw_negate_immediate(value.type, &value.fixed_hw_reg)) {
return false;
}
switch (inst->opcode) {
case BRW_OPCODE_MOV:
+ case SHADER_OPCODE_BROADCAST:
inst->src[arg] = value;
return true;
case SHADER_OPCODE_POW:
case SHADER_OPCODE_INT_QUOTIENT:
case SHADER_OPCODE_INT_REMAINDER:
- if (brw->gen < 8)
+ if (devinfo->gen < 8)
break;
/* fallthrough */
case BRW_OPCODE_DP2:
}
static bool
-try_copy_propagate(struct brw_context *brw, vec4_instruction *inst,
+try_copy_propagate(const struct brw_device_info *devinfo,
+ vec4_instruction *inst,
int arg, struct copy_entry *entry)
{
/* For constant propagation, we only handle the same constant
value.file != ATTR)
return false;
- if (brw->gen >= 8 && (value.negate || value.abs) &&
+ if (devinfo->gen >= 8 && (value.negate || value.abs) &&
is_logic_op(inst->opcode)) {
return false;
}
* instructions.
*/
if ((has_source_modifiers || value.file == UNIFORM ||
- value.swizzle != BRW_SWIZZLE_XYZW) && !inst->can_do_source_mods(brw))
+ value.swizzle != BRW_SWIZZLE_XYZW) && !inst->can_do_source_mods(devinfo))
return false;
if (has_source_modifiers && value.type != inst->src[arg].type)
if (c != 4)
continue;
- if (do_constant_prop && try_constant_propagate(brw, inst, i, &entry))
+ if (do_constant_prop && try_constant_propagate(devinfo, inst, i, &entry))
progress = true;
- if (try_copy_propagate(brw, inst, i, &entry))
+ if (try_copy_propagate(devinfo, inst, i, &entry))
progress = true;
}