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