Teach i80 ncg to use libfp. Enable ack -mcpm -fp
.
Old .o files stop working if they use floating point. One must recompile those files. Old files don't call libfp in the correct way, and may use symbols that I removed from libem. I don't keep old symbols in libem/flp.s, because a program that pulls both libfp and flp.s would get "multiply defined" errors in the linker. I teach mach/i80/ncg/table to use libfp by copying or adapting the patterns from mach/i86/ncg/table. I did not test all the patterns, but I did use `ack -mcpm -fp -O4` to compile examples/mandelbrot.c, then I ran it in the emulator YAZE-AG. It worked, but it was slow.
This commit is contained in:
parent
b9b3428e01
commit
93e01eb5d1
|
@ -1,7 +1,6 @@
|
|||
.define .adf4,.adf8,.sbf4,.sbf8,.mlf4,.mlf8,.dvf4,.dvf8
|
||||
.define .ngf4,.ngf8,.fif4,.fif8,.fef4,.fef8
|
||||
.define .zrf4,.zrf8
|
||||
.define .cfi,.cif,.cuf,.cff,.cfu
|
||||
.define .cfi,.cif4,.cif8,.cuf4,.cuf8,.cff4,.cff8,.cfu
|
||||
.define .cmf4,.cmf8
|
||||
.sect .text
|
||||
.sect .rom
|
||||
|
@ -25,12 +24,13 @@
|
|||
.fif8:
|
||||
.fef4:
|
||||
.fef8:
|
||||
.zrf4:
|
||||
.zrf8:
|
||||
.cfi:
|
||||
.cif:
|
||||
.cuf:
|
||||
.cff:
|
||||
.cif4:
|
||||
.cif8:
|
||||
.cuf4:
|
||||
.cuf8:
|
||||
.cff4:
|
||||
.cff8:
|
||||
.cfu:
|
||||
.cmf4:
|
||||
.cmf8:
|
||||
|
|
|
@ -41,21 +41,12 @@ con_mult(sz) word sz; {
|
|||
fprintf(codefile,".data4\t%ld\n",atol(str));
|
||||
}
|
||||
|
||||
void
|
||||
con_float() {
|
||||
static int warning_given;
|
||||
int i = argval;
|
||||
|
||||
if (!warning_given) {
|
||||
fprintf(stderr, "warning: dummy floating point constant\n");
|
||||
warning_given = 1;
|
||||
}
|
||||
while (i > 0) {
|
||||
fputs(".data4 0 !dummy float\n", codefile);
|
||||
i -= 4;
|
||||
}
|
||||
}
|
||||
|
||||
#define CODE_GENERATOR
|
||||
#define IEEEFLOAT
|
||||
#define FL_MSL_AT_LOW_ADDRESS 0
|
||||
#define FL_MSW_AT_LOW_ADDRESS 0
|
||||
#define FL_MSB_AT_LOW_ADDRESS 0
|
||||
#include <con_float>
|
||||
|
||||
void
|
||||
prolog(nlocals) full nlocals; {
|
||||
|
|
|
@ -817,61 +817,28 @@ gen mvi a,{const1,0}
|
|||
/* Group 5: Floating point arithmetic */
|
||||
/********************************************/
|
||||
|
||||
pat adf $1==4
|
||||
kills ALL
|
||||
gen Call {label,".adf4"}
|
||||
|
||||
pat adf $1==8
|
||||
kills ALL
|
||||
gen Call {label,".adf8"}
|
||||
|
||||
pat sbf $1==4
|
||||
kills ALL
|
||||
gen Call {label,".sbf4"}
|
||||
|
||||
pat sbf $1==8
|
||||
kills ALL
|
||||
gen Call {label,".sbf8"}
|
||||
|
||||
pat mlf $1==4
|
||||
kills ALL
|
||||
gen Call {label,".mlf4"}
|
||||
|
||||
pat mlf $1==8
|
||||
kills ALL
|
||||
gen Call {label,".mlf8"}
|
||||
|
||||
pat dvf $1==4
|
||||
kills ALL
|
||||
gen Call {label,".dvf4"}
|
||||
|
||||
pat dvf $1==8
|
||||
kills ALL
|
||||
gen Call {label,".dvf8"}
|
||||
|
||||
pat ngf $1==4
|
||||
kills ALL
|
||||
gen Call {label,".ngf4"}
|
||||
|
||||
pat ngf $1==8
|
||||
kills ALL
|
||||
gen Call {label,".ngf8"}
|
||||
pat adf $1==4 leaving cal ".adf4" asp 4
|
||||
pat adf $1==8 leaving cal ".adf8" asp 8
|
||||
pat sbf $1==4 leaving cal ".sbf4" asp 4
|
||||
pat sbf $1==8 leaving cal ".sbf8" asp 8
|
||||
pat mlf $1==4 leaving cal ".mlf4" asp 4
|
||||
pat mlf $1==8 leaving cal ".mlf8" asp 8
|
||||
pat dvf $1==4 leaving cal ".dvf4" asp 4
|
||||
pat dvf $1==8 leaving cal ".dvf8" asp 8
|
||||
pat ngf $1==4 leaving cal ".ngf4"
|
||||
pat ngf $1==8 leaving cal ".ngf8"
|
||||
|
||||
pat fif $1==4
|
||||
kills ALL
|
||||
gen Call {label,".fif4"}
|
||||
leaving lor 1 cal ".fif4" asp 2
|
||||
|
||||
pat fif $1==8
|
||||
kills ALL
|
||||
gen Call {label,".fif8"}
|
||||
leaving lor 1 cal ".fif8" asp 2
|
||||
|
||||
pat fef $1==4
|
||||
kills ALL
|
||||
gen Call {label,".fef4"}
|
||||
leaving lor 1 adp 0-2 cal ".fef4"
|
||||
|
||||
pat fef $1==8
|
||||
kills ALL
|
||||
gen Call {label,".fef8"}
|
||||
leaving lor 1 adp 0-2 cal ".fef8"
|
||||
|
||||
/********************************************/
|
||||
/* Group 6: Pointer arithmetic */
|
||||
|
@ -964,13 +931,9 @@ pat zre
|
|||
uses hlreg={const2,0}
|
||||
gen shld {label,$1}
|
||||
|
||||
pat zrf $1==4
|
||||
kills ALL
|
||||
gen Call {label,".zrf4"}
|
||||
pat zrf $1==4 leaving zer 4
|
||||
|
||||
pat zrf $1==8
|
||||
kills ALL
|
||||
gen Call {label,".zrf8"}
|
||||
pat zrf $1==8 leaving zer 8
|
||||
|
||||
pat zer $1==2 yields {const2,0}
|
||||
|
||||
|
@ -1086,25 +1049,51 @@ kills ALL
|
|||
gen mvi a,{const1,0}
|
||||
Call {label,".cii"}
|
||||
|
||||
pat cfi
|
||||
kills ALL
|
||||
gen Call {label,".cfi"}
|
||||
pat loc loc cfi $2==2
|
||||
leaving loc $1 loc $2 cal ".cfi" asp 4+$1 loe ".fra"
|
||||
|
||||
pat cif
|
||||
kills ALL
|
||||
gen Call {label,".cif"}
|
||||
pat loc loc cfi $2==4
|
||||
leaving loc $1 loc $2 cal ".cfi" asp 4+$1 lfr 4
|
||||
|
||||
pat cuf
|
||||
kills ALL
|
||||
gen Call {label,".cuf"}
|
||||
pat loc loc cif $2==4
|
||||
leaving loc $1 cal ".cif4" asp $1-2
|
||||
|
||||
pat cff
|
||||
kills ALL
|
||||
gen Call {label,".cff"}
|
||||
pat loc loc cif $1==2 && $2==8
|
||||
with hl_or_de
|
||||
gen push %1
|
||||
push %1
|
||||
push %1 leaving loc $1 cal ".cif8"
|
||||
|
||||
pat cfu
|
||||
kills ALL
|
||||
gen Call {label,".cfu"}
|
||||
pat loc loc cif $1==4 && $2==8
|
||||
with hl_or_de hl_or_de
|
||||
gen push %2
|
||||
push %2
|
||||
push %1 leaving loc $1 cal ".cif8"
|
||||
|
||||
pat loc loc cuf $2==4
|
||||
leaving loc $1 cal ".cuf4" asp $1-2
|
||||
|
||||
pat loc loc cuf $1==2 && $2==8
|
||||
with hl_or_de
|
||||
gen push %1
|
||||
push %1
|
||||
push %1 leaving loc $1 cal ".cuf8"
|
||||
|
||||
pat loc loc cuf $1==4 && $2==8
|
||||
with hl_or_de hl_or_de
|
||||
gen push %1
|
||||
push %2
|
||||
push %1 leaving loc $1 cal ".cuf8"
|
||||
|
||||
pat loc loc cff $1==8 && $2==4 leaving cal ".cff4" asp 4
|
||||
|
||||
pat loc loc cff $1==4 && $2==8 leaving dup 4 cal ".cff8"
|
||||
|
||||
pat loc loc cfu $2==2
|
||||
leaving loc $1 loc $2 cal ".cfu" asp 4+$1 loe ".fra"
|
||||
|
||||
pat loc loc cfu $2==4
|
||||
leaving loc $1 loc $2 cal ".cfu" asp 4+$1 lfr 4
|
||||
|
||||
/*****************************************/
|
||||
/* Group 9: Logical instructions */
|
||||
|
@ -1408,12 +1397,10 @@ gen mvi a,{const1,1}
|
|||
Call {label,".cmi4"} yields de
|
||||
|
||||
pat cmf $1==4
|
||||
kills ALL
|
||||
gen Call {label,".cmf4"}
|
||||
leaving cal ".cmf4" asp 8 lfr 2
|
||||
|
||||
pat cmf $1==8
|
||||
kills ALL
|
||||
gen Call {label,".cmf8"}
|
||||
leaving cal ".cmf8" asp 16 lfr 2
|
||||
|
||||
pat cmu $1==2
|
||||
with hl_or_de hl_or_de
|
||||
|
|
|
@ -58,7 +58,7 @@ name led
|
|||
program {EM}/lib/ack/em_led
|
||||
mapflag -l* LNAME={PLATFORMDIR}/lib*
|
||||
mapflag -i SEPID=-b1:0
|
||||
mapflag -fp FLOATS={EM}/{ILIB}fp
|
||||
mapflag -fp FLOATS={PLATFORMDIR}/libfp.a
|
||||
args {ALIGN} {SEPID?} \
|
||||
({RTS}:.b=-u _i_main) \
|
||||
(.e:{HEAD}={PLATFORMDIR}/boot.o) \
|
||||
|
|
Loading…
Reference in a new issue