From: Eric Anholt Date: Sat, 23 Feb 2019 19:21:26 +0000 (-0800) Subject: v3d: Translate f2i(fround_even) as FTOIN. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=a9dd227a47c8fd767b313827ccbb9e3c67e6b8e7;p=mesa.git v3d: Translate f2i(fround_even) as FTOIN. This appears to be just what the opcode does. Needed for equivalence when moving FF VPM stores into NIR. --- diff --git a/src/broadcom/compiler/nir_to_vir.c b/src/broadcom/compiler/nir_to_vir.c index d4f6088bcf2..f5729ffa238 100644 --- a/src/broadcom/compiler/nir_to_vir.c +++ b/src/broadcom/compiler/nir_to_vir.c @@ -866,9 +866,16 @@ ntq_emit_alu(struct v3d_compile *c, nir_alu_instr *instr) result = vir_FMAX(c, src[0], src[1]); break; - case nir_op_f2i32: - result = vir_FTOIZ(c, src[0]); + case nir_op_f2i32: { + nir_alu_instr *src0_alu = ntq_get_alu_parent(instr->src[0].src); + if (src0_alu && src0_alu->op == nir_op_fround_even) { + result = vir_FTOIN(c, ntq_get_alu_src(c, src0_alu, 0)); + } else { + result = vir_FTOIZ(c, src[0]); + } break; + } + case nir_op_f2u32: result = vir_FTOUZ(c, src[0]); break;