From dc6c35e1c328f3f2db87d9ebd55f892527071683 Mon Sep 17 00:00:00 2001 From: Rhys Perry Date: Fri, 22 Nov 2019 14:34:24 +0000 Subject: [PATCH] aco: be more careful with literals in combine_salu_{n2,lshl_add} MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit No pipeline-db changes. Signed-off-by: Rhys Perry Reviewed-by: Daniel Schürmann Part-of: --- src/amd/compiler/aco_optimizer.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) 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]; -- 2.30.2