From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <7e3d3a81285427c9f6ab21ee554ff0cf.axp-list@archive.invalid> X-Archive-Original-Message-ID: <199706020340.UAA16094@jolt.d2.com> Date: Sun, 1 Jun 1997 20:40:38 -0700 (PDT) From: Daryll Strauss Subject: IEEE FP Problems We've got a couple of IEEE floating point intensive applications that we're trying to run under Alpha Linux. One of the applications is a Dec Unix application which we don't have source to and the other is an in-house tools which is native under Linux. Both expect the IEEE behavior for floating point. There was some useful information on this topic posted to the list by Jim Paradis in April. I've looked through that and the kernel sources for traps.c, osf_sys.c, fp-emul.c, and ieee-math.c in 2.1.35. There seems to be several problems I'm encountering. I've made a little headway, but I've hit a serious stumbling block. The first thing I tried was to compile a program under Dec Unix that checked the state of the fp control register. Those start out being different. It looks like Dec Unix is clearing the bits back 0 and Linux isn't. I forced those bits to 0 and I made sure current->tss.flags&IEEE_TRAP_ENABLE_MASK=0 in osf_set_program_attributes. My native Dec Unix application did better, but still produced an FPE on some data files. I remembered Jim's comments about division by zero, and took a look at ieee-math.c. It looks like division by 0 returns NaN for 0/0, but causes and FPE for any other numerator. As a first stab I corrected that by returning setting *c=IEEE_PINF and returning 0 in the two division routines. This doesn't appear to be the right answer, because I'm always returning IEEE_PINF. I'm not sure of the exact IEEE spec. It seems like I should have to check the sign bits of the two operands and return IEEE_NINF if they are different. (Is that true for division by negative 0?) From looking at the rest of the code I don't think IEEE_NINF is ever returned. These changes completely solved my floating point exceptions. Now I'm seeing some arithmetic acceptions. So far, my testing has shown this as occuring in fp-emul.c in alpha_fp_emul_imprecise in the case where a OPC_PAL or OPC_JSR is encountered. I'm kind of baffled by this, because I don't know enough about the Alpha instructions and scheduling. What's this routine trying to do and what does the arithmetic exception really mean? If anyone has an suggestions for how to tackle this I'd be happy to hear them. I'm hoping to bundle these changes up into a patch once I get all the problems striaghtened out. Thanks, - |Daryll -- To unsubscribe: send e-mail to axp-list-request@redhat.com with 'unsubscribe' as the subject. Do not send it to axp-list@redhat.com