* [PATCH] Alpha - IEEE 754 - denorm fix.
@ 2002-03-19 19:15 George France
0 siblings, 0 replies; only message in thread
From: George France @ 2002-03-19 19:15 UTC (permalink / raw)
To: linux-kernel
[-- Attachment #1: Type: text/plain, Size: 1536 bytes --]
Start with a simple C program:
#include <stdio.h>
#include <values.h>
int main()
{
float val = 1.40129846432481707e-45f;
double dbl = val;
printf("MINFLOAT is %e(flt)\n", MINFLOAT );
printf("val is %e(flt) %g(dbl)\n", val, val);
}
Compile it:
gcc -mieee -o ieee ieee.c
Results with the patch:
MINFLOAT is 1.175494e-38(flt)
val is 1.401298e-45(flt) 1.4013e-45(dbl)
Results without the patch:
MINFLOAT is 1.175494e-38(flt)
val is 2.652495e-315(flt) 2.65249e-315(dbl)
Patch follows inline & attached:
--- linux-2.4.18-orig/arch/alpha/math-emu/math.c Fri Sep 22 16:54:09
2000+++ linux-2.4.18/arch/alpha/math-emu/math.c Mon Mar 18 18:26:53 2002
@@ -220,12 +220,12 @@
FP_CONV(S,D,1,1,SR,DB);
goto pack_s;
} else {
- /* CVTST need do nothing else but copy the
- bits and repack. */
- DR_c = DB_c;
- DR_s = DB_s;
- DR_e = DB_e;
- DR_f = DB_f;
+ vb = alpha_read_fp_reg_s(fb);
+ FP_UNPACK_SP(SB, &vb);
+ DR_c = SB_c;
+ DR_s = SB_s;
+ DR_e = SB_e;
+ DR_f = SB_f << ( 52 - 23 );
goto pack_d;
}
--George
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: patch-alpha-ieee-denorm --]
[-- Type: text/x-c; name="patch-alpha-ieee-denorm", Size: 1006 bytes --]
--- linux-2.4.18-orig/arch/alpha/math-emu/math.c Fri Sep 22 16:54:09 2000
+++ linux-2.4.18/arch/alpha/math-emu/math.c Mon Mar 18 18:26:53 2002
@@ -220,12 +220,12 @@
FP_CONV(S,D,1,1,SR,DB);
goto pack_s;
} else {
- /* CVTST need do nothing else but copy the
- bits and repack. */
- DR_c = DB_c;
- DR_s = DB_s;
- DR_e = DB_e;
- DR_f = DB_f;
+ vb = alpha_read_fp_reg_s(fb);
+ FP_UNPACK_SP(SB, &vb);
+ DR_c = SB_c;
+ DR_s = SB_s;
+ DR_e = SB_e;
+ DR_f = SB_f << ( 52 - 23 );
goto pack_d;
}
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2002-03-19 19:16 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-03-19 19:15 [PATCH] Alpha - IEEE 754 - denorm fix George France
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®