1dnl mpn_half 2 3dnl Copyright 2011 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_half) 26mov %rsi,%rax 27lea -8(%rdi,%rsi,8),%rdi 28shr $2,%rsi 29and $3,%eax 30jz t1 31shrq $1,(%rdi) 32lea -8(%rdi),%rdi 33dec %rax 34jz t1 35rcrq $1,(%rdi) 36lea -8(%rdi),%rdi 37dec %rax 38jz t1 39rcrq $1,(%rdi) 40lea -8(%rdi),%rdi 41dec %rax 42t1: 43sbb %rdx,%rdx 44cmp $0,%rsi 45jz skiplp 46add %rdx,%rdx 47.align 16 48lp: 49 rcrq $1,(%rdi) 50 nop 51 rcrq $1,-8(%rdi) 52 rcrq $1,-16(%rdi) 53 rcrq $1,-24(%rdi) 54 nop 55 dec %rsi 56 lea -32(%rdi),%rdi 57 jnz lp 58sbb %rdx,%rdx 59skiplp: 60sub %rdx,%rax 61shl $63,%rax 62ret 63EPILOGUE() 64