blob: ef90075c4b0a9c153c02cdfc0d0fbdc98e151134 [file] [log] [blame]
David Brazdil0f672f62019-12-10 10:32:29 +00001/* SPDX-License-Identifier: GPL-2.0-only */
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00002/*
3 * Copyright (C) 2018 Free Software Foundation, Inc.
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00004 */
David Brazdil0f672f62019-12-10 10:32:29 +00005
6#include <linux/linkage.h>
Olivier Deprez157378f2022-04-04 15:47:50 +02007#include <asm-generic/export.h>
David Brazdil0f672f62019-12-10 10:32:29 +00008
Olivier Deprez157378f2022-04-04 15:47:50 +02009SYM_FUNC_START(__lshrti3)
David Brazdil0f672f62019-12-10 10:32:29 +000010 beqz a2, .L1
11 li a5,64
12 sub a5,a5,a2
David Brazdil0f672f62019-12-10 10:32:29 +000013 sext.w a4,a5
14 blez a5, .L2
15 sext.w a2,a2
David Brazdil0f672f62019-12-10 10:32:29 +000016 srl a0,a0,a2
Olivier Deprez157378f2022-04-04 15:47:50 +020017 sll a4,a1,a4
18 srl a2,a1,a2
David Brazdil0f672f62019-12-10 10:32:29 +000019 or a0,a0,a4
Olivier Deprez157378f2022-04-04 15:47:50 +020020 mv a1,a2
Andrew Scullb4b6d4a2019-01-02 15:54:55 +000021.L1:
David Brazdil0f672f62019-12-10 10:32:29 +000022 ret
Andrew Scullb4b6d4a2019-01-02 15:54:55 +000023.L2:
Olivier Deprez157378f2022-04-04 15:47:50 +020024 negw a0,a4
25 li a2,0
26 srl a0,a1,a0
27 mv a1,a2
David Brazdil0f672f62019-12-10 10:32:29 +000028 ret
Olivier Deprez157378f2022-04-04 15:47:50 +020029SYM_FUNC_END(__lshrti3)
30EXPORT_SYMBOL(__lshrti3)
31
32SYM_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
52SYM_FUNC_END(__ashrti3)
53EXPORT_SYMBOL(__ashrti3)
54
55SYM_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
75SYM_FUNC_END(__ashlti3)
76EXPORT_SYMBOL(__ashlti3)