blob: 15f9d54c7db63859de60f86ced505165aa7a84cb [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>
7
8ENTRY(__lshrti3)
9 beqz a2, .L1
10 li a5,64
11 sub a5,a5,a2
12 addi sp,sp,-16
13 sext.w a4,a5
14 blez a5, .L2
15 sext.w a2,a2
16 sll a4,a1,a4
17 srl a0,a0,a2
18 srl a1,a1,a2
19 or a0,a0,a4
20 sd a1,8(sp)
21 sd a0,0(sp)
22 ld a0,0(sp)
23 ld a1,8(sp)
24 addi sp,sp,16
25 ret
Andrew Scullb4b6d4a2019-01-02 15:54:55 +000026.L1:
David Brazdil0f672f62019-12-10 10:32:29 +000027 ret
Andrew Scullb4b6d4a2019-01-02 15:54:55 +000028.L2:
David Brazdil0f672f62019-12-10 10:32:29 +000029 negw a4,a4
30 srl a1,a1,a4
31 sd a1,0(sp)
32 sd zero,8(sp)
33 ld a0,0(sp)
34 ld a1,8(sp)
35 addi sp,sp,16
36 ret
37ENDPROC(__lshrti3)