~ubuntu-branches/ubuntu/intrepid/ecl/intrepid

« back to all changes in this revision

Viewing changes to src/gmp/mpn/alpha/sub_n.asm

  • Committer: Bazaar Package Importer
  • Author(s): Peter Van Eynde
  • Date: 2006-05-17 02:46:26 UTC
  • Revision ID: james.westby@ubuntu.com-20060517024626-lljr08ftv9g9vefl
Tags: upstream-0.9h-20060510
ImportĀ upstreamĀ versionĀ 0.9h-20060510

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
dnl  Alpha mpn_sub_n -- Subtract two limb vectors of the same length > 0 and
 
2
dnl  store difference in a third limb vector.
 
3
 
 
4
dnl  Copyright 1995, 2000 Free Software Foundation, Inc.
 
5
 
 
6
dnl  This file is part of the GNU MP Library.
 
7
 
 
8
dnl  The GNU MP Library is free software; you can redistribute it and/or modify
 
9
dnl  it under the terms of the GNU Lesser General Public License as published
 
10
dnl  by the Free Software Foundation; either version 2.1 of the License, or (at
 
11
dnl  your option) any later version.
 
12
 
 
13
dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 
14
dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
 
15
dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
 
16
dnl  License for more details.
 
17
 
 
18
dnl  You should have received a copy of the GNU Lesser General Public License
 
19
dnl  along with the GNU MP Library; see the file COPYING.LIB.  If not, write to
 
20
dnl  the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
 
21
dnl  MA 02111-1307, USA.
 
22
 
 
23
include(`../config.m4')
 
24
 
 
25
dnl  INPUT PARAMETERS
 
26
dnl  res_ptr    r16
 
27
dnl  s1_ptr     r17
 
28
dnl  s2_ptr     r18
 
29
dnl  size       r19
 
30
 
 
31
ASM_START()
 
32
PROLOGUE(mpn_sub_n)
 
33
        ldq     r3,0(r17)
 
34
        ldq     r4,0(r18)
 
35
 
 
36
        subq    r19,1,r19
 
37
        and     r19,4-1,r2      C number of limbs in first loop
 
38
        bis     r31,r31,r0
 
39
        beq     r2,$L0          C if multiple of 4 limbs, skip first loop
 
40
 
 
41
        subq    r19,r2,r19
 
42
 
 
43
$Loop0: subq    r2,1,r2
 
44
        ldq     r5,8(r17)
 
45
        addq    r4,r0,r4
 
46
        ldq     r6,8(r18)
 
47
        cmpult  r4,r0,r1
 
48
        subq    r3,r4,r4
 
49
        cmpult  r3,r4,r0
 
50
        stq     r4,0(r16)
 
51
        bis     r0,r1,r0
 
52
 
 
53
        addq    r17,8,r17
 
54
        addq    r18,8,r18
 
55
        bis     r5,r5,r3
 
56
        bis     r6,r6,r4
 
57
        addq    r16,8,r16
 
58
        bne     r2,$Loop0
 
59
 
 
60
$L0:    beq     r19,$Lend
 
61
 
 
62
        ALIGN(8)
 
63
$Loop:  subq    r19,4,r19
 
64
 
 
65
        ldq     r5,8(r17)
 
66
        addq    r4,r0,r4
 
67
        ldq     r6,8(r18)
 
68
        cmpult  r4,r0,r1
 
69
        subq    r3,r4,r4
 
70
        cmpult  r3,r4,r0
 
71
        stq     r4,0(r16)
 
72
        bis     r0,r1,r0
 
73
 
 
74
        ldq     r3,16(r17)
 
75
        addq    r6,r0,r6
 
76
        ldq     r4,16(r18)
 
77
        cmpult  r6,r0,r1
 
78
        subq    r5,r6,r6
 
79
        cmpult  r5,r6,r0
 
80
        stq     r6,8(r16)
 
81
        bis     r0,r1,r0
 
82
 
 
83
        ldq     r5,24(r17)
 
84
        addq    r4,r0,r4
 
85
        ldq     r6,24(r18)
 
86
        cmpult  r4,r0,r1
 
87
        subq    r3,r4,r4
 
88
        cmpult  r3,r4,r0
 
89
        stq     r4,16(r16)
 
90
        bis     r0,r1,r0
 
91
 
 
92
        ldq     r3,32(r17)
 
93
        addq    r6,r0,r6
 
94
        ldq     r4,32(r18)
 
95
        cmpult  r6,r0,r1
 
96
        subq    r5,r6,r6
 
97
        cmpult  r5,r6,r0
 
98
        stq     r6,24(r16)
 
99
        bis     r0,r1,r0
 
100
 
 
101
        addq    r17,32,r17
 
102
        addq    r18,32,r18
 
103
        addq    r16,32,r16
 
104
        bne     r19,$Loop
 
105
 
 
106
$Lend:  addq    r4,r0,r4
 
107
        cmpult  r4,r0,r1
 
108
        subq    r3,r4,r4
 
109
        cmpult  r3,r4,r0
 
110
        stq     r4,0(r16)
 
111
        bis     r0,r1,r0
 
112
        ret     r31,(r26),1
 
113
EPILOGUE(mpn_sub_n)
 
114
ASM_END()