1 dnl Alpha mpn_mod_1s_4p
3 dnl Contributed to the GNU project by Torbjorn Granlund.
5 dnl Copyright 2009, 2010 Free Software Foundation, Inc.
7 dnl This file is part of the GNU MP Library.
9 dnl The GNU MP Library is free software; you can redistribute it and/or modify
10 dnl it under the terms of the GNU Lesser General Public License as published
11 dnl by the Free Software Foundation; either version 3 of the License, or (at
12 dnl your option) any later version.
14 dnl The GNU MP Library is distributed in the hope that it will be useful, but
15 dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
16 dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
17 dnl License for more details.
19 dnl You should have received a copy of the GNU Lesser General Public License
20 dnl along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
22 include(`../config.m4')
25 C * Optimise. 2.75 c/l should be possible.
26 C * Write a proper mpn_mod_1s_4p_cps. The code below was compiler generated.
27 C * Optimise feed-in code, starting the sw pipeline in switch code.
28 C * Shorten software pipeline. The mul instructions are scheduled too far
29 C from their users. Fixing this will allow us to use fewer registers.
30 C * If we cannot reduce register usage, write perhaps small-n basecase.
31 C * Does this work for PIC?
44 define(`B1modb', `r1')
45 define(`B2modb', `r2')
46 define(`B3modb', `r3')
47 define(`B4modb', `r4')
48 define(`B5modb', `r5')
51 PROLOGUE(mpn_mod_1s_4p)
63 s8addq n, ap, ap C point ap at vector end
72 L(b3): ldq r21, -16(ap)
76 umulh r21, B1modb, r12
78 umulh r22, B2modb, r13
89 L(b0): ldq r21, -24(ap)
94 umulh r21, B1modb, r12
96 umulh r22, B2modb, r13
98 umulh r23, B3modb, r27
113 L(b1): bis r31, r31, rh
118 L(b2): ldq rh, -8(ap)
122 L(com): ble n, L(ed3)
130 umulh r21, B1modb, r12
132 umulh r22, B2modb, r13
133 mulq r23, B3modb, r10
134 umulh r23, B3modb, r27
136 umulh rl, B4modb, r28
140 L(top): ldq r21, 8(ap)
152 umulh r21, B1modb, r12
160 umulh r22, B2modb, r13
164 mulq r23, B3modb, r10
167 umulh r23, B3modb, r27
172 umulh rl, B4modb, r28
177 L(ed2): mulq rh, B5modb, rl
199 L(ed3): mulq rh, B1modb, r8
205 ldq r24, 8(r19) C cnt
220 mulq r9, r18, r21 C qh * b
222 cmpult r8, rl, r0 C rl > ql
226 cmpule r18, rl, r0 C rl >= b
242 PROLOGUE(mpn_mod_1s_4p_cps,gp)
266 jsr r26, mpn_invert_limb