[comp.os.minix] 68K: New division subroutines for ack c compiler

I5110401%DBSTU1.BITNET@cunyvm.cuny.edu (Hello world ||) (07/12/90)

Hello all,
This is a small change to the minix-ST ACK runtime library to replace
the (quite slow) division subroutines. The new _dv[iu].s routines handle
some different cases to speed up division noticably. Inspection of my
private source pile shows that most long by long divisions are done with
small (well, 0 <= x <= 65535 8-) divisors, and just that case can be handled
quite fast by using max. 2 68000 divu instructions, needing around 400 cpu-
cycles (compare that to well over 1000 cycles for the original routine !).

Have fun,
--- Kai-Uwe Bloem, i5110401@dbstu1.bitnet ---
=== snip === snip === snip === snip === snip === snip === snip === snip ===
table
 !"#$%&'()*+,-./0123456789:;<=>?
@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_
begin 644 _dv.tar.Z
M'YV-7\C82>-B#H"#"!,J7,BPH<.'$"-*1 BCH@T:-$  J,CQAD:.%65\!%FQz
MAHT8-4# H&$#QL48,V; \ @C!@P9&#].W,FSI\^? .K,H1-&#L(Y>0P";2@Fy
MC9NE4*-*G4JUJE6>+LB4,>.T#(BL Q44+#.&SE<Z9?#0$3N'K%D7<MZT8>OVx
M*YDP1.F6_2IFSAP%"D"$ #$GS1DW9<B 8//&S1D09-(,U!HX1(O+F#-KWLRYw
ML^?/H$%7!B&GS!TY:>B@=0-"3!X02\*D:5'ECE<AC,NT 8$B38T8-FG4!$*Fv
M+YTZ,5PTI8.83@H09M[((0RG3&(7HT& &!%#>\T7,62\R %#N]/4:<*P(5UFu
M8.'&+D T<2J=/9DZ8[R^,4,831HS9KU1G1QXI='8'-@)IMUV(JDTPPLSC5<>t
M"$)Y90,.'$$F61T@.#64'/C182!K=Z!11FGMG0@"'&_XE888;)01'Q7^S0'"s
M&&B$X5@9E260P()MA+%&&39R1U@= YK!F%#QH: 5:G8D!EU<N[7QVA%.5*&Ar
M>R.2]D8=(B*60F6AE6GFF6AR-MH4<GDUAEQM-'9C&&W9.(:.K7F5HQMDQ*B8q
M4R"$01U9Z;'! @AMX(<&='2B-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IP)09RQ4M8N$=:s
M.#5XQ75[569^M2B!94V#%4^%)5.'%66*Q5A5]@:/]299I@!;UF6DE5GHIS=Wr
MYUEGEF8+&5MNYA1P%E1R)H:X"%QV)A<\F&>IL2C*)09IJ%L0Y3>_%5O"15S&q
MY3?(91;*Q5QKEEG2Q7Z!(T2IM5X(M%W=Q8YA<(SB15YX8%Z=@XSJE5V6]UXFp
M$E_SM5949%]R@%\6N#\8I(&,18)#(1TMIF0QA@(S!AA%EF,[UF,_%F3&2&0Wo
M)I9(5CY*QF1.)@>>I#-<U0:N5I=V>9=XF9=ZN9=\V9=^^9> &9B".9B$69B&n
$>9B@!CY*m
 l
end
=========================================================================
              " This space intentionally left blank "

Kai-Uwe Bloem, I5110401@DBSTU1.BitNet, ...!unido!dbstu1.bitnet!i5110401,
I5110401%DBSTU1.BITNET@CORNELLC.CCS.CORNELL.EDU (or other known gateways)
   student of cs at Technische Universitaet Braunschweig / w-germany

HBO043%DJUKFA11.BITNET@cunyvm.cuny.edu (Christoph van Wuellen) (07/13/90)

If you would have had a look at the support functions for the c68
compiler, you would have found just this.....

Christoph van Wuellen, Bochum/Germany.

I5110401%DBSTU1.BITNET@cunyvm.cuny.edu (Hello world ||) (07/17/90)

Christoph van Wuellen <HBO043%DJUKFA11.BITNET@CUNYVM.CUNY.EDU> writes:
>If you would have had a look at the support functions for the c68
>compiler, you would have found just this.....

Sorry. I don't use that compiler. I have enough memory for using gcc. BTW,
you should reorganize the runtime support library. As far as i can remember
you've used the sozobon c floating point routines, which are not very good.
Perhaps you should use another base here, like the old gcc routines (they are
mainly written in c) or the 68K floating point support pack for ack c.

Regards,
--- Kai-Uwe Bloem, I5110401@dbstu1.bitnet ---

HBO043%DJUKFA11.BITNET@cunyvm.cuny.edu (Christoph van Wuellen) (07/17/90)

Well, I took the sozobon floating point routines for two reasons:

before I had MINIX running, I had CP/M-68K, and the C compiler there uses
the same floating point format.
When I wrote that floating point stuff, the CP/M-68K mathlib was the only
floating point library I had.

I am hesitating including support for an 64-bit floating point format
as long I do not have a FPU. Since the code generator is strongly
register-oriented, the allocation of two 68000 registers for a floating
point number looks strange to me. If I can allocate a FPU register
instead, everything looks fine.

(Third, I use FORTRAN for my heavy floating point calculation. The existing
compilers are much better and I do not want to port some 100,000 lines of
code to C and learn that the vectorizer is not good for C.
I included the whole floating point stuff with TeX in mind. For this purpose,
the 32-bit format is ideal)

C.v.W.