From a9a2e027c8982d3f6847b738961d21458f3eb189 Mon Sep 17 00:00:00 2001 From: ceriel Date: Thu, 11 Aug 1988 14:57:39 +0000 Subject: [PATCH] improved floating point handling --- mach/mantra/int/Makefile | 13 ++++++++----- mach/mantra/int/con_float.c | 25 ------------------------- mach/mantra/int/mloop0 | 9 +++++++++ 3 files changed, 17 insertions(+), 30 deletions(-) diff --git a/mach/mantra/int/Makefile b/mach/mantra/int/Makefile index 731342d1b..146810604 100644 --- a/mach/mantra/int/Makefile +++ b/mach/mantra/int/Makefile @@ -44,14 +44,17 @@ em4_t-c-:tmp.s compile con_float.o em4_t--p: tmp.s compile con_float.o ./compile -o em4_t--p -P $(FLTRAP) -Dlword -Dopfreq=0 -Dlast=1 -Dcount=0 -Dtest=1 -Dflow=0 -Dprof=1 tmp.s con_float.o -con_float.o: con_float.c compile - ./compile -c -L -O con_float.c +con_float.o: con_float.c + case `ack_sys` in m68k2|pmds) \ + acc -mm68k4 -c -L -O con_float.c;; \ + *) acc -c -L -O con_float.c;; \ + esac compile: Makefile - case `ack_sys` in sun*) MACH=sun2;; pmds*) MACH=pmds4;; \ + case `ack_sys` in sun*) MACH=`ack_sys`; AS=-Ras=../../../lib/m68k2/as;; pmds*) MACH=pmds4;; \ m68_sysV_0) MACH=mantra;; \ - m68k2) MACH=m68k2;; *) MACH=m68k4;; \ - esac ; echo $$MACH -r.c -.m -fp '$$*' > compile; chmod +x compile + *) MACH=m68k4;; \ + esac ; echo $$MACH $$AS -r.c -.m -fp '$$*' > compile; chmod +x compile install: all -mkdir $b24 $b44 ls em2_???? | sed 's:em2_\(.*\):cp & $b24/em_\1:' | sh diff --git a/mach/mantra/int/con_float.c b/mach/mantra/int/con_float.c index 328f8cae1..f829ad0d6 100644 --- a/mach/mantra/int/con_float.c +++ b/mach/mantra/int/con_float.c @@ -20,32 +20,7 @@ con_float(argval, str, res) while (argval--) *res++ = *p++; return; } - f = frexp(f, &i); fl = f; - fl = frexp(fl,&j); - if (i+j > 127) { - /* overflow situation. Unfortunately we don't have the - slightest idea where the floating point constant came - from, so, for the time being, just ignore - */ - *res++ = f < 0 ? 0377 : 0177; - *res++ = 0377; - *res++ = 0377; - *res = 0377; - return; - } - if (i+j < -127) { - /* underflow situation. Unfortunately we don't have the - slightest idea where the floating point constant came - from, so, for the time being, just ignore - */ - *res++ = f < 0 ? 0200 : 0; - *res++ = 0200; - *res++ = 0; - *res = 0; - return; - } - fl = ldexp(fl, i+j); p = (char *) &fl; while (argval--) *res++ = *p++; } diff --git a/mach/mantra/int/mloop0 b/mach/mantra/int/mloop0 index b3bebc7f3..89e9e6a24 100644 --- a/mach/mantra/int/mloop0 +++ b/mach/mantra/int/mloop0 @@ -177,6 +177,9 @@ dat6: add.l d2,a3 ; move.l d2,d3 bne 6b ; add.l d3,a3 bra datloop +.sect .data +flt_label: .data4 0 +.sect .text dofloat: move.l d2,d0 checkfsize @@ -186,9 +189,11 @@ dofloat: move.l a3,-(sp) add.l d0,a3 move.l a4,-(sp) + move.l a4,flt_label move.l d0,-(sp) bsr _con_float lea 12(sp),sp + clr.l flt_label movem.l (sp)+,a0/a1/d0-d2 1: tst.b (a4)+ ; bne 1b @@ -200,6 +205,10 @@ _con_float: rts #else __fptrp: + tst.l flt_label + beq 1f + rts +1: move.l 4(sp),d0 mov d0,-(sp) bra error -- 2.34.1