1 dnl PowerPC-64 mpn_mod_34lsub1 -- modulo 2^24-1.
3 dnl Copyright 2005 Free Software Foundation, Inc.
5 dnl This file is part of the GNU MP Library.
7 dnl The GNU MP Library is free software; you can redistribute it and/or modify
8 dnl it under the terms of the GNU Lesser General Public License as published
9 dnl by the Free Software Foundation; either version 3 of the License, or (at
10 dnl your option) any later version.
12 dnl The GNU MP Library is distributed in the hope that it will be useful, but
13 dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14 dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
15 dnl License for more details.
17 dnl You should have received a copy of the GNU Lesser General Public License
18 dnl along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
20 include(`../config.m4')
32 PROLOGUE(mpn_mod_34lsub1)
41 li r0, -0x5556 C 0xFFFFFFFFFFFFAAAA
42 rldimi r0, r0, 16, 32 C 0xFFFFFFFFAAAAAAAA
43 rldimi r0, r0, 32, 63 C 0xAAAAAAAAAAAAAAAB
45 srdi r0, r0, 1 C r0 = [n / 3]
55 L(top): addc r8, r8, r5
79 L(end): addc r8, r8, r5
85 add r5, r5, r0 C r11 = n / 3 * 3
86 sub n, n, r5 C n = n mod 3
87 L(lt3): cmpdi cr6, n, 1
100 L(2): rldicl r0, r8, 0, 16 C r0 = r8 mod 2^48
101 srdi r3, r8, 48 C r3 = r8 div 2^48
102 rldic r4, r9, 16, 16 C r4 = (r9 mod 2^32) << 16
103 srdi r5, r9, 32 C r5 = r9 div 2^32
104 rldic r6, r10, 32, 16 C r6 = (r10 mod 2^16) << 32
105 srdi r7, r10, 16 C r7 = r10 div 2^16
118 C |__r10__|__r9___|__r8___|
119 C |-----|-----|-----|-----|