Mesa (master): vc4: Optimize out silly SUBs of 0.

Eric Anholt anholt at kemper.freedesktop.org
Mon Sep 29 22:02:07 UTC 2014


Module: Mesa
Branch: master
Commit: 76cd9955d96c1b0a13905e255571eb35b3aa2a99
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=76cd9955d96c1b0a13905e255571eb35b3aa2a99

Author: Eric Anholt <eric at anholt.net>
Date:   Wed Sep 24 21:57:06 2014 -0700

vc4: Optimize out silly SUBs of 0.

Drops instructions on vs-temp-array-mat4-index-col-row-wr.shader_test,
which I was looking at because it's failing to register allocate.

---

 src/gallium/drivers/vc4/vc4_opt_algebraic.c |   11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/src/gallium/drivers/vc4/vc4_opt_algebraic.c b/src/gallium/drivers/vc4/vc4_opt_algebraic.c
index b5cde05..f88a5c1 100644
--- a/src/gallium/drivers/vc4/vc4_opt_algebraic.c
+++ b/src/gallium/drivers/vc4/vc4_opt_algebraic.c
@@ -117,6 +117,17 @@ qir_opt_algebraic(struct vc4_compile *c)
                         }
                         break;
 
+                case QOP_FSUB:
+                case QOP_SUB:
+                        if (is_zero(c, defs, inst->src[1])) {
+                                dump_from(c, inst);
+                                inst->op = QOP_MOV;
+                                inst->src[1] = c->undef;
+                                progress = true;
+                                dump_to(c, inst);
+                        }
+                        break;
+
                 default:
                         break;
                 }




More information about the mesa-commit mailing list