aco: also reassign p_extract_vector post ra
authorGeorg Lehmann <dadschoorse@gmail.com>
Tue, 2 May 2023 09:54:26 +0000 (11:54 +0200)
committerMarge Bot <emma+marge@anholt.net>
Thu, 11 May 2023 10:26:24 +0000 (10:26 +0000)
Foz-DB Navi21:
Totals from 1223 (0.91% of 134864) affected shaders:
CodeSize: 6923888 -> 6913516 (-0.15%)
Instrs: 1293744 -> 1291151 (-0.20%)
Latency: 16928653 -> 16925035 (-0.02%); split: -0.02%, +0.00%
InvThroughput: 2985304 -> 2984775 (-0.02%); split: -0.02%, +0.00%
VClause: 32260 -> 32319 (+0.18%)
SClause: 54952 -> 54949 (-0.01%)
Copies: 83968 -> 81377 (-3.09%)

Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22821>

src/amd/compiler/aco_optimizer_postRA.cpp

index b9dd52a..a21bc33 100644 (file)
@@ -624,7 +624,8 @@ try_reassign_split_vector(pr_opt_ctx& ctx, aco_ptr<Instruction>& instr)
 
       /* Check if the operand is written by p_split_vector. */
       Instruction* split_vec = ctx.get(op_instr_idx);
-      if (split_vec->opcode != aco_opcode::p_split_vector)
+      if (split_vec->opcode != aco_opcode::p_split_vector &&
+          split_vec->opcode != aco_opcode::p_extract_vector)
          continue;
 
       Operand& split_op = split_vec->operands[0];
@@ -645,6 +646,10 @@ try_reassign_split_vector(pr_opt_ctx& ctx, aco_ptr<Instruction>& instr)
          continue;
 
       PhysReg reg = split_op.physReg();
+      if (split_vec->opcode == aco_opcode::p_extract_vector) {
+         reg =
+            reg.advance(split_vec->definitions[0].bytes() * split_vec->operands[1].constantValue());
+      }
       for (Definition& def : split_vec->definitions) {
          if (def.getTemp() != op.getTemp()) {
             reg = reg.advance(def.bytes());