summaryrefslogtreecommitdiffstats
path: root/src/gallium
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2014-10-09 09:36:03 +0200
committerEric Anholt <[email protected]>2014-10-09 11:01:18 +0200
commit5a1352289862a9bd695a15009c69cad54727c66b (patch)
treeedcd9f90d64fec4b1a3a67b7829a7e5fed9ae912 /src/gallium
parent00a9aebfe064ec252a95e0f3a38f4f6c967dadc4 (diff)
vc4: Optimize SF(ITOF(x)) -> SF(x).
This is a common production of st_glsl_to_tgsi, because CMP takes a float argument.
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/drivers/vc4/vc4_opt_algebraic.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/gallium/drivers/vc4/vc4_opt_algebraic.c b/src/gallium/drivers/vc4/vc4_opt_algebraic.c
index 4155e72fd21..e247f302ee9 100644
--- a/src/gallium/drivers/vc4/vc4_opt_algebraic.c
+++ b/src/gallium/drivers/vc4/vc4_opt_algebraic.c
@@ -91,6 +91,22 @@ qir_opt_algebraic(struct vc4_compile *c)
defs[inst->dst.index] = inst;
switch (inst->op) {
+ case QOP_SF:
+ /* SF just looks at the sign bit, or whether all the
+ * bits are 0. This is preserved across an itof
+ * transformation.
+ */
+ if (inst->src[0].file == QFILE_TEMP &&
+ defs[inst->src[0].index]->op == QOP_ITOF) {
+ dump_from(c, inst);
+ inst->src[0] =
+ defs[inst->src[0].index]->src[0];
+ progress = true;
+ dump_to(c, inst);
+ break;
+ }
+ break;
+
case QOP_SEL_X_Y_ZS:
case QOP_SEL_X_Y_ZC:
case QOP_SEL_X_Y_NS: