On Thu, Jan 18, 2007 at 05:36:23PM -0500, Robert Dewar wrote:
> Morten Welinder wrote:
> >>For sure a/b is undefined
> >
> >In C, it is.  In assembler it is perfectly well defined, i.e., it
> >traps.  But how is the
> >trap handler supposed to know the source of a given instruction?
> >
> >M.
> 
> Sure it traps, but what happens when that trap occurs is of course
> O/S dependent, there is no guarantee of the effect.

We're going around in circles.  Everything has been said. What if we put
together a Wiki page with the problem and possible solutions, as in

a) do nothing, no big deal.  This is what happens if no one contributes
   code in any case.

b) add a flag to generate code to compute something like
    divisor == -1 ? 0 : rem(dividend,divisor)
   or
    divisor == rem(dividend,abs(divisor))
   in an efficient way (cmov to avoid busting the pipeline)

   b1) enable by default on affected targets
   b2) disable by default on affected targets, add flag

c) do it in a trap handler (then discuss how to do this correctly,
   what targets it will/won't work on).

and fill in points/counterpoints *once* and *nonrepetitively*.

Reply via email to