1dnl Intel Pentium mpn_addmul_1 -- mpn by limb multiplication. 2 3dnl Copyright 1992, 1994, 1996, 1999, 2000, 2002 Free Software Foundation, 4dnl 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 34 35C P5: 14.0 cycles/limb 36 37 38ifdef(`OPERATION_addmul_1', ` 39 define(M4_inst, addl) 40 define(M4_function_1, mpn_addmul_1) 41 define(M4_function_1c, mpn_addmul_1c) 42 43',`ifdef(`OPERATION_submul_1', ` 44 define(M4_inst, subl) 45 define(M4_function_1, mpn_submul_1) 46 define(M4_function_1c, mpn_submul_1c) 47 48',`m4_error(`Need OPERATION_addmul_1 or OPERATION_submul_1 49')')') 50 51MULFUNC_PROLOGUE(mpn_addmul_1 mpn_addmul_1c mpn_submul_1 mpn_submul_1c) 52 53 54C mp_limb_t mpn_addmul_1 (mp_ptr dst, mp_srcptr src, mp_size_t size, 55C mp_limb_t mult); 56C mp_limb_t mpn_addmul_1c (mp_ptr dst, mp_srcptr src, mp_size_t size, 57C mp_limb_t mult, mp_limb_t carry); 58C 59C mp_limb_t mpn_submul_1 (mp_ptr dst, mp_srcptr src, mp_size_t size, 60C mp_limb_t mult); 61C mp_limb_t mpn_submul_1c (mp_ptr dst, mp_srcptr src, mp_size_t size, 62C mp_limb_t mult, mp_limb_t carry); 63C 64 65defframe(PARAM_CARRY, 20) 66defframe(PARAM_MULTIPLIER,16) 67defframe(PARAM_SIZE, 12) 68defframe(PARAM_SRC, 8) 69defframe(PARAM_DST, 4) 70 71 TEXT 72 73 ALIGN(8) 74PROLOGUE(M4_function_1c) 75deflit(`FRAME',0) 76 77 movl PARAM_CARRY, %ecx 78 pushl %esi FRAME_pushl() 79 80 jmp L(start_1c) 81 82EPILOGUE() 83 84 85 ALIGN(8) 86PROLOGUE(M4_function_1) 87deflit(`FRAME',0) 88 89 xorl %ecx, %ecx 90 pushl %esi FRAME_pushl() 91 92L(start_1c): 93 movl PARAM_SRC, %esi 94 movl PARAM_SIZE, %eax 95 96 pushl %edi FRAME_pushl() 97 pushl %ebx FRAME_pushl() 98 99 movl PARAM_DST, %edi 100 leal -1(%eax), %ebx C size-1 101 102 leal (%esi,%eax,4), %esi 103 xorl $-1, %ebx C -size, and clear carry 104 105 leal (%edi,%eax,4), %edi 106 107L(top): 108 C eax 109 C ebx counter, negative 110 C ecx carry 111 C edx 112 C esi src end 113 C edi dst end 114 C ebp 115 116 adcl $0, %ecx 117 movl (%esi,%ebx,4), %eax 118 119 mull PARAM_MULTIPLIER 120 121 addl %ecx, %eax 122 movl (%edi,%ebx,4), %ecx 123 124 adcl $0, %edx 125 M4_inst %eax, %ecx 126 127 movl %ecx, (%edi,%ebx,4) 128 incl %ebx 129 130 movl %edx, %ecx 131 jnz L(top) 132 133 134 adcl $0, %ecx 135 popl %ebx 136 137 movl %ecx, %eax 138 popl %edi 139 140 popl %esi 141 142 ret 143 144EPILOGUE() 145