repo.or.cz
/
zpugcc
/
jano.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
fixes for host gcc 4.6.1
[zpugcc/jano.git]
/
toolchain
/
gcc
/
newlib
/
libc
/
machine
/
h8500
/
divhi3.S
blob
ee3135110363ae46c1ac41bff8046d8599369685
1
.title "H8/500 DIVIDE"
2
!! 2 byte integer Divide code for the H8/500
3
!!
4
!! Steve Chamberlain
5
!! sac@cygnus.com
6
!!
7
!!
8
9
!! args in r1 and r4, result in r0/r1
10
11
#if __CODE__==32
12
#define RET prts
13
#else
14
#define RET rts
15
#endif
16
.global __divmodhi4
17
18
19
__divmodhi4:
20
clr.w r0
21
tst.w r1 ! neg arg1
22
bpl PU
23
24
25
neg.w r1
26
NU: tst.w r4
27
bmi NN
28
29
NP: divxu.w r4,r0
30
neg.w r0
31
neg.w r1
32
RET
33
34
NN: neg.w r4
35
divxu.w r4,r0
36
neg.w r0 ! get rem sign right
37
RET
38
39
40
PU:
41
tst.w r4
42
bpl PP
43
44
45
PN: neg.w r4
46
divxu.w r4,r0
47
neg.w r1
48
RET
49
50
PP: divxu.w r4,r0 ! rem in r0, q in r1
51
RET
52
53
54