beta-0.89.2
[luatex.git] / source / libs / gmp / gmp-src / mpn / s390_32 / esame / mul_basecase.asm
blob2c8138d8d2826692d96ffb8ec8cb8d39c02516c4
1 dnl S/390-32/esame mpn_mul_basecase.
3 dnl Copyright 2011 Free Software Foundation, Inc.
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/.
31 include(`../config.m4')
33 C cycles/limb
34 C z900 ?
35 C z990 ?
36 C z9 ?
37 C z10 ?
38 C z196 ?
40 C TODO
41 C * Perhaps add special case for un <= 2.
42 C * Replace loops by faster code. The mul_1 and addmul_1 loops could be sped
43 C up by about 10%.
45 C INPUT PARAMETERS
46 define(`rp', `%r2')
47 define(`up', `%r3')
48 define(`un', `%r4')
49 define(`vp', `%r5')
50 define(`vn', `%r6')
52 define(`zero', `%r8')
54 ASM_START()
55 PROLOGUE(mpn_mul_basecase)
56 chi un, 2
57 jhe L(ge2)
59 C un = vn = 1
60 l %r1, 0(vp)
61 ml %r0, 0(up)
62 st %r1, 0(rp)
63 st %r0, 4(rp)
64 br %r14
66 L(ge2): C jne L(gen)
69 L(gen):
70 C mul_1 =======================================================================
72 stm %r6, %r12, 24(%r15)
73 lhi zero, 0
74 ahi un, -1
76 l %r7, 0(vp)
77 l %r11, 0(up)
78 lhi %r12, 4 C init index register
79 mlr %r10, %r7
80 lr %r9, un
81 st %r11, 0(rp)
82 cr %r15, %r15 C clear carry flag
84 L(tm): l %r1, 0(%r12,up)
85 mlr %r0, %r7
86 alcr %r1, %r10
87 lr %r10, %r0 C copy high part to carry limb
88 st %r1, 0(%r12,rp)
89 la %r12, 4(%r12)
90 brct %r9, L(tm)
92 alcr %r0, zero
93 st %r0, 0(%r12,rp)
95 C addmul_1 loop ===============================================================
97 ahi vn, -1
98 je L(outer_end)
99 L(outer_loop):
101 la rp, 4(rp) C rp += 1
102 la vp, 4(vp) C up += 1
103 l %r7, 0(vp)
104 l %r11, 0(up)
105 lhi %r12, 4 C init index register
106 mlr %r10, %r7
107 lr %r9, un
108 al %r11, 0(rp)
109 st %r11, 0(rp)
111 L(tam): l %r1, 0(%r12,up)
112 l %r11, 0(%r12,rp)
113 mlr %r0, %r7
114 alcr %r1, %r11
115 alcr %r0, zero
116 alr %r1, %r10
117 lr %r10, %r0
118 st %r1, 0(%r12,rp)
119 la %r12, 4(%r12)
120 brct %r9, L(tam)
122 alcr %r0, zero
123 st %r0, 0(%r12,rp)
125 brct vn, L(outer_loop)
126 L(outer_end):
128 lm %r6, %r12, 24(%r15)
129 br %r14
130 EPILOGUE()