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>
This commit is contained in:
Connor Abbott 2024-02-29 12:19:30 -05:00 committed by Marge Bot
parent ce6c4f0320
commit 4828942d0c

View file

@ -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) {