xref: /netbsd-src/external/lgpl3/gmp/dist/mpn/s390_32/lshift.asm (revision 6d322f2f4598f0d8a138f10ea648ec4fabe41f8b)
1dnl  S/390-32 mpn_lshift.
2
3dnl  Copyright 2011 Free Software Foundation, Inc.
4
5dnl  This file is part of the GNU MP Library.
6
7dnl  The GNU MP Library is free software; you can redistribute it and/or modify
8dnl  it under the terms of the GNU Lesser General Public License as published
9dnl  by the Free Software Foundation; either version 3 of the License, or (at
10dnl  your option) any later version.
11
12dnl  The GNU MP Library is distributed in the hope that it will be useful, but
13dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
15dnl  License for more details.
16
17dnl  You should have received a copy of the GNU Lesser General Public License
18dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
19
20include(`../config.m4')
21
22C            cycles/limb
23C z900		 6
24C z990	         3
25C z9		 ?
26C z10		 ?
27C z196		 ?
28
29C TODO
30C  *
31
32C INPUT PARAMETERS
33define(`rp',	`%r2')
34define(`up',	`%r3')
35define(`n',	`%r4')
36define(`cnt',	`%r5')
37
38ASM_START()
39PROLOGUE(mpn_lshift)
40	lr	%r1, n
41	sll	%r1, 2
42	stm	%r6, %r12, 24(%r15)
43	la	up, 0(%r1,up)		C put up near end of U
44	la	rp, 0(%r1,rp)		C put rp near end of R
45	ahi	up, -20
46	ahi	rp, -16
47	lhi	%r8, 32
48	sr	%r8, cnt
49	l	%r12, 16(up)
50	srl	%r12, 0(%r8)		C return value
51	lhi	%r7, 3
52	nr	%r7, n
53	srl	n, 2
54	je	L(b0)
55	chi	%r7, 2
56	jl	L(b1)
57	je	L(b2)
58
59L(b3):	l	%r10, 16(up)
60	l	%r11, 12(up)
61	l	%r9,   8(up)
62	ahi	up, -8
63	lr	%r8, %r11
64	sldl	%r10, 0(cnt)
65	sldl	%r8,  0(cnt)
66	st	%r10, 12(rp)
67	st	%r8,   8(rp)
68	ahi	rp, -8
69	ltr	n, n
70	je	L(end)
71	j	L(top)
72
73L(b2):	l	%r10, 16(up)
74	l	%r11, 12(up)
75	ahi	up, -4
76	sldl	%r10, 0(cnt)
77	st	%r10, 12(rp)
78	ahi	rp, -4
79	ltr	n, n
80	je	L(end)
81	j	L(top)
82
83L(b1):	ltr	n, n
84	je	L(end)
85	j	L(top)
86
87L(b0):	l	%r10,16(up)
88	l	%r8, 12(up)
89	l	%r6,  8(up)
90	l	%r0,  4(up)
91	ahi	up, -12
92	lr	%r11, %r8
93	lr	%r9,  %r6
94	lr	%r7,  %r0
95	sldl	%r10,0(cnt)
96	sldl	%r8, 0(cnt)
97	sldl	%r6, 0(cnt)
98	st	%r10, 12(rp)
99	st	%r8,   8(rp)
100	st	%r6,   4(rp)
101	ahi	rp, -12
102	ahi	n, -1
103	je	L(end)
104
105	ALIGN(8)
106L(top):	l	%r10, 16(up)
107	l	%r8,  12(up)
108	l	%r6,   8(up)
109	l	%r0,   4(up)
110	l	%r1,   0(up)
111	lr	%r11, %r8
112	lr	%r9,  %r6
113	lr	%r7,  %r0
114	ahi	up, -16
115	sldl	%r10, 0(cnt)
116	sldl	%r8,  0(cnt)
117	sldl	%r6,  0(cnt)
118	sldl	%r0,  0(cnt)
119	st	%r10, 12(rp)
120	st	%r8,   8(rp)
121	st	%r6,   4(rp)
122	st	%r0,   0(rp)
123	ahi	rp, -16
124	brct	n, L(top)
125
126L(end):	l	%r10, 16(up)
127	sll	%r10, 0(cnt)
128	st	%r10, 12(rp)
129
130	lr	%r2, %r12
131	lm	%r6, %r12, 24(%r15)
132	br	%r14
133EPILOGUE()
134