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

Author: Faith Ekstrand <faith.ekstr...@collabora.com>
Date:   Sat Dec  9 10:38:55 2023 -0600

nak/sm50: Fix legalization of OpIAdd

Most of them specified bits 20..40 which is wrong because it's actually
19 bits with the sign bit off in bit 56 for some reason.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26615>

---

 src/nouveau/compiler/nak/legalize.rs | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/nouveau/compiler/nak/legalize.rs 
b/src/nouveau/compiler/nak/legalize.rs
index c027ad365f5..cccc9368806 100644
--- a/src/nouveau/compiler/nak/legalize.rs
+++ b/src/nouveau/compiler/nak/legalize.rs
@@ -147,7 +147,9 @@ fn legalize_sm50_instr(
         }
         Op::Vote(_) => (),
         Op::IAdd2(op) => {
-            copy_src_if_not_reg(b, &mut op.srcs[1], RegFile::GPR);
+            let [ref mut src0, ref mut src1] = op.srcs;
+            swap_srcs_if_not_reg(src0, src1);
+            copy_src_if_not_reg(b, src0, RegFile::GPR);
         }
         Op::I2F(op) => {
             copy_src_if_not_reg(b, &mut op.src, RegFile::GPR);

Reply via email to