go/test/codegen
Alberto Donizetti c028958393 test/codegen: fix issue with arm64 memmove codegen test
This recently added arm64 memmove codegen check:

  func movesmall() {
    // arm64:-"memmove"
    x := [...]byte{1, 2, 3, 4, 5, 6, 7}
    copy(x[1:], x[:])
  }

is not correct, for two reasons:

1. regexps are matched from the start of the disasm line (excluding
   line information). This mean that a negative -"memmove" check will
   pass against a 'CALL runtime.memmove' line because the line does
   not start with 'memmove' (its starts with CALL...).
   The way to specify no 'memmove' match whatsoever on the line is
   -".*memmove"

2. AFAIK comments on their own line are matched against the first
   subsequent non-comment line. So the code above only verifies that
   the x := ... line does not generate a memmove. The comment should
   be moved near the copy() line, if it's that one we want to not
   generate a memmove call.

The fact that the test above is not effective can be checked by
running `go run run.go -v codegen` in the toplevel test directory with
a go1.10 toolchain (that does not have the memmove-elision
optimization). The test will still pass (it shouldn't).

This change changes the regexp to -".*memmove" and moves it near the
line it needs to (not)match.

Change-Id: Ie01ef4d775e77d92dc8d8b7856b89b200f5e5ef2
Reviewed-on: https://go-review.googlesource.com/98977
Run-TryBot: Alberto Donizetti <alb.donizetti@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2018-03-07 16:41:24 +00:00
..
bits.go test/codegen: add copyright headers to new codegen files 2018-03-02 20:13:13 +00:00
issue22703.go test: port a nil-check interface test from asm_test 2018-03-03 20:20:54 +00:00
math.go test: convert all math-related tests from asm_test 2018-03-04 16:52:33 +00:00
mathbits.go test/codegen: port math/bits.ReverseBytes tests to codegen 2018-03-06 20:34:33 +00:00
memcombine.go cmd/compile/internal/ssa: improve store combine optimization on arm64 2018-03-06 20:29:04 +00:00
movesmall.go test/codegen: fix issue with arm64 memmove codegen test 2018-03-07 16:41:24 +00:00
rotate.go test: convert all math-related tests from asm_test 2018-03-04 16:52:33 +00:00