github.com/aergoio/aergo@v1.3.1/libtool/src/gmp-6.1.2/mpn/power/sub_n.asm (about) 1 dnl IBM POWER mpn_sub_n -- Subtract two limb vectors of equal, non-zero 2 dnl length. 3 4 dnl Copyright 1992, 1994-1996, 1999-2001, 2005 Free Software Foundation, Inc. 5 6 dnl This file is part of the GNU MP Library. 7 dnl 8 dnl The GNU MP Library is free software; you can redistribute it and/or modify 9 dnl it under the terms of either: 10 dnl 11 dnl * the GNU Lesser General Public License as published by the Free 12 dnl Software Foundation; either version 3 of the License, or (at your 13 dnl option) any later version. 14 dnl 15 dnl or 16 dnl 17 dnl * the GNU General Public License as published by the Free Software 18 dnl Foundation; either version 2 of the License, or (at your option) any 19 dnl later version. 20 dnl 21 dnl or both in parallel, as here. 22 dnl 23 dnl The GNU MP Library is distributed in the hope that it will be useful, but 24 dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 25 dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 26 dnl for more details. 27 dnl 28 dnl You should have received copies of the GNU General Public License and the 29 dnl GNU Lesser General Public License along with the GNU MP Library. If not, 30 dnl see https://www.gnu.org/licenses/. 31 32 33 dnl INPUT PARAMETERS 34 dnl res_ptr r3 35 dnl s1_ptr r4 36 dnl s2_ptr r5 37 dnl size r6 38 39 include(`../config.m4') 40 41 ASM_START() 42 PROLOGUE(mpn_sub_n) 43 andil. 10,6,1 C odd or even number of limbs? 44 l 8,0(4) C load least significant s1 limb 45 l 0,0(5) C load least significant s2 limb 46 cal 3,-4(3) C offset res_ptr, it's updated before it's used 47 sri 10,6,1 C count for unrolled loop 48 sf 7,0,8 C subtract least significant limbs, set cy 49 mtctr 10 C copy count into CTR 50 beq 0,Leven C branch if even # of limbs (# of limbs >= 2) 51 52 C We have an odd # of limbs. Add the first limbs separately. 53 cmpi 1,10,0 C is count for unrolled loop zero? 54 bc 4,6,L1 C bne cr1,L1 (misassembled by gas) 55 st 7,4(3) 56 sfe 3,0,0 C load !cy into ... 57 sfi 3,3,0 C ... return value register 58 br C return 59 60 C We added least significant limbs. Now reload the next limbs to enter loop. 61 L1: lu 8,4(4) C load s1 limb and update s1_ptr 62 lu 0,4(5) C load s2 limb and update s2_ptr 63 stu 7,4(3) 64 sfe 7,0,8 C subtract limbs, set cy 65 Leven: lu 9,4(4) C load s1 limb and update s1_ptr 66 lu 10,4(5) C load s2 limb and update s2_ptr 67 bdz Lend C If done, skip loop 68 69 Loop: lu 8,4(4) C load s1 limb and update s1_ptr 70 lu 0,4(5) C load s2 limb and update s2_ptr 71 sfe 11,10,9 C subtract previous limbs with cy, set cy 72 stu 7,4(3) C 73 lu 9,4(4) C load s1 limb and update s1_ptr 74 lu 10,4(5) C load s2 limb and update s2_ptr 75 sfe 7,0,8 C subtract previous limbs with cy, set cy 76 stu 11,4(3) C 77 bdn Loop C decrement CTR and loop back 78 79 Lend: sfe 11,10,9 C subtract limbs with cy, set cy 80 st 7,4(3) C 81 st 11,8(3) C 82 sfe 3,0,0 C load !cy into ... 83 sfi 3,3,0 C ... return value register 84 br 85 EPILOGUE(mpn_sub_n)