aco,radeonsi: don't forward LINE_STIPPLE_TEX_ENA VGPR from the PS prolog

It's unused. This frees 1 VGPR in the prolog for temps.

This only affects radeonsi.
This commit is contained in:
Marek Olšák 2026-04-25 14:04:21 -04:00
parent c1dbfc20fc
commit 57e465a3e4
2 changed files with 18 additions and 1 deletions

View file

@ -174,8 +174,16 @@ passthrough_all_args(isel_context* ctx, std::vector<Operand>& regs)
struct ac_arg arg;
arg.used = true;
for (arg.arg_index = 0; arg.arg_index < ctx->args->arg_count; arg.arg_index++)
for (arg.arg_index = 0; arg.arg_index < ctx->args->arg_count; arg.arg_index++) {
/* Don't pass LINE_STIPPLE_TEX_ENA to the next shader binary because it's unused.
* This saves 1 VGPR in the prolog.
*/
if (ctx->args->line_stipple_tex_ena.used &&
arg.arg_index == ctx->args->line_stipple_tex_ena.arg_index)
continue;
regs.emplace_back(Operand(get_arg(ctx, arg), get_arg_reg(ctx->args, arg)));
}
}
Temp

View file

@ -514,11 +514,20 @@ void si_llvm_build_ps_prolog(struct si_shader_context *ctx, union si_shader_part
si_llvm_create_func(ctx, "ps_prolog", return_types, num_returns, 0);
LLVMValueRef func = ctx->main_fn.value;
/* Disable elimination of unused inputs. */
ac_llvm_add_target_dep_function_attr(ctx->main_fn.value, "InitialPSInputAddr", 0xffffff);
/* Copy inputs to outputs. This should be no-op, as the registers match,
* but it will prevent the compiler from overwriting them unintentionally.
*/
LLVMValueRef ret = ctx->return_value;
for (int i = 0; i < args->ac.arg_count; i++) {
/* Don't pass LINE_STIPPLE_TEX_ENA to the next shader binary because it's unused.
* This saves 1 VGPR in the prolog.
*/
if (args->ac.line_stipple_tex_ena.used && i == args->ac.line_stipple_tex_ena.arg_index)
continue;
LLVMValueRef p = LLVMGetParam(func, i);
ret = insert_ret_of_arg(ctx, ret, p, i);
}