aco/optimizer: do not try to create 3 byte constant operands
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run

Operand::get_const will assert.

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/work_items/15239
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40828>
This commit is contained in:
Georg Lehmann 2026-04-07 17:00:37 +02:00 committed by Marge Bot
parent 0066328cf1
commit d1ed4e1774

View file

@ -1792,6 +1792,8 @@ pseudo_can_accept_constant(const aco_ptr<Instruction>& instr, unsigned operand)
assert(instr->operands.size() > operand);
if (instr->operands[operand].isFixed())
return false;
if (!util_is_power_of_two_nonzero(instr->operands[operand].bytes()))
return false;
switch (instr->opcode) {
case aco_opcode::p_extract_vector:
@ -2857,7 +2859,8 @@ label_instruction(opt_ctx& ctx, aco_ptr<Instruction>& instr)
instr->operands[0] = op;
break;
}
} else if (info.is_constant()) {
} else if (info.is_constant() &&
util_is_power_of_two_nonzero(instr->definitions[0].bytes())) {
/* propagate constants */
uint64_t mask = u_bit_consecutive64(0, instr->definitions[0].bytes() * 8u);
uint64_t val = (info.val >> (dst_offset * 8u)) & mask;