Commit a266cdba authored by Olof Johansson's avatar Olof Johansson Committed by Palmer Dabbelt

RISC-V: lib: minor asm cleanup

Fix tab/space conversion and use ENTRY/ENDPROC macros.
Signed-off-by: default avatarOlof Johansson <olof@lixom.net>
Signed-off-by: default avatarPalmer Dabbelt <palmer@sifive.com>
parent 358f3fff
...@@ -10,33 +10,36 @@ ...@@ -10,33 +10,36 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
*/ */
.globl __lshrti3
__lshrti3: #include <linux/linkage.h>
beqz a2, .L1
li a5,64 ENTRY(__lshrti3)
sub a5,a5,a2 beqz a2, .L1
addi sp,sp,-16 li a5,64
sext.w a4,a5 sub a5,a5,a2
blez a5, .L2 addi sp,sp,-16
sext.w a2,a2 sext.w a4,a5
sll a4,a1,a4 blez a5, .L2
srl a0,a0,a2 sext.w a2,a2
srl a1,a1,a2 sll a4,a1,a4
or a0,a0,a4 srl a0,a0,a2
sd a1,8(sp) srl a1,a1,a2
sd a0,0(sp) or a0,a0,a4
ld a0,0(sp) sd a1,8(sp)
ld a1,8(sp) sd a0,0(sp)
addi sp,sp,16 ld a0,0(sp)
ret ld a1,8(sp)
addi sp,sp,16
ret
.L1: .L1:
ret ret
.L2: .L2:
negw a4,a4 negw a4,a4
srl a1,a1,a4 srl a1,a1,a4
sd a1,0(sp) sd a1,0(sp)
sd zero,8(sp) sd zero,8(sp)
ld a0,0(sp) ld a0,0(sp)
ld a1,8(sp) ld a1,8(sp)
addi sp,sp,16 addi sp,sp,16
ret ret
ENDPROC(__lshrti3)
...@@ -11,28 +11,30 @@ ...@@ -11,28 +11,30 @@
* GNU General Public License for more details. * GNU General Public License for more details.
*/ */
.globl __udivdi3 #include <linux/linkage.h>
__udivdi3:
mv a2, a1 ENTRY(__udivdi3)
mv a1, a0 mv a2, a1
li a0, -1 mv a1, a0
beqz a2, .L5 li a0, -1
li a3, 1 beqz a2, .L5
bgeu a2, a1, .L2 li a3, 1
bgeu a2, a1, .L2
.L1: .L1:
blez a2, .L2 blez a2, .L2
slli a2, a2, 1 slli a2, a2, 1
slli a3, a3, 1 slli a3, a3, 1
bgtu a1, a2, .L1 bgtu a1, a2, .L1
.L2: .L2:
li a0, 0 li a0, 0
.L3: .L3:
bltu a1, a2, .L4 bltu a1, a2, .L4
sub a1, a1, a2 sub a1, a1, a2
or a0, a0, a3 or a0, a0, a3
.L4: .L4:
srli a3, a3, 1 srli a3, a3, 1
srli a2, a2, 1 srli a2, a2, 1
bnez a3, .L3 bnez a3, .L3
.L5: .L5:
ret ret
ENDPROC(__udivdi3)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment