intel/brw: Apply conventions to lower_src_modifiers helper

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33110>
This commit is contained in:
Caio Oliveira 2024-12-06 22:07:45 -08:00
parent 7d41cfa1a9
commit 793cba0e6f
3 changed files with 24 additions and 28 deletions

View file

@ -481,9 +481,6 @@ namespace brw {
{
return brw_uniform_reg(wm_prog_data->msaa_flags_param, BRW_TYPE_UD);
}
bool
lower_src_modifiers(fs_visitor *v, bblock_t *block, fs_inst *inst, unsigned i);
}
enum intel_barycentric_mode brw_barycentric_mode(const struct brw_wm_prog_key *key,
@ -540,6 +537,7 @@ bool brw_lower_scoreboard(fs_visitor &s);
bool brw_lower_send_descriptors(fs_visitor &s);
bool brw_lower_sends_overlapping_payload(fs_visitor &s);
bool brw_lower_simd_width(fs_visitor &s);
bool brw_lower_src_modifiers(fs_visitor &s, bblock_t *block, fs_inst *inst, unsigned i);
bool brw_lower_sub_sat(fs_visitor &s);
bool brw_lower_subgroup_ops(fs_visitor &s);
bool brw_lower_uniform_pull_constant_loads(fs_visitor &s);

View file

@ -247,7 +247,7 @@ brw_lower_mul_dword_inst(fs_visitor &s, fs_inst *inst, bblock_t *block)
if (inst->src[1].abs || (inst->src[1].negate &&
source_mods_unsupported))
lower_src_modifiers(&s, block, inst, 1);
brw_lower_src_modifiers(s, block, inst, 1);
if (inst->src[1].file == IMM) {
unsigned a;
@ -385,7 +385,7 @@ brw_lower_mulh_inst(fs_visitor &s, fs_inst *inst, bblock_t *block)
* mach (8) r5.0<1>:d r2.0<8;8,1>:d r3.0<8;8,1>:d"
*/
if (inst->src[1].negate || inst->src[1].abs)
lower_src_modifiers(&s, block, inst, 1);
brw_lower_src_modifiers(s, block, inst, 1);
/* Should have been lowered to 8-wide. */
assert(inst->exec_size <= brw_get_lowered_simd_width(&s, inst));

View file

@ -461,31 +461,29 @@ namespace {
lower_instruction(fs_visitor *v, bblock_t *block, fs_inst *inst);
}
namespace brw {
/**
* Remove any modifiers from the \p i-th source region of the instruction,
* including negate, abs and any implicit type conversion to the execution
* type. Instead any source modifiers will be implemented as a separate
* MOV instruction prior to the original instruction.
*/
bool
lower_src_modifiers(fs_visitor *v, bblock_t *block, fs_inst *inst, unsigned i)
{
assert(inst->components_read(i) == 1);
assert(v->devinfo->has_integer_dword_mul ||
inst->opcode != BRW_OPCODE_MUL ||
brw_type_is_float(get_exec_type(inst)) ||
MIN2(brw_type_size_bytes(inst->src[0].type), brw_type_size_bytes(inst->src[1].type)) >= 4 ||
brw_type_size_bytes(inst->src[i].type) == get_exec_type_size(inst));
/**
* Remove any modifiers from the \p i-th source region of the instruction,
* including negate, abs and any implicit type conversion to the execution
* type. Instead any source modifiers will be implemented as a separate
* MOV instruction prior to the original instruction.
*/
bool
brw_lower_src_modifiers(fs_visitor &s, bblock_t *block, fs_inst *inst, unsigned i)
{
assert(inst->components_read(i) == 1);
assert(s.devinfo->has_integer_dword_mul ||
inst->opcode != BRW_OPCODE_MUL ||
brw_type_is_float(get_exec_type(inst)) ||
MIN2(brw_type_size_bytes(inst->src[0].type), brw_type_size_bytes(inst->src[1].type)) >= 4 ||
brw_type_size_bytes(inst->src[i].type) == get_exec_type_size(inst));
const brw_builder ibld(v, block, inst);
const brw_reg tmp = ibld.vgrf(get_exec_type(inst));
const brw_builder ibld(&s, block, inst);
const brw_reg tmp = ibld.vgrf(get_exec_type(inst));
lower_instruction(v, block, ibld.MOV(tmp, inst->src[i]));
inst->src[i] = tmp;
lower_instruction(&s, block, ibld.MOV(tmp, inst->src[i]));
inst->src[i] = tmp;
return true;
}
return true;
}
namespace {
@ -789,7 +787,7 @@ namespace {
for (unsigned i = 0; i < inst->sources; i++) {
if (has_invalid_src_modifiers(devinfo, inst, i))
progress |= lower_src_modifiers(v, block, inst, i);
progress |= brw_lower_src_modifiers(*v, block, inst, i);
if (has_invalid_src_region(devinfo, inst, i))
progress |= lower_src_region(v, block, inst, i);