Austin Schuh | dace2a6 | 2020-08-18 10:56:48 -0700 | [diff] [blame] | 1 | dnl ARM mpn_copyd. |
| 2 | |
| 3 | dnl Contributed to the GNU project by Robert Harley and Torbjรถrn Granlund. |
| 4 | |
| 5 | dnl Copyright 2003, 2012, 2013 Free Software Foundation, Inc. |
| 6 | |
| 7 | dnl This file is part of the GNU MP Library. |
| 8 | dnl |
| 9 | dnl The GNU MP Library is free software; you can redistribute it and/or modify |
| 10 | dnl it under the terms of either: |
| 11 | dnl |
| 12 | dnl * the GNU Lesser General Public License as published by the Free |
| 13 | dnl Software Foundation; either version 3 of the License, or (at your |
| 14 | dnl option) any later version. |
| 15 | dnl |
| 16 | dnl or |
| 17 | dnl |
| 18 | dnl * the GNU General Public License as published by the Free Software |
| 19 | dnl Foundation; either version 2 of the License, or (at your option) any |
| 20 | dnl later version. |
| 21 | dnl |
| 22 | dnl or both in parallel, as here. |
| 23 | dnl |
| 24 | dnl The GNU MP Library is distributed in the hope that it will be useful, but |
| 25 | dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY |
| 26 | dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
| 27 | dnl for more details. |
| 28 | dnl |
| 29 | dnl You should have received copies of the GNU General Public License and the |
| 30 | dnl GNU Lesser General Public License along with the GNU MP Library. If not, |
| 31 | dnl see https://www.gnu.org/licenses/. |
| 32 | |
| 33 | include(`../config.m4') |
| 34 | |
| 35 | C cycles/limb |
| 36 | C StrongARM ? |
| 37 | C XScale ? |
| 38 | C Cortex-A7 ? |
| 39 | C Cortex-A8 ? |
| 40 | C Cortex-A9 1.25-1.5 |
| 41 | C Cortex-A15 1.25 |
| 42 | |
| 43 | C TODO |
| 44 | C * Consider wider unrolling. Analogous 8-way code runs 10% faster on both A9 |
| 45 | C and A15. But it probably slows things down for 8 <= n < a few dozen. |
| 46 | |
| 47 | define(`rp', `r0') |
| 48 | define(`up', `r1') |
| 49 | define(`n', `r2') |
| 50 | |
| 51 | ASM_START() |
| 52 | PROLOGUE(mpn_copyd) |
| 53 | mov r12, n, lsl #2 |
| 54 | sub r12, r12, #4 |
| 55 | add rp, rp, r12 |
| 56 | add up, up, r12 |
| 57 | |
| 58 | tst n, #1 |
| 59 | beq L(skip1) |
| 60 | ldr r3, [up], #-4 |
| 61 | str r3, [rp], #-4 |
| 62 | L(skip1): |
| 63 | tst n, #2 |
| 64 | beq L(skip2) |
| 65 | ldmda up!, { r3,r12 } |
| 66 | stmda rp!, { r3,r12 } |
| 67 | L(skip2): |
| 68 | bics n, n, #3 |
| 69 | beq L(rtn) |
| 70 | |
| 71 | push { r4-r5 } |
| 72 | subs n, n, #4 |
| 73 | ldmda up!, { r3,r4,r5,r12 } |
| 74 | beq L(end) |
| 75 | |
| 76 | L(top): subs n, n, #4 |
| 77 | stmda rp!, { r3,r4,r5,r12 } |
| 78 | ldmda up!, { r3,r4,r5,r12 } |
| 79 | bne L(top) |
| 80 | |
| 81 | L(end): stmda rp, { r3,r4,r5,r12 } |
| 82 | pop { r4-r5 } |
| 83 | L(rtn): return lr |
| 84 | EPILOGUE() |