[vector] CharVector and unsigned bytes
Paul Sandoz
paul.sandoz at oracle.com
Fri Dec 6 23:01:08 UTC 2019
Hi Richard,
No current plans to use ‘char’ as a carrier for a more general 16 bit unsigned integral type. I don’t think such operations are beyond the scope of the API, it’s just too early to tackle this right now.
Such operations could be applied to the existing signed integral types (just like we have a few methods on Integer for unsigned operations). We would need to add such operations to VectorOperators (in fact there is a fixme to add unsigned comparisons).
Alternatively we could wait for inline types and then add unsigned integral types, thereby leveraging existing and applicable op definitions.
I am not very familiar with the unsigned vector ops in x86 but I believe some may saturate whereas others may promote, both of which might complicate how we expose operations and optimize.
Nor do I have a sense of the importance of certain operations which might help determine a route taken on a case-by-case basis.
Some of the x86 operations may perhaps be considered more in “snowflake” territory. Here is an idea (not new): leverage Panama’s native binding support to derive a native method from a snippet of machine code operating on vector registers [*]. Enable such handles to be input to a generic (binary or unary, say) operation on a Vector<T>.
Thanks,
Paul.
[*] In fact that’s how we got started leveraging vector instructions :-)
> On Dec 6, 2019, at 11:38 AM, Richard Startin <richard at openkappa.co.uk> wrote:
>
> I see that there is no CharVector type - is there a plan for something like this or has it been ruled out, where the elements would behave like a Java char, except that operations would wrap rather than promote?
>
> char is Java's only unsigned type, but there are many useful unsigned vector operations operating on 8 bit elements - might these be beyond the scope of the API because there is no such thing as an unsigned byte?
>
> Thanks,
> Richard
More information about the panama-dev
mailing list