blob: 7236776655edbb1bc544a5feabcdb13cd0db55de [file] [log] [blame]
Jason A. Donenfeldfb872272017-11-03 15:18:58 +01001/*
2 * Copyright (C) 2017 Jason A. Donenfeld <Jason@zx2c4.com>. All Rights Reserved.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17#include <linux/linkage.h>
18
19ENTRY(__ashlti3)
20 cbz x2, 1f
21 mov x3, #64
22 sub x3, x3, x2
23 cmp x3, #0
24 b.le 2f
25 lsl x1, x1, x2
26 lsr x3, x0, x3
27 lsl x2, x0, x2
28 orr x1, x1, x3
29 mov x0, x2
301:
31 ret
322:
33 neg w1, w3
34 mov x2, #0
35 lsl x1, x0, x1
36 mov x0, x2
37 ret
38ENDPROC(__ashlti3)
39
40ENTRY(__ashrti3)
41 cbz x2, 3f
42 mov x3, #64
43 sub x3, x3, x2
44 cmp x3, #0
45 b.le 4f
46 lsr x0, x0, x2
47 lsl x3, x1, x3
48 asr x2, x1, x2
49 orr x0, x0, x3
50 mov x1, x2
513:
52 ret
534:
54 neg w0, w3
55 asr x2, x1, #63
56 asr x0, x1, x0
57 mov x1, x2
58 ret
59ENDPROC(__ashrti3)