summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/vc4/vc4_program.c
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2015-04-01 15:35:13 -0700
committerEric Anholt <[email protected]>2015-04-13 21:36:40 -0700
commit84ebaff1b7f78cb47cd8eed5476f03c5c3d0e14b (patch)
tree7d6e7f33efdae83714a0d1d4da477892c354af05 /src/gallium/drivers/vc4/vc4_program.c
parentcc5860e40787b3afe36856674f028e830685271b (diff)
vc4: Add a bunch of type conversions.
These are required to get piglit's idiv tests working. The unsigned<->float conversions are wrong, but are good enough to get piglit's small ranges of values working.
Diffstat (limited to 'src/gallium/drivers/vc4/vc4_program.c')
-rw-r--r--src/gallium/drivers/vc4/vc4_program.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/gallium/drivers/vc4/vc4_program.c b/src/gallium/drivers/vc4/vc4_program.c
index bcceb3ccb52..ca2e81c3900 100644
--- a/src/gallium/drivers/vc4/vc4_program.c
+++ b/src/gallium/drivers/vc4/vc4_program.c
@@ -925,15 +925,27 @@ ntq_emit_alu(struct vc4_compile *c, nir_alu_instr *instr)
case nir_op_fmax:
*dest = qir_FMAX(c, src[0], src[1]);
break;
+
case nir_op_f2i:
+ case nir_op_f2u:
*dest = qir_FTOI(c, src[0]);
break;
case nir_op_i2f:
+ case nir_op_u2f:
*dest = qir_ITOF(c, src[0]);
break;
case nir_op_b2f:
*dest = qir_AND(c, src[0], qir_uniform_f(c, 1.0));
break;
+ case nir_op_b2i:
+ *dest = qir_AND(c, src[0], qir_uniform_ui(c, 1));
+ break;
+ case nir_op_i2b:
+ case nir_op_f2b:
+ qir_SF(c, src[0]);
+ *dest = qir_SEL_X_0_ZC(c, qir_uniform_ui(c, ~0));
+ break;
+
case nir_op_iadd:
*dest = qir_ADD(c, src[0], src[1]);
break;