blob: 0fdff97794debbdfaae4a146a99b4550e670ab5e [file] [log] [blame]
Jason A. Donenfeld255845f2018-04-28 00:42:52 +02001/* SPDX-License-Identifier: (GPL-2.0 OR BSD-3-Clause)
Jason A. Donenfeldfb872272017-11-03 15:18:58 +01002 *
Jason A. Donenfeld255845f2018-04-28 00:42:52 +02003 * Copyright (C) 2017-2018 Jason A. Donenfeld <Jason@zx2c4.com>. All Rights Reserved.
Jason A. Donenfeldfb872272017-11-03 15:18:58 +01004 */
5
6#include <linux/linkage.h>
7
8ENTRY(__ashlti3)
9 cbz x2, 1f
10 mov x3, #64
11 sub x3, x3, x2
12 cmp x3, #0
13 b.le 2f
14 lsl x1, x1, x2
15 lsr x3, x0, x3
16 lsl x2, x0, x2
17 orr x1, x1, x3
18 mov x0, x2
191:
20 ret
212:
22 neg w1, w3
23 mov x2, #0
24 lsl x1, x0, x1
25 mov x0, x2
26 ret
27ENDPROC(__ashlti3)
28
29ENTRY(__ashrti3)
Jason A. Donenfeldf5ed22e2017-11-07 11:24:04 +090030 cbz x2, 1f
Jason A. Donenfeldfb872272017-11-03 15:18:58 +010031 mov x3, #64
32 sub x3, x3, x2
33 cmp x3, #0
Jason A. Donenfeldf5ed22e2017-11-07 11:24:04 +090034 b.le 2f
Jason A. Donenfeldfb872272017-11-03 15:18:58 +010035 lsr x0, x0, x2
36 lsl x3, x1, x3
37 asr x2, x1, x2
38 orr x0, x0, x3
39 mov x1, x2
Jason A. Donenfeldf5ed22e2017-11-07 11:24:04 +0900401:
Jason A. Donenfeldfb872272017-11-03 15:18:58 +010041 ret
Jason A. Donenfeldf5ed22e2017-11-07 11:24:04 +0900422:
Jason A. Donenfeldfb872272017-11-03 15:18:58 +010043 neg w0, w3
44 asr x2, x1, #63
45 asr x0, x1, x0
46 mov x1, x2
47 ret
48ENDPROC(__ashrti3)
Jason A. Donenfeld9bfe7552017-11-07 01:49:54 +000049
50ENTRY(__lshrti3)
51 cbz x2, 1f
52 mov x3, #64
53 sub x3, x3, x2
54 cmp x3, #0
55 b.le 2f
56 lsr x0, x0, x2
57 lsl x3, x1, x3
58 lsr x2, x1, x2
59 orr x0, x0, x3
60 mov x1, x2
611:
62 ret
632:
64 neg w0, w3
65 mov x2, #0
66 lsr x0, x1, x0
67 mov x1, x2
68 ret
69ENDPROC(__lshrti3)