public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* x86 Denormal flag
@ 2021-06-19  1:09 Michael Morrell
  2021-06-21 20:00 ` Joseph Myers
  0 siblings, 1 reply; 3+ messages in thread
From: Michael Morrell @ 2021-06-19  1:09 UTC (permalink / raw)
  To: libc-alpha

Should fetestexcept be able to test for the denormal flag in the MXCSR?

My test case is:

define _GNU_SOURCE
#include <fenv.h>
#include <stdio.h>
#include <xmmintrin.h>

volatile float two = 2.0f;
volatile float den = 0x1.0p-130;

int main()
{
    volatile float r;

    r = den / two;

    if (_mm_getcsr() & _MM_EXCEPT_DENORM)
                printf("mxcsr has DENORM bit set\n");
    if (fetestexcept(__FE_DENORM))
                printf("DENORM is set\n");
    return 0;
}

And it shows that the Denormal flag is set in MXCSR, but fetestexcept returns 0 here.

It seems like fetestexcept only works for the 5 standard IEEE flags, but then why is __FE_DENORM even defined?

   Michael

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

end of thread, other threads:[~2021-06-21 20:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-19  1:09 x86 Denormal flag Michael Morrell
2021-06-21 20:00 ` Joseph Myers
2021-06-21 20:44   ` Michael Morrell

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