agx: Add iadd/imad integer arithmetic
authorAlyssa Rosenzweig <alyssa@rosenzweig.io>
Sat, 17 Apr 2021 00:36:39 +0000 (20:36 -0400)
committerAlyssa Rosenzweig <none>
Sun, 2 May 2021 21:41:15 +0000 (17:41 -0400)
Lots of optimizations will be possible later on.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Acked-by: Jason Ekstrand <jason@jlekstrand.net>
Acked-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10582>

src/asahi/compiler/agx_compile.c

index 8395f1f..d206856 100644 (file)
@@ -258,6 +258,11 @@ agx_emit_alu(agx_builder *b, nir_alu_instr *instr)
    case nir_op_fabs: return agx_fmov_to(b, dst, agx_abs(s0));
    case nir_op_fneg: return agx_fmov_to(b, dst, agx_neg(s0));
 
+   case nir_op_iadd: return agx_iadd_to(b, dst, s0, s1, 0);
+   case nir_op_isub: return agx_iadd_to(b, dst, s0, agx_neg(s1), 0);
+   case nir_op_ineg: return agx_iadd_to(b, dst, agx_zero(), agx_neg(s0), 0);
+   case nir_op_imul: return agx_imad_to(b, dst, s0, s1, agx_zero(), 0);
+
    case nir_op_fsat:
    {
       agx_instr *I = agx_fadd_to(b, dst, s0, agx_negzero());