aco: Remove s_and with exec when all lanes are active.

This helps NGG GS and culling shaders.
No Fossil DB changes without NGG culling.

Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11458>
This commit is contained in:
Timur Kristóf 2021-06-18 15:25:35 +02:00 committed by Marge Bot
parent e66f54e5c8
commit 60c5abf685
1 changed files with 7 additions and 0 deletions

View File

@ -1642,6 +1642,13 @@ label_instruction(opt_ctx& ctx, aco_ptr<Instruction>& 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