1 dnl X86-64 mpn_add_n, mpn_sub_n, optimized for Intel Atom.
3 dnl Copyright 2003, 2004, 2005, 2007, 2008 Free Software Foundation, Inc.
5 dnl This file is part of the GNU MP Library.
7 dnl The GNU MP Library is free software; you can redistribute it and/or modify
8 dnl it under the terms of the GNU Lesser General Public License as published
9 dnl by the Free Software Foundation; either version 3 of the License, or (at
10 dnl your option) any later version.
12 dnl The GNU MP Library is distributed in the hope that it will be useful, but
13 dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14 dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
15 dnl License for more details.
17 dnl You should have received a copy of the GNU Lesser General Public License
18 dnl along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
20 include(`../config.m4')
35 define(`cy', `%r8') C (only for mpn_add_nc)
37 ifdef(`OPERATION_add_n', `
39 define(func, mpn_add_n)
40 define(func_nc, mpn_add_nc)')
41 ifdef(`OPERATION_sub_n', `
43 define(func, mpn_sub_n)
44 define(func_nc, mpn_sub_nc)')
46 MULFUNC_PROLOGUE(mpn_add_n mpn_add_nc mpn_sub_n mpn_sub_nc)
57 mov R32(%rcx), R32(%rax)
65 L(b1): mov (%rsi), %r10
66 test R32(%rcx), R32(%rcx)
71 mov R32(%rcx), R32(%rax) C zero rax
72 adc R32(%rax), R32(%rax)
74 L(gt1): ADCSBB (%rdx), %r10
81 L(b2): mov (%rsi), %r9
84 test R32(%rcx), R32(%rcx)
89 L(gt2): ADCSBB 8(%rdx), %r9
95 L(b3): mov (%rsi), %rax
98 test R32(%rcx), R32(%rcx)
103 L(gt3): ADCSBB (%rdx), %rax
106 L(b0): mov (%rsi), %r11
114 L(top): mov %r11, 24(%rdi)
117 L(m3): mov %rax, (%rdi)
120 L(m2): mov %r9, 8(%rdi)
121 ADCSBB 16(%rdx), %r10
123 L(m1): mov %r10, 16(%rdi)
124 L(m0): ADCSBB 24(%rdx), %r11
133 L(e3): ADCSBB (%rdx), %rax
135 L(e2): ADCSBB 8(%rdx), %r9
137 L(e1): ADCSBB 16(%rdx), %r10
139 mov R32(%rcx), R32(%rax) C zero rax
140 adc R32(%rax), R32(%rax)