aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>2019-10-17 16:37:48 -0400
committerAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>2019-10-20 12:02:31 +0000
commit5952add9a9da043341a669513e0201ef60c8d765 (patch)
tree056132e034e6d7d05c5cab4a07e9ad6257306f36
parentf77ea9798d48cdeeccde754b144fb6b1327b19bd (diff)
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@collabora.com>
-rw-r--r--src/panfrost/midgard/mir.c14
1 files 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))