summaryrefslogtreecommitdiff
path: root/src/asahi
diff options
context:
space:
mode:
authorAlyssa Rosenzweig <alyssa@rosenzweig.io>2021-07-24 17:23:42 -0400
committerAlyssa Rosenzweig <alyssa@rosenzweig.io>2021-07-24 17:23:42 -0400
commit50a4c993fd5638267d7f06e130b573a455a0891c (patch)
tree9e44d3016fe9c3d9967255ad96594e77cb476980 /src/asahi
parent3c1f754a7174b7d64de0cb5ad752012332e993a9 (diff)
agx: Add agx_ushr helper
Syntax sugar for the underlying bitfield manipulation instruction. Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12053>
Diffstat (limited to 'src/asahi')
-rw-r--r--src/asahi/compiler/agx_builder.h.py14
-rw-r--r--src/asahi/compiler/agx_compile.c2
2 files changed, 15 insertions, 1 deletions
diff --git a/src/asahi/compiler/agx_builder.h.py b/src/asahi/compiler/agx_builder.h.py
index f8591ca7409..1314640622c 100644
--- a/src/asahi/compiler/agx_builder.h.py
+++ b/src/asahi/compiler/agx_builder.h.py
@@ -157,6 +157,20 @@ agx_push_exec(agx_builder *b, unsigned n)
return agx_if_fcmp(b, agx_zero(), agx_zero(), n, AGX_FCOND_EQ, false);
}
+static inline agx_instr *
+agx_ushr_to(agx_builder *b, agx_index dst, agx_index s0, agx_index s1)
+{
+ return agx_bfeil_to(b, dst, agx_zero(), s0, s1, 0);
+}
+
+static inline agx_index
+agx_ushr(agx_builder *b, agx_index s0, agx_index s1)
+{
+ agx_index tmp = agx_temp(b->shader, s0.size);
+ agx_ushr_to(b, tmp, s0, s1);
+ return tmp;
+}
+
#endif
"""
diff --git a/src/asahi/compiler/agx_compile.c b/src/asahi/compiler/agx_compile.c
index f9563267b65..43912a21239 100644
--- a/src/asahi/compiler/agx_compile.c
+++ b/src/asahi/compiler/agx_compile.c
@@ -542,7 +542,7 @@ agx_emit_alu(agx_builder *b, nir_alu_instr *instr)
case nir_op_imul: return agx_imad_to(b, dst, s0, s1, agx_zero(), 0);
case nir_op_ishl: return agx_bfi_to(b, dst, agx_zero(), s0, s1, 0);
- case nir_op_ushr: return agx_bfeil_to(b, dst, agx_zero(), s0, s1, 0);
+ case nir_op_ushr: return agx_ushr_to(b, dst, s0, s1);
case nir_op_ishr: return agx_asr_to(b, dst, s0, s1);
case nir_op_bcsel: