[vectorIntrinsics] RFR: Load/store short vectors from/to char[]
Paul Sandoz
psandoz at openjdk.java.net
Mon Nov 16 22:08:09 UTC 2020
On Mon, 16 Nov 2020 21:37:34 GMT, Ludovic Henry <luhenry at openjdk.org> wrote:
>> Methods to load/store a `ShortVector` from/to `char[]`. These methods may be useful for encoding/decoding characters.
>>
>> Unclear if aliasing of `char[]` and `short[]` causes issues for the intrinsic or for Hotspot code gen.
>>
>> Testing-wise, it was easier to explicitly clone and reify the relevant tests rather than trying to generalize the template and its template arguments to distinguish between the vector type and the array type.
>
> Hey @PaulSandoz, thank you for doing that! It works for https://gist.github.com/luhenry/dc84c661997d5bc1cd51c2088d234727 so far. However, as I'm looking at expanding for CharBuffer as well, I'm seeing that there is a `fromByteBuffer`/`intoByteBuffer` method, but not a `fromCharBuffer`/`intoCharBuffer`.
I was hoping to avoid adding support for `CharBuffer` load/store. We have so far avoided adding support for `IntBuffer` etc. When `MemorySegment` exits incubation we may even remove the `ByteBuffer` methods (since segment can wrap them).
Can you operate on `char[]` instead for now? I see your code requires that the `dst` buffer has a backing `char[]` array, although perhaps you intend to support direct `CharBuffer` too?
-------------
PR: https://git.openjdk.java.net/panama-vector/pull/22
More information about the panama-dev
mailing list