1dnl PowerPC-64 mpn_and_n, mpn_andn_n, mpn_nand_n, mpn_ior_n, mpn_iorn_n, 2dnl mpn_nior_n, mpn_xor_n, mpn_xnor_n -- mpn bitwise logical operations. 3 4dnl Copyright 2003, 2004, 2005 Free Software Foundation, Inc. 5 6dnl This file is part of the GNU MP Library. 7 8dnl The GNU MP Library is free software; you can redistribute it and/or modify 9dnl it under the terms of the GNU Lesser General Public License as published 10dnl by the Free Software Foundation; either version 3 of the License, or (at 11dnl your option) any later version. 12 13dnl The GNU MP Library is distributed in the hope that it will be useful, but 14dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 15dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public 16dnl License for more details. 17 18dnl You should have received a copy of the GNU Lesser General Public License 19dnl along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. 20 21include(`../config.m4') 22 23C cycles/limb 24C POWER3/PPC630: 1.75 25C POWER4/PPC970: 2.10 26 27C n POWER3/PPC630 POWER4/PPC970 28C 1 15.00 15.33 29C 2 7.50 7.99 30C 3 5.33 6.00 31C 4 4.50 4.74 32C 5 4.20 4.39 33C 6 3.50 3.99 34C 7 3.14 3.64 35C 8 3.00 3.36 36C 9 3.00 3.36 37C 10 2.70 3.25 38C 11 2.63 3.11 39C 12 2.58 3.00 40C 13 2.61 3.02 41C 14 2.42 2.82 42C 15 2.40 2.79 43C 50 2.08 2.67 44C 100 1.85 2.31 45C 200 1.80 2.18 46C 400 1.77 2.14 47C 1000 1.76 2.10# 48C 2000 1.75# 2.13 49C 4000 2.30 2.57 50C 8000 2.62 2.58 51C 16000 2.52 4.25 52C 32000 2.49 16.25 53C 64000 2.66 18.76 54 55ifdef(`OPERATION_and_n', 56` define(`func',`mpn_and_n') 57 define(`logop', `and')') 58ifdef(`OPERATION_andn_n', 59` define(`func',`mpn_andn_n') 60 define(`logop', `andc')') 61ifdef(`OPERATION_nand_n', 62` define(`func',`mpn_nand_n') 63 define(`logop', `nand')') 64ifdef(`OPERATION_ior_n', 65` define(`func',`mpn_ior_n') 66 define(`logop', `or')') 67ifdef(`OPERATION_iorn_n', 68` define(`func',`mpn_iorn_n') 69 define(`logop', `orc')') 70ifdef(`OPERATION_nior_n', 71` define(`func',`mpn_nior_n') 72 define(`logop', `nor')') 73ifdef(`OPERATION_xor_n', 74` define(`func',`mpn_xor_n') 75 define(`logop', `xor')') 76ifdef(`OPERATION_xnor_n', 77` define(`func',`mpn_xnor_n') 78 define(`logop', `eqv')') 79 80C INPUT PARAMETERS 81C rp r3 82C up r4 83C vp r5 84C n r6 85 86MULFUNC_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) 87 88ASM_START() 89PROLOGUE(func) 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) 95 96ifdef(`HAVE_ABI_mode32', 97` rldicl r6, r6, 62,34', C ...branch count 98` rldicl r6, r6, 62, 2') C ...branch count 99 mtctr r6 100 101 ld r6, 0(r4) C read lowest u limb (again) 102 ld r7, 0(r5) C read lowest v limb (again) 103 104 add r5, r5, r0 C offset vp 105 add r4, r4, r0 C offset up 106 add r3, r3, r0 C offset rp 107 108 beq cr0, L(L01) 109 blt cr6, L(L10) 110 beq cr6, L(L11) 111 b L(L00) 112 113L(oop): ld r8, -24(r4) 114 ld r9, -24(r5) 115 logop r10, r6, r7 116 std r10, -32(r3) 117L(L00): ld r6, -16(r4) 118 ld r7, -16(r5) 119 logop r10, r8, r9 120 std r10, -24(r3) 121L(L11): ld r8, -8(r4) 122 ld r9, -8(r5) 123 logop r10, r6, r7 124 std r10, -16(r3) 125L(L10): ld r6, 0(r4) 126 ld r7, 0(r5) 127 logop r10, r8, r9 128 std r10, -8(r3) 129L(L01): addi r5, r5, 32 130 addi r4, r4, 32 131 addi r3, r3, 32 132 bdnz L(oop) 133 134 logop r10, r6, r7 135 std r10, -32(r3) 136 blr 137EPILOGUE() 138