Why doesn't HotSpot use div machine code?

Andrew Haley aph at redhat.com
Wed Jan 13 02:05:16 PST 2010


On 01/13/2010 09:55 AM, Christian Thalinger wrote:
> On Wed, 2009-12-23 at 22:01 +0100, Ulf Zibis wrote:
>> Why doesn't HotSpot use div machine code?
>> I guess this would be faster here.
> 
> Intel's div/idiv instructions have a very high latency and the latency
> even varies with the input values, as you can see in Intels'
> Optimization Reference Manual[1] around page C-27.  
> 
> Additionally a Java division (idiv) needs special treatment of corner
> cases, as you can read in the JVM specification.

Actually it doesn't, as you can see in the gcj implementation: it's
possible to fixup the corner cases afterwards.

http://gcc.gnu.org/svn/gcc/trunk/libjava/include/x86_64-signal.h

Andrew.


More information about the hotspot-compiler-dev mailing list