1 dnl PowerPC-64 mpn_and_n, mpn_andn_n, mpn_nand_n, mpn_ior_n, mpn_iorn_n,
2 dnl mpn_nior_n, mpn_xor_n, mpn_xnor_n -- mpn bitwise logical operations.
4 dnl Copyright 2003, 2004, 2005 Free Software Foundation, Inc.
6 dnl This file is part of the GNU MP Library.
8 dnl The GNU MP Library is free software; you can redistribute it and/or modify
9 dnl it under the terms of the GNU Lesser General Public License as published
10 dnl by the Free Software Foundation; either version 3 of the License, or (at
11 dnl your option) any later version.
13 dnl The GNU MP Library is distributed in the hope that it will be useful, but
14 dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
15 dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
16 dnl License for more details.
18 dnl You should have received a copy of the GNU Lesser General Public License
19 dnl along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
21 include(`../config.m4')
27 C n POWER3/PPC630 POWER4/PPC970
55 ifdef(`OPERATION_and_n',
56 ` define(`func',`mpn_and_n')
57 define(`logop', `and')')
58 ifdef(`OPERATION_andn_n',
59 ` define(`func',`mpn_andn_n')
60 define(`logop', `andc')')
61 ifdef(`OPERATION_nand_n',
62 ` define(`func',`mpn_nand_n')
63 define(`logop', `nand')')
64 ifdef(`OPERATION_ior_n',
65 ` define(`func',`mpn_ior_n')
66 define(`logop', `or')')
67 ifdef(`OPERATION_iorn_n',
68 ` define(`func',`mpn_iorn_n')
69 define(`logop', `orc')')
70 ifdef(`OPERATION_nior_n',
71 ` define(`func',`mpn_nior_n')
72 define(`logop', `nor')')
73 ifdef(`OPERATION_xor_n',
74 ` define(`func',`mpn_xor_n')
75 define(`logop', `xor')')
76 ifdef(`OPERATION_xnor_n',
77 ` define(`func',`mpn_xnor_n')
78 define(`logop', `eqv')')
86 MULFUNC_PROLOGUE(mpn_and_n mpn_andn_n mpn_nand_n mpn_ior_n mpn_iorn_n mpn_nior_n mpn_xor_n mpn_xnor_n)
90 ld r8, 0(r4) C read lowest u limb
91 ld r9, 0(r5) C read lowest v limb
92 addi r6, r6, 3 C compute branch count (1)
93 rldic. r0, r6, 3, 59 C r0 = (n-1 & 3) << 3; cr0 = (n == 4(t+1))?
94 cmpldi cr6, r0, 16 C cr6 = (n cmp 4t + 3)
96 ifdef(`HAVE_ABI_mode32',
97 ` rldicl r6, r6, 62,34', C ...branch count
98 ` rldicl r6, r6, 62, 2') C ...branch count
101 ld r6, 0(r4) C read lowest u limb (again)
102 ld r7, 0(r5) C read lowest v limb (again)
104 add r5, r5, r0 C offset vp
105 add r4, r4, r0 C offset up
106 add r3, r3, r0 C offset rp
113 L(oop): ld r8, -24(r4)
117 L(L00): ld r6, -16(r4)
121 L(L11): ld r8, -8(r4)
129 L(L01): addi r5, r5, 32