blob: e5b52dfa34b3c0b6060efc536c62215bb8b8ee46 [file] [log] [blame]
Austin Schuhdace2a62020-08-18 10:56:48 -07001dnl ARM mpn_lshiftc.
2
3dnl Contributed to the GNU project by Torbjรถrn Granlund.
4
5dnl Copyright 2012 Free Software Foundation, Inc.
6
7dnl This file is part of the GNU MP Library.
8dnl
9dnl The GNU MP Library is free software; you can redistribute it and/or modify
10dnl it under the terms of either:
11dnl
12dnl * the GNU Lesser General Public License as published by the Free
13dnl Software Foundation; either version 3 of the License, or (at your
14dnl option) any later version.
15dnl
16dnl or
17dnl
18dnl * the GNU General Public License as published by the Free Software
19dnl Foundation; either version 2 of the License, or (at your option) any
20dnl later version.
21dnl
22dnl or both in parallel, as here.
23dnl
24dnl The GNU MP Library is distributed in the hope that it will be useful, but
25dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
26dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
27dnl for more details.
28dnl
29dnl You should have received copies of the GNU General Public License and the
30dnl GNU Lesser General Public License along with the GNU MP Library. If not,
31dnl see https://www.gnu.org/licenses/.
32
33include(`../config.m4')
34
35C cycles/limb
36C StrongARM ?
37C XScale ?
38C Cortex-A7 ?
39C Cortex-A8 ?
40C Cortex-A9 4.0
41C Cortex-A15 ?
42
43define(`rp', `r0')
44define(`up', `r1')
45define(`n', `r2')
46define(`cnt', `r3')
47define(`tnc', `r12')
48
49ASM_START()
50PROLOGUE(mpn_lshiftc)
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 mvn r6, r4
57
58 mov r7, r6, lsl cnt
59 tst n, #1
60 beq L(evn) C n even
61
62L(odd): subs n, n, #2
63 bcc L(1) C n = 1
64 ldr r8, [up, #-4]!
65 mvn r8, r8
66 b L(mid)
67
68L(evn): ldr r6, [up, #-4]!
69 mvn r6, r6
70 subs n, n, #2
71 beq L(end)
72
73L(top): ldr r8, [up, #-4]!
74 orr r7, r7, r6, lsr tnc
75 str r7, [rp, #-4]!
76 mvn r8, r8
77 mov r7, r6, lsl cnt
78L(mid): ldr r6, [up, #-4]!
79 orr r7, r7, r8, lsr tnc
80 str r7, [rp, #-4]!
81 mvn r6, r6
82 mov r7, r8, lsl cnt
83 subs n, n, #2
84 bgt L(top)
85
86L(end): orr r7, r7, r6, lsr tnc
87 str r7, [rp, #-4]!
88 mov r7, r6, lsl cnt
89L(1): mvn r6, #0
90 orr r7, r7, r6, lsr tnc
91 str r7, [rp, #-4]
92 mov r0, r4, lsr tnc
93 pop {r4, r6, r7, r8}
94 return r14
95EPILOGUE()