[vectorIntrinsics] what about div?
Vladimir Ivanov
vladimir.x.ivanov at oracle.com
Fri May 31 22:29:40 UTC 2019
> I propose that we move div up into the top level class,
Yes, IMO it is the right move.
> and make it (for now) a partial operation which throws
> UOE. Later we can fill it in. I note that SVE seems to
> support it (though it may well be slow). And for Intel
> we can use some of the ideas here:
> https://stackoverflow.com/questions/16822757/sse-integer-division
>
> I think we can treat the 1/0 problem as similar to the
> range check problem (with toArray masked). Basically,
> we need to do `v.equal(broadcast(0)).anyTrue()` before
> a div and uncommon-trap to scalar code if it happens.
Yes, the problem looks very similar to range checks for masked accesses
(maybe even simpler? since zero reliably trigger the exception) and the
solution should be easily extended to masked variant
(v.equal(broadcast(0)).and(m).anyTrue()), but it's interesting to see
how much overhead it introduces.
Best regards,
Vladimir Ivanov
> ARM SVE defines zero as the result of x/0, but I don't think
> we need to do that.
>
> For efficient integer division up to 32 bits we can use
> 64-bit floats. For 64-bit integer division we can
> eventually optimize with something tricky; see the
> link above.
>
> — John
>
More information about the panama-dev
mailing list