Port-alpha archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

libm tests vs. alpha



Currently many libm tests are failing on alpha.

This is mostly due to constructs like:

        const double x = -1.0f / 0.0;

and then some using the resulting -inf as input to some libm function.

Here is a small sample to reproduce it:

--8<--
#include <stdio.h>
#include <math.h>

int main(int argc, char **argv)
{
        const double x = -1.0L / 0.0L;
        int inf = isinf(x);
        int sign = signbit(x);

        printf("inf: %d, sign: %d\n", inf, sign);

        return 0;
}
-->8--

However, it seems on alpha you can not disable the "div by zero" traps,
so we always die with a SIGFPE. Do I understand this correctly?
What should we do about it?

While looking at it, it occured to me that setregs() maybe should
init fpcr of a new fpu context with all exception traps disabled (in
the "not inheriting" case) - like:

       if (__predict_true((l->l_md.md_flags & IEEE_INHERIT) == 0)) {
                l->l_md.md_flags &= ~MDLWP_FP_C;
                pcb->pcb_fp.fpr_cr = FPCR_DYN(FP_RN);
// or in FPCR_INED, FPCR_UNFD, FPCR_UNDZ, FPCR_OVFD, FPCR_DZED....
        }


or should this be controlled by the compilers -mfp-trap-mode= settings?

And a last question: should we compile the libm tests on alpha
with some flags like -mieee-with-inexact and maybe -mtrap-precision=i ?

Martin


Home | Main Index | Thread Index | Old Index