1*5af32e75SAxel Dörfler/* Multiply a limb vector by a single limb, for PowerPC. 2*5af32e75SAxel Dörfler Copyright (C) 1993-1995, 1997, 1999, 2000 Free Software Foundation, Inc. 3*5af32e75SAxel Dörfler This file is part of the GNU C Library. 4*5af32e75SAxel Dörfler 5*5af32e75SAxel Dörfler The GNU C Library is free software; you can redistribute it and/or 6*5af32e75SAxel Dörfler modify it under the terms of the GNU Lesser General Public 7*5af32e75SAxel Dörfler License as published by the Free Software Foundation; either 8*5af32e75SAxel Dörfler version 2.1 of the License, or (at your option) any later version. 9*5af32e75SAxel Dörfler 10*5af32e75SAxel Dörfler The GNU C Library is distributed in the hope that it will be useful, 11*5af32e75SAxel Dörfler but WITHOUT ANY WARRANTY; without even the implied warranty of 12*5af32e75SAxel Dörfler MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13*5af32e75SAxel Dörfler Lesser General Public License for more details. 14*5af32e75SAxel Dörfler 15*5af32e75SAxel Dörfler You should have received a copy of the GNU Lesser General Public 16*5af32e75SAxel Dörfler License along with the GNU C Library; if not, write to the Free 17*5af32e75SAxel Dörfler Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 18*5af32e75SAxel Dörfler 02111-1307 USA. */ 19*5af32e75SAxel Dörfler 20*5af32e75SAxel Dörfler#include <sysdep.h> 21*5af32e75SAxel Dörfler#include <bp-sym.h> 22*5af32e75SAxel Dörfler#include <bp-asm.h> 23*5af32e75SAxel Dörfler 24*5af32e75SAxel Dörfler/* mp_limb_t mpn_addmul_1 (mp_ptr res_ptr, mp_srcptr s1_ptr, 25*5af32e75SAxel Dörfler mp_size_t s1_size, mp_limb_t s2_limb) 26*5af32e75SAxel Dörfler Calculate res+s1*s2 and put result back in res; return carry. */ 27*5af32e75SAxel DörflerENTRY (BP_SYM (__mpn_addmul_1)) 28*5af32e75SAxel Dörfler#if __BOUNDED_POINTERS__ 29*5af32e75SAxel Dörfler slwi r10,r5,2 /* convert limbs to bytes */ 30*5af32e75SAxel Dörfler CHECK_BOUNDS_BOTH_WIDE (r3, r8, r9, r10) 31*5af32e75SAxel Dörfler CHECK_BOUNDS_BOTH_WIDE (r4, r8, r9, r10) 32*5af32e75SAxel Dörfler#endif 33*5af32e75SAxel Dörfler mtctr r5 34*5af32e75SAxel Dörfler 35*5af32e75SAxel Dörfler lwz r0,0(r4) 36*5af32e75SAxel Dörfler mullw r7,r0,r6 37*5af32e75SAxel Dörfler mulhwu r10,r0,r6 38*5af32e75SAxel Dörfler lwz r9,0(r3) 39*5af32e75SAxel Dörfler addc r8,r7,r9 40*5af32e75SAxel Dörfler addi r3,r3,-4 /* adjust res_ptr */ 41*5af32e75SAxel Dörfler bdz L(1) 42*5af32e75SAxel Dörfler 43*5af32e75SAxel DörflerL(0): lwzu r0,4(r4) 44*5af32e75SAxel Dörfler stwu r8,4(r3) 45*5af32e75SAxel Dörfler mullw r8,r0,r6 46*5af32e75SAxel Dörfler adde r7,r8,r10 47*5af32e75SAxel Dörfler mulhwu r10,r0,r6 48*5af32e75SAxel Dörfler lwz r9,4(r3) 49*5af32e75SAxel Dörfler addze r10,r10 50*5af32e75SAxel Dörfler addc r8,r7,r9 51*5af32e75SAxel Dörfler bdnz L(0) 52*5af32e75SAxel Dörfler 53*5af32e75SAxel DörflerL(1): stw r8,4(r3) 54*5af32e75SAxel Dörfler addze r3,r10 55*5af32e75SAxel Dörfler blr 56*5af32e75SAxel DörflerEND (BP_SYM (__mpn_addmul_1)) 57