Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
G
golang
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
golang
Commits
ac499ed7
Commit
ac499ed7
authored
Mar 05, 2010
by
Russ Cox
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gc: better compilation of floating point +=
R=ken2 CC=golang-dev
https://golang.org/cl/255042
parent
8c9944d8
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
63 additions
and
31 deletions
+63
-31
ggen.c
src/cmd/5g/ggen.c
+17
-9
ggen.c
src/cmd/6g/ggen.c
+17
-9
cgen.c
src/cmd/8g/cgen.c
+1
-1
ggen.c
src/cmd/8g/ggen.c
+23
-10
walk.c
src/cmd/gc/walk.c
+5
-2
No files found.
src/cmd/5g/ggen.c
View file @
ac499ed7
...
...
@@ -479,27 +479,35 @@ cgen_asop(Node *n)
}
hard:
if
(
nr
->
ullman
>
nl
->
ullman
)
{
n2
.
op
=
0
;
n1
.
op
=
0
;
if
(
nr
->
ullman
>=
nl
->
ullman
||
nl
->
addable
)
{
regalloc
(
&
n2
,
nr
->
type
,
N
);
cgen
(
nr
,
&
n2
);
igen
(
nl
,
&
n1
,
N
)
;
nr
=
&
n2
;
}
else
{
igen
(
nl
,
&
n1
,
N
);
regalloc
(
&
n2
,
nr
->
type
,
N
);
tempname
(
&
n2
,
nr
->
type
);
cgen
(
nr
,
&
n2
);
nr
=
&
n2
;
}
if
(
!
nl
->
addable
)
{
igen
(
nl
,
&
n1
,
N
);
nl
=
&
n1
;
}
n3
=
*
n
;
n3
.
left
=
&
n1
;
n3
.
right
=
&
n2
;
n3
.
left
=
nl
;
n3
.
right
=
nr
;
n3
.
op
=
n
->
etype
;
regalloc
(
&
n4
,
nl
->
type
,
N
);
cgen
(
&
n3
,
&
n4
);
gmove
(
&
n4
,
&
n1
);
gmove
(
&
n4
,
nl
);
regfree
(
&
n1
);
regfree
(
&
n2
);
if
(
n1
.
op
)
regfree
(
&
n1
);
if
(
n2
.
op
==
OREGISTER
)
regfree
(
&
n2
);
regfree
(
&
n4
);
goto
ret
;
...
...
src/cmd/6g/ggen.c
View file @
ac499ed7
...
...
@@ -432,27 +432,35 @@ cgen_asop(Node *n)
}
hard:
if
(
nr
->
ullman
>
nl
->
ullman
)
{
n2
.
op
=
0
;
n1
.
op
=
0
;
if
(
nr
->
ullman
>=
nl
->
ullman
||
nl
->
addable
)
{
regalloc
(
&
n2
,
nr
->
type
,
N
);
cgen
(
nr
,
&
n2
);
igen
(
nl
,
&
n1
,
N
)
;
nr
=
&
n2
;
}
else
{
igen
(
nl
,
&
n1
,
N
);
regalloc
(
&
n2
,
nr
->
type
,
N
);
tempname
(
&
n2
,
nr
->
type
);
cgen
(
nr
,
&
n2
);
nr
=
&
n2
;
}
if
(
!
nl
->
addable
)
{
igen
(
nl
,
&
n1
,
N
);
nl
=
&
n1
;
}
n3
=
*
n
;
n3
.
left
=
&
n1
;
n3
.
right
=
&
n2
;
n3
.
left
=
nl
;
n3
.
right
=
nr
;
n3
.
op
=
n
->
etype
;
regalloc
(
&
n4
,
nl
->
type
,
N
);
cgen
(
&
n3
,
&
n4
);
gmove
(
&
n4
,
&
n1
);
gmove
(
&
n4
,
nl
);
regfree
(
&
n1
);
regfree
(
&
n2
);
if
(
n1
.
op
)
regfree
(
&
n1
);
if
(
n2
.
op
==
OREGISTER
)
regfree
(
&
n2
);
regfree
(
&
n4
);
ret:
...
...
src/cmd/8g/cgen.c
View file @
ac499ed7
...
...
@@ -18,7 +18,7 @@ mgen(Node *n, Node *n1, Node *rg)
reg
[
n
->
val
.
u
.
reg
]
++
;
return
;
}
if
(
n
->
type
->
width
>
widthptr
)
if
(
n
->
type
->
width
>
widthptr
&&
!
isfloat
[
n
->
type
->
etype
]
)
tempname
(
n1
,
n
->
type
);
else
regalloc
(
n1
,
n
->
type
,
rg
);
...
...
src/cmd/8g/ggen.c
View file @
ac499ed7
...
...
@@ -471,21 +471,34 @@ cgen_asop(Node *n)
}
hard:
tempname
(
&
n2
,
nr
->
type
);
cgen
(
nr
,
&
n2
);
igen
(
nl
,
&
n1
,
N
);
n2
.
op
=
0
;
n1
.
op
=
0
;
if
(
nr
->
ullman
>=
nl
->
ullman
||
nl
->
addable
)
{
mgen
(
nr
,
&
n2
,
N
);
nr
=
&
n2
;
nr
=
&
n2
;
}
else
{
tempname
(
&
n2
,
nr
->
type
);
cgen
(
nr
,
&
n2
);
nr
=
&
n2
;
}
if
(
!
nl
->
addable
)
{
igen
(
nl
,
&
n1
,
N
);
nl
=
&
n1
;
}
n3
=
*
n
;
n3
.
left
=
&
n1
;
n3
.
right
=
&
n2
;
n3
.
left
=
nl
;
n3
.
right
=
nr
;
n3
.
op
=
n
->
etype
;
tempname
(
&
n4
,
nl
->
type
);
cgen
(
&
n3
,
&
n4
);
gmove
(
&
n4
,
&
n1
);
mgen
(
&
n3
,
&
n4
,
N
);
gmove
(
&
n4
,
nl
);
regfree
(
&
n1
);
if
(
n1
.
op
)
regfree
(
&
n1
);
mfree
(
&
n2
);
mfree
(
&
n4
);
ret:
;
...
...
src/cmd/gc/walk.c
View file @
ac499ed7
...
...
@@ -823,10 +823,13 @@ walkexpr(Node **np, NodeList **init)
}
/*
* on 32-bit arch, rewrite 64-bit ops into l = l op r
* on 32-bit arch, rewrite 64-bit ops into l = l op r.
* on 386, rewrite float ops into l = l op r.
* TODO(rsc): Maybe this rewrite should be done always?
*/
et
=
n
->
left
->
type
->
etype
;
if
(
widthptr
==
4
&&
(
et
==
TUINT64
||
et
==
TINT64
))
{
if
((
widthptr
==
4
&&
(
et
==
TUINT64
||
et
==
TINT64
))
||
(
thechar
==
'8'
&&
isfloat
[
et
]))
{
l
=
safeexpr
(
n
->
left
,
init
);
r
=
nod
(
OAS
,
l
,
nod
(
n
->
etype
,
l
,
n
->
right
));
typecheck
(
&
r
,
Etop
);
...
...
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