From: Rhys Perry Date: Fri, 22 Nov 2019 14:34:24 +0000 (+0000) Subject: aco: be more careful with literals in combine_salu_{n2,lshl_add} X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=dc6c35e1c328f3f2db87d9ebd55f892527071683;p=mesa.git aco: be more careful with literals in combine_salu_{n2,lshl_add} No pipeline-db changes. Signed-off-by: Rhys Perry Reviewed-by: Daniel Schürmann Part-of: --- diff --git a/src/amd/compiler/aco_optimizer.cpp b/src/amd/compiler/aco_optimizer.cpp index 387d8c76c0a..61cb58df172 100644 --- a/src/amd/compiler/aco_optimizer.cpp +++ b/src/amd/compiler/aco_optimizer.cpp @@ -1678,6 +1678,10 @@ bool combine_salu_n2(opt_ctx& ctx, aco_ptr& instr) if (!op2_instr || (op2_instr->opcode != aco_opcode::s_not_b32 && op2_instr->opcode != aco_opcode::s_not_b64)) continue; + if (instr->operands[!i].isLiteral() && op2_instr->operands[0].isLiteral() && + instr->operands[!i].constantValue() != op2_instr->operands[0].constantValue()) + continue; + ctx.uses[instr->operands[i].tempId()]--; instr->operands[0] = instr->operands[!i]; instr->operands[1] = op2_instr->operands[0]; @@ -1720,6 +1724,10 @@ bool combine_salu_lshl_add(opt_ctx& ctx, aco_ptr& instr) if (shift < 1 || shift > 4) continue; + if (instr->operands[!i].isLiteral() && op2_instr->operands[0].isLiteral() && + instr->operands[!i].constantValue() != op2_instr->operands[0].constantValue()) + continue; + ctx.uses[instr->operands[i].tempId()]--; instr->operands[1] = instr->operands[!i]; instr->operands[0] = op2_instr->operands[0];