summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorConnor Abbott <cwabbott0@gmail.com>2024-02-29 12:19:30 -0500
committerMarge Bot <emma+marge@anholt.net>2024-04-26 12:55:14 +0000
commit4828942d0c3353ced285c9aebed1109bd696db77 (patch)
tree7ba8cdb932c4bd1b699c2bac246204b740ab2cc8
parentce6c4f03201b5046b5bed74934b52a7a874288d2 (diff)
ir3: Get sources before emitting scan_clusters.macro
We will emit conversion move when getting sources and shared-ness doesn't match, so it needs to be before emitting the instruction. Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22075>
-rw-r--r--src/freedreno/ir3/ir3_compiler_nir.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/freedreno/ir3/ir3_compiler_nir.c b/src/freedreno/ir3/ir3_compiler_nir.c
index 6a47e0dd21c..b27253afd05 100644
--- a/src/freedreno/ir3/ir3_compiler_nir.c
+++ b/src/freedreno/ir3/ir3_compiler_nir.c
@@ -2027,6 +2027,12 @@ emit_intrinsic_reduce_clusters(struct ir3_context *ctx,
create_immed_shared(ctx->block, get_reduce_identity(nir_reduce_op, dst_size),
true);
+ struct ir3_instruction *inclusive_src = ir3_get_src(ctx, &intr->src[0])[0];
+
+ struct ir3_instruction *exclusive_src = NULL;
+ if (need_exclusive)
+ exclusive_src = ir3_get_src(ctx, &intr->src[1])[0];
+
/* OPC_SCAN_CLUSTERS_MACRO has the following destinations:
* - Shared reg reduction result, must be initialized to the identity
* - Inclusive scan result
@@ -2074,14 +2080,10 @@ emit_intrinsic_reduce_clusters(struct ir3_context *ctx,
struct ir3_register *reduce_init = __ssa_src(scan, identity, IR3_REG_SHARED);
ir3_reg_tie(reduce, reduce_init);
- struct ir3_instruction *inclusive_src = ir3_get_src(ctx, &intr->src[0])[0];
__ssa_src(scan, inclusive_src, 0);
- if (need_exclusive) {
- struct ir3_instruction *exclusive_src =
- ir3_get_src(ctx, &intr->src[1])[0];
+ if (need_exclusive)
__ssa_src(scan, exclusive_src, 0);
- }
struct ir3_register *dst;
switch (intr->intrinsic) {