Mesa (master): pan/midgard: Factor out mir_get_alu_src

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Sun Oct 20 12:32:20 UTC 2019


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

Author: Alyssa Rosenzweig <alyssa.rosenzweig at collabora.com>
Date:   Thu Oct 17 16:37:48 2019 -0400

pan/midgard: Factor out mir_get_alu_src

This helper is used in a bunch of places ... might as well make that
common.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig at collabora.com>

---

 src/panfrost/midgard/mir.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/src/panfrost/midgard/mir.c b/src/panfrost/midgard/mir.c
index f1eca73f789..68a13d437ed 100644
--- a/src/panfrost/midgard/mir.c
+++ b/src/panfrost/midgard/mir.c
@@ -38,6 +38,13 @@ void mir_rewrite_index_dst_single(midgard_instruction *ins, unsigned old, unsign
                 ins->dest = new;
 }
 
+static midgard_vector_alu_src
+mir_get_alu_src(midgard_instruction *ins, unsigned idx)
+{
+        unsigned b = (idx == 0) ? ins->alu.src1 : ins->alu.src2;
+        return vector_alu_from_unsigned(b);
+}
+
 unsigned
 mir_get_swizzle(midgard_instruction *ins, unsigned idx)
 {
@@ -45,12 +52,7 @@ mir_get_swizzle(midgard_instruction *ins, unsigned idx)
                 if (idx == 2 || ins->compact_branch)
                         return ins->cond_swizzle;
 
-                unsigned b = (idx == 0) ? ins->alu.src1 : ins->alu.src2;
-
-                midgard_vector_alu_src s =
-                        vector_alu_from_unsigned(b);
-
-                return s.swizzle;
+                return (mir_get_alu_src(ins, idx)).swizzle;
         } else if (ins->type == TAG_LOAD_STORE_4) {
                 /* Main swizzle of a load is on the destination */
                 if (!OP_IS_STORE(ins->load_store.op))




More information about the mesa-commit mailing list