aco: don't constant-propagate into subdword PSEUDO instructions

PSEUDO instructions are lowered using SDWA, and thus,
cannot take literals and before GFX9 cannot take constants
at all. As the in-register representation differs between
32bit and 16bit floats, we first need to ensure correct
behavior.

Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4492>
This commit is contained in:
Daniel Schürmann 2020-04-07 10:46:37 +01:00 committed by Marge Bot
parent 1de18708cb
commit a39df3bfce
1 changed files with 8 additions and 6 deletions

View File

@ -699,13 +699,15 @@ void label_instruction(opt_ctx &ctx, Block& block, aco_ptr<Instruction>& instr)
/* SALU / PSEUDO: propagate inline constants */
if (instr->isSALU() || instr->format == Format::PSEUDO) {
const bool is_subdword = std::any_of(instr->definitions.begin(), instr->definitions.end(),
[] (const Definition& def) { return def.regClass().is_subdword();});
// TODO: optimize SGPR and constant propagation for subdword pseudo instructions on gfx9+
if (is_subdword)
continue;
if (info.is_temp() && info.temp.type() == RegType::sgpr) {
const bool is_subdword = std::any_of(instr->definitions.begin(), instr->definitions.end(),
[] (const Definition& def) { return def.regClass().is_subdword();});
if (instr->isSALU() || !is_subdword) {
instr->operands[i].setTemp(info.temp);
info = ctx.info[info.temp.id()];
}
instr->operands[i].setTemp(info.temp);
info = ctx.info[info.temp.id()];
} else if (info.is_temp() && info.temp.type() == RegType::vgpr) {
/* propagate vgpr if it can take it */
switch (instr->opcode) {