From 4dfb07e7eb9175c4c09c454b3cb7e0e324270339 Mon Sep 17 00:00:00 2001 From: Faith Ekstrand Date: Thu, 16 Apr 2026 16:31:49 -0400 Subject: [PATCH] pan/bi: Implement nir_op_f2[iu]32_rtne Reviewed-by: Christoph Pillmayer Reviewed-by: Lorenzo Rossi Part-of: --- .../compiler/bifrost/bifrost_compile.c | 20 +++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/src/panfrost/compiler/bifrost/bifrost_compile.c b/src/panfrost/compiler/bifrost/bifrost_compile.c index 4a3f3403a7f..1bd11c12eb9 100644 --- a/src/panfrost/compiler/bifrost/bifrost_compile.c +++ b/src/panfrost/compiler/bifrost/bifrost_compile.c @@ -3211,14 +3211,20 @@ bi_emit_alu(bi_builder *b, nir_alu_instr *instr) } case nir_op_f2i32: + case nir_op_f2i32_rtne: { /* v11 removed F16_TO_S32 */ assert(src_sz == 32 || (b->shader->arch < 11 && src_sz == 16)); + bi_instr *I; if (src_sz == 32) - bi_f32_to_s32_to(b, dst, s0); + I = bi_f32_to_s32_to(b, dst, s0); else - bi_f16_to_s32_to(b, dst, s0); + I = bi_f16_to_s32_to(b, dst, s0); + + if (instr->op == nir_op_f2i32_rtne) + I->round = BI_ROUND_NONE; break; + } /* Note 32-bit sources => no vectorization, so 32-bit works */ case nir_op_f2u16: @@ -3242,14 +3248,20 @@ bi_emit_alu(bi_builder *b, nir_alu_instr *instr) break; case nir_op_f2u32: + case nir_op_f2u32_rtne: { /* v11 removed F16_TO_U32 */ assert(src_sz == 32 || (b->shader->arch < 11 && src_sz == 16)); + bi_instr *I; if (src_sz == 32) - bi_f32_to_u32_to(b, dst, s0); + I = bi_f32_to_u32_to(b, dst, s0); else - bi_f16_to_u32_to(b, dst, s0); + I = bi_f16_to_u32_to(b, dst, s0); + + if (instr->op == nir_op_f2u32_rtne) + I->round = BI_ROUND_NONE; break; + } case nir_op_u2f16: /* Starting with v11, we don't have V2XXX_TO_V2F16, this should have been