1dnl x86_64 mpn_bdiv_dbm1. 2 3dnl Copyright 2008 Free Software Foundation, Inc. 4 5dnl This file is part of the GNU MP Library. 6 7dnl The GNU MP 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 3 of the License, or (at 10dnl your option) any later version. 11 12dnl The GNU MP 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 GNU MP Library. If not, see http://www.gnu.org/licenses/. 19 20include(`../config.m4') 21 22C cycles/limb 23C K8,K9: 2.25 24C K10: ? 25C P4: 12.5 26C P6 core2: 4.0 27C P6 corei7: 3.8 28C P6 atom: 20 29 30C TODO 31C * Do proper 4-way feed-in instead of the current epilogue 32 33C INPUT PARAMETERS shared 34define(`qp', `%rdi') 35define(`up', `%rsi') 36define(`n', `%rdx') 37define(`bd', `%rcx') 38define(`cy', `%r8') 39 40 41ASM_START() 42 TEXT 43 ALIGN(16) 44PROLOGUE(mpn_bdiv_dbm1c) 45 mov (%rsi), %rax 46 mov %rdx, %r9 C n 47 48 mul %rcx 49 sub %rax, %r8 50 mov %r8, (%rdi) 51 sbb %rdx, %r8 52 53 lea (%rsi,%r9,8), %rsi 54 lea (%rdi,%r9,8), %rdi 55 neg %r9 56 add $4, %r9 57 jns L(end) 58 ALIGN(16) 59L(top): 60 mov -24(%rsi,%r9,8), %rax 61 mul %rcx 62 sub %rax, %r8 63 mov %r8, -24(%rdi,%r9,8) 64 sbb %rdx, %r8 65L(3): 66 mov -16(%rsi,%r9,8), %rax 67 mul %rcx 68 sub %rax, %r8 69 mov %r8, -16(%rdi,%r9,8) 70 sbb %rdx, %r8 71L(2): 72 mov -8(%rsi,%r9,8), %rax 73 mul %rcx 74 sub %rax, %r8 75 mov %r8, -8(%rdi,%r9,8) 76 sbb %rdx, %r8 77L(1): 78 mov (%rsi,%r9,8), %rax 79 mul %rcx 80 sub %rax, %r8 81 mov %r8, (%rdi,%r9,8) 82 sbb %rdx, %r8 83 84 add $4, %r9 85 js L(top) 86L(end): 87 je L(3x) 88 cmp $2, %r9 89 jg L(ret) 90 mov $-1, %r9 91 je L(1) 92 jmp L(2) 93L(3x): 94 dec %r9 95 jmp L(3) 96 97L(ret): mov %r8, %rax 98 ret 99EPILOGUE() 100