3
* Copyright (C) 1995, 1998 Free Software Foundation, Inc.
5
* This file is part of GnuPG.
7
* GnuPG is free software; you can redistribute it and/or modify
8
* it under the terms of the GNU General Public License as published by
9
* the Free Software Foundation; either version 2 of the License, or
10
* (at your option) any later version.
12
* GnuPG is distributed in the hope that it will be useful,
13
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
* GNU General Public License for more details.
17
* You should have received a copy of the GNU General Public License
18
* along with this program; if not, write to the Free Software
19
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
23
#include "asm-syntax.h"
26
#ifndef USE_PPC_PATCHES
30
* mpihelp_lshift( mpi_ptr_t wp, (r3)
32
* mpi_size_t usize, (r5)
40
.globl .mpihelp_lshift
41
.csect mpihelp_lshift[DS]
43
.long .mpihelp_lshift, TOC[tc0], 0
46
mtctr 5 # copy size into CTR
48
add 7,3,0 # make r7 point at end of res
49
add 4,4,0 # make r4 point at end of s1
51
lwzu 11,-4(4) # load first s1 limb
52
srw 3,11,8 # compute function return value
77
/* Shift a limb left, low level routine.
78
Copyright (C) 1996, 1997 Free Software Foundation, Inc.
79
This file is part of the GNU C Library.
81
The GNU C Library is free software; you can redistribute it and/or
82
modify it under the terms of the GNU Library General Public License as
83
published by the Free Software Foundation; either version 2 of the
84
License, or (at your option) any later version.
86
The GNU C Library is distributed in the hope that it will be useful,
87
but WITHOUT ANY WARRANTY; without even the implied warranty of
88
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
89
Library General Public License for more details.
91
You should have received a copy of the GNU Library General Public
92
License along with the GNU C Library; see the file COPYING.LIB. If not,
93
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
94
Boston, MA 02111-1307, USA. */
96
/* mp_limb_t mpn_lshift (mp_ptr wp, mp_srcptr up, mp_size_t usize,
99
EALIGN(mpihelp_lshift,3,0)
100
mtctr %r5 # copy size into CTR
101
cmplwi %cr0,%r5,16 # is size < 16
103
add %r7,%r3,%r0 # make r7 point at end of res
104
add %r4,%r4,%r0 # make r4 point at end of s1
105
lwzu %r11,-4(%r4) # load first s1 limb
107
srw %r3,%r11,%r8 # compute function return value
108
bge %cr0,L(big) # branch if size >= 16
125
L(end1):slw %r0,%r11,%r6
130
/* Guaranteed not to succeed. */
131
L(boom): tweq %r0,%r0
133
/* We imitate a case statement, by using (yuk!) fixed-length code chunks,
134
of size 4*12 bytes. We have to do this (or something) to make this PIC. */
136
bltl- %cr0,L(boom) # Never taken, only used to set LR.
147
L(end2):slw %r0,%r10,%r6
151
#define DO_LSHIFT(n) \
153
0: lwzu %r10,-4(%r4); \
155
inslwi %r9,%r10,n,32-n; \
160
inslwi %r9,%r11,n,32-n; \