From 793cba0e6fb888fd553ac967e14dcc15a57bb45b Mon Sep 17 00:00:00 2001 From: Caio Oliveira Date: Fri, 6 Dec 2024 22:07:45 -0800 Subject: [PATCH] intel/brw: Apply conventions to lower_src_modifiers helper Reviewed-by: Lionel Landwerlin Part-of: --- src/intel/compiler/brw_fs.h | 4 +- .../brw_lower_integer_multiplication.cpp | 4 +- src/intel/compiler/brw_lower_regioning.cpp | 44 +++++++++---------- 3 files changed, 24 insertions(+), 28 deletions(-) diff --git a/src/intel/compiler/brw_fs.h b/src/intel/compiler/brw_fs.h index 36cba9427bb..47bb4af150a 100644 --- a/src/intel/compiler/brw_fs.h +++ b/src/intel/compiler/brw_fs.h @@ -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); diff --git a/src/intel/compiler/brw_lower_integer_multiplication.cpp b/src/intel/compiler/brw_lower_integer_multiplication.cpp index 46b8a4e6b73..c16ba89edbb 100644 --- a/src/intel/compiler/brw_lower_integer_multiplication.cpp +++ b/src/intel/compiler/brw_lower_integer_multiplication.cpp @@ -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)); diff --git a/src/intel/compiler/brw_lower_regioning.cpp b/src/intel/compiler/brw_lower_regioning.cpp index defe845bb68..26f6ffc5b23 100644 --- a/src/intel/compiler/brw_lower_regioning.cpp +++ b/src/intel/compiler/brw_lower_regioning.cpp @@ -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);