pan/bi: Paste over bi_has_arg
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>
diff --git a/src/panfrost/bifrost/bir.c b/src/panfrost/bifrost/bir.c
index 0f1efcb..5fe0ae4 100644
--- a/src/panfrost/bifrost/bir.c
+++ b/src/panfrost/bifrost/bir.c
@@ -60,3 +60,17 @@
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;
+}
diff --git a/src/panfrost/bifrost/compiler.h b/src/panfrost/bifrost/compiler.h
index 1c01b2d..cd0d4f5 100644
--- a/src/panfrost/bifrost/compiler.h
+++ b/src/panfrost/bifrost/compiler.h
@@ -474,6 +474,7 @@
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 */