xref: /netbsd-src/external/lgpl3/gmp/dist/mpn/s390_32/lshift.asm (revision ce54336801cf28877c3414aa2fcb251dddd543a2)
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.
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		 6
35C z990	         3
36C z9		 ?
37C z10		 ?
38C z196		 ?
39
40C TODO
41C  *
42
43C INPUT PARAMETERS
44define(`rp',	`%r2')
45define(`up',	`%r3')
46define(`n',	`%r4')
47define(`cnt',	`%r5')
48
49ASM_START()
50PROLOGUE(mpn_lshift)
51	lr	%r1, n
52	sll	%r1, 2
53	stm	%r6, %r12, 24(%r15)
54	la	up, 0(%r1,up)		C put up near end of U
55	la	rp, 0(%r1,rp)		C put rp near end of R
56	ahi	up, -20
57	ahi	rp, -16
58	lhi	%r8, 32
59	sr	%r8, cnt
60	l	%r12, 16(up)
61	srl	%r12, 0(%r8)		C return value
62	lhi	%r7, 3
63	nr	%r7, n
64	srl	n, 2
65	je	L(b0)
66	chi	%r7, 2
67	jl	L(b1)
68	je	L(b2)
69
70L(b3):	l	%r10, 16(up)
71	l	%r11, 12(up)
72	l	%r9,   8(up)
73	ahi	up, -8
74	lr	%r8, %r11
75	sldl	%r10, 0(cnt)
76	sldl	%r8,  0(cnt)
77	st	%r10, 12(rp)
78	st	%r8,   8(rp)
79	ahi	rp, -8
80	ltr	n, n
81	je	L(end)
82	j	L(top)
83
84L(b2):	l	%r10, 16(up)
85	l	%r11, 12(up)
86	ahi	up, -4
87	sldl	%r10, 0(cnt)
88	st	%r10, 12(rp)
89	ahi	rp, -4
90	ltr	n, n
91	je	L(end)
92	j	L(top)
93
94L(b1):	ltr	n, n
95	je	L(end)
96	j	L(top)
97
98L(b0):	l	%r10,16(up)
99	l	%r8, 12(up)
100	l	%r6,  8(up)
101	l	%r0,  4(up)
102	ahi	up, -12
103	lr	%r11, %r8
104	lr	%r9,  %r6
105	lr	%r7,  %r0
106	sldl	%r10,0(cnt)
107	sldl	%r8, 0(cnt)
108	sldl	%r6, 0(cnt)
109	st	%r10, 12(rp)
110	st	%r8,   8(rp)
111	st	%r6,   4(rp)
112	ahi	rp, -12
113	ahi	n, -1
114	je	L(end)
115
116	ALIGN(8)
117L(top):	l	%r10, 16(up)
118	l	%r8,  12(up)
119	l	%r6,   8(up)
120	l	%r0,   4(up)
121	l	%r1,   0(up)
122	lr	%r11, %r8
123	lr	%r9,  %r6
124	lr	%r7,  %r0
125	ahi	up, -16
126	sldl	%r10, 0(cnt)
127	sldl	%r8,  0(cnt)
128	sldl	%r6,  0(cnt)
129	sldl	%r0,  0(cnt)
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	st	%r10, 12(rp)
140
141	lr	%r2, %r12
142	lm	%r6, %r12, 24(%r15)
143	br	%r14
144EPILOGUE()
145