1dnl Intel Atom mpn_mul_1. 2 3dnl Contributed to the GNU project by Torbjorn Granlund and Marco Bodrato. 4 5dnl Copyright 2011 Free Software Foundation, Inc. 6 7dnl This file is part of the GNU MP Library. 8dnl 9dnl The GNU MP Library is free software; you can redistribute it and/or modify 10dnl it under the terms of either: 11dnl 12dnl * the GNU Lesser General Public License as published by the Free 13dnl Software Foundation; either version 3 of the License, or (at your 14dnl option) any later version. 15dnl 16dnl or 17dnl 18dnl * the GNU General Public License as published by the Free Software 19dnl Foundation; either version 2 of the License, or (at your option) any 20dnl later version. 21dnl 22dnl or both in parallel, as here. 23dnl 24dnl The GNU MP Library is distributed in the hope that it will be useful, but 25dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 26dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 27dnl for more details. 28dnl 29dnl You should have received copies of the GNU General Public License and the 30dnl GNU Lesser General Public License along with the GNU MP Library. If not, 31dnl see https://www.gnu.org/licenses/. 32 33include(`../config.m4') 34 35C cycles/limb 36C cycles/limb 37C P5 - 38C P6 model 0-8,10-12 - 39C P6 model 9 (Banias) 40C P6 model 13 (Dothan) 41C P4 model 0 (Willamette) 42C P4 model 1 (?) 43C P4 model 2 (Northwood) 44C P4 model 3 (Prescott) 45C P4 model 4 (Nocona) 46C Intel Atom 7.5 47C AMD K6 - 48C AMD K7 - 49C AMD K8 50C AMD K10 51 52defframe(PARAM_CARRY,20) 53defframe(PARAM_MUL, 16) 54defframe(PARAM_SIZE, 12) 55defframe(PARAM_SRC, 8) 56defframe(PARAM_DST, 4) 57 58define(`rp', `%edx') 59define(`up', `%esi') 60define(`n', `%ecx') 61 62ASM_START() 63 TEXT 64 ALIGN(16) 65deflit(`FRAME',0) 66 67PROLOGUE(mpn_mul_1c) 68 movd PARAM_CARRY, %mm6 C carry 69 jmp L(ent) 70EPILOGUE() 71 72 ALIGN(8) C for compact code 73PROLOGUE(mpn_mul_1) 74 pxor %mm6, %mm6 75L(ent): push %esi FRAME_pushl() 76 mov PARAM_SRC, up 77 mov PARAM_SIZE, %eax C size 78 movd PARAM_MUL, %mm7 79 movd (up), %mm0 80 mov %eax, n 81 and $3, %eax 82 pmuludq %mm7, %mm0 83 mov PARAM_DST, rp 84 jz L(lo0) 85 cmp $2, %eax 86 lea -16(up,%eax,4),up 87 lea -16(rp,%eax,4),rp 88 jc L(lo1) 89 jz L(lo2) 90 jmp L(lo3) 91 92 ALIGN(16) 93L(top): movd (up), %mm0 94 pmuludq %mm7, %mm0 95 psrlq $32, %mm6 96 lea 16(rp), rp 97L(lo0): paddq %mm0, %mm6 98 movd 4(up), %mm0 99 pmuludq %mm7, %mm0 100 movd %mm6, (rp) 101 psrlq $32, %mm6 102L(lo3): paddq %mm0, %mm6 103 movd 8(up), %mm0 104 pmuludq %mm7, %mm0 105 movd %mm6, 4(rp) 106 psrlq $32, %mm6 107L(lo2): paddq %mm0, %mm6 108 movd 12(up), %mm0 109 pmuludq %mm7, %mm0 110 movd %mm6, 8(rp) 111 psrlq $32, %mm6 112L(lo1): paddq %mm0, %mm6 113 sub $4, n 114 movd %mm6, 12(rp) 115 lea 16(up), up 116 ja L(top) 117 118 psrlq $32, %mm6 119 movd %mm6, %eax 120 emms 121 pop %esi FRAME_popl() 122 ret 123EPILOGUE() 124ASM_END() 125