1dnl  S/390-64 mpn_mod_34lsub1
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               5.8
35C z990           2
36C z9                 ?
37C z10                4.5
38C z196               ?
39
40C TODO
41C  * Optimise summation code, see x86_64.
42
43C INPUT PARAMETERS
44define(`rp',        `%r2')
45define(`n',         `%r3')
46
47ASM_START()
48PROLOGUE(mpn_mod_34lsub1)
49          stmg      %r7, %r12, 56(%r15)
50          lghi      %r11, 0
51          lghi      %r12, 0
52          lghi      %r0, 0
53          lghi      %r8, 0
54          lghi      %r9, 0
55          lghi      %r10, 0
56          lghi      %r7, 0
57          aghi      %r3, -3
58          jl        .L3
59
60L(top):   alg       %r0, 0(%r2)
61          alcg      %r12, 8(%r2)
62          alcg      %r11, 16(%r2)
63          alcgr     %r8, %r7
64          la        %r2, 24(%r2)
65          aghi      %r3, -3
66          jnl       L(top)
67
68          lgr       %r7, %r8
69          srlg      %r1, %r11, 16
70          nihh      %r7, 0                        C 0xffffffffffff
71          agr       %r7, %r1
72          srlg      %r8, %r8, 48
73          agr       %r7, %r8
74          sllg      %r11, %r11, 32
75          nihh      %r11, 0
76          agr       %r7, %r11
77.L3:
78          cghi      %r3, -3
79          je        .L6
80          alg       %r0, 0(%r2)
81          alcgr     %r10, %r10
82          cghi      %r3, -2
83          je        .L6
84          alg       %r12, 8(%r2)
85          alcgr     %r9, %r9
86.L6:
87          srlg      %r1, %r0, 48
88          nihh      %r0, 0                        C 0xffffffffffff
89          agr       %r0, %r1
90          agr       %r0, %r7
91          srlg      %r1, %r12, 32
92          agr       %r0, %r1
93          srlg      %r1, %r10, 32
94          agr       %r0, %r1
95          llgfr     %r12, %r12
96          srlg      %r1, %r9, 16
97          sllg      %r12, %r12, 16
98          llgfr     %r10, %r10
99          agr       %r0, %r1
100          llill     %r2, 65535
101          agr       %r0, %r12
102          sllg      %r10, %r10, 16
103          ngr       %r2, %r9
104          agr       %r0, %r10
105          sllg      %r2, %r2, 32
106          agr       %r2, %r0
107          lmg       %r7, %r12, 56(%r15)
108          br        %r14
109EPILOGUE()
110