pan/bi: Fix out of range access in bi_instr_replicates

For replicates, we were checking equivalence between two sources on some
instructions but some of them only had one source causing an out of
bound access and check against unrelated data.

Instead we now always return true for those instructions.

Signed-off-by: Mary Guillemard <mary.guillemard@collabora.com>
Fixes: f7d44a46cd ("pan/bi: Optimize replication")
Reviewed-by: Benjamin Lee <benjamin.lee@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33867>
(cherry picked from commit 8948b74955)
This commit is contained in:
Mary Guillemard 2025-03-04 10:12:42 +01:00 committed by Eric Engestrom
parent 2b381ba435
commit 54fb1e47d5
2 changed files with 5 additions and 3 deletions

View file

@ -5174,7 +5174,7 @@
"description": "pan/bi: Fix out of range access in bi_instr_replicates",
"nominated": true,
"nomination_type": 2,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": "f7d44a46cd424e797a38ef732360e546f093f0ae",
"notes": null

View file

@ -211,16 +211,18 @@ bi_instr_replicates(bi_instr *I, BITSET_WORD *replicates_16)
* sources are identical. Check this case first.
*/
case BI_OPCODE_MKVEC_V2I16:
case BI_OPCODE_V2F32_TO_V2F16:
return bi_is_value_equiv(I->src[0], I->src[1]);
case BI_OPCODE_V2F16_TO_V2S16:
case BI_OPCODE_V2F16_TO_V2U16:
case BI_OPCODE_V2F32_TO_V2F16:
case BI_OPCODE_V2S16_TO_V2F16:
case BI_OPCODE_V2S8_TO_V2F16:
case BI_OPCODE_V2S8_TO_V2S16:
case BI_OPCODE_V2U16_TO_V2F16:
case BI_OPCODE_V2U8_TO_V2F16:
case BI_OPCODE_V2U8_TO_V2U16:
return bi_is_value_equiv(I->src[0], I->src[1]);
return true;
/* 16-bit transcendentals are defined to output zero in their
* upper half, so they do not replicate