blob: d3db9b2cd479bebb64e0dd0b3c18edfef3d552b0 [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)
Jason A. Donenfeldf5ed22e2017-11-07 11:24:04 +090041 cbz x2, 1f
Jason A. Donenfeldfb872272017-11-03 15:18:58 +010042 mov x3, #64
43 sub x3, x3, x2
44 cmp x3, #0
Jason A. Donenfeldf5ed22e2017-11-07 11:24:04 +090045 b.le 2f
Jason A. Donenfeldfb872272017-11-03 15:18:58 +010046 lsr x0, x0, x2
47 lsl x3, x1, x3
48 asr x2, x1, x2
49 orr x0, x0, x3
50 mov x1, x2
Jason A. Donenfeldf5ed22e2017-11-07 11:24:04 +0900511:
Jason A. Donenfeldfb872272017-11-03 15:18:58 +010052 ret
Jason A. Donenfeldf5ed22e2017-11-07 11:24:04 +0900532:
Jason A. Donenfeldfb872272017-11-03 15:18:58 +010054 neg w0, w3
55 asr x2, x1, #63
56 asr x0, x1, x0
57 mov x1, x2
58 ret
59ENDPROC(__ashrti3)
Jason A. Donenfeld9bfe7552017-11-07 01:49:54 +000060
61ENTRY(__lshrti3)
62 cbz x2, 1f
63 mov x3, #64
64 sub x3, x3, x2
65 cmp x3, #0
66 b.le 2f
67 lsr x0, x0, x2
68 lsl x3, x1, x3
69 lsr x2, x1, x2
70 orr x0, x0, x3
71 mov x1, x2
721:
73 ret
742:
75 neg w0, w3
76 mov x2, #0
77 lsr x0, x1, x0
78 mov x1, x2
79 ret
80ENDPROC(__lshrti3)