aco/optimizer: Convert s_add_u32 with literals to s_add_i32 if carry is not used.

To allow further optimizations to s_addk_i32.

Signed-off-by: Georg Lehmann <dadschoorse@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15999>
This commit is contained in:
Georg Lehmann
2022-04-17 14:32:34 +02:00
committed by Marge Bot
parent e06773281b
commit 52f8167b25

View File

@@ -4604,6 +4604,11 @@ apply_literals(opt_ctx& ctx, aco_ptr<Instruction>& instr)
}
}
/* allow more s_addk_i32 optimizations if carry isn't used */
if (instr->opcode == aco_opcode::s_add_u32 && ctx.uses[instr->definitions[1].tempId()] == 0 &&
(instr->operands[0].isLiteral() || instr->operands[1].isLiteral()))
instr->opcode = aco_opcode::s_add_i32;
ctx.instructions.emplace_back(std::move(instr));
}