From 60c5abf6857b57893f313e2228e2ec0fac8f1995 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timur=20Krist=C3=B3f?= Date: Fri, 18 Jun 2021 15:25:35 +0200 Subject: [PATCH] aco: Remove s_and with exec when all lanes are active. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This helps NGG GS and culling shaders. No Fossil DB changes without NGG culling. Signed-off-by: Timur Kristóf Reviewed-by: Daniel Schürmann Part-of: --- src/amd/compiler/aco_optimizer.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/amd/compiler/aco_optimizer.cpp b/src/amd/compiler/aco_optimizer.cpp index af7dc3a3f68..8e4daaa8167 100644 --- a/src/amd/compiler/aco_optimizer.cpp +++ b/src/amd/compiler/aco_optimizer.cpp @@ -1642,6 +1642,13 @@ label_instruction(opt_ctx& ctx, aco_ptr& instr) ctx.info[instr->definitions[0].tempId()].set_uniform_bool( ctx.info[instr->operands[0].tempId()].instr->definitions[1].getTemp()); break; + } else if ((ctx.program->stage.num_sw_stages() > 1 || + ctx.program->stage.hw == HWStage::NGG) && + instr->pass_flags == 1) { + /* In case of merged shaders, pass_flags=1 means that all lanes are active (exec=-1), so + * s_and is unnecessary. */ + ctx.info[instr->definitions[0].tempId()].set_temp(instr->operands[0].getTemp()); + break; } else if (ctx.info[instr->operands[0].tempId()].is_vopc()) { Instruction* vopc_instr = ctx.info[instr->operands[0].tempId()].instr; /* Remove superfluous s_and when the VOPC instruction uses the same exec and thus