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
dc78c64f
Commit
dc78c64f
authored
Nov 07, 2008
by
Ken Thompson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
byte multiply
R=r OCL=18807 CL=18807
parent
434c6052
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
34 additions
and
1 deletion
+34
-1
src/cmd/6g/cgen.c
src/cmd/6g/cgen.c
+4
-1
src/cmd/6g/gen.c
src/cmd/6g/gen.c
+29
-0
src/cmd/6g/gg.h
src/cmd/6g/gg.h
+1
-0
No files found.
src/cmd/6g/cgen.c
View file @
dc78c64f
...
...
@@ -122,7 +122,10 @@ cgen(Node *n, Node *res)
case
OADD
:
case
OMUL
:
a
=
optoas
(
n
->
op
,
nl
->
type
);
goto
sbop
;
if
(
a
!=
AIMULB
)
goto
sbop
;
cgen_bmul
(
n
->
op
,
nl
,
nr
,
res
);
break
;
// asymmetric binary
case
OSUB
:
...
...
src/cmd/6g/gen.c
View file @
dc78c64f
...
...
@@ -1095,6 +1095,35 @@ ret:
;
}
void
cgen_bmul
(
int
op
,
Node
*
nl
,
Node
*
nr
,
Node
*
res
)
{
Node
n1
,
n2
;
Type
*
t
;
int
a
;
t
=
types
[
TUINT16
];
if
(
issigned
[
nl
->
type
->
etype
])
t
=
types
[
TINT16
];
if
(
nl
->
ullman
>=
nr
->
ullman
)
{
regalloc
(
&
n1
,
t
,
nl
);
cgen
(
nl
,
&
n1
);
regalloc
(
&
n2
,
t
,
nr
);
cgen
(
nr
,
&
n2
);
}
else
{
regalloc
(
&
n2
,
t
,
nr
);
cgen
(
nr
,
&
n2
);
regalloc
(
&
n1
,
t
,
nl
);
cgen
(
nl
,
&
n1
);
}
a
=
optoas
(
op
,
t
);
gins
(
a
,
&
n2
,
&
n1
);
gmove
(
&
n1
,
res
);
regfree
(
&
n1
);
regfree
(
&
n2
);
}
void
checklabels
(
void
)
{
...
...
src/cmd/6g/gg.h
View file @
dc78c64f
...
...
@@ -138,6 +138,7 @@ void cgen_callinter(Node*, Node*, int);
void
cgen_proc
(
Node
*
);
void
cgen_callret
(
Node
*
,
Node
*
);
void
cgen_div
(
int
,
Node
*
,
Node
*
,
Node
*
);
void
cgen_bmul
(
int
,
Node
*
,
Node
*
,
Node
*
);
void
cgen_shift
(
int
,
Node
*
,
Node
*
,
Node
*
);
void
genpanic
(
void
);
int
needconvert
(
Type
*
,
Type
*
);
...
...
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