aboutsummaryrefslogtreecommitdiffstats
path: root/src/panfrost
diff options
context:
space:
mode:
Diffstat (limited to 'src/panfrost')
-rw-r--r--src/panfrost/bifrost/bir.c14
-rw-r--r--src/panfrost/bifrost/compiler.h1
-rw-r--r--src/panfrost/midgard/compiler.h2
3 files changed, 16 insertions, 1 deletions
diff --git a/src/panfrost/bifrost/bir.c b/src/panfrost/bifrost/bir.c
index 0f1efcb3388..5fe0ae48409 100644
--- a/src/panfrost/bifrost/bir.c
+++ b/src/panfrost/bifrost/bir.c
@@ -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;
+}
diff --git a/src/panfrost/bifrost/compiler.h b/src/panfrost/bifrost/compiler.h
index 1c01b2d989b..cd0d4f56536 100644
--- a/src/panfrost/bifrost/compiler.h
+++ b/src/panfrost/bifrost/compiler.h
@@ -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 */
diff --git a/src/panfrost/midgard/compiler.h b/src/panfrost/midgard/compiler.h
index aa0c193d99d..6614439fbfb 100644
--- a/src/panfrost/midgard/compiler.h
+++ b/src/panfrost/midgard/compiler.h
@@ -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;
}