Module: Mesa
Branch: staging/22.2
Commit: 609949fbcf1b15c8db8a2ce7fa8f9dd8bb7739a2
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=609949fbcf1b15c8db8a2ce7fa8f9dd8bb7739a2

Author: Alyssa Rosenzweig <[email protected]>
Date:   Fri Sep  2 22:53:59 2022 -0400

agx: Fix float copyprop of neg(neg) case

They should cancel each other. Fixes:

   dEQP-GLES2.functional.shaders.random.basic_expression.combined.0

Fixes: 28801b48493 ("agx: Add forward optimizing pass for fmov")
Signed-off-by: Alyssa Rosenzweig <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18380>
(cherry picked from commit 095415cdf716e2f4311d07e01f2c279518c140aa)

---

 .pick_status.json                  | 2 +-
 src/asahi/compiler/agx_optimizer.c | 7 ++++---
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/.pick_status.json b/.pick_status.json
index a910fd8c063..dd24d4e0a3e 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -4522,7 +4522,7 @@
         "description": "agx: Fix float copyprop of neg(neg) case",
         "nominated": true,
         "nomination_type": 1,
-        "resolution": 0,
+        "resolution": 1,
         "main_sha": null,
         "because_sha": "28801b4849371e633eb66dd2c802d44dbb9e3304"
     },
diff --git a/src/asahi/compiler/agx_optimizer.c 
b/src/asahi/compiler/agx_optimizer.c
index ada3afa9be1..2c9471c6373 100644
--- a/src/asahi/compiler/agx_optimizer.c
+++ b/src/asahi/compiler/agx_optimizer.c
@@ -81,11 +81,12 @@ agx_is_fmov(agx_instr *def)
 static agx_index
 agx_compose_float_src(agx_index to, agx_index from)
 {
-   if (to.abs)
+   if (to.abs) {
       from.neg = false;
+      from.abs = true;
+   }
 
-   from.abs |= to.abs;
-   from.neg |= to.neg;
+   from.neg ^= to.neg;
 
    return from;
 }

Reply via email to