1/* Shift a limb right, low level routine. 2 Copyright (C) 1995, 1997, 1999, 2000 Free Software Foundation, Inc. 3 This file is part of the GNU C Library. 4 5 The GNU C Library is free software; you can redistribute it and/or 6 modify it under the terms of the GNU Lesser General Public 7 License as published by the Free Software Foundation; either 8 version 2.1 of the License, or (at your option) any later version. 9 10 The GNU C Library is distributed in the hope that it will be useful, 11 but WITHOUT ANY WARRANTY; without even the implied warranty of 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 Lesser General Public License for more details. 14 15 You should have received a copy of the GNU Lesser General Public 16 License along with the GNU C Library; if not, write to the Free 17 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 18 02111-1307 USA. */ 19 20#include <sysdep.h> 21#include <bp-sym.h> 22#include <bp-asm.h> 23 24/* INPUT PARAMETERS 25 res_ptr r3 26 s1_ptr r4 27 size r5 28 cnt r6 */ 29 30ENTRY (BP_SYM (__mpn_rshift)) 31#if __BOUNDED_POINTERS__ 32 slwi r10,r5,2 /* convert limbs to bytes */ 33 CHECK_BOUNDS_BOTH_WIDE (r3, r8, r9, r10) 34 CHECK_BOUNDS_BOTH_WIDE (r4, r8, r9, r10) 35#endif 36 mtctr r5 # copy size into CTR 37 addi r7,r3,-4 # move adjusted res_ptr to free return reg 38 subfic r8,r6,32 39 lwz r11,0(r4) # load first s1 limb 40 slw r3,r11,r8 # compute function return value 41 bdz L(1) 42 43L(0): lwzu r10,4(r4) 44 srw r9,r11,r6 45 slw r12,r10,r8 46 or r9,r9,r12 47 stwu r9,4(r7) 48 bdz L(2) 49 lwzu r11,4(r4) 50 srw r9,r10,r6 51 slw r12,r11,r8 52 or r9,r9,r12 53 stwu r9,4(r7) 54 bdnz L(0) 55 56L(1): srw r0,r11,r6 57 stw r0,4(r7) 58 blr 59 60L(2): srw r0,r10,r6 61 stw r0,4(r7) 62 blr 63END (BP_SYM (__mpn_rshift)) 64