FAQ
Reviewers: golang-dev_googlegroups.com,

Message:
Hello golang-dev@googlegroups.com (cc: golang-dev@googlegroups.com),

I'd like you to review this change to
https://go.googlecode.com/hg/


Description:
cmd/8g: extend elimination of temporaries to SSE2 code.

Before:
(erf.go:188) TEXT Erf+0(SB),$220
(erf.go:265) TEXT Erfc+0(SB),$204
(lgamma.go:174) TEXT Lgamma+0(SB),$948

After:
(erf.go:188) TEXT Erf+0(SB),$84
(erf.go:265) TEXT Erfc+0(SB),$84
(lgamma.go:174) TEXT Lgamma+0(SB),$44

SSE before vs. SSE after:

benchmark old ns/op new ns/op delta
BenchmarkAcosh 81 49 -39.14%
BenchmarkAsinh 109 109 +0.00%
BenchmarkAtanh 73 74 +0.68%
BenchmarkLgamma 138 42 -69.20%
BenchmarkModf 24 15 -36.95%
BenchmarkSqrtGo 565 556 -1.59%

Please review this at https://codereview.appspot.com/7028048/

Affected files:
M src/cmd/8g/reg.c


Index: src/cmd/8g/reg.c
===================================================================
--- a/src/cmd/8g/reg.c
+++ b/src/cmd/8g/reg.c
@@ -1845,26 +1845,33 @@
for(p=firstp; p!=P; p=p->link) {
if(debug['R'] && debug['v'])
print("%P\n", p);
- if(p->link == P
- || !RtoB(p->from.type)
- || p->to.type != D_AUTO
- || isfloat[p->to.etype])
+ if(p->link == P || p->to.type != D_AUTO)
continue;
- switch(p->as) {
- case AMOVB:
- if(p->to.width == 1)
+ if(isfloat[p->to.etype] && FtoB(p->from.type)) {
+ switch(p->as) {
+ case AMOVSS:
+ case AMOVSD:
break;
- case AMOVW:
- if(p->to.width == 2)
- break;
- case AMOVL:
- if(p->to.width == 4)
- break;
- default:
+ default:
+ continue;
+ }
+ } else if(!isfloat[p->to.etype] && RtoB(p->from.type)) {
+ switch(p->as) {
+ case AMOVB:
+ if(p->to.width == 1)
+ break;
+ case AMOVW:
+ if(p->to.width == 2)
+ break;
+ case AMOVL:
+ if(p->to.width == 4)
+ break;
+ default:
+ continue;
+ }
+ } else
continue;
- }
// p is a MOV reg, mem.
- // and it is not a float.
p2 = p->link;
h = hash32to16(fnv1(p->to.sym));
if(counts[h] != 2) {
@@ -1872,7 +1879,9 @@
}
switch(p2->as) {
case ALEAL:
- case AFMOVL:
+ case AFMOVD:
+ case AFMOVF:
+ case AFMOVL:
case AFMOVW:
case AFMOVV:
// funny

Search Discussions

  • Remyoudompheng at Jan 2, 2013 at 10:20 pm
    The introduction of the GO386=sse setting caused a performance hit: on a
    Core 2, GO386=387 vs GO386=sse (before patch)

    benchmark old ns/op new ns/op delta
    BenchmarkAcosh 56 81 +44.13%
    BenchmarkAsinh 73 109 +48.70%
    BenchmarkAtanh 52 73 +39.77%
    BenchmarkLgamma 77 138 +77.61%
    BenchmarkModf 16 24 +54.66%
    BenchmarkSqrtGo 510 565 +10.78%

    Strangely, the patch fixes the Acosh performance regression, but the
    difference between the SSE before and the SSE after is a single MOVAPD
    (and the code generated for BenchmarkAcosh's loop is the same).


    https://codereview.appspot.com/7028048/
  • Rsc at Jan 2, 2013 at 10:22 pm
  • Remyoudompheng at Jan 2, 2013 at 11:44 pm
    *** Submitted as
    https://code.google.com/p/go/source/detail?r=6e941dd4ded3 ***

    cmd/8g: extend elimination of temporaries to SSE2 code.

    Before:
    (erf.go:188) TEXT Erf+0(SB),$220
    (erf.go:265) TEXT Erfc+0(SB),$204
    (lgamma.go:174) TEXT Lgamma+0(SB),$948

    After:
    (erf.go:188) TEXT Erf+0(SB),$84
    (erf.go:265) TEXT Erfc+0(SB),$84
    (lgamma.go:174) TEXT Lgamma+0(SB),$44

    SSE before vs. SSE after:

    benchmark old ns/op new ns/op delta
    BenchmarkAcosh 81 49 -39.14%
    BenchmarkAsinh 109 109 +0.00%
    BenchmarkAtanh 73 74 +0.68%
    BenchmarkLgamma 138 42 -69.20%
    BenchmarkModf 24 15 -36.95%
    BenchmarkSqrtGo 565 556 -1.59%

    R=rsc
    CC=golang-dev
    https://codereview.appspot.com/7028048


    https://codereview.appspot.com/7028048/

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupgolang-dev @
categoriesgo
postedJan 2, '13 at 10:18p
activeJan 2, '13 at 11:44p
posts4
users2
websitegolang.org

2 users in discussion

Remyoudompheng: 3 posts Rsc: 1 post

People

Translate

site design / logo © 2021 Grokbase