pan/bi: Paste over bi_has_arg
authorAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Wed, 11 Mar 2020 18:40:01 +0000 (14:40 -0400)
committerMarge Bot <eric+marge@anholt.net>
Wed, 11 Mar 2020 20:28:21 +0000 (20:28 +0000)
While we're at it, cleanup the Midgard one.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4150>

src/panfrost/bifrost/bir.c
src/panfrost/bifrost/compiler.h
src/panfrost/midgard/compiler.h

index 0f1efcb3388d10ca508be4d9571a454b6aab44ef..5fe0ae484091ac86cf3dd887358e7f509d2ab8ce 100644 (file)
@@ -60,3 +60,17 @@ bi_is_src_swizzled(bi_instruction *ins, unsigned s)
 
         return classy && small && first;
 }
+
+bool
+bi_has_arg(bi_instruction *ins, unsigned arg)
+{
+        if (!ins)
+                return false;
+
+        bi_foreach_src(ins, s) {
+                if (ins->src[s] == arg)
+                        return true;
+        }
+
+        return false;
+}
index 1c01b2d989b95c4f317b201727a6c92933c9a1f1..cd0d4f565367e6646cf3efcc7df78e1005ca12af 100644 (file)
@@ -474,6 +474,7 @@ bir_dest_index(nir_dest *dst)
 bool bi_has_outmod(bi_instruction *ins);
 bool bi_has_source_mods(bi_instruction *ins);
 bool bi_is_src_swizzled(bi_instruction *ins, unsigned s);
+bool bi_has_arg(bi_instruction *ins, unsigned arg);
 
 /* BIR passes */
 
index aa0c193d99ddabd5a9ebabcfe6ac9842ebce9f2a..6614439fbfb551939702826325bfbd00ca9b765d 100644 (file)
@@ -602,7 +602,7 @@ mir_has_arg(midgard_instruction *ins, unsigned arg)
         if (!ins)
                 return false;
 
-        for (unsigned i = 0; i < ARRAY_SIZE(ins->src); ++i) {
+        mir_foreach_src(ins, i) {
                 if (ins->src[i] == arg)
                         return true;
         }