Andrew Haley wrote:
Andrew Pinski writes:
> 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.
There are two issues:
1) Should the compiler generate a trap on division by zero?
As far as I can tell, most mips compilers can be configured to generate
a trap on division by zero. We should not remove this capability, just
make it as efficient as possible.
2) Should the mips[el]-linux port of libgcj use trapping division?
The JLS requires that an exception be thrown on division by zero. For
the mips a division + conditional trap = 2 instructions and no
branching. Calling the special libgcj divide function executes at least
4 times as many instructions and involves at least two jumps (call and
return). I am not going to benchmark it. If you think there is a
better way, you can benchmark it and report your findings.
David Daney