summaryrefslogtreecommitdiff
path: root/src/panfrost/midgard
diff options
context:
space:
mode:
authorIcecream95 <ixn@disroot.org>2020-12-29 01:00:24 +1300
committerMarge Bot <eric+marge@anholt.net>2021-01-01 02:58:49 +0000
commitb504602370293c08e9dda4b262f03b7a3c5b537e (patch)
tree940428e14916bc4453b723d4afbca66c70a75950 /src/panfrost/midgard
parentb7f2619798ae2867c8ee22593130d86c2c8525ea (diff)
pan/mdg: Add i2i64 to mir_match_offset
Similar to the existing u2u64 function, but with a different type. Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8264>
Diffstat (limited to 'src/panfrost/midgard')
-rw-r--r--src/panfrost/midgard/midgard_address.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/panfrost/midgard/midgard_address.c b/src/panfrost/midgard/midgard_address.c
index 310d7927360..88726b8c626 100644
--- a/src/panfrost/midgard/midgard_address.c
+++ b/src/panfrost/midgard/midgard_address.c
@@ -132,6 +132,25 @@ mir_match_u2u64(struct mir_address *address)
address->type = ITYPE_U32;
}
+/* Matches i2i64 and sets type */
+
+static void
+mir_match_i2i64(struct mir_address *address)
+{
+ if (!address->B.def || !nir_ssa_scalar_is_alu(address->B))
+ return;
+
+ if (!mir_args_ssa(address->B, 1))
+ return;
+
+ nir_op op = nir_ssa_scalar_alu_op(address->B);
+ if (op != nir_op_i2i64) return;
+ nir_ssa_scalar arg = nir_ssa_scalar_chase_alu_src(address->B, 0);
+
+ address->B = arg;
+ address->type = ITYPE_I32;
+}
+
/* Matches ishl to shift */
static void
@@ -193,6 +212,7 @@ mir_match_offset(nir_ssa_def *offset, bool first_free)
mir_match_iadd(&address, first_free);
mir_match_mov(&address);
mir_match_u2u64(&address);
+ mir_match_i2i64(&address);
mir_match_mov(&address);
mir_match_ishl(&address);