[vectorIntrinsics] RFR: 8258072: Add Reinterpret nodes implementation for Arm SVE

Xiaohong Gong xgong at openjdk.java.net
Wed Jan 6 03:42:14 UTC 2021


On Wed, 6 Jan 2021 03:00:08 GMT, Wang Huang <whuang at openjdk.org> wrote:

> Add reduction nodes support for Arm SVE. Add the backend codegen for node like "VectorReinterpret" .
> In this patch, We implement these instructs: 
> *  reinterpret (src == dst)
> *  reinterpretExpand (src < dst)
> *  reinterpretShrink (src > dst)
> At the same time, we fix a bug (JDK-8258989) because it is not merged in panama-vector/vectorIntrinsics.

src/hotspot/cpu/aarch64/aarch64_sve.ad line 384:

> 382:                      zr, as_Register($tmp$$reg));
> 383:       __ sve_cpy(as_FloatRegister($dst$$reg), __ B,
> 384:                  as_PRegister($pTmp$$reg), as_FloatRegister($src$$reg));

It seems using `cpy` is not right here, which usually accept a `imm, scalar or SIMD&FP scalar register`. This instruction is expected to copy the scalar value to each active element. So use `"mov"` instead ? BTW, the normal `MOV <Zd>.<T>, <Pg>/M, <Zn>.<T>`  instruction uses the `merging` feature of predicate while not `zeroing`. To make sure the non active elements are zero, do you think it's better to use `MOVS <Pd>.B, <Pg>/Z, <Pn>.B` here?

src/hotspot/cpu/aarch64/aarch64_sve.ad line 369:

> 367: %}
> 368: 
> 369: instruct reinterpretExpand(vReg dst, vReg src, iRegINoSp tmp, pRegGov pTmp, rFlagsReg cr) %{

Could you please add some comments for this rule? Thanks so much!

src/hotspot/cpu/aarch64/aarch64_sve.ad line 390:

> 388: %}
> 389: 
> 390: instruct reinterpretShrink(vReg dst, vReg src, iRegINoSp tmp, pRegGov pTmp, rFlagsReg cr) %{

Could you please add some comments for this rule to describe why `predicate` is needed here? Thanks so much!

src/hotspot/cpu/aarch64/aarch64_sve.ad line 116:

> 114:   }
> 115: 
> 116:   static inline uint vector_length_in_bytes(const Node* n) {

Is it possible that we reuse the existed functions `vector_length` ? Besides, the argument type is  `Node*` which is not the same with other functions that use `MachNode*` .  Use the same type?

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

PR: https://git.openjdk.java.net/panama-vector/pull/30


More information about the panama-dev mailing list