diff -uNr ./nwfpe/ChangeLog ./projects/nwfpe/ChangeLog --- ./nwfpe/ChangeLog Wed Dec 31 19:00:00 1969 +++ ./projects/nwfpe/ChangeLog Mon Nov 23 09:39:52 1998 @@ -0,0 +1,20 @@ +1998-11-23 Scott Bambrough + + * README.FPE - fix typo in description of lfm/sfm instructions + * NOTES - Added file to describe known bugs/problems + * fpmodule.c - Changed version number to 0.94 + +1998-11-20 Scott Bambrough + + * README.FPE - fix description of URD, NRM instructions + * TODO - remove URD, NRM instructions from TODO list + * single_cpdo.c - implement URD, NRM + * double_cpdo.c - implement URD, NRM + * extended_cpdo.c - implement URD, NRM + +1998-11-19 Scott Bambrough + + * ChangeLog - Added this file to track changes made. + * fpa11.c - added code to initialize register types to typeNone + * fpa11_cpdt.c - fixed bug in storeExtended (typeExtended changed to + typeDouble in switch statement) diff -uNr ./nwfpe/NOTES ./projects/nwfpe/NOTES --- ./nwfpe/NOTES Wed Dec 31 19:00:00 1969 +++ ./projects/nwfpe/NOTES Mon Nov 23 09:35:02 1998 @@ -0,0 +1,29 @@ +There seems to be a problem with exp(double) and our emulator. I haven't +been able to track it down yet. This does not occur with the emulator +supplied by Russell King. + +I also found one oddity in the emulator. I don't think it is serious but +will point it out. The ARM calling conventions require floating point +registers f4-f7 to be preserved over a function call. The compiler quite +often uses an stfe instruction to save f4 on the stack upon entry to a +function, and an ldfe instruction to restore it before returning. + +I was looking at some code, that calculated a double result, stored it in f4 +then made a function call. Upon return from the function call the number in +f4 had been converted to an extended value in the emulator. + +This is a side effect of the stfe instruction. The double in f4 had to be +converted to extended, then stored. If an lfm/sfm combination had been used, +then no conversion would occur. This has performance considerations. The +result from the function call and f4 were used in a multiplication. If the +emulator sees a multiply of a double and extended, it promotes the double to +extended, then does the multiply in extended precision. + +This code will cause this problem: + +double x, y, z; +z = log(x)/log(y); + +The result of log(x) (a double) will be calculated, returned in f0, then +moved to f4 to preserve it over the log(y) call. The division will be done +in extended precision, due to the stfe instruction used to save f4 in log(y). diff -uNr ./nwfpe/README.FPE ./projects/nwfpe/README.FPE --- ./nwfpe/README.FPE Fri Nov 13 15:14:17 1998 +++ ./projects/nwfpe/README.FPE Mon Nov 23 08:50:03 1998 @@ -31,7 +31,7 @@ Form 2 syntax: {cond} Fd, , [Rn]{!} -These instructions are fully implemented. They store/load three bytes +These instructions are fully implemented. They store/load three words for each floating point register into the memory location given in the instruction. The format in memory is unlikely to be compatible with other implementations, in particular the actual hardware. Specific @@ -111,11 +111,10 @@ URD{cond}{P,M,Z} Fd, - unnormalized round NRM{cond}{P,M,Z} Fd, - normalize -RND{cond}{P,M,Z} Fd, - round -These are not implemented as yet. They are not issued by the compiler, -hence we have ignored them for the moment. They should be implemented -in future versions. +These are implemented. URD is implemented using the same code as the RND +instruction. Since URD cannot return a unnormalized number, NRM becomes +a NOP. Library calls: diff -uNr ./nwfpe/TODO ./projects/nwfpe/TODO --- ./nwfpe/TODO Fri Nov 13 11:23:48 1998 +++ ./projects/nwfpe/TODO Mon Nov 23 08:52:28 1998 @@ -1,18 +1,6 @@ TODO LIST --------- -URD{cond}{P,M,Z} Fd, - unnormalized round -NRM{cond}{P,M,Z} Fd, - normalize - -According to the ARM manual, the URD instruction performs the IEEE round -to integer operation, but can sometimes leave its result in and abnormal, -unnormalized form. The NRM instruction is used to convert such a result -into a proper normalized floating point value. Implementation in the -emulator should probably use the same implementation for URD and RND. -The NRM code could check for an non-normalized floating point number and -normalize it if necessary. If the load, flt and round instructions always -leave their result in a normalized form, then NRM could be a NOP. - POW{cond}{P,M,Z} Fd, Fn, - power RPW{cond}{P,M,Z} Fd, Fn, - reverse power POL{cond}{P,M,Z} Fd, Fn, - polar angle (arctan2) diff -uNr ./nwfpe/double_cpdo.c ./projects/nwfpe/double_cpdo.c --- ./nwfpe/double_cpdo.c Wed Nov 11 16:17:58 1998 +++ ./projects/nwfpe/double_cpdo.c Mon Nov 23 08:59:35 1998 @@ -164,6 +164,7 @@ break; case RND_CODE: + case URD_CODE: fpa11.fpreg[Fd].fValue.fDouble = int32_to_float64(float64_to_int32(rFm)); break; @@ -208,8 +209,9 @@ fpa11.fpreg[Fd].fValue.fDouble = float64_arctan(rFm); break; - case URD_CODE: case NRM_CODE: + break; + default: { nRc = 0; diff -uNr ./nwfpe/extended_cpdo.c ./projects/nwfpe/extended_cpdo.c --- ./nwfpe/extended_cpdo.c Wed Nov 11 16:17:58 1998 +++ ./projects/nwfpe/extended_cpdo.c Mon Nov 23 08:44:34 1998 @@ -156,6 +156,7 @@ break; case RND_CODE: + case URD_CODE: fpa11.fpreg[Fd].fValue.fExtended = int32_to_floatx80(floatx80_to_int32(rFm)); break; @@ -200,8 +201,9 @@ fpa11.fpreg[Fd].fValue.fExtended = floatx80_arctan(rFm); break; - case URD_CODE: case NRM_CODE: + break; + default: { nRc = 0; diff -uNr ./nwfpe/fpa11.c ./projects/nwfpe/fpa11.c --- ./nwfpe/fpa11.c Fri Nov 13 14:47:17 1998 +++ ./projects/nwfpe/fpa11.c Wed Nov 18 16:40:30 1998 @@ -38,6 +38,13 @@ /* Reset the FPA11 chip. Called to initialize and reset the emulator. */ void resetFPA11(void) { + int i; + /* initialize the registers */ + for (i=0;i<=7;i++) + { + fpa11.fpreg[i].fType = typeNone; + } + /* FPSR: set system id to FP_EMULATOR, clear all other bits */ fpa11.fpsr = FP_EMULATOR; diff -uNr ./nwfpe/fpa11_cpdt.c ./projects/nwfpe/fpa11_cpdt.c --- ./nwfpe/fpa11_cpdt.c Wed Nov 11 16:17:35 1998 +++ ./projects/nwfpe/fpa11_cpdt.c Mon Nov 23 09:08:56 1998 @@ -120,7 +120,6 @@ break; case typeExtended: - fp_printk("storeDouble called floatx80_to_float64()\n"); val = floatx80_to_float64(fpa11.fpreg[Fn].fValue.fExtended); break; @@ -142,7 +141,7 @@ val = float32_to_floatx80(fpa11.fpreg[Fn].fValue.fSingle); break; - case typeExtended: + case typeDouble: val = float64_to_floatx80(fpa11.fpreg[Fn].fValue.fDouble); break; diff -uNr ./nwfpe/fpmodule.c ./projects/nwfpe/fpmodule.c --- ./nwfpe/fpmodule.c Fri Nov 13 15:02:19 1998 +++ ./projects/nwfpe/fpmodule.c Mon Nov 23 09:33:31 1998 @@ -74,7 +74,7 @@ void C_SYMBOL_NAME(fpe_version)(void) { static const char szTitle[] = "<4>NetWinder Floating Point Emulator "; - static const char szVersion[] = "V0.93 "; + static const char szVersion[] = "V0.94 "; static const char szCopyright[] = "(c) 1998 Corel Computer Corp.\n"; C_SYMBOL_NAME(fp_printk)(szTitle); C_SYMBOL_NAME(fp_printk)(szVersion); diff -uNr ./nwfpe/single_cpdo.c ./projects/nwfpe/single_cpdo.c --- ./nwfpe/single_cpdo.c Wed Nov 11 16:17:58 1998 +++ ./projects/nwfpe/single_cpdo.c Mon Nov 23 08:43:09 1998 @@ -144,6 +144,7 @@ break; case RND_CODE: + case URD_CODE: fpa11.fpreg[Fd].fValue.fSingle = int32_to_float32(float32_to_int32(rFm)); break; @@ -188,8 +189,9 @@ fpa11.fpreg[Fd].fValue.fSingle = float32_arctan(rFm); break; - case URD_CODE: case NRM_CODE: + break; + default: { nRc = 0;