This is the mail archive of the java-discuss@sourceware.cygnus.com mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: [PATCH] Java: expand divide, expand conversions


> Date: Mon, 19 Jul 1999 10:52:17 -0700
> From: Tom Tromey <tromey@cygnus.com>
> 
> >> It seems like we could potentially optimize the test away in some
> >> situations (that is, if gcc has the necessary machinery for this,
> >> which is something I don't know).
> 
> Andrew> The call to the divide subroutine isn't generated when
> Andrew> dividing by a constant, so there's no overhead in that case.
> 
> Cool.  I also meant the case where we have "a / b" but can prove that
> b != 0.  Can gcc do this?

Yes, I think that if it can prove a region of code is unreaschable the
code will just be deleted.  For example, if a division was already in
an `if (i != 0) ...' guarded block, the test could just be removed.
However, what we need is a rule which says: 

  If you can prove that i != 0, generate a `div' insn.  Otherwise,
  call a divide subroutine.

It's an interesting idea, but I don't think there's any way to express
it in gcc.  I wonder...

Andrew.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]