Fix POWER7 Implies
[glibc.git] / sysdeps / x86_64 / rshift.S
blobee0c8aa15ca1a16e1847eb3342c6e6f52d0f81a9
1 /* AMD64 __mpn_rshift --
2    Copyright (C) 2004, 2006 Free Software Foundation, Inc.
3    This file is part of the GNU MP Library.
5    The GNU MP Library is free software; you can redistribute it and/or modify
6    it under the terms of the GNU Lesser General Public License as published by
7    the Free Software Foundation; either version 2.1 of the License, or (at your
8    option) any later version.
10    The GNU MP Library is distributed in the hope that it will be useful, but
11    WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12    or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
13    License for more details.
15    You should have received a copy of the GNU Lesser General Public License
16    along with the GNU MP Library; see the file COPYING.LIB.  If not, write to
17    the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
18    MA 02111-1307, USA. */
20 #include "sysdep.h"
21 #include "asm-syntax.h"
23         .text
24 ENTRY (__mpn_rshift)
25         movq    (%rsi), %mm7
26         movd    %ecx, %mm1
27         movl    $64, %eax
28         subl    %ecx, %eax
29         movd    %eax, %mm0
30         movq    %mm7, %mm3
31         psllq   %mm0, %mm7
32         movd    %mm7, %rax
33         leaq    (%rsi,%rdx,8), %rsi
34         leaq    (%rdi,%rdx,8), %rdi
35         negq    %rdx
36         addq    $2, %rdx
37         jg      L(endo)
38         .p2align 2
39 L(loop):
40         movq    -8(%rsi,%rdx,8), %mm6
41         movq    %mm6, %mm2
42         psllq   %mm0, %mm6
43         psrlq   %mm1, %mm3
44         por     %mm6, %mm3
45         movq    %mm3, -16(%rdi,%rdx,8)
46         je      L(ende)
47         movq    (%rsi,%rdx,8), %mm7
48         movq    %mm7, %mm3
49         psllq   %mm0, %mm7
50         psrlq   %mm1, %mm2
51         por     %mm7, %mm2
52         movq    %mm2, -8(%rdi,%rdx,8)
53         addq    $2, %rdx
54         jle     L(loop)
55 L(endo):
56         movq    %mm3, %mm2
57 L(ende):
58         psrlq   %mm1, %mm2
59         movq    %mm2, -8(%rdi)
60         emms
61         ret
62 END (__mpn_rshift)