From: Peter Maydell <peter.maydell@linaro.org>
To: Sebastian Huber <sebastian.huber@embedded-brains.de>
Cc: qemu-devel <qemu-devel@nongnu.org>
Subject: Re: Are floating-point exceptions usable on AArch64?
Date: Thu, 26 Sep 2024 14:52:17 +0100 [thread overview]
Message-ID: <CAFEAcA_kuDNzW8i6Sfx9WiEG4sxudts6zn=9+=KFn1dAGURyhg@mail.gmail.com> (raw)
In-Reply-To: <1832886563.20496.1725444713946.JavaMail.zimbra@embedded-brains.de>
On Wed, 4 Sept 2024 at 11:32, Sebastian Huber
<sebastian.huber@embedded-brains.de> wrote:
>
> Hello,
>
> I tried to provoke a division-by-zero exception on AArch64 using:
>
> uint64_t value;
> __asm__ volatile (
> "mrs %0, FPCR\n"
> "orr %0, %0, 0x200\n"
> "msr FPCR, %0" : "=&r" ( value ) : : "memory"
> );
> volatile double x = 0x0;
> volatile double y = 0x0;
> x /= y;
>
> When I look with the debugger at $fpcr it still says 0x0 after the msr. Are floating-point exceptions usable on AArch64 in general?
Something I just noticed when I was playing around with this
example for other reasons -- it won't trigger an exception
even on a system where trapped floating point exceptions are
implemented. This is because in the FPCR you are setting the
DZE bit to request trapping of division by zero. However the
operation you are doing is 0 / 0, which is defined to
set the InvalidOp floating point exception. If you want
to get a DivideByZero condition you need to divide some
non-zero number by 0.
thanks
-- PMM
prev parent reply other threads:[~2024-09-26 13:53 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-04 10:11 Are floating-point exceptions usable on AArch64? Sebastian Huber
2024-09-04 12:18 ` Peter Maydell
2024-09-26 13:52 ` Peter Maydell [this message]
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='CAFEAcA_kuDNzW8i6Sfx9WiEG4sxudts6zn=9+=KFn1dAGURyhg@mail.gmail.com' \
--to=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=sebastian.huber@embedded-brains.de \
/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;
as well as URLs for NNTP newsgroup(s).