|
Packit Service |
82fcde |
/* i80386 __mpn_rshift --
|
|
Packit Service |
82fcde |
Copyright (C) 1992-2018 Free Software Foundation, Inc.
|
|
Packit Service |
82fcde |
This file is part of the GNU MP Library.
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
The GNU MP Library is free software; you can redistribute it and/or modify
|
|
Packit Service |
82fcde |
it under the terms of the GNU Lesser General Public License as published by
|
|
Packit Service |
82fcde |
the Free Software Foundation; either version 2.1 of the License, or (at your
|
|
Packit Service |
82fcde |
option) any later version.
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
The GNU MP Library is distributed in the hope that it will be useful, but
|
|
Packit Service |
82fcde |
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
|
Packit Service |
82fcde |
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
|
|
Packit Service |
82fcde |
License for more details.
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
You should have received a copy of the GNU Lesser General Public License
|
|
Packit Service |
82fcde |
along with the GNU MP Library; see the file COPYING.LIB. If not,
|
|
Packit Service |
82fcde |
see <http://www.gnu.org/licenses/>. */
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
#include "sysdep.h"
|
|
Packit Service |
82fcde |
#include "asm-syntax.h"
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
#define PARMS 4+12 /* space for 3 saved regs */
|
|
Packit Service |
82fcde |
#define RES PARMS
|
|
Packit Service |
82fcde |
#define S RES+4
|
|
Packit Service |
82fcde |
#define SIZE S+4
|
|
Packit Service |
82fcde |
#define CNT SIZE+4
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
.text
|
|
Packit Service |
82fcde |
ENTRY (__mpn_rshift)
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
pushl %edi
|
|
Packit Service |
82fcde |
cfi_adjust_cfa_offset (4)
|
|
Packit Service |
82fcde |
pushl %esi
|
|
Packit Service |
82fcde |
cfi_adjust_cfa_offset (4)
|
|
Packit Service |
82fcde |
pushl %ebx
|
|
Packit Service |
82fcde |
cfi_adjust_cfa_offset (4)
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
movl RES(%esp),%edi
|
|
Packit Service |
82fcde |
cfi_rel_offset (edi, 8)
|
|
Packit Service |
82fcde |
movl S(%esp),%esi
|
|
Packit Service |
82fcde |
cfi_rel_offset (esi, 4)
|
|
Packit Service |
82fcde |
movl SIZE(%esp),%edx
|
|
Packit Service |
82fcde |
movl CNT(%esp),%ecx
|
|
Packit Service |
82fcde |
leal -4(%edi,%edx,4),%edi
|
|
Packit Service |
82fcde |
leal (%esi,%edx,4),%esi
|
|
Packit Service |
82fcde |
negl %edx
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
movl (%esi,%edx,4),%ebx /* read least significant limb */
|
|
Packit Service |
82fcde |
cfi_rel_offset (ebx, 0)
|
|
Packit Service |
82fcde |
cfi_remember_state
|
|
Packit Service |
82fcde |
xorl %eax,%eax
|
|
Packit Service |
82fcde |
shrdl %cl,%ebx,%eax /* compute carry limb */
|
|
Packit Service |
82fcde |
incl %edx
|
|
Packit Service |
82fcde |
jz L(end)
|
|
Packit Service |
82fcde |
pushl %eax /* push carry limb onto stack */
|
|
Packit Service |
82fcde |
cfi_adjust_cfa_offset (4)
|
|
Packit Service |
82fcde |
testb $1,%dl
|
|
Packit Service |
82fcde |
jnz L(1) /* enter loop in the middle */
|
|
Packit Service |
82fcde |
movl %ebx,%eax
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
ALIGN (3)
|
|
Packit Service |
82fcde |
L(oop): movl (%esi,%edx,4),%ebx /* load next higher limb */
|
|
Packit Service |
82fcde |
shrdl %cl,%ebx,%eax /* compute result limb */
|
|
Packit Service |
82fcde |
movl %eax,(%edi,%edx,4) /* store it */
|
|
Packit Service |
82fcde |
incl %edx
|
|
Packit Service |
82fcde |
L(1): movl (%esi,%edx,4),%eax
|
|
Packit Service |
82fcde |
shrdl %cl,%eax,%ebx
|
|
Packit Service |
82fcde |
movl %ebx,(%edi,%edx,4)
|
|
Packit Service |
82fcde |
incl %edx
|
|
Packit Service |
82fcde |
jnz L(oop)
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
shrl %cl,%eax /* compute most significant limb */
|
|
Packit Service |
82fcde |
movl %eax,(%edi) /* store it */
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
popl %eax /* pop carry limb */
|
|
Packit Service |
82fcde |
cfi_adjust_cfa_offset (-4)
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
popl %ebx
|
|
Packit Service |
82fcde |
cfi_adjust_cfa_offset (-4)
|
|
Packit Service |
82fcde |
cfi_restore (ebx)
|
|
Packit Service |
82fcde |
popl %esi
|
|
Packit Service |
82fcde |
cfi_adjust_cfa_offset (-4)
|
|
Packit Service |
82fcde |
cfi_restore (esi)
|
|
Packit Service |
82fcde |
popl %edi
|
|
Packit Service |
82fcde |
cfi_adjust_cfa_offset (-4)
|
|
Packit Service |
82fcde |
cfi_restore (edi)
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
ret
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
cfi_restore_state
|
|
Packit Service |
82fcde |
L(end): shrl %cl,%ebx /* compute most significant limb */
|
|
Packit Service |
82fcde |
movl %ebx,(%edi) /* store it */
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
popl %ebx
|
|
Packit Service |
82fcde |
cfi_adjust_cfa_offset (-4)
|
|
Packit Service |
82fcde |
cfi_restore (ebx)
|
|
Packit Service |
82fcde |
popl %esi
|
|
Packit Service |
82fcde |
cfi_adjust_cfa_offset (-4)
|
|
Packit Service |
82fcde |
cfi_restore (esi)
|
|
Packit Service |
82fcde |
popl %edi
|
|
Packit Service |
82fcde |
cfi_adjust_cfa_offset (-4)
|
|
Packit Service |
82fcde |
cfi_restore (edi)
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
ret
|
|
Packit Service |
82fcde |
END (__mpn_rshift)
|