Austin Schuh | dace2a6 | 2020-08-18 10:56:48 -0700 | [diff] [blame] | 1 | dnl SPARC v9 mpn_lshiftc |
| 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 1&2: 3 |
| 37 | C UltraSPARC 3: 3 |
| 38 | C UltraSPARC T1: 17 |
| 39 | C UltraSPARC T3: 10 |
| 40 | C UltraSPARC T4: 3.5 |
| 41 | |
| 42 | C INPUT PARAMETERS |
| 43 | define(`rp', `%i0') |
| 44 | define(`up', `%i1') |
| 45 | define(`n', `%i2') |
| 46 | define(`cnt', `%i3') |
| 47 | |
| 48 | define(`tcnt', `%i4') |
| 49 | define(`retval', `%i5') |
| 50 | define(`u0', `%l0') |
| 51 | define(`u1', `%l1') |
| 52 | define(`r0', `%l6') |
| 53 | define(`r1', `%l7') |
| 54 | define(`u0_off', `%o0') |
| 55 | define(`u1_off', `%o1') |
| 56 | define(`r0_off', `%o2') |
| 57 | define(`r1_off', `%o3') |
| 58 | |
| 59 | ASM_START() |
| 60 | REGISTER(%g2,#scratch) |
| 61 | REGISTER(%g3,#scratch) |
| 62 | PROLOGUE(mpn_lshiftc) |
| 63 | save %sp, -176, %sp |
| 64 | |
| 65 | sllx n, 3, n |
| 66 | sub %g0, cnt, tcnt |
| 67 | |
| 68 | sub up, 8, u1_off |
| 69 | add rp, (5 * 8), r1_off |
| 70 | |
| 71 | ldx [n + u1_off], u1 C WAS: up - 8 |
| 72 | add u1_off, (3 * 8), u1_off |
| 73 | |
| 74 | sub r1_off, 8, r0_off |
| 75 | sub u1_off, 8, u0_off |
| 76 | |
| 77 | subcc n, (3 * 8), n |
| 78 | srlx u1, tcnt, retval |
| 79 | |
| 80 | bl,pn %xcc, L(end12) |
| 81 | sllx u1, cnt, %l3 |
| 82 | |
| 83 | ldx [n + u0_off], u0 C WAS: up - 16 |
| 84 | subcc n, (2 * 8), n |
| 85 | |
| 86 | ldx [n + u1_off], u1 C WAS: up - 24 |
| 87 | |
| 88 | bl,pn %xcc, L(end34) |
| 89 | srlx u0, tcnt, %l4 |
| 90 | |
| 91 | b,a L(top) |
| 92 | ALIGN(16) |
| 93 | L(top): |
| 94 | not %l3, %l3 |
| 95 | sllx u0, cnt, %l2 |
| 96 | |
| 97 | andn %l3, %l4, r0 |
| 98 | ldx [n + u0_off], u0 C WAS: up - 16 |
| 99 | |
| 100 | srlx u1, tcnt, %l5 |
| 101 | stx r0, [n + r0_off] C WAS: rp - 8 |
| 102 | |
| 103 | subcc n, (2 * 8), n |
| 104 | not %l2, %l2 |
| 105 | |
| 106 | sllx u1, cnt, %l3 |
| 107 | andn %l2, %l5, r1 |
| 108 | |
| 109 | ldx [n + u1_off], u1 C WAS: up - 24 |
| 110 | srlx u0, tcnt, %l4 |
| 111 | |
| 112 | bge,pt %xcc, L(top) |
| 113 | stx r1, [n + r1_off] C WAS: rp - 16 |
| 114 | |
| 115 | L(end34): |
| 116 | not %l3, %l3 |
| 117 | sllx u0, cnt, %l2 |
| 118 | |
| 119 | andn %l3, %l4, r0 |
| 120 | srlx u1, tcnt, %l5 |
| 121 | |
| 122 | stx r0, [n + r0_off] C WAS: rp - 8 |
| 123 | not %l2, %l2 |
| 124 | |
| 125 | andn %l2, %l5, r1 |
| 126 | sub n, (2 * 8), %o5 |
| 127 | |
| 128 | sllx u1, cnt, %l3 |
| 129 | stx r1, [%o5 + r1_off] C WAS: rp - 16 |
| 130 | |
| 131 | L(end12): |
| 132 | andcc n, 8, %g0 |
| 133 | bz %xcc, L(done)+4 |
| 134 | not %l3, %l3 |
| 135 | |
| 136 | ldx [n + u0_off], u1 |
| 137 | srlx u1, tcnt, %l4 |
| 138 | andn %l3, %l4, r0 |
| 139 | stx r0, [r0_off - 24] |
| 140 | sllx u1, cnt, %l3 |
| 141 | L(done): |
| 142 | not %l3, %l3 |
| 143 | stx %l3, [r0_off - 32] |
| 144 | |
| 145 | ret |
| 146 | restore retval, 0, %o0 |
| 147 | EPILOGUE() |