Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
go
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
go
Commits
d169dcee
Commit
d169dcee
authored
Aug 04, 2009
by
Russ Cox
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix division bug
R=ken OCL=32760 CL=32760
parent
abaf6046
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
2 deletions
+27
-2
src/cmd/6g/ggen.c
src/cmd/6g/ggen.c
+27
-2
No files found.
src/cmd/6g/ggen.c
View file @
d169dcee
...
...
@@ -534,21 +534,46 @@ dodiv(int op, Node *nl, Node *nr, Node *res, Node *ax, Node *dx)
void
cgen_div
(
int
op
,
Node
*
nl
,
Node
*
nr
,
Node
*
res
)
{
Node
ax
,
dx
;
Node
ax
,
dx
,
oldax
,
olddx
;
int
rax
,
rdx
;
if
(
nl
->
ullman
>=
UINF
||
nr
->
ullman
>=
UINF
)
fatal
(
"cgen_div UINF"
);
rax
=
reg
[
D_AX
];
rdx
=
reg
[
D_DX
];
nodreg
(
&
ax
,
types
[
TINT64
],
D_AX
);
nodreg
(
&
dx
,
types
[
TINT64
],
D_DX
);
regalloc
(
&
ax
,
nl
->
type
,
&
ax
);
regalloc
(
&
dx
,
nl
->
type
,
&
dx
);
// save current ax and dx if they are live
memset
(
&
oldax
,
0
,
sizeof
oldax
);
memset
(
&
olddx
,
0
,
sizeof
olddx
);
if
(
rax
>
0
)
{
regalloc
(
&
oldax
,
nl
->
type
,
N
);
gmove
(
&
ax
,
&
oldax
);
}
if
(
rdx
>
0
)
{
regalloc
(
&
olddx
,
nl
->
type
,
N
);
gmove
(
&
dx
,
&
olddx
);
}
dodiv
(
op
,
nl
,
nr
,
res
,
&
ax
,
&
dx
);
regfree
(
&
ax
);
regfree
(
&
dx
);
if
(
rax
>
0
)
{
gmove
(
&
oldax
,
&
ax
);
regfree
(
&
oldax
);
}
if
(
rdx
>
0
)
{
gmove
(
&
olddx
,
&
dx
);
regfree
(
&
olddx
);
}
}
/*
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment