agx: Implement limited case of i2i16/i2i32 as iadd
authorAlyssa Rosenzweig <alyssa@rosenzweig.io>
Sat, 17 Apr 2021 20:57:01 +0000 (16:57 -0400)
committerAlyssa Rosenzweig <none>
Sun, 2 May 2021 21:41:17 +0000 (17:41 -0400)
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 94617e8..30df9ce 100644 (file)
@@ -267,6 +267,22 @@ agx_emit_alu(agx_builder *b, nir_alu_instr *instr)
    case nir_op_ushr: return agx_bfeil_to(b, dst, agx_zero(), s0, s1, 0);
    case nir_op_ishr: return agx_asr_to(b, dst, s0, s1);
 
+   case nir_op_i2i32:
+   {
+      if (s0.size != AGX_SIZE_16)
+         unreachable("todo: more conversions");
+
+      return agx_iadd_to(b, dst, s0, agx_zero(), 0);
+   }
+
+   case nir_op_i2i16:
+   {
+      if (s0.size != AGX_SIZE_32)
+         unreachable("todo: more conversions");
+
+      return agx_iadd_to(b, dst, s0, agx_zero(), 0);
+   }
+
    case nir_op_iadd_sat:
    {
       agx_instr *I = agx_iadd_to(b, dst, s0, s1, 0);