This is the mail archive of the glibc-bugs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug math/13185] New: fegetexceptflag does not report SSE exceptions on i386


http://sourceware.org/bugzilla/show_bug.cgi?id=13185

             Bug #: 13185
           Summary: fegetexceptflag does not report SSE exceptions on i386
           Product: glibc
           Version: unspecified
            Status: NEW
          Severity: minor
          Priority: P2
         Component: math
        AssignedTo: aj@suse.de
        ReportedBy: jahns@dkrz.de
    Classification: Unclassified


While SSE is not part of the ABI in i386, I'd like it to report SSE exceptions
the same way as in x86_64 in case the CPU does have SSE registers.

The difference is obvious if one looks at sysdeps/i386/fpu/fgetexcptflg.c vs.
sysdeps/x86_64/fpu/fgetexcptflg.c, i.e. while the latter queries the FPU status
word and the SSE status register, the former only inspects the FPU status word.

Specifically, if one compiles code with -mfpmath=sse and -msse or -msse2 on
i386, parts of fenv.h no longer work as advertised. One could argue this is use
of an unsupported feature from libc point-of-view. But since it took me some
time to figure out why code relying on proper exception handling no longer
worked when switching on sse, I assume other people would prefer not to go down
this rabbit-hole and have fenv.h functions "just work".

I assume this requires some tricks with CPUID in assembly and a one-time-check
if the kernel handles SSE on context-switch. I'd volunteer to read up on this
and provide a patch in case nobody cares. But first I'd like to hear if my idea
is consistent with how the maintainers feel the issue should be addressed. On
the other hand, gcc and any other optimizing compiler could provide an
implementation in its runtime, but fixing this once in glibc seems like the
saner solution to me.

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]