xref: /netbsd-src/external/lgpl3/gmp/dist/mpn/s390_32/lshiftc.asm (revision 479d8f7d843cc1b22d497efdf1f27a50ee8418d4)
1dnl  S/390-32 mpn_lshiftc.
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		 7
24C z990	         3.375
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_lshiftc)
40	lr	%r1, n
41	sll	%r1, 2
42	stm	%r6, %r13, 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	%r13, -1
52	lhi	%r7, 3
53	nr	%r7, n
54	srl	n, 2
55	je	L(b0)
56	chi	%r7, 2
57	jl	L(b1)
58	je	L(b2)
59
60L(b3):	l	%r10, 16(up)
61	l	%r11, 12(up)
62	l	%r9,   8(up)
63	ahi	up, -8
64	lr	%r8, %r11
65	sldl	%r10, 0(cnt)
66	sldl	%r8,  0(cnt)
67	xr	%r10, %r13
68	xr	%r8, %r13
69	st	%r10, 12(rp)
70	st	%r8,   8(rp)
71	ahi	rp, -8
72	ltr	n, n
73	je	L(end)
74	j	L(top)
75
76L(b2):	l	%r10, 16(up)
77	l	%r11, 12(up)
78	ahi	up, -4
79	sldl	%r10, 0(cnt)
80	xr	%r10, %r13
81	st	%r10, 12(rp)
82	ahi	rp, -4
83	ltr	n, n
84	je	L(end)
85	j	L(top)
86
87L(b1):	ltr	n, n
88	je	L(end)
89	j	L(top)
90
91L(b0):	l	%r10,16(up)
92	l	%r8, 12(up)
93	l	%r6,  8(up)
94	l	%r0,  4(up)
95	ahi	up, -12
96	lr	%r11, %r8
97	lr	%r9,  %r6
98	lr	%r7,  %r0
99	sldl	%r10,0(cnt)
100	sldl	%r8, 0(cnt)
101	sldl	%r6, 0(cnt)
102	xr	%r10, %r13
103	xr	%r8, %r13
104	xr	%r6, %r13
105	st	%r10, 12(rp)
106	st	%r8,   8(rp)
107	st	%r6,   4(rp)
108	ahi	rp, -12
109	ahi	n, -1
110	je	L(end)
111
112	ALIGN(8)
113L(top):	l	%r10, 16(up)
114	l	%r8,  12(up)
115	l	%r6,   8(up)
116	l	%r0,   4(up)
117	l	%r1,   0(up)
118	lr	%r11, %r8
119	lr	%r9,  %r6
120	lr	%r7,  %r0
121	ahi	up, -16
122	sldl	%r10, 0(cnt)
123	sldl	%r8,  0(cnt)
124	sldl	%r6,  0(cnt)
125	sldl	%r0,  0(cnt)
126	xr	%r10, %r13
127	xr	%r8, %r13
128	xr	%r6, %r13
129	xr	%r0, %r13
130	st	%r10, 12(rp)
131	st	%r8,   8(rp)
132	st	%r6,   4(rp)
133	st	%r0,   0(rp)
134	ahi	rp, -16
135	brct	n, L(top)
136
137L(end):	l	%r10, 16(up)
138	sll	%r10, 0(cnt)
139	xr	%r10, %r13
140	st	%r10, 12(rp)
141
142	lr	%r2, %r12
143	lm	%r6, %r13, 24(%r15)
144	br	%r14
145EPILOGUE()
146