1dnl mpn_mul_2 2 3dnl Copyright 2010 The Code Cavern 4 5dnl This file is part of the MPIR Library. 6 7dnl The MPIR Library is free software; you can redistribute it and/or modify 8dnl it under the terms of the GNU Lesser General Public License as published 9dnl by the Free Software Foundation; either version 2.1 of the License, or (at 10dnl your option) any later version. 11 12dnl The MPIR Library is distributed in the hope that it will be useful, but 13dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 14dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public 15dnl License for more details. 16 17dnl You should have received a copy of the GNU Lesser General Public License 18dnl along with the MPIR Library; see the file COPYING.LIB. If not, write 19dnl to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 20dnl Boston, MA 02110-1301, USA. 21 22include(`../config.m4') 23 24ASM_START() 25PROLOGUE(mpn_mul_2) 26push %rbx 27mov 8(%rcx),%r8 28mov (%rcx),%rcx 29mov $3,%rbx 30lea -24(%rdi,%rdx,8),%rdi 31lea -24(%rsi,%rdx,8),%rsi 32sub %rdx,%rbx 33 #mul %r8 34 #add %rax,%r9 35 #adc %rdx,%r10 36 #mov -16(%rsi,%rbx,8),%rax 37 mov $0,%r11 38 #mul %rcx 39 #add %rax,%r9 40 #adc %rdx,%r10 41 #adc $0,%r11 42 #mov -16(%rsi,%rbx,8),%rax 43 #mul %r8 44 #add %rax,%r10 45 #mov -8(%rsi,%rbx,8),%rax 46 #adc %rdx,%r11 47 #mul %rcx 48 #add %rax,%r10 49 #mov %r9,-16(%rdi,%rbx,8) 50 #adc %rdx,%r11 51 mov $0,%r9 52 #mov -8(%rsi,%rbx,8),%rax 53 #adc $0,%r9 54 #mul %r8 55 #add %rax,%r11 56 #mov %r10,-8(%rdi,%rbx,8) 57 mov (%rsi,%rbx,8),%rax 58 mov $0,%r10 59 #adc %rdx,%r9 60 mul %rcx 61 add %rax,%r11 62 mov (%rsi,%rbx,8),%rax 63 mov %r11,(%rdi,%rbx,8) 64 adc %rdx,%r9 65 #adc $0,%r10 66 #add $3,%rbx 67cmp $0,%rbx 68jge skiplp 69ALIGN(16) 70lp: mul %r8 71 add %rax,%r9 72 adc %rdx,%r10 73 mov 8(%rsi,%rbx,8),%rax 74 mov $0,%r11 75 mul %rcx 76 add %rax,%r9 77 adc %rdx,%r10 78 adc $0,%r11 79 mov 8(%rsi,%rbx,8),%rax 80 mul %r8 81 add %rax,%r10 82 mov 16(%rsi,%rbx,8),%rax 83 adc %rdx,%r11 84 mul %rcx 85 add %rax,%r10 86 mov %r9,8(%rdi,%rbx,8) 87 adc %rdx,%r11 88 mov $0,%r9 89 mov 16(%rsi,%rbx,8),%rax 90 adc $0,%r9 91 mul %r8 92 add %rax,%r11 93 mov %r10,16(%rdi,%rbx,8) 94 mov 24(%rsi,%rbx,8),%rax 95 mov $0,%r10 96 adc %rdx,%r9 97 mul %rcx 98 add %rax,%r11 99 mov 24(%rsi,%rbx,8),%rax 100 mov %r11,24(%rdi,%rbx,8) 101 adc %rdx,%r9 102 adc $0,%r10 103 add $3,%rbx 104 jnc lp 105skiplp: 106cmp $1,%rbx 107ja case0 108je case1 109case2: mul %r8 110 add %rax,%r9 111 adc %rdx,%r10 112 mov 8(%rsi,%rbx,8),%rax 113 mov $0,%r11 114 mul %rcx 115 add %rax,%r9 116 adc %rdx,%r10 117 adc $0,%r11 118 mov 8(%rsi,%rbx,8),%rax 119 mul %r8 120 add %rax,%r10 121 mov 16(%rsi,%rbx,8),%rax 122 adc %rdx,%r11 123 mul %rcx 124 add %rax,%r10 125 mov %r9,8(%rdi,%rbx,8) 126 adc %rdx,%r11 127 mov $0,%r9 128 mov 16(%rsi,%rbx,8),%rax 129 adc $0,%r9 130 mul %r8 131 add %rax,%r11 132 mov %r10,16(%rdi,%rbx,8) 133 adc %rdx,%r9 134 mov %r11,24(%rdi,%rbx,8) 135 mov %r9,%rax 136 pop %rbx 137 ret 138case1: mul %r8 139 add %rax,%r9 140 adc %rdx,%r10 141 mov 8(%rsi,%rbx,8),%rax 142 mov $0,%r11 143 mul %rcx 144 add %rax,%r9 145 adc %rdx,%r10 146 adc $0,%r11 147 mov 8(%rsi,%rbx,8),%rax 148 mul %r8 149 add %rax,%r10 150 adc %rdx,%r11 151 mov %r9,8(%rdi,%rbx,8) 152 mov %r10,16(%rdi,%rbx,8) 153 mov %r11,%rax 154 pop %rbx 155 ret 156case0: mul %r8 157 add %rax,%r9 158 adc %rdx,%r10 159 mov %r9,8(%rdi,%rbx,8) 160 mov %r10,%rax 161 pop %rbx 162 ret 163EPILOGUE() 164 165 166 167