public inbox for libc-ports@sourceware.org
 help / color / mirror / Atom feed
* Detecting support for trapping floating-point exceptions on ARM
@ 2012-06-12 19:11 Joseph S. Myers
  2012-06-27 17:58 ` Richard Henderson
  0 siblings, 1 reply; 3+ messages in thread
From: Joseph S. Myers @ 2012-06-12 19:11 UTC (permalink / raw)
  To: libc-ports, linux-arm-kernel

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?

-- 
Joseph S. Myers
joseph@codesourcery.com

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Detecting support for trapping floating-point exceptions on ARM
  2012-06-12 19:11 Detecting support for trapping floating-point exceptions on ARM Joseph S. Myers
@ 2012-06-27 17:58 ` Richard Henderson
  2012-06-27 19:17   ` Joseph S. Myers
  0 siblings, 1 reply; 3+ messages in thread
From: Richard Henderson @ 2012-06-27 17:58 UTC (permalink / raw)
  To: Joseph S. Myers; +Cc: libc-ports, linux-arm-kernel

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?

Yes, that violates the spec as written, but if it just so happens to
work in current hardware that might be good enough convince someone
to adjust the spec to be slightly more handy.


r~

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Detecting support for trapping floating-point exceptions on ARM
  2012-06-27 17:58 ` Richard Henderson
@ 2012-06-27 19:17   ` Joseph S. Myers
  0 siblings, 0 replies; 3+ messages in thread
From: Joseph S. Myers @ 2012-06-27 19:17 UTC (permalink / raw)
  To: Richard Henderson; +Cc: libc-ports, linux-arm-kernel

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-06-27 19:17 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-06-12 19:11 Detecting support for trapping floating-point exceptions on ARM Joseph S. Myers
2012-06-27 17:58 ` Richard Henderson
2012-06-27 19:17   ` Joseph S. Myers

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).