addmul_1.asm revision 1.1.1.2
1dnl Alpha mpn_addmul_1 -- Multiply a limb vector with a limb and add the 2dnl result to a second limb vector. 3 4dnl Copyright 1992, 1994, 1995, 2000, 2002 Free Software Foundation, Inc. 5 6dnl This file is part of the GNU MP Library. 7dnl 8dnl The GNU MP Library is free software; you can redistribute it and/or modify 9dnl it under the terms of either: 10dnl 11dnl * the GNU Lesser General Public License as published by the Free 12dnl Software Foundation; either version 3 of the License, or (at your 13dnl option) any later version. 14dnl 15dnl or 16dnl 17dnl * the GNU General Public License as published by the Free Software 18dnl Foundation; either version 2 of the License, or (at your option) any 19dnl later version. 20dnl 21dnl or both in parallel, as here. 22dnl 23dnl The GNU MP Library is distributed in the hope that it will be useful, but 24dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 25dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 26dnl for more details. 27dnl 28dnl You should have received copies of the GNU General Public License and the 29dnl GNU Lesser General Public License along with the GNU MP Library. If not, 30dnl see https://www.gnu.org/licenses/. 31 32include(`../config.m4') 33 34C cycles/limb 35C EV4: 42 36C EV5: 18 37C EV6: 7 38 39C INPUT PARAMETERS 40C rp r16 41C up r17 42C n r18 43C vl r19 44 45 46ASM_START() 47PROLOGUE(mpn_addmul_1) 48 ldq r2,0(r17) C r2 = s1_limb 49 addq r17,8,r17 C s1_ptr++ 50 subq r18,1,r18 C size-- 51 mulq r2,r19,r3 C r3 = prod_low 52 ldq r5,0(r16) C r5 = *res_ptr 53 umulh r2,r19,r0 C r0 = prod_high 54 beq r18,$Lend1 C jump if size was == 1 55 ldq r2,0(r17) C r2 = s1_limb 56 addq r17,8,r17 C s1_ptr++ 57 subq r18,1,r18 C size-- 58 addq r5,r3,r3 59 cmpult r3,r5,r4 60 stq r3,0(r16) 61 addq r16,8,r16 C res_ptr++ 62 beq r18,$Lend2 C jump if size was == 2 63 64 ALIGN(8) 65$Loop: mulq r2,r19,r3 C r3 = prod_low 66 ldq r5,0(r16) C r5 = *res_ptr 67 addq r4,r0,r0 C cy_limb = cy_limb + 'cy' 68 subq r18,1,r18 C size-- 69 umulh r2,r19,r4 C r4 = cy_limb 70 ldq r2,0(r17) C r2 = s1_limb 71 addq r17,8,r17 C s1_ptr++ 72 addq r3,r0,r3 C r3 = cy_limb + prod_low 73 cmpult r3,r0,r0 C r0 = carry from (cy_limb + prod_low) 74 addq r5,r3,r3 75 cmpult r3,r5,r5 76 stq r3,0(r16) 77 addq r16,8,r16 C res_ptr++ 78 addq r5,r0,r0 C combine carries 79 bne r18,$Loop 80 81$Lend2: mulq r2,r19,r3 C r3 = prod_low 82 ldq r5,0(r16) C r5 = *res_ptr 83 addq r4,r0,r0 C cy_limb = cy_limb + 'cy' 84 umulh r2,r19,r4 C r4 = cy_limb 85 addq r3,r0,r3 C r3 = cy_limb + prod_low 86 cmpult r3,r0,r0 C r0 = carry from (cy_limb + prod_low) 87 addq r5,r3,r3 88 cmpult r3,r5,r5 89 stq r3,0(r16) 90 addq r5,r0,r0 C combine carries 91 addq r4,r0,r0 C cy_limb = prod_high + cy 92 ret r31,(r26),1 93$Lend1: addq r5,r3,r3 94 cmpult r3,r5,r5 95 stq r3,0(r16) 96 addq r0,r5,r0 97 ret r31,(r26),1 98EPILOGUE(mpn_addmul_1) 99ASM_END() 100