aco: don't propagate SGPRs into subdword PSEUDO instructions
authorDaniel Schürmann <daniel@schuermann.dev>
Fri, 21 Feb 2020 16:06:32 +0000 (17:06 +0100)
committerDaniel Schürmann <daniel@schuermann.dev>
Fri, 3 Apr 2020 22:13:15 +0000 (23:13 +0100)
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-By: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4002>

src/amd/compiler/aco_optimizer.cpp

index a6b68dd5448903a1e6ddc4662d022495d9d9088e..f3819676df9bf8775eefc668ee3581f250bf1227 100644 (file)
@@ -698,8 +698,12 @@ void label_instruction(opt_ctx &ctx, Block& block, aco_ptr<Instruction>& instr)
       /* SALU / PSEUDO: propagate inline constants */
       if (instr->isSALU() || instr->format == Format::PSEUDO) {
          if (info.is_temp() && info.temp.type() == RegType::sgpr) {
-            instr->operands[i].setTemp(info.temp);
-            info = ctx.info[info.temp.id()];
+            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()];
+            }
          } else if (info.is_temp() && info.temp.type() == RegType::vgpr) {
             /* propagate vgpr if it can take it */
             switch (instr->opcode) {