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

Jan Beulich jbeulich@suse.com
Tue Oct 24 06:02:24 GMT 2023


On 24.10.2023 06:07, Tsukasa OI wrote:
> 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?

Certainly, and I didn't put the macro under question. "The former of the
two" was referring to the invocation of the macro with all 1 arguments.
Interestingly this case also doesn't appear in the table above (for,
perhaps, the very reason I was asking the question).

Jan


More information about the Binutils mailing list