pan/bit: Add min/max support to interpreter
authorAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Mon, 6 Apr 2020 17:08:44 +0000 (13:08 -0400)
committerMarge Bot <eric+marge@anholt.net>
Mon, 6 Apr 2020 19:41:56 +0000 (19:41 +0000)
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4470>

src/panfrost/bifrost/test/bi_interpret.c

index b6807f55456a5e94b8d71418547a9b32018aa64e..f0068398df49d4e0a4d3d5b9f651ab0269aca774 100644 (file)
@@ -184,6 +184,8 @@ bit_write(struct bit_state *s, unsigned index, nir_alu_type T, bit_t value, bool
 bit_make_poly(add, a + b);
 bit_make_float(fma, (a * b) + c);
 bit_make_poly(mov, a);
+bit_make_poly(min, MIN2(a, b));
+bit_make_poly(max, MAX2(a, b));
 
 /* Modifiers */
 
@@ -317,9 +319,16 @@ bit_step(struct bit_state *s, bi_instruction *ins, bool FMA)
 
         case BI_FREXP:
         case BI_ISUB:
-        case BI_MINMAX:
                 unreachable("Unsupported op");
 
+        case BI_MINMAX: {
+                if (ins->op.minmax == BI_MINMAX_MIN) {
+                        bpoly(min);
+                } else {
+                        bpoly(max);
+                }
+        }
+
         case BI_MOV:
                 bpoly(mov);