From: David Daney <ddaney@avtrex.com>
To: Andrew Haley <aph@redhat.com>
Cc: gcc@gcc.gnu.org, linux-mips@linux-mips.org, java@gcc.gnu.org
Subject: Re: [RFC] MIPS division by zero and libgcj...
Date: Thu, 10 Jun 2004 13:31:14 -0700 [thread overview]
Message-ID: <40C8C512.2020607@avtrex.com> (raw)
In-Reply-To: <16584.48456.389968.903435@cuddles.cambridge.redhat.com>
Andrew Haley wrote:
>David Daney writes:
> > Andrew Haley wrote:
> >
> > MIPS div instructions never trap. However I think that GCC always emits
> > things like this when it cannot determine that the divisor is non zero:
> >
> > div $0,$17,$16
> > bne $16,$0,1f
> > nop
> > break 7
> > 1:
> >
> >
>
> > >No, there's no reason not to do it. You'll have to write some hairy
> > >code to satisfy all the rules, though.
> > >
> > What are the rules? Are they more complicated then throw an
> > ArithmeticException when the divisor is zero?
>
>Yes. You also have to do
>
> if (dividend == (jint) 0x80000000L && divisor == -1)
> return dividend;
>
>and not throw an exception.
>
That is evidently what you have to do on i386. MIPS gives the right
answer without faulting (i.e. hitting the break 7).
David Daney.
next prev parent reply other threads:[~2004-06-10 20:32 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-06-10 19:12 [RFC] MIPS division by zero and libgcj David Daney
2004-06-10 19:31 ` Andrew Haley
2004-06-10 19:39 ` Andrew Haley
2004-06-10 19:48 ` David Daney
2004-06-10 19:58 ` Andrew Haley
2004-06-10 20:31 ` David Daney [this message]
2004-06-10 20:27 ` Ralf Baechle
2004-06-11 14:01 ` Maciej W. Rozycki
2004-06-11 15:34 ` David Daney
2004-06-11 15:39 ` Maciej W. Rozycki
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=40C8C512.2020607@avtrex.com \
--to=ddaney@avtrex.com \
--cc=aph@redhat.com \
--cc=gcc@gcc.gnu.org \
--cc=java@gcc.gnu.org \
--cc=linux-mips@linux-mips.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox