From 5952add9a9da043341a669513e0201ef60c8d765 Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Thu, 17 Oct 2019 16:37:48 -0400 Subject: [PATCH] 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 --- 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)) -- 2.30.2