From 212684877151fcc9dccf880a6eef201e2e1074eb Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Fri, 16 Apr 2021 17:55:49 -0400 Subject: [PATCH] agx: Implement native float->int conversions No 8-bit or 64-bit yet since those need lowerings. Signed-off-by: Alyssa Rosenzweig Acked-by: Jason Ekstrand Acked-by: Bas Nieuwenhuizen Part-of: --- src/asahi/compiler/agx_compile.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/asahi/compiler/agx_compile.c b/src/asahi/compiler/agx_compile.c index ca4b5a7a63b..3e1fa3c3861 100644 --- a/src/asahi/compiler/agx_compile.c +++ b/src/asahi/compiler/agx_compile.c @@ -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: