| 1 | /* Pentium __mpn_addmul_1 -- Multiply a limb vector with a limb and add |
| 2 | the result to a second limb vector. |
| 3 | Copyright (C) 1992-2024 Free Software Foundation, Inc. |
| 4 | This file is part of the GNU MP Library. |
| 5 | |
| 6 | The GNU MP Library is free software; you can redistribute it and/or modify |
| 7 | it under the terms of the GNU Lesser General Public License as published by |
| 8 | the Free Software Foundation; either version 2.1 of the License, or (at your |
| 9 | option) any later version. |
| 10 | |
| 11 | The GNU MP Library is distributed in the hope that it will be useful, but |
| 12 | WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY |
| 13 | or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public |
| 14 | License for more details. |
| 15 | |
| 16 | You should have received a copy of the GNU Lesser General Public License |
| 17 | along with the GNU MP Library; see the file COPYING.LIB. If not, |
| 18 | see <https://www.gnu.org/licenses/>. */ |
| 19 | |
| 20 | #include "sysdep.h" |
| 21 | #include "asm-syntax.h" |
| 22 | |
| 23 | #define PARMS 4+16 /* space for 4 saved regs */ |
| 24 | #define RES PARMS |
| 25 | #define S1 RES+4 |
| 26 | #define SIZE S1+4 |
| 27 | #define S2LIMB SIZE+4 |
| 28 | |
| 29 | #define res_ptr edi |
| 30 | #define s1_ptr esi |
| 31 | #define size ecx |
| 32 | #define s2_limb ebx |
| 33 | |
| 34 | .text |
| 35 | ENTRY (__mpn_addmul_1) |
| 36 | |
| 37 | pushl %res_ptr |
| 38 | cfi_adjust_cfa_offset (4) |
| 39 | pushl %s1_ptr |
| 40 | cfi_adjust_cfa_offset (4) |
| 41 | pushl %ebp |
| 42 | cfi_adjust_cfa_offset (4) |
| 43 | pushl %s2_limb |
| 44 | cfi_adjust_cfa_offset (4) |
| 45 | |
| 46 | movl RES(%esp), %res_ptr |
| 47 | cfi_rel_offset (res_ptr, 12) |
| 48 | movl S1(%esp), %s1_ptr |
| 49 | cfi_rel_offset (s1_ptr, 8) |
| 50 | movl SIZE(%esp), %size |
| 51 | movl S2LIMB(%esp), %s2_limb |
| 52 | cfi_rel_offset (s2_limb, 0) |
| 53 | leal (%res_ptr,%size,4), %res_ptr |
| 54 | leal (%s1_ptr,%size,4), %s1_ptr |
| 55 | negl %size |
| 56 | xorl %ebp, %ebp |
| 57 | cfi_rel_offset (ebp, 4) |
| 58 | ALIGN (3) |
| 59 | |
| 60 | L(oop): adcl $0, %ebp |
| 61 | movl (%s1_ptr,%size,4), %eax |
| 62 | |
| 63 | mull %s2_limb |
| 64 | |
| 65 | addl %ebp, %eax |
| 66 | movl (%res_ptr,%size,4), %ebp |
| 67 | |
| 68 | adcl $0, %edx |
| 69 | addl %eax, %ebp |
| 70 | |
| 71 | movl %ebp, (%res_ptr,%size,4) |
| 72 | incl %size |
| 73 | |
| 74 | movl %edx, %ebp |
| 75 | jnz L(oop) |
| 76 | |
| 77 | adcl $0, %ebp |
| 78 | movl %ebp, %eax |
| 79 | popl %s2_limb |
| 80 | cfi_adjust_cfa_offset (-4) |
| 81 | cfi_restore (s2_limb) |
| 82 | popl %ebp |
| 83 | cfi_adjust_cfa_offset (-4) |
| 84 | cfi_restore (ebp) |
| 85 | popl %s1_ptr |
| 86 | cfi_adjust_cfa_offset (-4) |
| 87 | cfi_restore (s1_ptr) |
| 88 | popl %res_ptr |
| 89 | cfi_adjust_cfa_offset (-4) |
| 90 | cfi_restore (res_ptr) |
| 91 | |
| 92 | ret |
| 93 | #undef size |
| 94 | END (__mpn_addmul_1) |
| 95 | |