RFR: 8356159: RISC-V: Add Zabha [v11]

Feilong Jiang fjiang at openjdk.org
Tue Jun 3 12:14:55 UTC 2025


On Tue, 3 Jun 2025 11:46:27 GMT, Robbin Ehn <rehn at openjdk.org> wrote:

>> If nothing else the assembler always checks:
>> 
>>   void amo_base(Register Rd, Register Rs1, uint8_t Rs2, Aqrl memory_order = aqrl) {
>>     assert(width > AMO_WIDTH_HALFWORD || UseZabha, "Must be");
>>     assert(funct5 != AMO_CAS || UseZacas, "Must be");
>> 
>> 
>> I'll have a look!
>
> When we call amocas with unknown size (i.e. not hardcoded int64/int32) we have this assert in the caller:
> `assert((UseZacas && UseZabha) || (size != int8 && size != int16), "unsupported operand size");`
> 
> So it seems like we should be fine, no?

Looks like `UseZabha` relies on `UseZacas`? The following code will call `atomic_cas` only when `UseZacas` is true even if the size is `int8` or `int16`. If that is true (maybe `(UseZacas && UseZabha)` already explained), then it makes sense.

https://github.com/openjdk/jdk/blob/78a392aa3b0cda52cfacfa15250fa61010519424/src/hotspot/cpu/riscv/macroAssembler_riscv.cpp#L4019-L4031

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/25252#discussion_r2123625099


More information about the hotspot-dev mailing list