Upload Tizen:Base source
[external/gmp.git] / mpn / powerpc32 / 750 / com.asm
1 dnl  PowerPC 750 mpn_com -- mpn bitwise one's complement
2
3 dnl  Copyright 2002, 2003 Free Software Foundation, Inc.
4 dnl
5 dnl  This file is part of the GNU MP Library.
6 dnl
7 dnl  The GNU MP Library is free software; you can redistribute it and/or
8 dnl  modify it under the terms of the GNU Lesser General Public License as
9 dnl  published by the Free Software Foundation; either version 3 of the
10 dnl  License, or (at your option) any later version.
11 dnl
12 dnl  The GNU MP Library is distributed in the hope that it will be useful,
13 dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
14 dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15 dnl  Lesser General Public License for more details.
16 dnl
17 dnl  You should have received a copy of the GNU Lesser General Public License
18 dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
19
20 include(`../config.m4')
21
22
23 C                cycles/limb
24 C 603e:            ?
25 C 604e:            3.0
26 C 75x (G3):        2.0
27 C 7400,7410 (G4):  2.0
28 C 744x,745x (G4+): 3.0
29
30 C void mpn_com (mp_ptr dst, mp_srcptr src, mp_size_t size);
31 C
32 C This loop form is necessary for the claimed speed.
33
34 ASM_START()
35 PROLOGUE(mpn_com)
36
37         C r3    dst
38         C r4    src
39         C r5    size
40
41         mtctr   r5              C size
42         lwz     r5, 0(r4)       C src low limb
43
44         sub     r4, r4, r3      C src-dst
45         subi    r3, r3, 4       C dst-4
46
47         addi    r4, r4, 8       C src-dst+8
48         bdz     L(one)
49
50 L(top):
51         C r3    &dst[i-1]
52         C r4    src-dst
53         C r5    src[i]
54         C r6    scratch
55
56         not     r6, r5          C ~src[i]
57         lwzx    r5, r4,r3       C src[i+1]
58
59         stwu    r6, 4(r3)       C dst[i]
60         bdnz    L(top)
61
62 L(one):
63         not     r6, r5
64
65         stw     r6, 4(r3)       C dst[size-1]
66         blr
67
68 EPILOGUE()