Andrew Pinski writes: > On 4/1/07, David Daney <[EMAIL PROTECTED]> wrote: > > The issue is that for some things (the java front-end) we need the > > trapping behavior. I just want to optimize it if the divisor is known > > to be non-zero. VRP knows, but by the time we generate the code it > > seems that we have forgotten. > > The java front-end as far as I know emits a functon call always for > targets that don't trap on divide by zero.
I's sure David knows that. > And as far as I know that is the x86 back-end which is the only > target which traps really on divide by zero. We have handlers for GNU/Linux on PPC, x86, MIPS, S/390, and x86-64. For a while we didn't have a divide overflow handler on x86-64 because I didn't think it was worthwhile, but to my amazement the divide subroutine was taking up severeal percent of CPU time in real-world code. I think this is because divisions are used a lot to generate hash indexes. > It seems wrong that the java front-end thinks we don't have to use > the divide subroutine for MIPS. Really I think it is wrong that > the mips back-end thinks it should enable by default trap on divide > by zero. I'm not sure about that: the MIPS conditional trap instruction is quite efficient. Before making any change we should do some benchmarking. Andrew. -- Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SL4 1TE, UK Registered in England and Wales No. 3798903