Mesa (master): r600/sfn: cayman fix int trans op2

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon May 18 22:07:57 UTC 2020


Module: Mesa
Branch: master
Commit: 19273fb227d1434d28821aa5cae8ec2e7ab46d70
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=19273fb227d1434d28821aa5cae8ec2e7ab46d70

Author: Dave Airlie <airlied at redhat.com>
Date:   Mon May 18 16:28:10 2020 +1000

r600/sfn: cayman fix int trans op2

Fix integer multiplies

Reviewed-by: Gert Wollny <gert.wollny at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5084>

---

 .../drivers/r600/sfn/sfn_emitaluinstruction.cpp    | 38 +++++++++++++++++-----
 1 file changed, 29 insertions(+), 9 deletions(-)

diff --git a/src/gallium/drivers/r600/sfn/sfn_emitaluinstruction.cpp b/src/gallium/drivers/r600/sfn/sfn_emitaluinstruction.cpp
index ba84e57ac1a..566e253bcb5 100644
--- a/src/gallium/drivers/r600/sfn/sfn_emitaluinstruction.cpp
+++ b/src/gallium/drivers/r600/sfn/sfn_emitaluinstruction.cpp
@@ -710,15 +710,35 @@ bool EmitAluInstruction::emit_alu_trans_op2(const nir_alu_instr& instr, EAluOp o
    const nir_alu_src& src1 = instr.src[1];
 
    AluInstruction *ir = nullptr;
-   for (int i = 0; i < 4 ; ++i) {
-      if (instr.dest.write_mask & (1 << i)){
-         ir = new AluInstruction(opcode, from_nir(instr.dest, i), from_nir(src0, i), from_nir(src1, i), last_write);
-         if (src0.negate) ir->set_flag(alu_src0_neg);
-         if (src0.abs) ir->set_flag(alu_src0_abs);
-         if (src1.negate) ir->set_flag(alu_src1_neg);
-         if (src1.abs) ir->set_flag(alu_src1_abs);
-         if (instr.dest.saturate) ir->set_flag(alu_dst_clamp);
-         emit_instruction(ir);
+
+   if (get_chip_class() == CAYMAN) {
+      int lasti = util_last_bit(instr.dest.write_mask);
+      for (int k = 0; k < lasti ; ++k) {
+         if (instr.dest.write_mask & (1 << k)) {
+
+            for (int i = 0; i < 4; i++) {
+               ir = new AluInstruction(opcode, from_nir(instr.dest, i), from_nir(src0, k), from_nir(src1, k), (i == k) ? write : empty);
+               if (src0.negate) ir->set_flag(alu_src0_neg);
+            if (src0.abs) ir->set_flag(alu_src0_abs);
+            if (src1.negate) ir->set_flag(alu_src1_neg);
+            if (src1.abs) ir->set_flag(alu_src1_abs);
+            if (instr.dest.saturate) ir->set_flag(alu_dst_clamp);
+            if (i == 3) ir->set_flag(alu_last_instr);
+            emit_instruction(ir);
+            }
+         }
+      }
+   } else {
+      for (int i = 0; i < 4 ; ++i) {
+         if (instr.dest.write_mask & (1 << i)){
+            ir = new AluInstruction(opcode, from_nir(instr.dest, i), from_nir(src0, i), from_nir(src1, i), last_write);
+            if (src0.negate) ir->set_flag(alu_src0_neg);
+            if (src0.abs) ir->set_flag(alu_src0_abs);
+            if (src1.negate) ir->set_flag(alu_src1_neg);
+            if (src1.abs) ir->set_flag(alu_src1_abs);
+            if (instr.dest.saturate) ir->set_flag(alu_dst_clamp);
+            emit_instruction(ir);
+         }
       }
    }
    return true;



More information about the mesa-commit mailing list