sublsh1_n.asm revision 1.1.1.2
1dnl S/390-64 mpn_sublsh1_n 2 3dnl Copyright 2011 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 10 35C z990 5 36C z9 ? 37C z10 12 38C z196 ? 39 40C TODO 41C * Optimise for small n 42C * Compute RETVAL for sublsh1_n less stupidly 43 44C INPUT PARAMETERS 45define(`rp', `%r2') 46define(`up', `%r3') 47define(`vp', `%r4') 48define(`n', `%r5') 49 50ifdef(`OPERATION_addlsh1_n',` 51 define(ADSBR, algr) 52 define(ADSBCR, alcgr) 53 define(INITCY, `lghi %r13, -1') 54 define(RETVAL, `la %r2, 2(%r1,%r13)') 55 define(func, mpn_addlsh1_n) 56') 57ifdef(`OPERATION_sublsh1_n',` 58 define(ADSBR, slgr) 59 define(ADSBCR, slbgr) 60 define(INITCY, `lghi %r13, 0') 61 define(RETVAL,`dnl 62 slgr %r1, %r13 63 lghi %r2, 1 64 algr %r2, %r1') 65 define(func, mpn_sublsh1_n) 66') 67 68ASM_START() 69PROLOGUE(mpn_sublsh1_n) 70 stmg %r6, %r13, 48(%r15) 71 72 aghi n, 3 73 lghi %r7, 3 74 srlg %r0, n, 2 75 ngr %r7, n C n mod 4 76 je L(b1) 77 cghi %r7, 2 78 jl L(b2) 79 jne L(b0) 80 81L(b3): lmg %r5, %r7, 0(up) 82 la up, 24(up) 83 lmg %r9, %r11, 0(vp) 84 la vp, 24(vp) 85 86 algr %r9, %r9 87 alcgr %r10, %r10 88 alcgr %r11, %r11 89 slbgr %r1, %r1 90 91 ADSBR %r5, %r9 92 ADSBCR %r6, %r10 93 ADSBCR %r7, %r11 94 slbgr %r13, %r13 95 96 stmg %r5, %r7, 0(rp) 97 la rp, 24(rp) 98 brctg %r0, L(top) 99 j L(end) 100 101L(b0): lghi %r1, -1 102 INITCY 103 j L(top) 104 105L(b1): lg %r5, 0(up) 106 la up, 8(up) 107 lg %r9, 0(vp) 108 la vp, 8(vp) 109 110 algr %r9, %r9 111 slbgr %r1, %r1 112 ADSBR %r5, %r9 113 slbgr %r13, %r13 114 115 stg %r5, 0(rp) 116 la rp, 8(rp) 117 brctg %r0, L(top) 118 j L(end) 119 120L(b2): lmg %r5, %r6, 0(up) 121 la up, 16(up) 122 lmg %r9, %r10, 0(vp) 123 la vp, 16(vp) 124 125 algr %r9, %r9 126 alcgr %r10, %r10 127 slbgr %r1, %r1 128 129 ADSBR %r5, %r9 130 ADSBCR %r6, %r10 131 slbgr %r13, %r13 132 133 stmg %r5, %r6, 0(rp) 134 la rp, 16(rp) 135 brctg %r0, L(top) 136 j L(end) 137 138L(top): lmg %r9, %r12, 0(vp) 139 la vp, 32(vp) 140 141 aghi %r1, 1 C restore carry 142 143 alcgr %r9, %r9 144 alcgr %r10, %r10 145 alcgr %r11, %r11 146 alcgr %r12, %r12 147 148 slbgr %r1, %r1 C save carry 149 150 lmg %r5, %r8, 0(up) 151 la up, 32(up) 152 153 aghi %r13, 1 C restore carry 154 155 ADSBCR %r5, %r9 156 ADSBCR %r6, %r10 157 ADSBCR %r7, %r11 158 ADSBCR %r8, %r12 159 160 slbgr %r13, %r13 C save carry 161 162 stmg %r5, %r8, 0(rp) 163 la rp, 32(rp) 164 brctg %r0, L(top) 165 166L(end): RETVAL 167 lmg %r6, %r13, 48(%r15) 168 br %r14 169EPILOGUE() 170