From 80edb8124d4cbb2157ae6fb3846b7f295dbe9ac6 Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Sat, 24 Apr 2021 16:23:15 -0400 Subject: [PATCH] agx: Implement b2f Signed-off-by: Alyssa Rosenzweig Acked-by: Jason Ekstrand Acked-by: Bas Nieuwenhuizen Part-of: --- src/asahi/compiler/agx_compile.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/asahi/compiler/agx_compile.c b/src/asahi/compiler/agx_compile.c index 18dfeae6927..fe5fba7b1ac 100644 --- a/src/asahi/compiler/agx_compile.c +++ b/src/asahi/compiler/agx_compile.c @@ -425,6 +425,19 @@ 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_b2f16: + case nir_op_b2f32: + { + /* At this point, boolean is just zero/nonzero, so compare with zero */ + agx_index one = (sz == 16) ? + agx_mov_imm(b, 16, _mesa_float_to_half(1.0)) : + agx_mov_imm(b, 32, fui(1.0)); + + agx_index zero = agx_zero(); + + return agx_fcmpsel_to(b, dst, s0, zero, zero, one, AGX_FCOND_EQ); + } + case nir_op_i2i32: { if (s0.size != AGX_SIZE_16)