public inbox for libc-ports@sourceware.org
 help / color / mirror / Atom feed
From: "Joseph S. Myers" <joseph@codesourcery.com>
To: Richard Henderson <rth@twiddle.net>
Cc: <libc-ports@sourceware.org>, <linux-arm-kernel@lists.infradead.org>
Subject: Re: Detecting support for trapping floating-point exceptions on ARM
Date: Wed, 27 Jun 2012 19:17:00 -0000	[thread overview]
Message-ID: <Pine.LNX.4.64.1206271904570.32296@digraph.polyomino.org.uk> (raw)
In-Reply-To: <4FEB49B3.2030602@twiddle.net>

On Wed, 27 Jun 2012, Richard Henderson wrote:

> On 06/12/2012 12:11 PM, Joseph S. Myers wrote:
> > ARM VFPv3 and VFPv4 do not support trapping floating-point exceptions; 
> > VFPv2, VFPv3U and VFPv4U do.  The lack of support causes the glibc 
> > math/test-fenv test to fail on VFPv3 and VFPv4 systems.
> > 
> > The natural fix for that would be for fesetenv (FE_NOMASK_ENV) to fail on 
> > hardware not supporting trapping exceptions.  There is, however, no HWCAP 
> > bit to indicate whether trapping floating-point exceptions is supported.  
> > Could one be added to the kernel, or is there a good way fesetenv could 
> > detect this from userspace without a new HWCAP bit?
> 
> I don't suppose those SBZ/RAZ bits just so happen to be ignored in
> actual hardware, so that you can write 1 and read it back and get 0
> to see if exceptions are unsupported?

Good point.  I tested on one VFPv3 system and the bits did read back as 
zero (and on one VFPv2 system and got back the expected 0x1f00).  And 
DDI0406C (page 1552) says "They are reserved, RAZ/WI, on a system that 
implements VFPv3 or VFPv4.", where RAZ/WI is "Read-As-Zero, Writes 
Ignored.  In any implementation, the bit must read as 0, or all 0s for a 
bit field, and writes to the field must be ignored.  Software can rely on 
the bit reading as 0, or all 0s for a bit field, and on writes being 
ignored." (page 2676), so this can be relied upon.  (This is a change in 
the documentation from DDI0406B which said RAZ/SBZP.)  So it is possible 
to test for this in userspace the way you suggest.

-- 
Joseph S. Myers
joseph@codesourcery.com

      reply	other threads:[~2012-06-27 19:17 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-12 19:11 Joseph S. Myers
2012-06-27 17:58 ` Richard Henderson
2012-06-27 19:17   ` Joseph S. Myers [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=Pine.LNX.4.64.1206271904570.32296@digraph.polyomino.org.uk \
    --to=joseph@codesourcery.com \
    --cc=libc-ports@sourceware.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=rth@twiddle.net \
    /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 read-only IMAP folder(s) and NNTP newsgroup(s).