[PATCH v2] RISC-V: Add support for 'Zacas' atomic CAS

Tsukasa OI research_trasio@irq.a4lg.com
Tue Oct 24 04:07:37 GMT 2023


On 2023/10/23 15:47, Jan Beulich wrote:
> 
> Mind me asking what good the former of the two really does? It's just
> match_opcode() aiui, properly obfuscated.
> 
> Jan
> 

****Excuse me?****

As a single patch set, I think Gianluca's patch with a minor fix will
work perfectly.  But, the concept of register pairs / register groups
are not specific to 'Zacas', that's what I'm talking about and the
reason I think Gianluca's patch set's match function will not be a long
term solution (actually, I found Gianluca's patch set after I wrote
mine, but that wouldn't change my opinion).

So, let me list all register group-related constraints in existing and
upcoming extensions (except all ones; x is "not applicable" and can be
theoretically replaced to "1" but it's probably better to be named "x"
to indicate that the instruction does not use "x" operand as register):

Extension   |  RD | RS1 | RS2 | RS3
----------- | --- | --- | --- | ---
Zdinx       |   2 |   2 |   2 |   x
Zdinx       |   2 |   2 |   2 |   2
Zdinx       |   x |   2 |   2 |   x
Zdinx       |   1 |   2 |   x |   x
Zdinx       |   2 |   1 |   x |   x
Zdinx       |   2 |   2 |   x |   x
----------- | --- | --- | --- | ---
Zqinx       |   2 |   2 |   2 |   x
Zqinx       |   4 |   4 |   4 |   x
Zqinx       |   2 |   2 |   2 |   2
Zqinx       |   4 |   4 |   4 |   4
Zqinx       |   x |   2 |   2 |   x
Zqinx       |   x |   4 |   4 |   x
Zqinx       |   1 |   2 |   x |   x
Zqinx       |   1 |   4 |   x |   x
Zqinx       |   2 |   1 |   x |   x
Zqinx       |   2 |   2 |   x |   x
Zqinx       |   2 |   4 |   x |   x
Zqinx       |   4 |   1 |   x |   x
Zqinx       |   4 |   2 |   x |   x
Zqinx       |   4 |   4 |   x |   x
----------- | --- | --- | --- | ---
Zpsfoperand |   2 |   1 |   1 |   x
Zpsfoperand |   2 |   2 |   1 |   x
Zpsfoperand |   2 |   2 |   2 |   x
----------- | --- | --- | --- | ---
Zacas       |   2 |   1 |   2 |   x

Lots of similar constraints but different values.  Don't you think a
generator macro is the best solution for this kind of situation?

Tsukasa


More information about the Binutils mailing list