Mesa (master): vc4: Add algebraic opt for rcp(1.0).

Eric Anholt anholt at kemper.freedesktop.org
Fri Aug 21 06:43:51 UTC 2015


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

Author: Eric Anholt <eric at anholt.net>
Date:   Tue Aug 18 22:19:12 2015 -0700

vc4: Add algebraic opt for rcp(1.0).

We're generating rcps as part of backend lowering of the packed coordinate
in the CS, and we don't want to lower them in NIR because of the extra
newton-raphson steps in the common case.  However, GLB2.7 is moving a
vertex attribute with a 1.0 W component to the position, and that makes us
produce some silly RCPs.

total instructions in shared programs: 97590 -> 97580 (-0.01%)
instructions in affected programs:     74 -> 64 (-13.51%)

---

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

diff --git a/src/gallium/drivers/vc4/vc4_opt_algebraic.c b/src/gallium/drivers/vc4/vc4_opt_algebraic.c
index 77028bc..5b43583 100644
--- a/src/gallium/drivers/vc4/vc4_opt_algebraic.c
+++ b/src/gallium/drivers/vc4/vc4_opt_algebraic.c
@@ -275,6 +275,14 @@ qir_opt_algebraic(struct vc4_compile *c)
                         }
                         break;
 
+                case QOP_RCP:
+                        if (is_1f(c, inst->src[0])) {
+                                replace_with_mov(c, inst, inst->src[0]);
+                                progress = true;
+                                break;
+                        }
+                        break;
+
                 default:
                         break;
                 }




More information about the mesa-commit mailing list