blob: a88613834fb07b350031390cb3ecf4595bc877f5 [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
Mark Rutlandabb77f32018-12-07 18:08:17 +00008#include <asm/assembler.h>
9
Mark Brown3ac0f452020-01-06 19:58:17 +000010SYM_FUNC_START(__ashlti3)
Jason A. Donenfeldfb872272017-11-03 15:18:58 +010011 cbz x2, 1f
12 mov x3, #64
13 sub x3, x3, x2
14 cmp x3, #0
15 b.le 2f
16 lsl x1, x1, x2
17 lsr x3, x0, x3
18 lsl x2, x0, x2
19 orr x1, x1, x3
20 mov x0, x2
211:
22 ret
232:
24 neg w1, w3
25 mov x2, #0
26 lsl x1, x0, x1
27 mov x0, x2
28 ret
Mark Brown3ac0f452020-01-06 19:58:17 +000029SYM_FUNC_END(__ashlti3)
Mark Rutlandabb77f32018-12-07 18:08:17 +000030EXPORT_SYMBOL(__ashlti3)
Jason A. Donenfeldfb872272017-11-03 15:18:58 +010031
Mark Brown3ac0f452020-01-06 19:58:17 +000032SYM_FUNC_START(__ashrti3)
Jason A. Donenfeldf5ed22e2017-11-07 11:24:04 +090033 cbz x2, 1f
Jason A. Donenfeldfb872272017-11-03 15:18:58 +010034 mov x3, #64
35 sub x3, x3, x2
36 cmp x3, #0
Jason A. Donenfeldf5ed22e2017-11-07 11:24:04 +090037 b.le 2f
Jason A. Donenfeldfb872272017-11-03 15:18:58 +010038 lsr x0, x0, x2
39 lsl x3, x1, x3
40 asr x2, x1, x2
41 orr x0, x0, x3
42 mov x1, x2
Jason A. Donenfeldf5ed22e2017-11-07 11:24:04 +0900431:
Jason A. Donenfeldfb872272017-11-03 15:18:58 +010044 ret
Jason A. Donenfeldf5ed22e2017-11-07 11:24:04 +0900452:
Jason A. Donenfeldfb872272017-11-03 15:18:58 +010046 neg w0, w3
47 asr x2, x1, #63
48 asr x0, x1, x0
49 mov x1, x2
50 ret
Mark Brown3ac0f452020-01-06 19:58:17 +000051SYM_FUNC_END(__ashrti3)
Mark Rutlandabb77f32018-12-07 18:08:17 +000052EXPORT_SYMBOL(__ashrti3)
Jason A. Donenfeld9bfe7552017-11-07 01:49:54 +000053
Mark Brown3ac0f452020-01-06 19:58:17 +000054SYM_FUNC_START(__lshrti3)
Jason A. Donenfeld9bfe7552017-11-07 01:49:54 +000055 cbz x2, 1f
56 mov x3, #64
57 sub x3, x3, x2
58 cmp x3, #0
59 b.le 2f
60 lsr x0, x0, x2
61 lsl x3, x1, x3
62 lsr x2, x1, x2
63 orr x0, x0, x3
64 mov x1, x2
651:
66 ret
672:
68 neg w0, w3
69 mov x2, #0
70 lsr x0, x1, x0
71 mov x1, x2
72 ret
Mark Brown3ac0f452020-01-06 19:58:17 +000073SYM_FUNC_END(__lshrti3)
Mark Rutlandabb77f32018-12-07 18:08:17 +000074EXPORT_SYMBOL(__lshrti3)