aco: improve sub-dword check for sgpr/constant propagation
authorRhys Perry <pendingchaos02@gmail.com>
Mon, 18 May 2020 14:26:58 +0000 (15:26 +0100)
committerMarge Bot <eric+marge@anholt.net>
Mon, 15 Jun 2020 18:24:22 +0000 (18:24 +0000)
p_create_vector can have sub-dword operands with a v1 definition.

No fossil-db changes.

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5245>

src/amd/compiler/aco_optimizer.cpp

index 211f347c0ab4222d2a3c697bb5e3e083a1cc07cd..37564b7e993fe60fe5814b25e198ab503c173e91 100644 (file)
@@ -727,11 +727,16 @@ 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();});
+         bool is_subdword = false;
          // TODO: optimize SGPR and constant propagation for subdword pseudo instructions on gfx9+
-         if (is_subdword)
-            continue;
+         if (instr->format == Format::PSEUDO) {
+            is_subdword = std::any_of(instr->definitions.begin(), instr->definitions.end(),
+                                      [] (const Definition& def) { return def.regClass().is_subdword();});
+            is_subdword = is_subdword || std::any_of(instr->operands.begin(), instr->operands.end(),
+                                                     [] (const Operand& op) { return op.hasRegClass() && op.regClass().is_subdword();});
+            if (is_subdword)
+               continue;
+         }
 
          if (info.is_temp() && info.temp.type() == RegType::sgpr) {
             instr->operands[i].setTemp(info.temp);