Java 8 Integer and Long unsigned methods - are there plans to add intrinsics for them?
Andrew Haley
aph at redhat.com
Fri Apr 11 11:52:39 UTC 2014
On 04/11/2014 12:54 AM, Roman Leventov wrote:
> > 11.04.2014, 02:51, "Christian Thalinger" <christian.thalinger at oracle.com>:
> > Do you see a performance problem with these methods?
> Currently divideUnsigned and remainderUnsigned take a dozen of instructions with
> widening to long, while there is a signle div assembly instruction for this.
It seems this is an x86 thing rather than a HotSpot thing. On AArch64
I get
01c ubfm R10, R2, 0, 31 # ui2l
020 ubfm R11, R1, 0, 31 # ui2l
024 cbeq R10, B4 P=0.000001 C=-1.000000
028 sdiv R10, R11, R10
This isn't exactly ideal, given that long division is slower than int
division, but it's not terrible.
I can't match on
(Set dst (DivL (AndL (ConvI2L src1) mask) (AndL (ConvI2L src2) mask1)))
and generate a simple udiv because of the pesky (If ...) that checks for
division by zero. I suppose we could persuade HotSpot to rearrange things.
Andrew.
More information about the hotspot-compiler-dev
mailing list