github.com/aergoio/aergo@v1.3.1/libtool/src/gmp-6.1.2/mpn/s390_64/logops_n.asm (about) 1 dnl S/390-64 logops. 2 3 dnl Copyright 2011 Free Software Foundation, Inc. 4 5 dnl This file is part of the GNU MP Library. 6 dnl 7 dnl The GNU MP Library is free software; you can redistribute it and/or modify 8 dnl it under the terms of either: 9 dnl 10 dnl * the GNU Lesser General Public License as published by the Free 11 dnl Software Foundation; either version 3 of the License, or (at your 12 dnl option) any later version. 13 dnl 14 dnl or 15 dnl 16 dnl * the GNU General Public License as published by the Free Software 17 dnl Foundation; either version 2 of the License, or (at your option) any 18 dnl later version. 19 dnl 20 dnl or both in parallel, as here. 21 dnl 22 dnl The GNU MP Library is distributed in the hope that it will be useful, but 23 dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 24 dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 25 dnl for more details. 26 dnl 27 dnl You should have received copies of the GNU General Public License and the 28 dnl GNU Lesser General Public License along with the GNU MP Library. If not, 29 dnl see https://www.gnu.org/licenses/. 30 31 include(`../config.m4') 32 33 C cycles/limb variant 1 variant 2 variant 3 34 C rp!=up rp=up 35 C z900 4.5 2.25 5.5 5.5 36 C z990 2.75 2 3.25 3.25 37 C z9 ? ? ? 38 C z10 3.25 3.75 3.75 39 C z196 ? ? ? 40 41 C INPUT PARAMETERS 42 define(`rp', `%r2') 43 define(`up', `%r3') 44 define(`vp', `%r4') 45 define(`n', `%r5') 46 47 ifdef(`OPERATION_and_n',` 48 define(`func',`mpn_and_n') 49 define(`VARIANT_1') 50 define(`LOGOPC',`nc') 51 define(`LOGOP',`ng')') 52 ifdef(`OPERATION_andn_n',` 53 define(`func',`mpn_andn_n') 54 define(`VARIANT_2') 55 define(`LOGOP',`ng')') 56 ifdef(`OPERATION_nand_n',` 57 define(`func',`mpn_nand_n') 58 define(`VARIANT_3') 59 define(`LOGOP',`ng')') 60 ifdef(`OPERATION_ior_n',` 61 define(`func',`mpn_ior_n') 62 define(`VARIANT_1') 63 define(`LOGOPC',`oc') 64 define(`LOGOP',`og')') 65 ifdef(`OPERATION_iorn_n',` 66 define(`func',`mpn_iorn_n') 67 define(`VARIANT_2') 68 define(`LOGOP',`og')') 69 ifdef(`OPERATION_nior_n',` 70 define(`func',`mpn_nior_n') 71 define(`VARIANT_3') 72 define(`LOGOP',`og')') 73 ifdef(`OPERATION_xor_n',` 74 define(`func',`mpn_xor_n') 75 define(`VARIANT_1') 76 define(`LOGOPC',`xc') 77 define(`LOGOP',`xg')') 78 ifdef(`OPERATION_xnor_n',` 79 define(`func',`mpn_xnor_n') 80 define(`VARIANT_2') 81 define(`LOGOP',`xg')') 82 83 MULFUNC_PROLOGUE(mpn_and_n mpn_andn_n mpn_nand_n mpn_ior_n mpn_iorn_n mpn_nior_n mpn_xor_n mpn_xnor_n) 84 85 ASM_START() 86 PROLOGUE(func) 87 ifdef(`VARIANT_1',` 88 cgr rp, up 89 jne L(normal) 90 91 sllg n, n, 3 92 aghi n, -1 93 srlg %r1, n, 8 94 ltgr %r1, %r1 C < 256 bytes to copy? 95 je L(1) 96 97 L(tp): LOGOPC 0(256, rp), 0(vp) 98 la rp, 256(rp) 99 la vp, 256(vp) 100 brctg %r1, L(tp) 101 102 L(1): bras %r1, L(2) C make r1 point to mvc insn 103 LOGOPC 0(1, rp), 0(vp) 104 L(2): ex n, 0(%r1) C execute mvc with length ((n-1) mod 256)+1 105 L(rtn): br %r14 106 107 108 L(normal): 109 stmg %r6, %r8, 48(%r15) 110 aghi n, 3 111 lghi %r7, 3 112 srlg %r0, n, 2 113 ngr %r7, n C n mod 4 114 je L(b1) 115 cghi %r7, 2 116 jl L(b2) 117 jne L(top) 118 119 L(b3): lmg %r5, %r7, 0(up) 120 la up, 24(up) 121 LOGOP %r5, 0(vp) 122 LOGOP %r6, 8(vp) 123 LOGOP %r7, 16(vp) 124 stmg %r5, %r7, 0(rp) 125 la rp, 24(rp) 126 la vp, 24(vp) 127 j L(mid) 128 129 L(b1): lg %r5, 0(up) 130 la up, 8(up) 131 LOGOP %r5, 0(vp) 132 stg %r5, 0(rp) 133 la rp, 8(rp) 134 la vp, 8(vp) 135 j L(mid) 136 137 L(b2): lmg %r5, %r6, 0(up) 138 la up, 16(up) 139 LOGOP %r5, 0(vp) 140 LOGOP %r6, 8(vp) 141 stmg %r5, %r6, 0(rp) 142 la rp, 16(rp) 143 la vp, 16(vp) 144 j L(mid) 145 146 L(top): lmg %r5, %r8, 0(up) 147 la up, 32(up) 148 LOGOP %r5, 0(vp) 149 LOGOP %r6, 8(vp) 150 LOGOP %r7, 16(vp) 151 LOGOP %r8, 24(vp) 152 stmg %r5, %r8, 0(rp) 153 la rp, 32(rp) 154 la vp, 32(vp) 155 L(mid): brctg %r0, L(top) 156 157 lmg %r6, %r8, 48(%r15) 158 br %r14 159 ') 160 161 ifdef(`VARIANT_2',` 162 stmg %r6, %r8, 48(%r15) 163 lghi %r1, -1 164 165 aghi n, 3 166 lghi %r7, 3 167 srlg %r0, n, 2 168 ngr %r7, n C n mod 4 169 je L(b1) 170 cghi %r7, 2 171 jl L(b2) 172 jne L(top) 173 174 L(b3): lmg %r5, %r7, 0(vp) 175 la vp, 24(vp) 176 xgr %r5, %r1 177 xgr %r6, %r1 178 xgr %r7, %r1 179 LOGOP %r5, 0(up) 180 LOGOP %r6, 8(up) 181 LOGOP %r7, 16(up) 182 stmg %r5, %r7, 0(rp) 183 la rp, 24(rp) 184 la up, 24(up) 185 j L(mid) 186 187 L(b1): lg %r5, 0(vp) 188 la vp, 8(vp) 189 xgr %r5, %r1 190 LOGOP %r5, 0(up) 191 stg %r5, 0(rp) 192 la rp, 8(rp) 193 la up, 8(up) 194 j L(mid) 195 196 L(b2): lmg %r5, %r6, 0(vp) 197 la vp, 16(vp) 198 xgr %r5, %r1 199 xgr %r6, %r1 200 LOGOP %r5, 0(up) 201 LOGOP %r6, 8(up) 202 stmg %r5, %r6, 0(rp) 203 la rp, 16(rp) 204 la up, 16(up) 205 j L(mid) 206 207 L(top): lmg %r5, %r8, 0(vp) 208 la vp, 32(vp) 209 xgr %r5, %r1 210 xgr %r6, %r1 211 xgr %r7, %r1 212 xgr %r8, %r1 213 LOGOP %r5, 0(up) 214 LOGOP %r6, 8(up) 215 LOGOP %r7, 16(up) 216 LOGOP %r8, 24(up) 217 la up, 32(up) 218 stmg %r5, %r8, 0(rp) 219 la rp, 32(rp) 220 L(mid): brctg %r0, L(top) 221 222 lmg %r6, %r8, 48(%r15) 223 br %r14 224 ') 225 226 ifdef(`VARIANT_3',` 227 stmg %r6, %r8, 48(%r15) 228 lghi %r1, -1 229 230 aghi n, 3 231 lghi %r7, 3 232 srlg %r0, n, 2 233 ngr %r7, n C n mod 4 234 je L(b1) 235 cghi %r7, 2 236 jl L(b2) 237 jne L(top) 238 239 L(b3): lmg %r5, %r7, 0(vp) 240 la vp, 24(vp) 241 LOGOP %r5, 0(up) 242 LOGOP %r6, 8(up) 243 xgr %r5, %r1 244 xgr %r6, %r1 245 LOGOP %r7, 16(up) 246 xgr %r7, %r1 247 stmg %r5, %r7, 0(rp) 248 la rp, 24(rp) 249 la up, 24(up) 250 j L(mid) 251 252 L(b1): lg %r5, 0(vp) 253 la vp, 8(vp) 254 LOGOP %r5, 0(up) 255 xgr %r5, %r1 256 stg %r5, 0(rp) 257 la rp, 8(rp) 258 la up, 8(up) 259 j L(mid) 260 261 L(b2): lmg %r5, %r6, 0(vp) 262 la vp, 16(vp) 263 LOGOP %r5, 0(up) 264 LOGOP %r6, 8(up) 265 xgr %r5, %r1 266 xgr %r6, %r1 267 stmg %r5, %r6, 0(rp) 268 la rp, 16(rp) 269 la up, 16(up) 270 j L(mid) 271 272 L(top): lmg %r5, %r8, 0(vp) 273 la vp, 32(vp) 274 LOGOP %r5, 0(up) 275 LOGOP %r6, 8(up) 276 xgr %r5, %r1 277 xgr %r6, %r1 278 LOGOP %r7, 16(up) 279 LOGOP %r8, 24(up) 280 xgr %r7, %r1 281 xgr %r8, %r1 282 stmg %r5, %r8, 0(rp) 283 la up, 32(up) 284 la rp, 32(rp) 285 L(mid): brctg %r0, L(top) 286 287 lmg %r6, %r8, 48(%r15) 288 br %r14 289 ') 290 291 EPILOGUE()