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

Author: Boris Brezillon <[email protected]>
Date:   Sun Oct 18 21:52:25 2020 +0200

pan/bi: Lower {i,u}{min,max} instructions

There's no native integer min/min instruction on Bifrost, lower those
to a cmp+bcsel pair.

Signed-off-by: Boris Brezillon <[email protected]>
Reviewed-by: Alyssa Rosenzweig <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7314>

---

 src/panfrost/bifrost/bifrost_nir_algebraic.py | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/src/panfrost/bifrost/bifrost_nir_algebraic.py 
b/src/panfrost/bifrost/bifrost_nir_algebraic.py
index 974bdf2c899..b0aa98316c4 100644
--- a/src/panfrost/bifrost/bifrost_nir_algebraic.py
+++ b/src/panfrost/bifrost/bifrost_nir_algebraic.py
@@ -42,6 +42,14 @@ for isz in ('8', '16', '32'):
         for osz in ('16', '32', '64'):
                 algebraic_late += [(('b2f' + osz, 'a@' + isz), ('b' + isz + 
'csel', a, 1.0, 0.0))]
 
+# There's no native integer min/max instruction, lower those to cmp+bcsel
+for sz in ('8', '16', '32'):
+    for t in ('i', 'u'):
+        algebraic_late += [
+            ((t + 'min', 'a@' + sz, 'b@' + sz), ('b' + sz + 'csel', (t + 'lt' 
+ sz, a, b), a, b)),
+            ((t + 'max', 'a@' + sz, 'b@' + sz), ('b' + sz + 'csel', (t + 'lt' 
+ sz, b, a), a, b))
+        ]
+
 # Midgard is able to type convert down by only one "step" per instruction; if
 # NIR wants more than one step, we need to break up into multiple instructions
 

_______________________________________________
mesa-commit mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to