~ubuntu-branches/ubuntu/vivid/gcl/vivid

« back to all changes in this revision

Viewing changes to gmp/mpn/arm/mul_1.S

  • Committer: Bazaar Package Importer
  • Author(s): Camm Maguire
  • Date: 2002-03-04 14:29:59 UTC
  • Revision ID: james.westby@ubuntu.com-20020304142959-dey14w08kr7lldu3
Tags: upstream-2.5.0.cvs20020219
ImportĀ upstreamĀ versionĀ 2.5.0.cvs20020219

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
@ ARM mpn_addmul_1 -- Multiply a limb vector with a limb and store the result
 
2
@ in a 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 sl r10
 
30
#define fp r11
 
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_mul_1
 
39
        .type   __gmpn_mul_1,%function
 
40
__gmpn_mul_1:
 
41
        stmfd   sp!, { r8, r9, lr }
 
42
        ands    ip, n, #1
 
43
        beq     skip1
 
44
        ldr     lr, [a], #4
 
45
        umull   r9, ip, w, lr
 
46
        str     r9, [p], #4
 
47
skip1:
 
48
        tst     n, #2
 
49
        beq     skip2
 
50
        mov     r8, ip
 
51
        ldmia   a!, { ip, lr }
 
52
        mov     r9, #0
 
53
        umlal   r8, r9, w, ip
 
54
        mov     ip, #0
 
55
        umlal   r9, ip, w, lr
 
56
        stmia   p!, { r8, r9 }
 
57
skip2:
 
58
        bics    n, n, #3
 
59
        beq     return
 
60
        stmfd   sp!, { r6, r7 }
 
61
mul_1_loop:
 
62
        mov     r6, ip
 
63
        ldmia   a!, { r8, r9, ip, lr }
 
64
        ldr     r7, [p] /* Bring stuff into cache. */
 
65
        mov     r7, #0
 
66
        umlal   r6, r7, w, r8
 
67
        mov     r8, #0
 
68
        umlal   r7, r8, w, r9
 
69
        mov     r9, #0
 
70
        umlal   r8, r9, w, ip
 
71
        mov     ip, #0
 
72
        umlal   r9, ip, w, lr
 
73
        subs    n, n, #4
 
74
        stmia   p!, { r6, r7, r8, r9 }
 
75
        bne     mul_1_loop
 
76
        ldmfd   sp!, { r6, r7 }
 
77
return:
 
78
        mov     r0, ip
 
79
        ldmfd   sp!, { r8, r9, pc }
 
80
end:
 
81
        .size   __gmpn_mul_1, end - __gmpn_mul_1