Mesa (master): vc4: Make integer multiply use 24 bits for the low parts.

Eric Anholt anholt at kemper.freedesktop.org
Mon Mar 30 16:40:08 UTC 2015


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

Author: Eric Anholt <eric at anholt.net>
Date:   Sun Mar 29 21:21:10 2015 -0700

vc4: Make integer multiply use 24 bits for the low parts.

The hardware uses the low 24 bits in integer multiplies, so we can have
fewer high bits (and so probably drop them more frequently).

---

 src/gallium/drivers/vc4/vc4_program.c |   10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/gallium/drivers/vc4/vc4_program.c b/src/gallium/drivers/vc4/vc4_program.c
index 56a3a96..49b9466 100644
--- a/src/gallium/drivers/vc4/vc4_program.c
+++ b/src/gallium/drivers/vc4/vc4_program.c
@@ -367,13 +367,13 @@ tgsi_to_qir_umul(struct vc4_compile *c,
                  enum qop op, struct qreg *src, int i)
 {
         struct qreg src0_hi = qir_SHR(c, src[0 * 4 + i],
-                                      qir_uniform_ui(c, 16));
+                                      qir_uniform_ui(c, 24));
         struct qreg src0_lo = qir_AND(c, src[0 * 4 + i],
-                                      qir_uniform_ui(c, 0xffff));
+                                      qir_uniform_ui(c, 0xffffff));
         struct qreg src1_hi = qir_SHR(c, src[1 * 4 + i],
-                                      qir_uniform_ui(c, 16));
+                                      qir_uniform_ui(c, 24));
         struct qreg src1_lo = qir_AND(c, src[1 * 4 + i],
-                                      qir_uniform_ui(c, 0xffff));
+                                      qir_uniform_ui(c, 0xffffff));
 
         struct qreg hilo = qir_MUL24(c, src0_hi, src1_lo);
         struct qreg lohi = qir_MUL24(c, src0_lo, src1_hi);
@@ -381,7 +381,7 @@ tgsi_to_qir_umul(struct vc4_compile *c,
 
         return qir_ADD(c, lolo, qir_SHL(c,
                                         qir_ADD(c, hilo, lohi),
-                                        qir_uniform_ui(c, 16)));
+                                        qir_uniform_ui(c, 24)));
 }
 
 static struct qreg




More information about the mesa-commit mailing list