xref: /netbsd-src/external/lgpl3/gmp/dist/mpn/powerpc32/sqr_diag_addlsh1.asm (revision cef8759bd76c1b621f8eab8faa6f208faabc2e15)
1dnl  PowerPC-32 mpn_sqr_diag_addlsh1.
2
3dnl  Copyright 2013 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 603e			 ?
35C 604e			 ?
36C 75x (G3)		 ?
37C 7400,7410 (G4)	 ?
38C 744x,745x (G4+)	 6
39C power4/ppc970		 ?
40C power5		 ?
41
42C This has been feebly optimised for 7447 but not for any other CPU.
43
44define(`rp',	r3)
45define(`tp',	r4)
46define(`up',	r5)
47define(`n',	r6)
48
49ASM_START()
50PROLOGUE(mpn_sqr_diag_addlsh1)
51	addi	n, n, -1
52	addi	tp, tp, -4
53	mtctr	n
54	lwz	r0, 0(up)
55	li	r10, 0
56	mullw	r7, r0, r0
57	stw	r7, 0(rp)
58	mulhwu	r6, r0, r0
59	addic	r31, r31, 0	C clear CF
60
61	ALIGN(16)
62L(top):	lwzu	r0, 4(up)
63	mullw	r7, r0, r0
64	lwz	r8, 4(tp)
65	lwzu	r9, 8(tp)
66	rlwimi	r10, r8, 1,0,30
67	srwi	r11, r8, 31
68	rlwimi	r11, r9, 1,0,30
69	adde	r10, r10, r6
70	adde	r11, r11, r7
71	stw	r10, 4(rp)
72	srwi	r10, r9, 31
73	mulhwu	r6, r0, r0
74	stwu	r11, 8(rp)
75	bdnz	L(top)
76
77	adde	r10, r10, r6
78	stw	r10, 4(rp)
79	blr
80EPILOGUE()
81