pan/bi: Model Valhall-style A(CMP)XCHG

Handled consistently with computational atomics.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15223>
This commit is contained in:
Alyssa Rosenzweig 2022-03-22 22:30:11 -04:00 committed by Marge Bot
parent 90867e8204
commit cfde0275e4
2 changed files with 4 additions and 2 deletions

View file

@ -8253,6 +8253,8 @@
<opt>aand</opt> <opt>aand</opt>
<opt>aor</opt> <opt>aor</opt>
<opt>axor</opt> <opt>axor</opt>
<opt>axchg</opt> <!-- For Valhall -->
<opt>acmpxchg</opt> <!-- For Valhall -->
</mod> </mod>
<!-- not actually encoded, but used for IR --> <!-- not actually encoded, but used for IR -->
<immediate name="sr_count" size="4" pseudo="true"/> <immediate name="sr_count" size="4" pseudo="true"/>

View file

@ -86,9 +86,9 @@ bi_count_staging_registers(const bi_instr *ins)
unsigned unsigned
bi_count_read_registers(const bi_instr *ins, unsigned s) bi_count_read_registers(const bi_instr *ins, unsigned s)
{ {
/* ATOM reads 1 but writes 2 */ /* ATOM reads 1 but writes 2. Exception for ACMPXCHG */
if (s == 0 && ins->op == BI_OPCODE_ATOM_RETURN_I32) if (s == 0 && ins->op == BI_OPCODE_ATOM_RETURN_I32)
return 1; return (ins->atom_opc == BI_ATOM_OPC_ACMPXCHG) ? 2 : 1;
else if (s == 0 && bi_opcode_props[ins->op].sr_read) else if (s == 0 && bi_opcode_props[ins->op].sr_read)
return bi_count_staging_registers(ins); return bi_count_staging_registers(ins);
else if (s == 4 && ins->op == BI_OPCODE_BLEND) else if (s == 4 && ins->op == BI_OPCODE_BLEND)