agx: Implement native float->int conversions
authorAlyssa Rosenzweig <alyssa@rosenzweig.io>
Fri, 16 Apr 2021 21:55:49 +0000 (17:55 -0400)
committerAlyssa Rosenzweig <none>
Sun, 2 May 2021 21:41:14 +0000 (17:41 -0400)
No 8-bit or 64-bit yet since those need lowerings.

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 ca4b5a7..3e1fa3c 100644 (file)
@@ -264,6 +264,22 @@ agx_emit_alu(agx_builder *b, nir_alu_instr *instr)
       return agx_fmul_to(b, dst, sinc, fixup);
    }
 
+   case nir_op_f2i16:
+      return agx_convert_to(b, dst,
+            agx_immediate(AGX_CONVERT_F_TO_S16), s0, AGX_ROUND_RTZ);
+
+   case nir_op_f2i32:
+      return agx_convert_to(b, dst,
+            agx_immediate(AGX_CONVERT_F_TO_S32), s0, AGX_ROUND_RTZ);
+
+   case nir_op_f2u16:
+      return agx_convert_to(b, dst,
+            agx_immediate(AGX_CONVERT_F_TO_U16), s0, AGX_ROUND_RTZ);
+
+   case nir_op_f2u32:
+      return agx_convert_to(b, dst,
+            agx_immediate(AGX_CONVERT_F_TO_U32), s0, AGX_ROUND_RTZ);
+
    case nir_op_vec2:
    case nir_op_vec3:
    case nir_op_vec4: