1: /*
2: * Copyright (c) 1987 Regents of the University of California.
3: * All rights reserved. The Berkeley software License Agreement
4: * specifies the terms and conditions for redistribution.
5: */
6:
7: #ifdef LIBC_SCCS
8: <@(#)lmul.s 2.3 (Berkeley) 1/28/87\0>
9: .even
10: #endif LIBC_SCCS
11:
12: /*
13: * lmul(lhs, rhs)
14: * long lhs, rhs;
15: *
16: * 32-bit "*" routine for fixed point hardware. Also recommended for floating
17: * hardware, for compatility & speed. Credit to an unknown author who slipped
18: * it under the door. Calls to aldiv are generated automatically by the C
19: * compiler.
20: */
21: #include "DEFS.h"
22:
23: ASENTRY(lmul)
24: mov r2,-(sp) / faster than csv and just 1 more word
25: mov r3,-(sp)
26: mov 8.(sp),r2 / r2 = loint(lhs)
27: sxt r1 / r1 = sxt(loint(lhs)) - hiint(lhs)
28: sub 6(sp),r1
29: mov 12.(sp),r0 / r0 = loint(rhs)
30: sxt r3 / r3 = sxt(loint(rhs)) - hiint(rhs)
31: sub 10.(sp),r3
32: mul r0,r1 / MAGIC = loint(rhs) * hiint(lhs)'
33: mul r2,r3 / + loint(lhs) * hiint(rhs)'
34: add r1,r3
35: mul r2,r0 / prod (r0:r1) = loint(lhs)*loint(rhs)
36: sub r3,r0 / hiint(prod) -= MAGIC
37: mov (sp)+,r3
38: mov (sp)+,r2
39: rts pc
Defined functions
lmul
defined in line
23;
never used