Mesa (main): aco: fix check_vop3_operands() for f16vec2 ffma fneg combine

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Dec 17 11:36:34 UTC 2021


Module: Mesa
Branch: main
Commit: 94603786c5d6caf6988680e8469067a65ffffdff
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=94603786c5d6caf6988680e8469067a65ffffdff

Author: Rhys Perry <pendingchaos02 at gmail.com>
Date:   Thu Dec 16 15:47:53 2021 +0000

aco: fix check_vop3_operands() for f16vec2 ffma fneg combine

For v_pk_fma_f16, we should consider all three operands, not the first
two.

Signed-off-by: Rhys Perry <pendingchaos02 at gmail.com>
Reviewed-by: Daniel Schürmann <daniel at schuermann.dev>
Fixes: 15a375b4c86 ("radv,aco: don't lower some ffma instructions")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14229>

---

 src/amd/compiler/aco_optimizer.cpp | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/amd/compiler/aco_optimizer.cpp b/src/amd/compiler/aco_optimizer.cpp
index ed90c63bf30..9b1ac026b89 100644
--- a/src/amd/compiler/aco_optimizer.cpp
+++ b/src/amd/compiler/aco_optimizer.cpp
@@ -3120,8 +3120,11 @@ combine_vop3p(opt_ctx& ctx, aco_ptr<Instruction>& instr)
          ssa_info& info = ctx.info[op.tempId()];
          if (info.is_vop3p() && info.instr->opcode == aco_opcode::v_pk_mul_f16 &&
              info.instr->operands[1].constantEquals(0xBC00)) {
-            Operand ops[2] = {instr->operands[!i], info.instr->operands[0]};
-            if (!check_vop3_operands(ctx, 2, ops))
+            Operand ops[3];
+            for (unsigned j = 0; j < instr->operands.size(); j++)
+               ops[j] = instr->operands[j];
+            ops[i] = info.instr->operands[0];
+            if (!check_vop3_operands(ctx, instr->operands.size(), ops))
                continue;
 
             VOP3P_instruction* fneg = &info.instr->vop3p();



More information about the mesa-commit mailing list