1dnl Alpha mpn_mul_1 -- Multiply a limb vector with a limb and store 2dnl the result in 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 44C cl r20 45 46 47ASM_START() 48PROLOGUE(mpn_mul_1c) 49 ldq r2,0(r17) C r2 = s1_limb 50 lda r18,-1(r18) C size-- 51 mulq r2,r19,r3 C r3 = prod_low 52 umulh r2,r19,r4 C r4 = prod_high 53 beq r18,$Le1c C jump if size was == 1 54 ldq r2,8(r17) C r2 = s1_limb 55 lda r18,-1(r18) C size-- 56 addq r3,r20,r3 C r3 = cy_limb + cl 57 stq r3,0(r16) 58 cmpult r3,r20,r0 C r0 = carry from (cy_limb + cl) 59 bne r18,$Loop C jump if size was == 2 60 br r31,$Le2 61$Le1c: addq r3,r20,r3 C r3 = cy_limb + cl 62 cmpult r3,r20,r0 C r0 = carry from (cy_limb + cl) 63$Le1: stq r3,0(r16) 64 addq r4,r0,r0 65 ret r31,(r26),1 66EPILOGUE(mpn_mul_1c) 67 68PROLOGUE(mpn_mul_1) 69 ldq r2,0(r17) C r2 = s1_limb 70 lda r18,-1(r18) C size-- 71 mulq r2,r19,r3 C r3 = prod_low 72 bic r31,r31,r0 C clear cy_limb 73 umulh r2,r19,r4 C r4 = prod_high 74 beq r18,$Le1 C jump if size was == 1 75 ldq r2,8(r17) C r2 = s1_limb 76 lda r18,-1(r18) C size-- 77 stq r3,0(r16) 78 beq r18,$Le2 C jump if size was == 2 79 80 ALIGN(8) 81$Loop: mulq r2,r19,r3 C r3 = prod_low 82 addq r4,r0,r0 C cy_limb = cy_limb + 'cy' 83 lda r18,-1(r18) C size-- 84 umulh r2,r19,r4 C r4 = prod_high 85 ldq r2,16(r17) C r2 = s1_limb 86 lda r17,8(r17) C s1_ptr++ 87 addq r3,r0,r3 C r3 = cy_limb + prod_low 88 stq r3,8(r16) 89 cmpult r3,r0,r0 C r0 = carry from (cy_limb + prod_low) 90 lda r16,8(r16) C res_ptr++ 91 bne r18,$Loop 92 93$Le2: mulq r2,r19,r3 C r3 = prod_low 94 addq r4,r0,r0 C cy_limb = cy_limb + 'cy' 95 umulh r2,r19,r4 C r4 = prod_high 96 addq r3,r0,r3 C r3 = cy_limb + prod_low 97 cmpult r3,r0,r0 C r0 = carry from (cy_limb + prod_low) 98 stq r3,8(r16) 99 addq r4,r0,r0 C cy_limb = prod_high + cy 100 ret r31,(r26),1 101EPILOGUE(mpn_mul_1) 102ASM_END() 103