1dnl S/390-64 mpn_rshift. 2 3dnl Copyright 2011, 2014 Free Software Foundation, Inc. 4 5dnl This file is part of the GNU MP Library. 6dnl 7dnl The GNU MP Library is free software; you can redistribute it and/or modify 8dnl it under the terms of either: 9dnl 10dnl * the GNU Lesser General Public License as published by the Free 11dnl Software Foundation; either version 3 of the License, or (at your 12dnl option) any later version. 13dnl 14dnl or 15dnl 16dnl * the GNU General Public License as published by the Free Software 17dnl Foundation; either version 2 of the License, or (at your option) any 18dnl later version. 19dnl 20dnl or both in parallel, as here. 21dnl 22dnl The GNU MP Library is distributed in the hope that it will be useful, but 23dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 24dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 25dnl for more details. 26dnl 27dnl You should have received copies of the GNU General Public License and the 28dnl GNU Lesser General Public License along with the GNU MP Library. If not, 29dnl see https://www.gnu.org/licenses/. 30 31include(`../config.m4') 32 33C cycles/limb 34C z900 7 35C z990 3 36C z9 ? 37C z10 6 38C z196 ? 39 40C NOTES 41C * See notes in lshift.asm. 42 43C INPUT PARAMETERS 44define(`rp', `%r2') 45define(`up', `%r3') 46define(`n', `%r4') 47define(`cnt', `%r5') 48 49define(`tnc', `%r6') 50 51ASM_START() 52PROLOGUE(mpn_rshift) 53 cghi n, 3 54 jh L(gt1) 55 56 stmg %r6, %r7, 48(%r15) 57 larl %r1, L(tab)-4 58 lcgr tnc, cnt 59 sllg n, n, 2 60 b 0(n,%r1) 61L(tab): j L(n1) 62 j L(n2) 63 j L(n3) 64 65L(n1): lg %r1, 0(up) 66 srlg %r0, %r1, 0(cnt) 67 stg %r0, 0(rp) 68 sllg %r2, %r1, 0(tnc) 69 lg %r6, 48(%r15) C restoring r7 not needed 70 br %r14 71 72L(n2): lg %r1, 0(up) 73 sllg %r4, %r1, 0(tnc) 74 srlg %r0, %r1, 0(cnt) 75 lg %r1, 8(up) 76 sllg %r7, %r1, 0(tnc) 77 ogr %r7, %r0 78 srlg %r0, %r1, 0(cnt) 79 stg %r7, 0(rp) 80 stg %r0, 8(rp) 81 lgr %r2, %r4 82 lmg %r6, %r7, 48(%r15) 83 br %r14 84 85 86L(n3): lg %r1, 0(up) 87 sllg %r4, %r1, 0(tnc) 88 srlg %r0, %r1, 0(cnt) 89 lg %r1, 8(up) 90 sllg %r7, %r1, 0(tnc) 91 ogr %r7, %r0 92 srlg %r0, %r1, 0(cnt) 93 stg %r7, 0(rp) 94 lg %r1, 16(up) 95 sllg %r7, %r1, 0(tnc) 96 ogr %r7, %r0 97 srlg %r0, %r1, 0(cnt) 98 stg %r7, 8(rp) 99 stg %r0, 16(rp) 100 lgr %r2, %r4 101 lmg %r6, %r7, 48(%r15) 102 br %r14 103 104L(gt1): stmg %r6, %r13, 48(%r15) 105 lcgr tnc, cnt C tnc = -cnt 106 107 sllg %r1, n, 3 108 srlg %r0, n, 2 C loop count 109 110 lghi %r7, 3 111 ngr %r7, n 112 je L(b0) 113 cghi %r7, 2 114 jl L(b1) 115 je L(b2) 116 117L(b3): aghi rp, -8 118 lg %r7, 0(up) 119 sllg %r9, %r7, 0(tnc) 120 srlg %r11, %r7, 0(cnt) 121 lg %r8, 8(up) 122 lg %r7, 16(up) 123 sllg %r4, %r8, 0(tnc) 124 srlg %r13, %r8, 0(cnt) 125 ogr %r11, %r4 126 la up, 24(up) 127 j L(lm3) 128 129L(b2): aghi rp, -16 130 lg %r8, 0(up) 131 lg %r7, 8(up) 132 sllg %r9, %r8, 0(tnc) 133 srlg %r13, %r8, 0(cnt) 134 la up, 16(up) 135 j L(lm2) 136 137L(b1): aghi rp, -24 138 lg %r7, 0(up) 139 sllg %r9, %r7, 0(tnc) 140 srlg %r11, %r7, 0(cnt) 141 lg %r8, 8(up) 142 lg %r7, 16(up) 143 sllg %r4, %r8, 0(tnc) 144 srlg %r10, %r8, 0(cnt) 145 ogr %r11, %r4 146 la up, 8(up) 147 j L(lm1) 148 149L(b0): aghi rp, -32 150 lg %r8, 0(up) 151 lg %r7, 8(up) 152 sllg %r9, %r8, 0(tnc) 153 srlg %r10, %r8, 0(cnt) 154 j L(lm0) 155 156 ALIGN(8) 157L(top): sllg %r4, %r8, 0(tnc) 158 srlg %r13, %r8, 0(cnt) 159 ogr %r11, %r4 160 stg %r10, 0(rp) 161L(lm3): stg %r11, 8(rp) 162L(lm2): sllg %r12, %r7, 0(tnc) 163 srlg %r11, %r7, 0(cnt) 164 lg %r8, 0(up) 165 lg %r7, 8(up) 166 ogr %r13, %r12 167 sllg %r4, %r8, 0(tnc) 168 srlg %r10, %r8, 0(cnt) 169 ogr %r11, %r4 170 stg %r13, 16(rp) 171L(lm1): stg %r11, 24(rp) 172L(lm0): sllg %r12, %r7, 0(tnc) 173 aghi rp, 32 174 srlg %r11, %r7, 0(cnt) 175 lg %r8, 16(up) 176 lg %r7, 24(up) 177 aghi up, 32 178 ogr %r10, %r12 179 brctg %r0, L(top) 180 181L(end): sllg %r4, %r8, 0(tnc) 182 srlg %r13, %r8, 0(cnt) 183 ogr %r11, %r4 184 stg %r10, 0(rp) 185 stg %r11, 8(rp) 186 sllg %r12, %r7, 0(tnc) 187 srlg %r11, %r7, 0(cnt) 188 ogr %r13, %r12 189 stg %r13, 16(rp) 190 stg %r11, 24(rp) 191 lgr %r2, %r9 192 193 lmg %r6, %r13, 48(%r15) 194 br %r14 195EPILOGUE() 196