From b04d99d093d2de7f0ccdf0071c50aee3acb21686 Mon Sep 17 00:00:00 2001 From: Georg Lehmann Date: Mon, 27 May 2024 21:56:55 +0200 Subject: [PATCH] aco/optimizer: use p_create_vector to create mask when a copy can't be used MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed-by: Daniel Schürmann Part-of: --- src/amd/compiler/aco_optimizer.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/amd/compiler/aco_optimizer.cpp b/src/amd/compiler/aco_optimizer.cpp index e5dea2dfa2b..5f5a32dcd69 100644 --- a/src/amd/compiler/aco_optimizer.cpp +++ b/src/amd/compiler/aco_optimizer.cpp @@ -2355,11 +2355,11 @@ optimize_cmp_subgroup_invocation(opt_ctx& ctx, aco_ptr& instr) Instruction* cpy = NULL; const uint64_t mask = BITFIELD64_RANGE(first_bit, num_bits); - if (wave_size == 64 && mask > 0x7fffffff && mask != -1ull) { - /* Mask can't be represented as a 64-bit constant or literal, use s_bfm_b64. */ - cpy = create_instruction(aco_opcode::s_bfm_b64, Format::SOP2, 2, 1); - cpy->operands[0] = Operand::c32(num_bits); - cpy->operands[1] = Operand::c32(first_bit); + if (!Operand::is_constant_representable(mask, wave_size / 8, true, false)) { + /* Mask can't be represented as a 64-bit constant or literal, create a vector */ + cpy = create_instruction(aco_opcode::p_create_vector, Format::PSEUDO, 2, 1); + cpy->operands[0] = Operand::c32(mask); + cpy->operands[1] = Operand::c32(mask >> 32); } else { /* Copy mask as a literal constant. */ cpy = create_instruction(aco_opcode::p_parallelcopy, Format::PSEUDO, 1, 1);