1dnl S/390-32 mpn_addlsh1_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 9.25 35C z990 5 36C z9 ? 37C z10 ? 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(ADDSUBC, alr) 52 define(ADDSUBE, alcr) 53 define(INITCY, `lhi %r13, -1') 54 define(RETVAL, `alr %r1, %r13 55 lhi %r2, 2 56 alr %r2, %r1') 57 define(func, mpn_addlsh1_n) 58') 59ifdef(`OPERATION_sublsh1_n',` 60 define(ADDSUBC, slr) 61 define(ADDSUBE, slbr) 62 define(INITCY, `lhi %r13, 0') 63 define(RETVAL, `slr %r1, %r13 64 lhi %r2, 1 65 alr %r2, %r1') 66 define(func, mpn_sublsh1_n) 67') 68 69MULFUNC_PROLOGUE(mpn_addlsh1_n mpn_sublsh1_n) 70 71ASM_START() 72PROLOGUE(func) 73 stm %r6, %r13, 24(%r15) 74 75 la %r0, 3(n) 76 lhi %r7, 3 77 srl %r0, 2 78 nr %r7, n C n mod 4 79 je L(b0) 80 chi %r7, 2 81 jl L(b1) 82 je L(b2) 83 84L(b3): lm %r5, %r7, 0(up) 85 la up, 12(up) 86 lm %r9, %r11, 0(vp) 87 la vp, 12(vp) 88 89 alr %r9, %r9 90 alcr %r10, %r10 91 alcr %r11, %r11 92 slbr %r1, %r1 93 94 ADDSUBC %r5, %r9 95 ADDSUBE %r6, %r10 96 ADDSUBE %r7, %r11 97 slbr %r13, %r13 98 99 stm %r5, %r7, 0(rp) 100 la rp, 12(rp) 101 brct %r0, L(top) 102 j L(end) 103 104L(b0): lhi %r1, -1 105 INITCY 106 j L(top) 107 108L(b1): l %r5, 0(up) 109 la up, 4(up) 110 l %r9, 0(vp) 111 la vp, 4(vp) 112 113 alr %r9, %r9 114 slbr %r1, %r1 115 ADDSUBC %r5, %r9 116 slbr %r13, %r13 117 118 st %r5, 0(rp) 119 la rp, 4(rp) 120 brct %r0, L(top) 121 j L(end) 122 123L(b2): lm %r5, %r6, 0(up) 124 la up, 8(up) 125 lm %r9, %r10, 0(vp) 126 la vp, 8(vp) 127 128 alr %r9, %r9 129 alcr %r10, %r10 130 slbr %r1, %r1 131 132 ADDSUBC %r5, %r9 133 ADDSUBE %r6, %r10 134 slbr %r13, %r13 135 136 stm %r5, %r6, 0(rp) 137 la rp, 8(rp) 138 brct %r0, L(top) 139 j L(end) 140 141L(top): lm %r9, %r12, 0(vp) 142 la vp, 16(vp) 143 144 ahi %r1, 1 C restore carry 145 146 alcr %r9, %r9 147 alcr %r10, %r10 148 alcr %r11, %r11 149 alcr %r12, %r12 150 151 slbr %r1, %r1 C save carry 152 153 lm %r5, %r8, 0(up) 154 la up, 16(up) 155 156 ahi %r13, 1 C restore carry 157 158 ADDSUBE %r5, %r9 159 ADDSUBE %r6, %r10 160 ADDSUBE %r7, %r11 161 ADDSUBE %r8, %r12 162 163 slbr %r13, %r13 164 165 stm %r5, %r8, 0(rp) 166 la rp, 16(rp) 167 brct %r0, L(top) 168 169L(end): 170 RETVAL 171 lm %r6, %r13, 24(%r15) 172 br %r14 173EPILOGUE() 174