1dnl ARM mpn_sub_n -- Subtract two limb vectors of the same length > 0 and 2dnl store difference in a third limb vector. 3dnl Contributed by Robert Harley. 4 5dnl Copyright 1997, 2000, 2001 Free Software Foundation, Inc. 6 7dnl This file is part of the GNU MP Library. 8 9dnl The GNU MP Library is free software; you can redistribute it and/or modify 10dnl it under the terms of the GNU Lesser General Public License as published 11dnl by the Free Software Foundation; either version 3 of the License, or (at 12dnl your option) any later version. 13 14dnl The GNU MP Library is distributed in the hope that it will be useful, but 15dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 16dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public 17dnl License for more details. 18 19dnl You should have received a copy of the GNU Lesser General Public License 20dnl along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. 21 22include(`../config.m4') 23 24C This code runs at 5 cycles/limb. 25 26define(`rp',`r0') 27define(`up',`r1') 28define(`vp',`r2') 29define(`n',`r3') 30 31 32ASM_START() 33PROLOGUE(mpn_sub_n) 34 stmfd sp!, { r8, r9, lr } 35 subs r12, r12, r12 36 tst n, #1 37 beq L(skip1) 38 ldr r12, [up], #4 39 ldr lr, [vp], #4 40 subs r12, r12, lr 41 str r12, [rp], #4 42L(skip1): 43 tst n, #2 44 beq L(skip2) 45 ldmia up!, { r8, r9 } 46 ldmia vp!, { r12, lr } 47 sbcs r8, r8, r12 48 sbcs r9, r9, lr 49 stmia rp!, { r8, r9 } 50L(skip2): 51 bics n, n, #3 52 beq L(return) 53 stmfd sp!, { r4, r5, r6, r7 } 54L(sub_n_loop): 55 ldmia up!, { r4, r5, r6, r7 } 56 ldmia vp!, { r8, r9, r12, lr } 57 sbcs r4, r4, r8 58 ldr r8, [rp, #12] C cache allocate 59 sbcs r5, r5, r9 60 sbcs r6, r6, r12 61 sbcs r7, r7, lr 62 stmia rp!, { r4, r5, r6, r7 } 63 sub n, n, #4 64 teq n, #0 65 bne L(sub_n_loop) 66 ldmfd sp!, { r4, r5, r6, r7 } 67L(return): 68 sbc r0, r0, r0 69 and r0, r0, #1 70 ldmfd sp!, { r8, r9, pc } 71EPILOGUE(mpn_sub_n) 72