Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(725)

Issue 6494107: code review 6494107: cmd/6g, cmd/8g: add OINDREG, ODOT, ODOTPTR cases to igen. (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
11 years, 7 months ago by remyoudompheng
Modified:
11 years, 7 months ago
Reviewers:
CC:
rsc, nigeltao, golang-dev, remy_archlinux.org
Visibility:
Public.

Description

cmd/6g, cmd/8g: add OINDREG, ODOT, ODOTPTR cases to igen. Apart from reducing the number of LEAL/LEAQ instructions by about 30%, it gives 8g easier registerization in several cases, for example in strconv. Performance with 6g is not affected. Before (386): src/pkg/strconv/decimal.go:22 TEXT (*decimal).String+0(SB),$240-12 src/pkg/strconv/extfloat.go:540 TEXT (*extFloat).ShortestDecimal+0(SB),$584-20 After (386): src/pkg/strconv/decimal.go:22 TEXT (*decimal).String+0(SB),$196-12 src/pkg/strconv/extfloat.go:540 TEXT (*extFloat).ShortestDecimal+0(SB),$420-20 Benchmarks with GOARCH=386 (on a Core 2). benchmark old ns/op new ns/op delta BenchmarkBinaryTree17 7110191000 7079644000 -0.43% BenchmarkFannkuch11 7769274000 7766514000 -0.04% BenchmarkGobDecode 33454820 34755400 +3.89% BenchmarkGobEncode 11675710 11007050 -5.73% BenchmarkGzip 2013519000 1593855000 -20.84% BenchmarkGunzip 253368200 242667600 -4.22% BenchmarkJSONEncode 152443900 120763400 -20.78% BenchmarkJSONDecode 304112800 247461800 -18.63% BenchmarkMandelbrot200 29245520 29240490 -0.02% BenchmarkParse 8484105 8088660 -4.66% BenchmarkRevcomp 2695688000 2841263000 +5.40% BenchmarkTemplate 363759800 277271200 -23.78% benchmark old ns/op new ns/op delta BenchmarkAtof64Decimal 127 129 +1.57% BenchmarkAtof64Float 166 164 -1.20% BenchmarkAtof64FloatExp 308 300 -2.60% BenchmarkAtof64Big 584 571 -2.23% BenchmarkAppendFloatDecimal 440 430 -2.27% BenchmarkAppendFloat 995 776 -22.01% BenchmarkAppendFloatExp 897 746 -16.83% BenchmarkAppendFloatNegExp 900 752 -16.44% BenchmarkAppendFloatBig 1528 1228 -19.63% BenchmarkAppendFloat32Integer 443 453 +2.26% BenchmarkAppendFloat32ExactFraction 812 661 -18.60% BenchmarkAppendFloat32Point 1002 773 -22.85% BenchmarkAppendFloat32Exp 858 725 -15.50% BenchmarkAppendFloat32NegExp 848 728 -14.15% BenchmarkAppendFloat64Fixed1 447 431 -3.58% BenchmarkAppendFloat64Fixed2 480 462 -3.75% BenchmarkAppendFloat64Fixed3 461 457 -0.87% BenchmarkAppendFloat64Fixed4 509 484 -4.91% Update issue 1914.

Patch Set 1 #

Patch Set 2 : diff -r 0a0666f2fe86 https://go.googlecode.com/hg/ #

Patch Set 3 : diff -r 0a0666f2fe86 https://go.googlecode.com/hg/ #

Patch Set 4 : diff -r 46e193d130ce https://go.googlecode.com/hg/ #

Total comments: 2

Patch Set 5 : diff -r b7ce1e467a60 https://go.googlecode.com/hg/ #

Total comments: 4

Patch Set 6 : diff -r 3129dea153c7 https://go.googlecode.com/hg/ #

Patch Set 7 : diff -r 3129dea153c7 https://go.googlecode.com/hg/ #

Patch Set 8 : diff -r 3129dea153c7 https://go.googlecode.com/hg/ #

Unified diffs Side-by-side diffs Delta from patch set Stats (+76 lines, -11 lines) Patch
M src/cmd/6g/cgen.c View 1 2 3 4 5 2 chunks +34 lines, -1 line 0 comments Download
M src/cmd/8g/cgen.c View 1 2 3 4 5 3 chunks +36 lines, -4 lines 0 comments Download
M src/cmd/8g/gsubr.c View 1 2 3 4 3 chunks +3 lines, -3 lines 0 comments Download
M src/cmd/gc/go.h View 1 2 3 4 5 1 chunk +3 lines, -3 lines 0 comments Download

Messages

Total messages: 15
remyoudompheng
Hello rsc@golang.org, golang-dev@googlegroups.com (cc: golang-dev@googlegroups.com, remy@archlinux.org), I'd like you to review this change to https://go.googlecode.com/hg/
11 years, 7 months ago (2012-09-09 08:02:13 UTC) #1
nigeltao
FWIW, for 6g, the before/after for go build -a -gcflags '-S' cmd/go | grep LEAQ ...
11 years, 7 months ago (2012-09-10 06:47:42 UTC) #2
remyoudompheng
I think the patch is missing a refcount update on the register. It doesn't cause ...
11 years, 7 months ago (2012-09-10 06:56:58 UTC) #3
rsc
yes, you should need a refcount update
11 years, 7 months ago (2012-09-11 03:25:46 UTC) #4
remyoudompheng
Hello rsc@golang.org, golang-dev@googlegroups.com, nigeltao@golang.org (cc: golang-dev@googlegroups.com, remy@archlinux.org), Please take another look.
11 years, 7 months ago (2012-09-11 19:32:36 UTC) #5
remyoudompheng
I have added ODOT and ODOTPTR which were initially intended for a separate patch. I ...
11 years, 7 months ago (2012-09-11 19:35:19 UTC) #6
rsc
Looks good except for the loops in gsubr.c. I think they should stay D_AL because ...
11 years, 7 months ago (2012-09-17 21:10:24 UTC) #7
remyoudompheng
On 2012/09/17 21:10:24, rsc wrote: > Looks good except for the loops in gsubr.c. > ...
11 years, 7 months ago (2012-09-17 21:21:32 UTC) #8
rsc
I think you are probably right that they cannot be used at all. In that ...
11 years, 7 months ago (2012-09-17 21:26:02 UTC) #9
remyoudompheng
Hello rsc@golang.org, nigeltao@golang.org (cc: golang-dev@googlegroups.com, remy@archlinux.org), Please take another look.
11 years, 7 months ago (2012-09-17 23:25:34 UTC) #10
remyoudompheng
I apparently was confused by the n->type->type thing and added a comment to make more ...
11 years, 7 months ago (2012-09-17 23:27:35 UTC) #11
remyoudompheng
ping
11 years, 7 months ago (2012-09-21 21:51:57 UTC) #12
rsc
LGTM Please double-check that I didn't get the TMAP parts backward. http://codereview.appspot.com/6494107/diff/14001/src/cmd/gc/go.h File src/cmd/gc/go.h (right): ...
11 years, 7 months ago (2012-09-24 14:38:38 UTC) #13
remyoudompheng
I will regenerate the benchmarks because some other patches were committed.
11 years, 7 months ago (2012-09-24 20:15:08 UTC) #14
remyoudompheng
11 years, 7 months ago (2012-09-24 21:09:17 UTC) #15
*** Submitted as http://code.google.com/p/go/source/detail?r=7a7ff5c22a26 ***

cmd/6g, cmd/8g: add OINDREG, ODOT, ODOTPTR cases to igen.

Apart from reducing the number of LEAL/LEAQ instructions by about
30%, it gives 8g easier registerization in several cases,
for example in strconv. Performance with 6g is not affected.

Before (386):
src/pkg/strconv/decimal.go:22   TEXT  (*decimal).String+0(SB),$240-12
src/pkg/strconv/extfloat.go:540 TEXT  (*extFloat).ShortestDecimal+0(SB),$584-20

After (386):
src/pkg/strconv/decimal.go:22   TEXT  (*decimal).String+0(SB),$196-12
src/pkg/strconv/extfloat.go:540 TEXT  (*extFloat).ShortestDecimal+0(SB),$420-20

Benchmarks with GOARCH=386 (on a Core 2).

benchmark                 old ns/op    new ns/op    delta
BenchmarkBinaryTree17    7110191000   7079644000   -0.43%
BenchmarkFannkuch11      7769274000   7766514000   -0.04%
BenchmarkGobDecode         33454820     34755400   +3.89%
BenchmarkGobEncode         11675710     11007050   -5.73%
BenchmarkGzip            2013519000   1593855000  -20.84%
BenchmarkGunzip           253368200    242667600   -4.22%
BenchmarkJSONEncode       152443900    120763400  -20.78%
BenchmarkJSONDecode       304112800    247461800  -18.63%
BenchmarkMandelbrot200     29245520     29240490   -0.02%
BenchmarkParse              8484105      8088660   -4.66%
BenchmarkRevcomp         2695688000   2841263000   +5.40%
BenchmarkTemplate         363759800    277271200  -23.78%

benchmark                       old ns/op    new ns/op    delta
BenchmarkAtof64Decimal                127          129   +1.57%
BenchmarkAtof64Float                  166          164   -1.20%
BenchmarkAtof64FloatExp               308          300   -2.60%
BenchmarkAtof64Big                    584          571   -2.23%
BenchmarkAppendFloatDecimal           440          430   -2.27%
BenchmarkAppendFloat                  995          776  -22.01%
BenchmarkAppendFloatExp               897          746  -16.83%
BenchmarkAppendFloatNegExp            900          752  -16.44%
BenchmarkAppendFloatBig              1528         1228  -19.63%
BenchmarkAppendFloat32Integer         443          453   +2.26%
BenchmarkAppendFloat32ExactFraction   812          661  -18.60%
BenchmarkAppendFloat32Point          1002          773  -22.85%
BenchmarkAppendFloat32Exp             858          725  -15.50%
BenchmarkAppendFloat32NegExp          848          728  -14.15%
BenchmarkAppendFloat64Fixed1          447          431   -3.58%
BenchmarkAppendFloat64Fixed2          480          462   -3.75%
BenchmarkAppendFloat64Fixed3          461          457   -0.87%
BenchmarkAppendFloat64Fixed4          509          484   -4.91%

Update issue 1914.

R=rsc, nigeltao
CC=golang-dev, remy
http://codereview.appspot.com/6494107

http://codereview.appspot.com/6494107/diff/14001/src/cmd/gc/go.h
File src/cmd/gc/go.h (right):

http://codereview.appspot.com/6494107/diff/14001/src/cmd/gc/go.h#newcode173
src/cmd/gc/go.h:173: Type*	type;		// the element type, like Elem in reflect
On 2012/09/24 14:38:38, rsc wrote:
> // actual type for TFIELD, element type for TARRAY, TCHAN, TMAP, TPTRxx

Done.

http://codereview.appspot.com/6494107/diff/14001/src/cmd/gc/go.h#newcode177
src/cmd/gc/go.h:177: Type*	down;		// also used in TMAP
On 2012/09/24 14:38:38, rsc wrote:
> // also key type in TMAP

Done.
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b