1dnl SPARC T3/T4/T5 mpn_bdiv_dbm1c. 2 3dnl Contributed to the GNU project by Torbjörn Granlund. 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: 25 37C UltraSPARC T4/T5: 4 38 39C INPUT PARAMETERS 40define(`qp', `%i0') 41define(`ap', `%i1') 42define(`n', `%i2') 43define(`bd', `%i3') 44define(`h', `%i4') 45 46define(`plo0',`%g4') define(`plo1',`%g5') 47define(`phi0',`%l0') define(`phi1',`%l1') 48define(`a0', `%g1') define(`a1', `%g3') 49 50ASM_START() 51 REGISTER(%g2,#scratch) 52 REGISTER(%g3,#scratch) 53PROLOGUE(mpn_bdiv_dbm1c) 54 save %sp, -176, %sp 55 56 and n, 3, %g5 57 ldx [ap + 0], %g2 58 add n, -5, n 59 brz %g5, L(b0) 60 cmp %g5, 2 61 bcs %xcc, L(b1) 62 nop 63 be %xcc, L(b2) 64 nop 65 66L(b3): ldx [ap + 8], a0 67 mulx bd, %g2, plo1 68 umulxhi(bd, %g2, phi1) 69 ldx [ap + 16], a1 70 add qp, -24, qp 71 b L(lo3) 72 add ap, -8, ap 73 74L(b2): ldx [ap + 8], a1 75 mulx bd, %g2, plo0 76 umulxhi(bd, %g2, phi0) 77 brlz,pt n, L(wd2) 78 nop 79L(gt2): ldx [ap + 16], a0 80 add ap, 16, ap 81 b L(lo2) 82 add n, -1, n 83 84L(b1): mulx bd, %g2, plo1 85 umulxhi(bd, %g2, phi1) 86 brlz,pn n, L(wd1) 87 add qp, -8, qp 88L(gt1): ldx [ap + 8], a0 89 ldx [ap + 16], a1 90 b L(lo1) 91 add ap, 8, ap 92 93L(b0): ldx [ap + 8], a1 94 mulx bd, %g2, plo0 95 umulxhi(bd, %g2, phi0) 96 ldx [ap + 16], a0 97 b L(lo0) 98 add qp, -16, qp 99 100L(top): ldx [ap + 0], a0 101 sub h, phi1, h 102L(lo2): mulx bd, a1, plo1 103 umulxhi(bd, a1, phi1) 104 subcc h, plo0, h 105 addxc( phi0, %g0, phi0) 106 stx h, [qp + 0] 107 ldx [ap + 8], a1 108 sub h, phi0, h 109L(lo1): mulx bd, a0, plo0 110 umulxhi(bd, a0, phi0) 111 subcc h, plo1, h 112 addxc( phi1, %g0, phi1) 113 stx h, [qp + 8] 114 ldx [ap + 16], a0 115 sub h, phi1, h 116L(lo0): mulx bd, a1, plo1 117 umulxhi(bd, a1, phi1) 118 subcc h, plo0, h 119 addxc( phi0, %g0, phi0) 120 stx h, [qp + 16] 121 ldx [ap + 24], a1 122 sub h, phi0, h 123L(lo3): mulx bd, a0, plo0 124 umulxhi(bd, a0, phi0) 125 subcc h, plo1, h 126 addxc( phi1, %g0, phi1) 127 stx h, [qp + 24] 128 add ap, 32, ap 129 add qp, 32, qp 130 brgz,pt n, L(top) 131 add n, -4, n 132 133L(end): sub h, phi1, h 134L(wd2): mulx bd, a1, plo1 135 umulxhi(bd, a1, phi1) 136 subcc h, plo0, h 137 addxc( phi0, %g0, phi0) 138 stx h, [qp + 0] 139 sub h, phi0, h 140L(wd1): subcc h, plo1, h 141 addxc( phi1, %g0, phi1) 142 stx h, [qp + 8] 143 sub h, phi1, %i0 144 145 ret 146 restore 147EPILOGUE() 148