~ubuntu-branches/ubuntu/quantal/gclcvs/quantal

« back to all changes in this revision

Viewing changes to gmp3/mpn/alpha/sqr_diagonal.asm

  • Committer: Bazaar Package Importer
  • Author(s): Camm Maguire
  • Date: 2004-06-24 15:13:46 UTC
  • Revision ID: james.westby@ubuntu.com-20040624151346-xh0xaaktyyp7aorc
Tags: 2.7.0-26
C_GC_OFFSET is 2 on m68k-linux

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
dnl  Alpha mpn_sqr_diagonal.
 
2
 
 
3
dnl  Copyright 2001 Free Software Foundation, Inc.
 
4
 
 
5
dnl  This file is part of the GNU MP Library.
 
6
 
 
7
dnl  The GNU MP Library is free software; you can redistribute it and/or modify
 
8
dnl  it under the terms of the GNU Lesser General Public License as published
 
9
dnl  by the Free Software Foundation; either version 2.1 of the License, or (at
 
10
dnl  your option) any later version.
 
11
 
 
12
dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 
13
dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
 
14
dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
 
15
dnl  License for more details.
 
16
 
 
17
dnl  You should have received a copy of the GNU Lesser General Public License
 
18
dnl  along with the GNU MP Library; see the file COPYING.LIB.  If not, write to
 
19
dnl  the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
 
20
dnl  MA 02111-1307, USA.
 
21
 
 
22
include(`../config.m4')
 
23
 
 
24
dnl  INPUT PARAMETERS
 
25
dnl  res_ptr    r16
 
26
dnl  s1_ptr     r17
 
27
dnl  size       r18
 
28
 
 
29
dnl  This code runs at 42 cycles/limb on EV4, 18 cycles/limb on EV5, and 4
 
30
dnl  cycles/limb on EV6.
 
31
 
 
32
ASM_START()
 
33
PROLOGUE(mpn_sqr_diagonal)
 
34
        ldq     r2,0(r17)       C r2 = s1_limb
 
35
        lda     r18,-2(r18)     C size -= 2
 
36
        mulq    r2,r2,r3        C r3 = prod_low
 
37
        umulh   r2,r2,r4        C r4 = prod_high
 
38
        blt     r18,$Lend1      C jump if size was == 1
 
39
        ldq     r2,8(r17)       C r2 = s1_limb
 
40
        beq     r18,$Lend2      C jump if size was == 2
 
41
 
 
42
        ALIGN(8)
 
43
$Loop:  stq     r3,0(r16)
 
44
        mulq    r2,r2,r3        C r3 = prod_low
 
45
        lda     r18,-1(r18)     C size--
 
46
        stq     r4,8(r16)
 
47
        umulh   r2,r2,r4        C r4 = cy_limb
 
48
        ldq     r2,16(r17)      C r2 = s1_limb
 
49
        lda     r17,8(r17)      C s1_ptr++
 
50
        lda     r16,16(r16)     C res_ptr++
 
51
        bne     r18,$Loop
 
52
 
 
53
$Lend2: stq     r3,0(r16)
 
54
        mulq    r2,r2,r3        C r3 = prod_low
 
55
        stq     r4,8(r16)
 
56
        umulh   r2,r2,r4        C r4 = cy_limb
 
57
        stq     r3,16(r16)
 
58
        stq     r4,24(r16)
 
59
        ret     r31,(r26),1
 
60
$Lend1: stq     r3,0(r16)
 
61
        stq     r4,8(r16)
 
62
        ret     r31,(r26),1
 
63
EPILOGUE(mpn_sqr_diagonal)
 
64
ASM_END()