From 072815e5cbe5c919ad39b924b5113c937e4ec528 Mon Sep 17 00:00:00 2001 From: Georg Lehmann Date: Tue, 9 Dec 2025 14:04:32 +0100 Subject: [PATCH] aco/gfx6: move mrtz writemask workaround to assembler and handle all mrt Reviewed-by: Samuel Pitoiset Part-of: --- src/amd/compiler/aco_assembler.cpp | 9 +++++++++ .../instruction_selection/aco_select_ps_epilog.cpp | 8 -------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/amd/compiler/aco_assembler.cpp b/src/amd/compiler/aco_assembler.cpp index e5c1d5e8fcf..0803455f108 100644 --- a/src/amd/compiler/aco_assembler.cpp +++ b/src/amd/compiler/aco_assembler.cpp @@ -999,6 +999,15 @@ emit_exp_instruction(asm_context& ctx, std::vector& out, const Instruc encoding |= exp.done ? 0b1 << 11 : 0; encoding |= exp.dest << 4; encoding |= exp.enabled_mask; + + /* GFX6 (except OLAND and HAINAN) has a bug that it only looks at the X + * writemask component. + */ + if (ctx.gfx_level == GFX6 && ctx.program->family != CHIP_OLAND && + ctx.program->family != CHIP_HAINAN && exp.enabled_mask && exp.dest <= V_008DFC_SQ_EXP_MRTZ) { + encoding |= 0x1; + } + out.push_back(encoding); encoding = reg(ctx, exp.operands[0], 8); encoding |= reg(ctx, exp.operands[1], 8) << 8; diff --git a/src/amd/compiler/instruction_selection/aco_select_ps_epilog.cpp b/src/amd/compiler/instruction_selection/aco_select_ps_epilog.cpp index bf83b8dd961..cf4639d6d40 100644 --- a/src/amd/compiler/instruction_selection/aco_select_ps_epilog.cpp +++ b/src/amd/compiler/instruction_selection/aco_select_ps_epilog.cpp @@ -344,14 +344,6 @@ export_fs_mrtz(isel_context* ctx, const struct aco_ps_epilog_info* info, Temp de } } - /* GFX6 (except OLAND and HAINAN) has a bug that it only looks at the X - * writemask component. - */ - if (ctx->options->gfx_level == GFX6 && ctx->options->family != CHIP_OLAND && - ctx->options->family != CHIP_HAINAN) { - enabled_channels |= 0x1; - } - bld.exp(aco_opcode::exp, values[0], values[1], values[2], values[3], enabled_channels, V_008DFC_SQ_EXP_MRTZ, compr); }