github.com/aergoio/aergo@v1.3.1/libtool/src/gmp-6.1.2/mpn/sparc64/ultrasparct3/sub_n.asm (about) 1 dnl SPARC v9 mpn_sub_n for T3/T4. 2 3 dnl Contributed to the GNU project by David Miller. 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 C cycles/limb 36 C UltraSPARC T3: 8 37 C UltraSPARC T4: 3 38 39 C INPUT PARAMETERS 40 define(`rp', `%i0') 41 define(`up', `%i1') 42 define(`vp', `%i2') 43 define(`n', `%i3') 44 define(`cy', `%i4') 45 46 define(`u0_off', `%l0') 47 define(`u1_off', `%l1') 48 define(`v0_off', `%l2') 49 define(`v1_off', `%l3') 50 define(`r0_off', `%l4') 51 define(`r1_off', `%l5') 52 define(`loop_n', `%l6') 53 define(`tmp', `%l7') 54 55 ASM_START() 56 REGISTER(%g2,#scratch) 57 REGISTER(%g3,#scratch) 58 PROLOGUE(mpn_sub_nc) 59 save %sp, -176, %sp 60 ba,pt %xcc, L(ent) 61 xor cy, 1, cy 62 EPILOGUE() 63 PROLOGUE(mpn_sub_n) 64 save %sp, -176, %sp 65 mov 1, cy 66 L(ent): 67 subcc n, 1, n 68 be L(final_one) 69 cmp %g0, cy 70 71 ldx [up + 0], %o4 72 sllx n, 3, tmp 73 74 ldx [vp + 0], %o5 75 add up, tmp, u0_off 76 77 ldx [up + 8], %g5 78 add vp, tmp, v0_off 79 80 ldx [vp + 8], %g1 81 add rp, tmp, r0_off 82 83 neg tmp, loop_n 84 add u0_off, 8, u1_off 85 86 add v0_off, 8, v1_off 87 sub loop_n, -(2 * 8), loop_n 88 89 sub r0_off, 16, r0_off 90 brgez,pn loop_n, L(loop_tail) 91 sub r0_off, 8, r1_off 92 93 b,a L(top) 94 ALIGN(16) 95 L(top): 96 xnor %o5, 0, tmp 97 ldx [loop_n + v0_off], %o5 98 99 addxccc(%o4, tmp, %g3) 100 ldx [loop_n + u0_off], %o4 101 102 xnor %g1, 0, %g1 103 stx %g3, [loop_n + r0_off] 104 105 addxccc(%g5, %g1, tmp) 106 ldx [loop_n + v1_off], %g1 107 108 ldx [loop_n + u1_off], %g5 109 sub loop_n, -(2 * 8), loop_n 110 111 brlz loop_n, L(top) 112 stx tmp, [loop_n + r1_off] 113 114 L(loop_tail): 115 xnor %o5, 0, tmp 116 xnor %g1, 0, %g1 117 118 addxccc(%o4, tmp, %g3) 119 add loop_n, u0_off, up 120 121 addxccc(%g5, %g1, %g5) 122 add loop_n, r0_off, rp 123 124 stx %g3, [rp + 0] 125 add loop_n, v0_off, vp 126 127 brgz,pt loop_n, L(done) 128 stx %g5, [rp + 8] 129 130 add rp, (2 * 8), rp 131 132 L(final_one): 133 ldx [up+0], %o4 134 ldx [vp+0], %o5 135 xnor %o5, %g0, %o5 136 addxccc(%o4, %o5, %g3) 137 stx %g3, [rp+0] 138 139 L(done): 140 clr %i0 141 movcc %xcc, 1, %i0 142 ret 143 restore 144 EPILOGUE()