1dnl PowerPC-32 mpn_addlsh1_n -- rp[] = up[] + (vp[] << 1) 2 3dnl Copyright 2003, 2005, 2007 Free Software Foundation, Inc. 4 5dnl This file is part of the GNU MP Library. 6dnl 7dnl The GNU MP Library is free software; you can redistribute it and/or modify 8dnl it under the terms of either: 9dnl 10dnl * the GNU Lesser General Public License as published by the Free 11dnl Software Foundation; either version 3 of the License, or (at your 12dnl option) any later version. 13dnl 14dnl or 15dnl 16dnl * the GNU General Public License as published by the Free Software 17dnl Foundation; either version 2 of the License, or (at your option) any 18dnl later version. 19dnl 20dnl or both in parallel, as here. 21dnl 22dnl The GNU MP Library is distributed in the hope that it will be useful, but 23dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 24dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 25dnl for more details. 26dnl 27dnl You should have received copies of the GNU General Public License and the 28dnl GNU Lesser General Public License along with the GNU MP Library. If not, 29dnl see https://www.gnu.org/licenses/. 30 31include(`../config.m4') 32 33C cycles/limb 34C 603e: ? 35C 604e: 4.0 36C 75x (G3): 5.0 37C 7400,7410 (G4): 5.0 38C 744x,745x (G4+): 5.0 39C power4/ppc970: 4.25 40C power5: 5.0 41 42C INPUT PARAMETERS 43C rp r3 44C up r4 45C vp r5 46C n r6 47 48define(`rp',`r3') 49define(`up',`r4') 50define(`vp',`r5') 51 52define(`s0',`r6') 53define(`s1',`r7') 54define(`u0',`r8') 55define(`v0',`r10') 56define(`v1',`r11') 57 58ASM_START() 59PROLOGUE(mpn_addlsh1_n) 60 mtctr r6 C copy n in ctr 61 addic r31, r31, 0 C clear cy 62 63 lwz v0, 0(vp) C load v limb 64 lwz u0, 0(up) C load u limb 65 addi up, up, -4 C update up 66 addi rp, rp, -4 C update rp 67 slwi s1, v0, 1 68 bdz L(end) C If done, skip loop 69 70L(loop): 71 lwz v1, 4(vp) C load v limb 72 adde s1, s1, u0 C add limbs with cy, set cy 73 srwi s0, v0, 31 C shift down previous v limb 74 stw s1, 4(rp) C store result limb 75 lwzu u0, 8(up) C load u limb and update up 76 rlwimi s0, v1, 1, 0,30 C left shift v limb and merge with prev v limb 77 78 bdz L(exit) C decrement ctr and exit if done 79 80 lwzu v0, 8(vp) C load v limb and update vp 81 adde s0, s0, u0 C add limbs with cy, set cy 82 srwi s1, v1, 31 C shift down previous v limb 83 stwu s0, 8(rp) C store result limb and update rp 84 lwz u0, 4(up) C load u limb 85 rlwimi s1, v0, 1, 0,30 C left shift v limb and merge with prev v limb 86 87 bdnz L(loop) C decrement ctr and loop back 88 89L(end): adde r7, s1, u0 90 srwi r4, v0, 31 91 stw r7, 4(rp) C store last result limb 92 addze r3, r4 93 blr 94L(exit): 95 adde r7, s0, u0 96 srwi r4, v1, 31 97 stw r7, 8(rp) C store last result limb 98 addze r3, r4 99 blr 100EPILOGUE() 101