| 1 |
dnl SPARC v9-2011 simulation support. |
| 2 |
|
| 3 |
dnl Contributed to the GNU project by Torbjörn Granlund. |
| 4 |
|
| 5 |
dnl Copyright 2013 Free Software Foundation, Inc. |
| 6 |
|
| 7 |
dnl This file is part of the GNU MP Library. |
| 8 |
dnl |
| 9 |
dnl The GNU MP Library is free software; you can redistribute it and/or modify |
| 10 |
dnl it under the terms of either: |
| 11 |
dnl |
| 12 |
dnl * the GNU Lesser General Public License as published by the Free |
| 13 |
dnl Software Foundation; either version 3 of the License, or (at your |
| 14 |
dnl option) any later version. |
| 15 |
dnl |
| 16 |
dnl or |
| 17 |
dnl |
| 18 |
dnl * the GNU General Public License as published by the Free Software |
| 19 |
dnl Foundation; either version 2 of the License, or (at your option) any |
| 20 |
dnl later version. |
| 21 |
dnl |
| 22 |
dnl or both in parallel, as here. |
| 23 |
dnl |
| 24 |
dnl The GNU MP Library is distributed in the hope that it will be useful, but |
| 25 |
dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY |
| 26 |
dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
| 27 |
dnl for more details. |
| 28 |
dnl |
| 29 |
dnl You should have received copies of the GNU General Public License and the |
| 30 |
dnl GNU Lesser General Public License along with the GNU MP Library. If not, |
| 31 |
dnl see https://www.gnu.org/licenses/. |
| 32 |
|
| 33 |
include(`../config.m4') |
| 34 |
|
| 35 |
ASM_START() |
| 36 |
PROLOGUE(__gmpn_umulh) |
| 37 |
save %sp, -176, %sp |
| 38 |
ldx [%sp+2047+176+256], %o0 |
| 39 |
ldx [%sp+2047+176+256+8], %o1 |
| 40 |
rd %ccr, %o4 |
| 41 |
srl %o0, 0, %l4 |
| 42 |
srl %o1, 0, %l1 |
| 43 |
srlx %o1, 32, %o1 |
| 44 |
mulx %o1, %l4, %l2 |
| 45 |
srlx %o0, 32, %o0 |
| 46 |
mulx %o0, %l1, %l3 |
| 47 |
mulx %l1, %l4, %l1 |
| 48 |
srlx %l1, 32, %l1 |
| 49 |
add %l2, %l1, %l2 |
| 50 |
addcc %l2, %l3, %l2 |
| 51 |
mulx %o1, %o0, %o1 |
| 52 |
mov 0, %l1 |
| 53 |
movcs %xcc, 1, %l1 |
| 54 |
sllx %l1, 32, %l1 |
| 55 |
add %o1, %l1, %o1 |
| 56 |
srlx %l2, 32, %o0 |
| 57 |
add %o1, %o0, %o0 |
| 58 |
stx %o0, [%sp+2047+176+256] |
| 59 |
wr %o4, 0, %ccr |
| 60 |
ret |
| 61 |
restore |
| 62 |
EPILOGUE() |
| 63 |
|
| 64 |
PROLOGUE(__gmpn_lzcnt) |
| 65 |
save %sp, -176, %sp |
| 66 |
ldx [%sp+2047+176+256], %o0 |
| 67 |
brz,a %o0, 2f |
| 68 |
mov 64, %o1 |
| 69 |
brlz %o0, 2f |
| 70 |
mov 0, %o1 |
| 71 |
1: sllx %o0, 1, %o0 |
| 72 |
brgz %o0, 1b |
| 73 |
add %o1, 1, %o1 |
| 74 |
stx %o1, [%sp+2047+176+256] |
| 75 |
2: ret |
| 76 |
restore |
| 77 |
EPILOGUE() |