xref: /linux/arch/riscv/lib/tishift.S (revision e9f0878c4b2004ac19581274c1ae4c61ae3ca70e)
1/*
2 * 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.
12 */
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
32.L1:
33  ret
34.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
43