This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Miscompilation of remainder expressions


On Wed, 17 Jan 2007, Andrew Haley wrote:

| Ian Lance Taylor writes:
|  > Gabriel Dos Reis <gdr@cs.tamu.edu> writes:
|  >
|  > > Ian, do you believe something along the line of
|  > >
|  > >  # > I mean, could not we generate the following for "%":
|  > >  # >
|  > >  # >     rem a b :=
|  > >  # >       if abs(b) == 1
|  > >  # >          return 0
|  > >  # >       return <machine-instruction> a b
|  > >  #
|  > >  # On x86 processors that have conditional moves, why not do the equivalent
|  > >  # of
|  > >  #
|  > >  #         neg_b = -b;
|  > >  #         cmov(last result is negative,neg_b,b)
|  > >  #         __machine_rem(a,b)
|  > >  #
|  > >  # Then there's no disruption of the pipeline.
|  > >
|  > > is workable for the affected targets?
|  >
|  > Sure, I think the only real issue is where the code should be
|  > inserted.
|
| From a performance/convenience angle, the best place to handle this is
| either libc or the kernel.

Hmm, that is predicated on assumptions not convenient to users
on targets that are not glibc-based or GNU/Linux-based.

-- Gaby


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