1dnl  S/390-64 mpn_invert_limb
2
3dnl  Contributed to the GNU project by Torbjorn Granlund.
4
5dnl  Copyright 2011, 2013 Free Software Foundation, Inc.
6
7dnl  This file is part of the GNU MP Library.
8dnl
9dnl  The GNU MP Library is free software; you can redistribute it and/or modify
10dnl  it under the terms of either:
11dnl
12dnl    * the GNU Lesser General Public License as published by the Free
13dnl      Software Foundation; either version 3 of the License, or (at your
14dnl      option) any later version.
15dnl
16dnl  or
17dnl
18dnl    * the GNU General Public License as published by the Free Software
19dnl      Foundation; either version 2 of the License, or (at your option) any
20dnl      later version.
21dnl
22dnl  or both in parallel, as here.
23dnl
24dnl  The GNU MP Library is distributed in the hope that it will be useful, but
25dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
26dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
27dnl  for more details.
28dnl
29dnl  You should have received copies of the GNU General Public License and the
30dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
31dnl  see https://www.gnu.org/licenses/.
32
33include(`../config.m4')
34
35C            cycles/limb
36C z900	       142
37C z990          86
38C z9		 ?
39C z10	       120
40C z196		 ?
41
42ASM_START()
43	TEXT
44	ALIGN(16)
45PROLOGUE(mpn_invert_limb)
46	stg	%r9, 72(%r15)
47	srlg	%r9, %r2, 55
48	agr	%r9, %r9
49	larl	%r4, approx_tab-512
50	srlg	%r3, %r2, 24
51	aghi	%r3, 1
52	lghi	%r5, 1
53	llgh	%r4, 0(%r9, %r4)
54	sllg	%r9, %r4, 11
55	msgr	%r4, %r4
56	msgr	%r4, %r3
57	srlg	%r4, %r4, 40
58	aghi	%r9, -1
59	sgr	%r9, %r4
60	sllg	%r0, %r9, 60
61	sllg	%r1, %r9, 13
62	msgr	%r9, %r9
63	msgr	%r9, %r3
64	sgr	%r0, %r9
65	ngr	%r5, %r2
66	srlg	%r4, %r2, 1
67	srlg	%r3, %r0, 47
68	agr	%r3, %r1
69	agr	%r4, %r5
70	msgr	%r4, %r3
71	srlg	%r1, %r3, 1
72	lcgr	%r5, %r5
73	ngr	%r1, %r5
74	sgr	%r1, %r4
75	mlgr	%r0, %r3
76	srlg	%r9, %r0, 1
77	sllg	%r4, %r3, 31
78	agr	%r4, %r9
79	lgr	%r1, %r4
80	mlgr	%r0, %r2
81	algr	%r1, %r2
82	alcgr	%r0, %r2
83	lgr	%r2, %r4
84	sgr	%r2, %r0
85	lg	%r9, 72(%r15)
86	br	%r14
87EPILOGUE()
88	RODATA
89	ALIGN(2)
90approx_tab:
91forloop(i,256,512-1,dnl
92`	.word	eval(0x7fd00/i)
93')dnl
94ASM_END()
95