Made floating point stuff depend on a #define: FPPSIM

This commit is contained in:
ceriel 1987-02-02 10:16:40 +00:00
parent ae3c81e0a6
commit e41a2618f8

View file

@ -23,7 +23,7 @@ static char rcsid[] = "$Header$";
* machine dependent back end routines for the Motorola 68000 * machine dependent back end routines for the Motorola 68000
*/ */
/* #define IEEEFLOAT */ #include "fppsim.h"
#ifdef IEEEFLOAT #ifdef IEEEFLOAT
#include "FP.h" #include "FP.h"
@ -78,19 +78,24 @@ con_float()
{ {
register word sz; register word sz;
register long *l; register long *l;
#ifdef FPPSIM
#ifdef IEEEFLOAT #ifdef IEEEFLOAT
register my_dbl *md; register my_dbl *md;
#endif IEEEFLOAT #endif IEEEFLOAT
double d; double d, atof();
char mesg[128]; #else not FPPSIM
static int been_here;
#endif
sz = argval; sz = argval;
if (sz!= 4 && sz!= 8) { if (sz!= 4 && sz!= 8) {
char mesg[128];
sprintf(mesg,"con_float(): bad fcon size %d %ld\nstr: %s\n\0", sprintf(mesg,"con_float(): bad fcon size %d %ld\nstr: %s\n\0",
sz,sz,str); sz,sz,str);
fatal(mesg); fatal(mesg);
} }
#ifdef FPPSIM
d = atof(str); d = atof(str);
l = (long *) &d; l = (long *) &d;
@ -109,6 +114,16 @@ con_float()
sz -=4 ; sz -=4 ;
l++; l++;
} }
#else not FPPSIM
if (! been_here) {
been_here = 1;
fprintf(stderr,"warning: dummy floating constant(s)\n");
}
while (sz) {
fprintf(codefile,"\t.data4 0 !dummy float\n");
sz -= 4;
}
#endif
} }
#ifdef REGVARS #ifdef REGVARS