mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-06 11:00:11 +01:00
ir3/cp: add option to disable immediate to const lowering
This will allow it to be used after ir3_imm_const_to_preamble so that we don't have to do the propagation of immediates manually there. Signed-off-by: Job Noorman <jnoorman@igalia.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34397>
This commit is contained in:
parent
6546a40225
commit
1618c2495b
3 changed files with 9 additions and 3 deletions
|
|
@ -2311,7 +2311,8 @@ bool ir3_cf(struct ir3 *ir);
|
|||
bool ir3_shared_fold(struct ir3 *ir);
|
||||
|
||||
/* copy-propagate: */
|
||||
bool ir3_cp(struct ir3 *ir, struct ir3_shader_variant *so);
|
||||
bool ir3_cp(struct ir3 *ir, struct ir3_shader_variant *so,
|
||||
bool lower_imm_to_const);
|
||||
|
||||
/* common subexpression elimination: */
|
||||
bool ir3_cse(struct ir3 *ir);
|
||||
|
|
|
|||
|
|
@ -5805,7 +5805,7 @@ ir3_compile_shader_nir(struct ir3_compiler *compiler,
|
|||
/* the folding doesn't seem to work reliably on a4xx */
|
||||
if (ctx->compiler->gen != 4)
|
||||
progress |= IR3_PASS(ir, ir3_cf);
|
||||
progress |= IR3_PASS(ir, ir3_cp, so);
|
||||
progress |= IR3_PASS(ir, ir3_cp, so, true);
|
||||
progress |= IR3_PASS(ir, ir3_cse);
|
||||
progress |= IR3_PASS(ir, ir3_dce, so);
|
||||
progress |= IR3_PASS(ir, ir3_opt_predicates, so);
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ struct ir3_cp_ctx {
|
|||
struct ir3 *shader;
|
||||
struct ir3_shader_variant *so;
|
||||
bool progress;
|
||||
bool lower_imm_to_const;
|
||||
};
|
||||
|
||||
/* is it a type preserving mov, with ok flags?
|
||||
|
|
@ -124,6 +125,9 @@ static bool
|
|||
lower_immed(struct ir3_cp_ctx *ctx, struct ir3_instruction *instr, unsigned n,
|
||||
struct ir3_register *reg, unsigned new_flags)
|
||||
{
|
||||
if (!ctx->lower_imm_to_const)
|
||||
return false;
|
||||
|
||||
if (!(new_flags & IR3_REG_IMMED))
|
||||
return false;
|
||||
|
||||
|
|
@ -591,11 +595,12 @@ instr_cp(struct ir3_cp_ctx *ctx, struct ir3_instruction *instr)
|
|||
}
|
||||
|
||||
bool
|
||||
ir3_cp(struct ir3 *ir, struct ir3_shader_variant *so)
|
||||
ir3_cp(struct ir3 *ir, struct ir3_shader_variant *so, bool lower_imm_to_const)
|
||||
{
|
||||
struct ir3_cp_ctx ctx = {
|
||||
.shader = ir,
|
||||
.so = so,
|
||||
.lower_imm_to_const = lower_imm_to_const,
|
||||
};
|
||||
|
||||
/* This is a bit annoying, and probably wouldn't be necessary if we
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue