From: Daniel Schürmann Date: Tue, 7 Apr 2020 09:46:37 +0000 (+0100) Subject: aco: don't constant-propagate into subdword PSEUDO instructions X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=a39df3bfce2c418a251eeafe2e309c9543a9d50d;p=mesa.git 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 Part-of: --- diff --git a/src/amd/compiler/aco_optimizer.cpp b/src/amd/compiler/aco_optimizer.cpp index 72ae710f838..5e80d9afe7f 100644 --- a/src/amd/compiler/aco_optimizer.cpp +++ b/src/amd/compiler/aco_optimizer.cpp @@ -699,13 +699,15 @@ void label_instruction(opt_ctx &ctx, Block& block, aco_ptr& 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) {