aco/optimizer: do not try to create 3 byte constant operands

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
(cherry picked from commit d1ed4e1774)

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40979>
This commit is contained in:
Georg Lehmann 2026-04-07 17:00:37 +02:00 committed by Eric Engestrom
parent fa0abe9510
commit 599bb79ff4
2 changed files with 5 additions and 2 deletions

View file

@ -3124,7 +3124,7 @@
"description": "aco/optimizer: do not try to create 3 byte constant operands",
"nominated": true,
"nomination_type": 1,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": null,
"notes": null

View file

@ -1759,6 +1759,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:
@ -2810,7 +2812,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;