summaryrefslogtreecommitdiffstats
path: root/src/broadcom/compiler/nir_to_vir.c
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2019-02-18 18:15:59 -0800
committerEric Anholt <[email protected]>2019-02-18 18:18:37 -0800
commitdbe3af67a47ba929c89e9482fbc9396fc1114d93 (patch)
tree957bb61ec5dd00f71476bbf44ab6972abac2a20d /src/broadcom/compiler/nir_to_vir.c
parent0bba9c8489726fa7ddb855f5ad68b1934dd0312b (diff)
v3d: Move i2b and f2b support into emit_comparison.
This lets us save a resolve to NIR true/false for ifs and discard_if. No change in shader-db.
Diffstat (limited to 'src/broadcom/compiler/nir_to_vir.c')
-rw-r--r--src/broadcom/compiler/nir_to_vir.c25
1 files changed, 12 insertions, 13 deletions
diff --git a/src/broadcom/compiler/nir_to_vir.c b/src/broadcom/compiler/nir_to_vir.c
index 4a0fd7d20e7..e441bd5997d 100644
--- a/src/broadcom/compiler/nir_to_vir.c
+++ b/src/broadcom/compiler/nir_to_vir.c
@@ -746,6 +746,16 @@ ntq_emit_comparison(struct v3d_compile *c,
vir_set_pf(vir_SUB_dest(c, nop, src0, src1), V3D_QPU_PF_PUSHC);
break;
+ case nir_op_i2b32:
+ vir_set_pf(vir_MOV_dest(c, nop, src0), V3D_QPU_PF_PUSHZ);
+ cond_invert = true;
+ break;
+
+ case nir_op_f2b32:
+ vir_set_pf(vir_FMOV_dest(c, nop, src0), V3D_QPU_PF_PUSHZ);
+ cond_invert = true;
+ break;
+
default:
return false;
}
@@ -875,19 +885,6 @@ ntq_emit_alu(struct v3d_compile *c, nir_alu_instr *instr)
case nir_op_b2i32:
result = vir_AND(c, src[0], vir_uniform_ui(c, 1));
break;
- case nir_op_i2b32:
- vir_set_pf(vir_MOV_dest(c, vir_nop_reg(), src[0]),
- V3D_QPU_PF_PUSHZ);
- result = vir_MOV(c, vir_SEL(c, V3D_QPU_COND_IFNA,
- vir_uniform_ui(c, ~0),
- vir_uniform_ui(c, 0)));
- case nir_op_f2b32:
- vir_set_pf(vir_FMOV_dest(c, vir_nop_reg(), src[0]),
- V3D_QPU_PF_PUSHZ);
- result = vir_MOV(c, vir_SEL(c, V3D_QPU_COND_IFNA,
- vir_uniform_ui(c, ~0),
- vir_uniform_ui(c, 0)));
- break;
case nir_op_iadd:
result = vir_ADD(c, src[0], src[1]);
@@ -950,6 +947,8 @@ ntq_emit_alu(struct v3d_compile *c, nir_alu_instr *instr)
break;
}
+ case nir_op_i2b32:
+ case nir_op_f2b32:
case nir_op_feq32:
case nir_op_fne32:
case nir_op_fge32: