Austin Schuh | dace2a6 | 2020-08-18 10:56:48 -0700 | [diff] [blame^] | 1 | dnl ARM mpn_lshift. |
| 2 | |
| 3 | dnl Contributed to the GNU project by Torbjรถrn Granlund. |
| 4 | |
| 5 | dnl Copyright 2012 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 3.5 |
| 41 | C Cortex-A15 ? |
| 42 | |
| 43 | define(`rp', `r0') |
| 44 | define(`up', `r1') |
| 45 | define(`n', `r2') |
| 46 | define(`cnt', `r3') |
| 47 | define(`tnc', `r12') |
| 48 | |
| 49 | ASM_START() |
| 50 | PROLOGUE(mpn_lshift) |
| 51 | add up, up, n, lsl #2 |
| 52 | push {r4, r6, r7, r8} |
| 53 | ldr r4, [up, #-4]! |
| 54 | add rp, rp, n, lsl #2 |
| 55 | rsb tnc, cnt, #32 |
| 56 | |
| 57 | mov r7, r4, lsl cnt |
| 58 | tst n, #1 |
| 59 | beq L(evn) C n even |
| 60 | |
| 61 | L(odd): subs n, n, #2 |
| 62 | bcc L(1) C n = 1 |
| 63 | ldr r8, [up, #-4]! |
| 64 | b L(mid) |
| 65 | |
| 66 | L(evn): ldr r6, [up, #-4]! |
| 67 | subs n, n, #2 |
| 68 | beq L(end) |
| 69 | |
| 70 | L(top): ldr r8, [up, #-4]! |
| 71 | orr r7, r7, r6, lsr tnc |
| 72 | str r7, [rp, #-4]! |
| 73 | mov r7, r6, lsl cnt |
| 74 | L(mid): ldr r6, [up, #-4]! |
| 75 | orr r7, r7, r8, lsr tnc |
| 76 | str r7, [rp, #-4]! |
| 77 | mov r7, r8, lsl cnt |
| 78 | subs n, n, #2 |
| 79 | bgt L(top) |
| 80 | |
| 81 | L(end): orr r7, r7, r6, lsr tnc |
| 82 | str r7, [rp, #-4]! |
| 83 | mov r7, r6, lsl cnt |
| 84 | L(1): str r7, [rp, #-4] |
| 85 | mov r0, r4, lsr tnc |
| 86 | pop {r4, r6, r7, r8} |
| 87 | return r14 |
| 88 | EPILOGUE() |