1dnl SPARC v9 mpn_hamdist for T3/T4. 2 3dnl Contributed to the GNU project by David Miller. 4 5dnl Copyright 2013 Free Software Foundation, Inc. 6 7dnl This file is part of the GNU MP Library. 8dnl 9dnl The GNU MP Library is free software; you can redistribute it and/or modify 10dnl it under the terms of either: 11dnl 12dnl * the GNU Lesser General Public License as published by the Free 13dnl Software Foundation; either version 3 of the License, or (at your 14dnl option) any later version. 15dnl 16dnl or 17dnl 18dnl * the GNU General Public License as published by the Free Software 19dnl Foundation; either version 2 of the License, or (at your option) any 20dnl later version. 21dnl 22dnl or both in parallel, as here. 23dnl 24dnl The GNU MP Library is distributed in the hope that it will be useful, but 25dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 26dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 27dnl for more details. 28dnl 29dnl You should have received copies of the GNU General Public License and the 30dnl GNU Lesser General Public License along with the GNU MP Library. If not, 31dnl see https://www.gnu.org/licenses/. 32 33include(`../config.m4') 34 35C cycles/limb 36C UltraSPARC T3: 18 37C UltraSPARC T4: 3.5 38 39C INPUT PARAMETERS 40define(`up', `%o0') 41define(`vp', `%o1') 42define(`n', `%o2') 43define(`pcnt', `%o5') 44 45ASM_START() 46 REGISTER(%g2,#scratch) 47 REGISTER(%g3,#scratch) 48PROLOGUE(mpn_hamdist) 49 subcc n, 1, n 50 be L(final_one) 51 clr pcnt 52L(top): 53 ldx [up + 0], %g1 54 ldx [vp + 0], %g2 55 ldx [up + 8], %o4 56 ldx [vp + 8], %g3 57 sub n, 2, n 58 xor %g1, %g2, %g1 59 add up, 16, up 60 popc %g1, %g2 61 add vp, 16, vp 62 xor %o4, %g3, %o4 63 add pcnt, %g2, pcnt 64 popc %o4, %g3 65 brgz n, L(top) 66 add pcnt, %g3, pcnt 67 brlz,pt n, L(done) 68 nop 69L(final_one): 70 ldx [up + 0], %g1 71 ldx [vp + 0], %g2 72 xor %g1,%g2, %g1 73 popc %g1, %g2 74 add pcnt, %g2, pcnt 75L(done): 76 retl 77 mov pcnt, %o0 78EPILOGUE() 79