Upload Tizen:Base source
[external/gmp.git] / mpn / alpha / cntlz.asm
1 dnl  Alpha auxiliary for longlong.h's count_leading_zeros
2
3 dnl  Copyright 1997, 2000, 2002 Free Software Foundation, Inc.
4
5 dnl  This file is part of the GNU MP Library.
6
7 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
8 dnl  it under the terms of the GNU Lesser General Public License as published
9 dnl  by the Free Software Foundation; either version 3 of the License, or (at
10 dnl  your option) any later version.
11
12 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
13 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14 dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
15 dnl  License for more details.
16
17 dnl  You should have received a copy of the GNU Lesser General Public License
18 dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
19
20 include(`../config.m4')
21
22
23 ASM_START()
24 EXTERN(__clz_tab)
25 PROLOGUE(mpn_count_leading_zeros,gp)
26         cmpbge  r31,  r16, r1
27         LEA(r3,__clz_tab)
28         sra     r1,   1,   r1
29         xor     r1,   127, r1
30         srl     r16,  1,   r16
31         addq    r1,   r3,  r1
32         ldq_u   r0,   0(r1)
33         lda     r2,   64
34         extbl   r0,   r1,   r0
35         s8subl  r0,   8,    r0
36         srl     r16,  r0,   r16
37         addq    r16,  r3,   r16
38         ldq_u   r1,   0(r16)
39         extbl   r1,   r16,  r1
40         subq    r2,   r1,   r2
41         subq    r2,   r0,   r0
42         ret     r31,  (r26),1
43 EPILOGUE(mpn_count_leading_zeros)
44 ASM_END()