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

Author: Gert Wollny <[email protected]>
Date:   Tue Jun 20 21:13:23 2023 +0200

r600/sfn: Add source mod propagation also to fp64 ops

Signed-off-by: Gert Wollny <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23754>

---

 src/gallium/drivers/r600/sfn/sfn_instr_alu.cpp | 6 ++----
 src/gallium/drivers/r600/sfn/sfn_peephole.cpp  | 8 +++++++-
 2 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/src/gallium/drivers/r600/sfn/sfn_instr_alu.cpp 
b/src/gallium/drivers/r600/sfn/sfn_instr_alu.cpp
index c5dbd209a60..bbe18c02139 100644
--- a/src/gallium/drivers/r600/sfn/sfn_instr_alu.cpp
+++ b/src/gallium/drivers/r600/sfn/sfn_instr_alu.cpp
@@ -1960,8 +1960,6 @@ emit_alu_neg(const nir_alu_instr& alu, Shader& shader)
 {
    auto& value_factory = shader.value_factory();
 
-   auto group = new AluGroup();
-
    AluInstr *ir = nullptr;
 
    for (unsigned i = 0; i < nir_dest_num_components(alu.dest.dest); ++i) {
@@ -1970,13 +1968,13 @@ emit_alu_neg(const nir_alu_instr& alu, Shader& shader)
                            value_factory.dest(alu.dest, 2 * i + c, pin_chan),
                            value_factory.src64(alu.src[0], i, c),
                            {alu_write});
-         group->add_instruction(ir);
+         shader.emit_instruction(ir);
       }
       ir->set_source_mod(0, AluInstr::mod_neg);
    }
    if (ir)
       ir->set_alu_flag(alu_last_instr);
-   shader.emit_instruction(group);
+
    return true;
 }
 
diff --git a/src/gallium/drivers/r600/sfn/sfn_peephole.cpp 
b/src/gallium/drivers/r600/sfn/sfn_peephole.cpp
index a8cae1d5bc9..3d9128b8373 100644
--- a/src/gallium/drivers/r600/sfn/sfn_peephole.cpp
+++ b/src/gallium/drivers/r600/sfn/sfn_peephole.cpp
@@ -25,6 +25,7 @@
  */
 
 #include "sfn_peephole.h"
+#include "sfn_instr_alugroup.h"
 
 namespace r600 {
 
@@ -122,7 +123,7 @@ PeepholeVisitor::visit(AluInstr *instr)
    }
 
    auto opinfo = alu_ops.at(instr->opcode());
-   if (opinfo.can_srcmod && !opinfo.is_fp64)
+   if (opinfo.can_srcmod)
          apply_source_mods(instr);
 }
 
@@ -138,6 +139,11 @@ PeepholeVisitor::convert_to_mov(AluInstr *alu, int src_idx)
 void
 PeepholeVisitor::visit(UNUSED AluGroup *instr)
 {
+   for (auto alu : *instr) {
+      if (!alu)
+         continue;
+      visit(alu);
+   }
 }
 
 void

Reply via email to