initial import
[glibc.git] / sysdeps / m88k / m88110 / mul_1.S
blob7a076238651b6aff4e5f1f78cc04e7b2f1bc2571
1 ; mc88110 __mpn_mul_1 -- Multiply a limb vector with a single limb and
2 ; store the product in a second limb vector.
4 ; Copyright (C) 1992, 1994 Free Software Foundation, Inc.
6 ; This file is part of the GNU MP Library.
8 ; The GNU MP Library is free software; you can redistribute it and/or modify
9 ; it under the terms of the GNU General Public License as published by
10 ; the Free Software Foundation; either version 2, or (at your option)
11 ; any later version.
13 ; The GNU MP Library is distributed in the hope that it will be useful,
14 ; but WITHOUT ANY WARRANTY; without even the implied warranty of
15 ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 ; GNU General Public License for more details.
18 ; You should have received a copy of the GNU General Public License
19 ; along with the GNU MP Library; see the file COPYING.  If not, write to
20 ; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
23 ; INPUT PARAMETERS
24 ; res_ptr       r2
25 ; s1_ptr        r3
26 ; size          r4
27 ; s2_limb       r5
29 #include "sysdep.h"
31 ENTRY (__mpn_mul_1)
32         ld       r6,r3,0
33         sub      r4,r0,r4
34         sub      r3,r3,r4               ; r3 is offset s1_ptr
35         sub      r2,r2,r4
36         sub      r8,r2,8                ; r8 is offset res_ptr
37         mulu.d   r10,r6,r5
39         addu     r4,r4,1
40         bcnd     eq0,r4,Lend
41          addu.co r2,r0,0                ; clear cy_limb
43 Loop:   ld       r6,r3[r4]
44         addu.cio r9,r11,r2
45         or       r2,r10,r0              ; could be avoided if unrolled
46         addu     r4,r4,1
47         mulu.d   r10,r6,r5
48         bcnd     ne0,r4,Loop
49          st      r9,r8[r4]
51 Lend:   addu.cio r9,r11,r2
52         st       r9,r8,4
53         jmp.n    r1
54          addu.ci r2,r10,r0
56 ; This is the Right Way to do this on '110.  4 cycles / 64-bit limb.
57 ;       ld.d    r10,
58 ;       mulu.d
59 ;       addu.cio
60 ;       addu.cio
61 ;       st.d
62 ;       mulu.d  ,r11,r5
63 ;       ld.d    r12,
64 ;       mulu.d  ,r10,r5
65 ;       addu.cio
66 ;       addu.cio
67 ;       st.d
68 ;       mulu.d
69 ;       ld.d    r10,
70 ;       mulu.d
71 ;       addu.cio
72 ;       addu.cio
73 ;       st.d
74 ;       mulu.d
75 ;       ld.d    r10,
76 ;       mulu.d
77 ;       addu.cio
78 ;       addu.cio
79 ;       st.d
80 ;       mulu.d