question about vector registers

yangfei at iscas.ac.cn yangfei at iscas.ac.cn
Tue May 23 00:52:36 UTC 2023


Hi,

Comments inlined.

> -----Original Messages-----
> From: "Vladimir Kempik" <vladimir.kempik at gmail.com>
> Sent Time: 2023-05-23 04:44:38 (Tuesday)
> To: riscv-port-dev <riscv-port-dev at openjdk.org>
> Cc: 
> Subject: question about vector registers
> 
> Hello
> 
> I have few questions about vector registers usage in hotspot.
> 
> Currently there is no calling convention for vector registers [1].
>
> Currently all vector registers ( usage in hotspot) are not preserved and volatile ? is it true ?

Yes, the ABI spec only mentions that vector registers are volatile and are not used for passing arguments or return values for now.
So if you look at register definition for C2, we set both 'register save type' and 'C convention save type' for vector registers as SOC (Save-On-Call).

> why do we have defition for v1_reg-v5_reg and the rest of the registers ( except  v0_mask) ?

Several vector registers (including v0_mask register) are used as scratch registers to optimize code for C2 nodes like ClearArray, StrComp, etc.
And if you do this, remember to make this explicit on the side effect for those nodes like: https://github.com/openjdk/jdk/blob/master/src/hotspot/cpu/riscv/riscv_v.ad#L3278

> I guess some v6+ could be used somewhere due to lmul  = 2 or 4.

I think it will depend on your specific usage then.
We already have some use of lmul =2/4 in some C2 assembler functions like C2_MacroAssembler::clear_array_v.
But currently those usages won't involve v6+ yet.

Hope that answers the questions,
Fei Yang
</riscv-port-dev at openjdk.org></vladimir.kempik at gmail.com>


More information about the riscv-port-dev mailing list