Linux kernel mirror (for testing)
git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel
os
linux
1/*
2 * Copyright (C) 2016-2017 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
14#include <linux/linkage.h>
15
16ENTRY(__udivdi3)
17 mv a2, a1
18 mv a1, a0
19 li a0, -1
20 beqz a2, .L5
21 li a3, 1
22 bgeu a2, a1, .L2
23.L1:
24 blez a2, .L2
25 slli a2, a2, 1
26 slli a3, a3, 1
27 bgtu a1, a2, .L1
28.L2:
29 li a0, 0
30.L3:
31 bltu a1, a2, .L4
32 sub a1, a1, a2
33 or a0, a0, a3
34.L4:
35 srli a3, a3, 1
36 srli a2, a2, 1
37 bnez a3, .L3
38.L5:
39 ret
40ENDPROC(__udivdi3)