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

« back to all changes in this revision

Viewing changes to src/gmp/mpn/a29k/lshift.s

  • 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
; 29000 __gmpn_lshift --
 
2
 
 
3
; Copyright 1992, 1994, 2000 Free Software Foundation, Inc.
 
4
 
 
5
; This file is part of the GNU MP Library.
 
6
 
 
7
; The GNU MP Library is free software; you can redistribute it and/or modify
 
8
; it under the terms of the GNU Lesser General Public License as published by
 
9
; the Free Software Foundation; either version 2.1 of the License, or (at your
 
10
; option) any later version.
 
11
 
 
12
; The GNU MP Library is distributed in the hope that it will be useful, but
 
13
; WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
 
14
; or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
 
15
; License for more details.
 
16
 
 
17
; You should have received a copy of the GNU Lesser General Public License
 
18
; along with the GNU MP Library; see the file COPYING.LIB.  If not, write to
 
19
; the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
 
20
; MA 02111-1307, USA.
 
21
 
 
22
 
 
23
; INPUT PARAMETERS
 
24
; res_ptr       lr2
 
25
; s1_ptr        lr3
 
26
; s2_ptr        lr4
 
27
; size          lr5
 
28
 
 
29
; We use the loadm/storem instructions and operate on chunks of 8
 
30
; limbs/per iteration, until less than 8 limbs remain.
 
31
 
 
32
        .sect .lit,lit
 
33
        .text
 
34
        .align  4
 
35
        .global ___gmpn_lshift
 
36
        .word   0x60000
 
37
___gmpn_lshift:
 
38
        sll     gr116,lr4,2
 
39
        add     lr3,gr116,lr3
 
40
        add     lr2,gr116,lr2
 
41
        sub     lr3,lr3,4
 
42
        load    0,0,gr119,lr3
 
43
 
 
44
        subr    gr116,lr5,32
 
45
        srl     gr96,gr119,gr116        ; return value
 
46
        sub     lr4,lr4,1               ; actual loop count is SIZE - 1
 
47
 
 
48
        srl     gr117,lr4,3             ; chuck count = (actual count) / 8
 
49
        cpeq    gr118,gr117,0
 
50
        jmpt    gr118,Ltail
 
51
         mtsr   fc,lr5
 
52
 
 
53
        sub     gr117,gr117,2           ; count for jmpfdec
 
54
 
 
55
; Main loop working 8 limbs/iteration.
 
56
Loop:   sub     lr3,lr3,32
 
57
        mtsrim  cr,(8-1)
 
58
        loadm   0,0,gr100,lr3
 
59
 
 
60
        extract gr109,gr119,gr107
 
61
        extract gr108,gr107,gr106
 
62
        extract gr107,gr106,gr105
 
63
        extract gr106,gr105,gr104
 
64
        extract gr105,gr104,gr103
 
65
        extract gr104,gr103,gr102
 
66
        extract gr103,gr102,gr101
 
67
        extract gr102,gr101,gr100
 
68
 
 
69
        sub     lr2,lr2,32
 
70
        mtsrim  cr,(8-1)
 
71
        storem  0,0,gr102,lr2
 
72
        jmpfdec gr117,Loop
 
73
         or     gr119,gr100,0
 
74
 
 
75
; Code for the last up-to-7 limbs.
 
76
 
 
77
        and     lr4,lr4,(8-1)
 
78
Ltail:  cpeq    gr118,lr4,0
 
79
        jmpt    gr118,Lend
 
80
         sub    lr4,lr4,2               ; count for jmpfdec
 
81
 
 
82
Loop2:  sub     lr3,lr3,4
 
83
        load    0,0,gr116,lr3
 
84
        extract gr117,gr119,gr116
 
85
        sub     lr2,lr2,4
 
86
        store   0,0,gr117,lr2
 
87
        jmpfdec lr4,Loop2
 
88
         or     gr119,gr116,0
 
89
 
 
90
Lend:   extract gr117,gr119,0
 
91
        sub     lr2,lr2,4
 
92
        jmpi    lr0
 
93
         store  0,0,gr117,lr2