]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/compile: log large copies on riscv64
authorJoel Sing <joel@sing.id.au>
Sun, 12 Apr 2020 15:39:45 +0000 (01:39 +1000)
committerJoel Sing <joel@sing.id.au>
Sun, 12 Apr 2020 17:51:29 +0000 (17:51 +0000)
Log large copies in the riscv64 compiler.

This was missed in 47ade08141b23cfeafed92943e16012d5dc5eb8b, resulting in
the new test added to cmd/compile/internal/logopt failing on riscv64.

Change-Id: I6f763e86f42834148e911d16928f9fbabcfa4290
Reviewed-on: https://go-review.googlesource.com/c/go/+/227804
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Reviewed-by: David Chase <drchase@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

src/cmd/compile/internal/ssa/gen/RISCV64.rules
src/cmd/compile/internal/ssa/rewriteRISCV64.go

index 3d3718b9ae7d2e1e2675e2a8c1e6b33437cd2caf..95aadeb2b8446bd9229381ccd5f4496184740de6 100644 (file)
 (Move [8] dst src mem) -> (MOVDstore dst (MOVDload src mem) mem)
 
 // Generic move uses a loop
-(Move [s] {t} dst src mem) ->
+(Move [s] {t} dst src mem) && (s <= 16 || logLargeCopy(v, s)) ->
        (LoweredMove [t.(*types.Type).Alignment()]
                dst
                src
index 7405f686eb6cba76bcac67f326aba52d38caf1cb..6a0f7f1c96f88d0a525f7d04694f625d79863f24 100644 (file)
@@ -1894,6 +1894,7 @@ func rewriteValueRISCV64_OpMove(v *Value) bool {
                return true
        }
        // match: (Move [s] {t} dst src mem)
+       // cond: (s <= 16 || logLargeCopy(v, s))
        // result: (LoweredMove [t.(*types.Type).Alignment()] dst src (ADDI <src.Type> [s-moveSize(t.(*types.Type).Alignment(), config)] src) mem)
        for {
                s := v.AuxInt
@@ -1901,6 +1902,9 @@ func rewriteValueRISCV64_OpMove(v *Value) bool {
                dst := v_0
                src := v_1
                mem := v_2
+               if !(s <= 16 || logLargeCopy(v, s)) {
+                       break
+               }
                v.reset(OpRISCV64LoweredMove)
                v.AuxInt = t.(*types.Type).Alignment()
                v0 := b.NewValue0(v.Pos, OpRISCV64ADDI, src.Type)
@@ -1909,6 +1913,7 @@ func rewriteValueRISCV64_OpMove(v *Value) bool {
                v.AddArg4(dst, src, v0, mem)
                return true
        }
+       return false
 }
 func rewriteValueRISCV64_OpMul16(v *Value) bool {
        v_1 := v.Args[1]