pan/bit: Interpret IMATH
authorAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Mon, 4 May 2020 18:29:03 +0000 (14:29 -0400)
committerMarge Bot <eric+marge@anholt.net>
Mon, 4 May 2020 18:45:15 +0000 (18:45 +0000)
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4890>

src/panfrost/bifrost/test/bi_interpret.c

index 6a7fa694342fd8cf78c92ce0d30f7576da3635e1..1285787ef27a309138f49db5b56de27e700c4c63 100644 (file)
@@ -185,6 +185,7 @@ bit_write(struct bit_state *s, unsigned index, nir_alu_type T, bit_t value, bool
         bit_make_int(name, expr) \
         
 bit_make_poly(add, a + b);
+bit_make_int(sub, a - b);
 bit_make_float(fma, (a * b) + c);
 bit_make_poly(mov, a);
 bit_make_poly(min, MIN2(a, b));
@@ -525,8 +526,18 @@ bit_step(struct bit_state *s, bi_instruction *ins, bool FMA)
 
                 break;
         }
-        case BI_IMATH:
-                unreachable("Unsupported op");
+
+        case BI_IMATH: {
+                if (ins->op.imath == BI_IMATH_ADD) {
+                        bint(bit_i64add, bit_i32add, bit_i16add, bit_i8add);
+                } else if (ins->op.imath == BI_IMATH_SUB) {
+                        bint(bit_i64sub, bit_i32sub, bit_i16sub, bit_i8sub);
+                } else {
+                        unreachable("Unsupported op");
+                }
+
+                break;
+        }
 
         case BI_MINMAX: {
                 if (ins->op.minmax == BI_MINMAX_MIN) {