hc
2024-02-20 102a0743326a03cd1a1202ceda21e175b7d3575c
kernel/arch/riscv/lib/tishift.S
....@@ -1,42 +1,76 @@
1
+/* SPDX-License-Identifier: GPL-2.0-only */
12 /*
23 * Copyright (C) 2018 Free Software Foundation, Inc.
3
- *
4
- * This program is free software; you can redistribute it and/or
5
- * modify it under the terms of the GNU General Public License
6
- * as published by the Free Software Foundation, version 2.
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.
124 */
13
- .globl __lshrti3
14
-__lshrti3:
15
- beqz a2, .L1
16
- li a5,64
17
- sub a5,a5,a2
18
- addi sp,sp,-16
19
- sext.w a4,a5
20
- blez a5, .L2
21
- sext.w a2,a2
22
- sll a4,a1,a4
23
- srl a0,a0,a2
24
- srl a1,a1,a2
25
- or a0,a0,a4
26
- sd a1,8(sp)
27
- sd a0,0(sp)
28
- ld a0,0(sp)
29
- ld a1,8(sp)
30
- addi sp,sp,16
31
- ret
5
+
6
+#include <linux/linkage.h>
7
+#include <asm-generic/export.h>
8
+
9
+SYM_FUNC_START(__lshrti3)
10
+ beqz a2, .L1
11
+ li a5,64
12
+ sub a5,a5,a2
13
+ sext.w a4,a5
14
+ blez a5, .L2
15
+ sext.w a2,a2
16
+ srl a0,a0,a2
17
+ sll a4,a1,a4
18
+ srl a2,a1,a2
19
+ or a0,a0,a4
20
+ mv a1,a2
3221 .L1:
33
- ret
22
+ ret
3423 .L2:
35
- negw a4,a4
36
- srl a1,a1,a4
37
- sd a1,0(sp)
38
- sd zero,8(sp)
39
- ld a0,0(sp)
40
- ld a1,8(sp)
41
- addi sp,sp,16
42
- ret
24
+ negw a0,a4
25
+ li a2,0
26
+ srl a0,a1,a0
27
+ mv a1,a2
28
+ ret
29
+SYM_FUNC_END(__lshrti3)
30
+EXPORT_SYMBOL(__lshrti3)
31
+
32
+SYM_FUNC_START(__ashrti3)
33
+ beqz a2, .L3
34
+ li a5,64
35
+ sub a5,a5,a2
36
+ sext.w a4,a5
37
+ blez a5, .L4
38
+ sext.w a2,a2
39
+ srl a0,a0,a2
40
+ sll a4,a1,a4
41
+ sra a2,a1,a2
42
+ or a0,a0,a4
43
+ mv a1,a2
44
+.L3:
45
+ ret
46
+.L4:
47
+ negw a0,a4
48
+ srai a2,a1,0x3f
49
+ sra a0,a1,a0
50
+ mv a1,a2
51
+ ret
52
+SYM_FUNC_END(__ashrti3)
53
+EXPORT_SYMBOL(__ashrti3)
54
+
55
+SYM_FUNC_START(__ashlti3)
56
+ beqz a2, .L5
57
+ li a5,64
58
+ sub a5,a5,a2
59
+ sext.w a4,a5
60
+ blez a5, .L6
61
+ sext.w a2,a2
62
+ sll a1,a1,a2
63
+ srl a4,a0,a4
64
+ sll a2,a0,a2
65
+ or a1,a1,a4
66
+ mv a0,a2
67
+.L5:
68
+ ret
69
+.L6:
70
+ negw a1,a4
71
+ li a2,0
72
+ sll a1,a0,a1
73
+ mv a0,a2
74
+ ret
75
+SYM_FUNC_END(__ashlti3)
76
+EXPORT_SYMBOL(__ashlti3)