floating point stuff added
This commit is contained in:
parent
022cb596be
commit
ca9a6feeb0
|
@ -23,6 +23,19 @@ static char rcsid[] = "$Header$";
|
|||
* machine dependent back end routines for the Motorola 68000
|
||||
*/
|
||||
|
||||
#define IEEEFLOAT
|
||||
|
||||
#ifdef IEEEFLOAT
|
||||
#include "FP.h"
|
||||
#include "trp.c"
|
||||
#include "fcompact.c"
|
||||
#include "dbl_extract.c"
|
||||
#ifdef PRT_EXP_DEBUG
|
||||
#include "prt_extend.c"
|
||||
#endif
|
||||
#endif IEEEFLOAT
|
||||
|
||||
|
||||
con_part(sz,w) register sz; word w; {
|
||||
|
||||
while (part_size % sz)
|
||||
|
@ -48,18 +61,53 @@ con_mult(sz) word sz; {
|
|||
fprintf(codefile,".long %s\n",str);
|
||||
}
|
||||
|
||||
con_float() {
|
||||
#ifdef IEEEFLOAT
|
||||
dbl_adjust(fl)
|
||||
my_dbl *fl;
|
||||
{
|
||||
EXTEND buf;
|
||||
|
||||
static int been_here;
|
||||
if (argval != 4 && argval != 8)
|
||||
fatal("bad fcon size");
|
||||
fprintf(codefile,".long\t");
|
||||
if (argval == 8)
|
||||
fprintf(codefile,"F_DUM,");
|
||||
fprintf(codefile,"F_DUM\n");
|
||||
if ( !been_here++)
|
||||
{
|
||||
fprintf(stderr,"Warning : dummy float-constant(s)\n");
|
||||
/* special routine to strip SGL_BIAS */
|
||||
dbl_extract(fl,&buf);
|
||||
/* standard routine to add DBL_BIAS */
|
||||
fcompact(&buf,fl,sizeof(double));
|
||||
}
|
||||
#endif IEEEFLOAT
|
||||
|
||||
con_float()
|
||||
{
|
||||
register word sz;
|
||||
register long *l;
|
||||
#ifdef IEEEFLOAT
|
||||
register my_dbl *md;
|
||||
#endif IEEEFLOAT
|
||||
double d;
|
||||
char mesg[128];
|
||||
|
||||
sz = argval;
|
||||
if (sz!= 4 && sz!= 8) {
|
||||
sprintf(mesg,"con_float(): bad fcon size %d %D\nstr: %s\n\0",
|
||||
sz,sz,str);
|
||||
fatal(mesg);
|
||||
}
|
||||
|
||||
d = atof(str);
|
||||
l = (long *) &d;
|
||||
|
||||
#ifdef IEEEFLOAT
|
||||
if (sz == 8) {
|
||||
/* ATOF() RETURNS THE PROPER FORMAT FOR A FLOAT */
|
||||
/* BUT NOT FOR A DOUBLE. CORRECT THE FORMAT. */
|
||||
md = (my_dbl *) &d;
|
||||
dbl_adjust(md);
|
||||
}
|
||||
#endif IEEEFLOAT
|
||||
|
||||
while ( sz ) {
|
||||
fprintf(codefile,"\t.word 0x%x,0x%x !float test %s\n",
|
||||
(int)(*l)&0xFFFF,(int)(*l>>16)&0xFFFF,str);
|
||||
sz -=4 ;
|
||||
l++;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1035,6 +1035,50 @@ adu | | | | adi $1 |
|
|||
sbu | | | | sbi $1 |
|
||||
slu | | | | sli $1 |
|
||||
|
||||
/* Floating point stuff */
|
||||
adf $1==4 | |
|
||||
remove(ALL)
|
||||
"jsr .adf4" | | asp 8 lfr 4 |
|
||||
adf $1==8 | |
|
||||
remove(ALL)
|
||||
"jsr .adf8" | | asp 16 lfr 4 loi 8 |
|
||||
sbf $1==4 | |
|
||||
remove(ALL)
|
||||
"jsr .sbf4" | | asp 8 lfr 4 |
|
||||
sbf $1==8 | |
|
||||
remove(ALL)
|
||||
"jsr .sbf8" | | asp 16 lfr 4 loi 8 |
|
||||
mlf $1==4 | |
|
||||
remove(ALL)
|
||||
"jsr .mlf4" | | asp 8 lfr 4 |
|
||||
mlf $1==8 | |
|
||||
remove(ALL)
|
||||
"jsr .mlf8" | | asp 16 lfr 4 loi 8 |
|
||||
dvf $1==4 | |
|
||||
remove(ALL)
|
||||
"jsr .dvf4" | | asp 8 lfr 4 |
|
||||
dvf $1==8 | |
|
||||
remove(ALL)
|
||||
"jsr .dvf8" | | asp 16 lfr 4 loi 8 |
|
||||
ngf $1==4 | |
|
||||
remove(ALL)
|
||||
"jsr .ngf4" | | asp 4 lfr 4 |
|
||||
ngf $1==8 | |
|
||||
remove(ALL)
|
||||
"jsr .ngf8" | | asp 16 lfr 4 loi 8 |
|
||||
fif $1==4 | |
|
||||
remove(ALL)
|
||||
"jsr .fif4" | | asp 16 lfr 4 loi 8 |
|
||||
fif $1==8 | |
|
||||
remove(ALL)
|
||||
"jsr .fif8" | | asp 16 lfr 4 loi 16 |
|
||||
fef $1==4 | |
|
||||
remove(ALL)
|
||||
"jsr .fef4" | | asp 4 lfr 4 loi 8 |
|
||||
fef $1==8 | |
|
||||
remove(ALL)
|
||||
"jsr .fef8" | | asp 8 lfr 4 loi 12 |
|
||||
|
||||
|
||||
|
||||
/* G R O U P VI : P O I N T E R A R I T H M E T I C */
|
||||
|
@ -1249,6 +1293,7 @@ zer $1 > 12 | | remove(ALL)
|
|||
"1:"
|
||||
"clr -(sp)"
|
||||
"dbf %[a],1b" | | |
|
||||
zrf | | | | zer $1 |
|
||||
|
||||
|
||||
|
||||
|
@ -1298,6 +1343,88 @@ loc loc ciu $1==4 && $2==2 | DATAREG4 | | %[1.1] | |
|
|||
loc loc cui $1==4 && $2==2 | DATAREG4 | | %[1.1] | |
|
||||
... | ANY | | | |
|
||||
|
||||
/* Floating point stuff */
|
||||
|
||||
loc loc cif $1==2 && $2==4 | |
|
||||
remove(ALL)
|
||||
"move.w #$1,-(sp)"
|
||||
"jsr .cif4" | | asp 4 lfr 4 |
|
||||
loc loc cif $1==2 && $2==8 | |
|
||||
remove(ALL)
|
||||
"move.w #$1,-(sp)"
|
||||
"jsr .cif8" | | asp 4 lfr 4 loi 8 |
|
||||
loc loc cif $1==4 && $2==4 | |
|
||||
remove(ALL)
|
||||
"move.w #$1,-(sp)"
|
||||
"jsr .cif4" | | asp 6 lfr 4 |
|
||||
loc loc cif $1==4 && $2==8 | |
|
||||
remove(ALL)
|
||||
"move.w #$1,-(sp)"
|
||||
"jsr .cif8" | | asp 6 lfr 4 loi 8 |
|
||||
loc loc cuf $1==2 && $2==4 | |
|
||||
remove(ALL)
|
||||
"move.w #$1,-(sp)"
|
||||
"jsr .cuf4" | | asp 4 lfr 4 |
|
||||
loc loc cuf $1==2 && $2==8 | |
|
||||
remove(ALL)
|
||||
"move.w #$1,-(sp)"
|
||||
"jsr .cuf8" | | asp 4 lfr 4 loi 8 |
|
||||
loc loc cuf $1==4 && $2==4 | |
|
||||
remove(ALL)
|
||||
"move.w #$1,-(sp)"
|
||||
"jsr .cuf4" | | asp 6 lfr 4 |
|
||||
loc loc cuf $1==4 && $2==8 | |
|
||||
remove(ALL)
|
||||
"move.w #$1,-(sp)"
|
||||
"jsr .cuf8" | | asp 6 lfr 4 loi 8 |
|
||||
loc loc cfi $1==4 && $2==2 | |
|
||||
remove(ALL)
|
||||
"move.w #$1,-(sp)"
|
||||
"move.w #$2,-(sp)"
|
||||
"jsr .cfi" | | asp 8 lfr 2 |
|
||||
loc loc cfi $1==4 && $2==4 | |
|
||||
remove(ALL)
|
||||
"move.w #$1,-(sp)"
|
||||
"move.w #$2,-(sp)"
|
||||
"jsr .cfi" | | asp 8 lfr 4 |
|
||||
loc loc cfi $1==8 && $2==2 | |
|
||||
remove(ALL)
|
||||
"move.w #$1,-(sp)"
|
||||
"move.w #$2,-(sp)"
|
||||
"jsr .cfi" | | asp 12 lfr 2 |
|
||||
loc loc cfi $1==8 && $2==4 | |
|
||||
remove(ALL)
|
||||
"move.w #$1,-(sp)"
|
||||
"move.w #$2,-(sp)"
|
||||
"jsr .cfi" | | asp 12 lfr 4 |
|
||||
loc loc cfu $1==4 && $2==2 | |
|
||||
remove(ALL)
|
||||
"move.w #$1,-(sp)"
|
||||
"move.w #$2,-(sp)"
|
||||
"jsr .cfu" | | asp 8 lfr 2 |
|
||||
loc loc cfu $1==4 && $2==4 | |
|
||||
remove(ALL)
|
||||
"move.w #$1,-(sp)"
|
||||
"move.w #$2,-(sp)"
|
||||
"jsr .cfu" | | asp 8 lfr 4 |
|
||||
loc loc cfu $1==8 && $2==2 | |
|
||||
remove(ALL)
|
||||
"move.w #$1,-(sp)"
|
||||
"move.w #$2,-(sp)"
|
||||
"jsr .cfu" | | asp 12 lfr 2 |
|
||||
loc loc cfu $1==8 && $2==4 | |
|
||||
remove(ALL)
|
||||
"move.w #$1,-(sp)"
|
||||
"move.w #$2,-(sp)"
|
||||
"jsr .cfu" | | asp 12 lfr 4 |
|
||||
loc loc cff $1==8 && $2==4 | |
|
||||
remove(ALL)
|
||||
"jsr .cff4" | | asp 8 lfr 4 |
|
||||
loc loc cff $1==4 && $2==8 | |
|
||||
remove(ALL)
|
||||
"jsr .cff8" | | asp 4 lfr 4 loi 8 |
|
||||
|
||||
|
||||
/* G R O U P IX : L O G I C A L */
|
||||
|
||||
and defined($1) && $1 == 2 | ANY DATASCR |
|
||||
|
@ -1727,6 +1854,15 @@ cms !defined($1) | ANY | remove(ALL)
|
|||
cmp | | remove(ALL)
|
||||
"jsr .cmp"
|
||||
| D1 | |
|
||||
/* floating point */
|
||||
|
||||
cmf $1==4 | |
|
||||
remove(ALL)
|
||||
"jsr .cmf4" | | asp 8 lfr 2 |
|
||||
cmf $1==8 | |
|
||||
remove(ALL)
|
||||
"jsr .cmf8" | | asp 16 lfr 2 |
|
||||
|
||||
|
||||
cmi tlt and $1==2 && $3==2 | ANY DATAREG DATASCR |
|
||||
"cmp %[1],%[2]"
|
||||
|
@ -2652,27 +2788,6 @@ str $1 == 2 | | remove(ALL)
|
|||
trp | STACK | "jsr .trp" | | |
|
||||
|
||||
|
||||
/* For several floating point instructions we generate an illegal
|
||||
* instruction trap.
|
||||
*/
|
||||
|
||||
adf | | | | loc 18 trp |
|
||||
sbf | | | | loc 18 trp |
|
||||
mlf | | | | loc 18 trp |
|
||||
dvf | | | | loc 18 trp |
|
||||
ngf | | | | loc 18 trp |
|
||||
fef | | | | loc 18 trp |
|
||||
fif | | | | loc 18 trp |
|
||||
zrf | | | | loc 18 trp |
|
||||
cfi | | | | loc 18 trp |
|
||||
cif | | | | loc 18 trp |
|
||||
cuf | | | | loc 18 trp |
|
||||
cff | | | | loc 18 trp |
|
||||
cfu | | | | loc 18 trp |
|
||||
cmf | | | | loc 18 trp |
|
||||
|
||||
|
||||
|
||||
/* C O E R C I O N S */
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue