remove empty dir
[ghc-hetmet.git] / ghc / rts / gmp / mpn / arm / addmul_1.S
1 @ ARM mpn_mul_1 -- Multiply a limb vector with a limb and add the result to a
2 @ second limb vector.
3 @ Contributed by Robert Harley.
4
5 @ Copyright (C) 1998, 2000 Free Software Foundation, Inc.
6
7 @ This file is part of the GNU MP Library.
8
9 @ The GNU MP Library is free software; you can redistribute it and/or modify
10 @ it under the terms of the GNU Lesser General Public License as published by
11 @ the Free Software Foundation; either version 2.1 of the License, or (at your
12 @ option) any later version.
13
14 @ The GNU MP Library is distributed in the hope that it will be useful, but
15 @ WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
16 @ or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
17 @ License for more details.
18
19 @ You should have received a copy of the GNU Lesser General Public License
20 @ along with the GNU MP Library; see the file COPYING.LIB.  If not, write to
21 @ the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
22 @ MA 02111-1307, USA.
23
24 #define p r0
25 #define a r1
26 #define n r2
27 #define w r3
28
29 #define z r11
30
31 #define ip r12
32 #define sp r13
33 #define lr r14
34 #define pc r15
35
36 .text
37         .align  0
38         .global __gmpn_addmul_1
39         .type   __gmpn_addmul_1,%function
40 __gmpn_addmul_1:
41         stmfd   sp!, { r8-r11, lr }
42         mov     z, #0
43         mov     ip, #0
44         movs    n, n, lsr #1
45         bcc     skip1
46         ldr     lr, [a], #4
47         ldr     r9, [p]
48         umlal   r9, ip, w, lr
49         str     r9, [p], #4
50 skip1:
51         movs    n, n, lsr #1
52         bcc     skip2
53         ldmia   p, { r9, r10 }
54         adds    r8, ip, r9
55         adc     r9, z, #0
56         ldmia   a!, { ip, lr }
57         umlal   r8, r9, w, ip
58         adds    r9, r9, r10
59         adc     ip, z, #0
60         umlal   r9, ip, w, lr
61         stmia   p!, { r8, r9 }
62 skip2:
63         teq     n, #0
64         beq     return
65         stmfd   sp!, { r4-r7 }
66 addmul_loop:
67         ldmia   p, { r5, r6, r7, r8 }
68         adds    r4, ip, r5
69         adc     r5, z, #0
70         ldmia   a!, { r9, r10, ip, lr }
71         umlal   r4, r5, w, r9
72         adds    r5, r5, r6
73         adc     r6, z, #0
74         umlal   r5, r6, w, r10
75         adds    r6, r6, r7
76         adc     r7, z, #0
77         umlal   r6, r7, w, ip
78         adds    r7, r7, r8
79         adc     ip, z, #0
80         umlal   r7, ip, w, lr
81         subs    n, n, #1
82         stmia   p!, { r4, r5, r6, r7 }
83         bne     addmul_loop
84         ldmfd   sp!, { r4-r7 }
85 return:
86         mov     r0, ip
87         ldmfd   sp!, { r8-r11, pc }
88 end:
89         .size   __gmpn_addmul_1, end - __gmpn_addmul_1