summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2019-02-23 11:21:26 -0800
committerEric Anholt <[email protected]>2019-03-05 10:59:40 -0800
commita9dd227a47c8fd767b313827ccbb9e3c67e6b8e7 (patch)
tree5fe72a01019a4a0346644b47237b4f59baf4fd88
parenta4f612b4cf84cb5f40ab7eda6075dff89c2b6404 (diff)
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.
-rw-r--r--src/broadcom/compiler/nir_to_vir.c11
1 files changed, 9 insertions, 2 deletions
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;