diff options
author | Austin Clements <austin@google.com> | 2014-11-03 10:53:11 -0500 |
---|---|---|
committer | Austin Clements <austin@google.com> | 2014-11-03 10:53:11 -0500 |
commit | a99ecf3e88b4af2999b94cc7195cb64c8e7addcd (patch) | |
tree | 7503515b74bc72ddf1b66e17da99c2f9cae22b31 /test | |
parent | 27415cf7bf3f0be8cd0a5e696bfaac6d16cc9cf1 (diff) | |
parent | 0fc3394d300f31ece45f1ddf7d3e4db951d73466 (diff) | |
download | go-a99ecf3e88b4af2999b94cc7195cb64c8e7addcd.tar.gz |
[dev.power64] all: merge default into dev.power64
Trivial merge except for src/runtime/asm_power64x.s and
src/runtime/signal_power64x.c
LGTM=rsc
R=rsc
CC=golang-codereviews
https://codereview.appspot.com/168950044
Diffstat (limited to 'test')
-rw-r--r-- | test/clearfat.go | 68 | ||||
-rw-r--r-- | test/nosplit.go | 21 |
2 files changed, 83 insertions, 6 deletions
diff --git a/test/clearfat.go b/test/clearfat.go new file mode 100644 index 000000000..45d539306 --- /dev/null +++ b/test/clearfat.go @@ -0,0 +1,68 @@ +// runoutput + +// Copyright 2014 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Check that {5,6,8,9}g/ggen.c:clearfat is zeroing the entire object. + +package main + +import ( + "bytes" + "fmt" + "strconv" + "strings" +) + +const ntest = 1100 + +func main() { + var decls, calls bytes.Buffer + + for i := 1; i <= ntest; i++ { + s := strconv.Itoa(i) + decls.WriteString(strings.Replace(decl, "$", s, -1)) + calls.WriteString(strings.Replace("poison$()\n\tclearfat$()\n\t", "$", s, -1)) + } + + program = strings.Replace(program, "$DECLS", decls.String(), 1) + program = strings.Replace(program, "$CALLS", calls.String(), 1) + fmt.Print(program) +} + +var program = `package main + +var count int + +$DECLS + +func main() { + $CALLS + if count != 0 { + println("failed", count, "case(s)") + } +} +` + +const decl = ` +func poison$() { + // Grow and poison the stack space that will be used by clearfat$ + var t [2*$]byte + for i := range t { + t[i] = 0xff + } +} + +func clearfat$() { + var t [$]byte + + for _, x := range t { + if x != 0 { +// println("clearfat$: index", i, "expected 0, got", x) + count++ + break + } + } +} +` diff --git a/test/nosplit.go b/test/nosplit.go index 953a5bf0a..3a63e8731 100644 --- a/test/nosplit.go +++ b/test/nosplit.go @@ -127,8 +127,9 @@ main 136 nosplit; REJECT # Calling a nosplit function from a nosplit function requires # having room for the saved caller PC and the called frame. # Because ARM doesn't save LR in the leaf, it gets an extra 4 bytes. +# Because Power64 doesn't save LR in the leaf, it gets an extra 8 bytes. main 112 nosplit call f; f 0 nosplit -main 116 nosplit call f; f 0 nosplit; REJECT amd64 +main 116 nosplit call f; f 0 nosplit main 120 nosplit call f; f 0 nosplit; REJECT amd64 main 124 nosplit call f; f 0 nosplit; REJECT amd64 386 main 128 nosplit call f; f 0 nosplit; REJECT @@ -137,8 +138,8 @@ main 136 nosplit call f; f 0 nosplit; REJECT # Calling a splitting function from a nosplit function requires # having room for the saved caller PC of the call but also the -# saved caller PC for the call to morestack. Again the ARM works -# in less space. +# saved caller PC for the call to morestack. +# Again the ARM and Power64 work in less space. main 104 nosplit call f; f 0 call f main 108 nosplit call f; f 0 call f main 112 nosplit call f; f 0 call f; REJECT amd64 @@ -234,9 +235,17 @@ TestCases: fmt.Fprintf(&gobuf, "package main\n") var buf bytes.Buffer - if goarch == "arm" { + ptrSize := 4 + switch goarch { + case "power64", "power64le": + ptrSize = 8 + fmt.Fprintf(&buf, "#define CALL BL\n#define REGISTER (CTR)\n#define RET RETURN\n") + case "arm": fmt.Fprintf(&buf, "#define CALL BL\n#define REGISTER (R0)\n") - } else { + case "amd64": + ptrSize = 8 + fmt.Fprintf(&buf, "#define REGISTER AX\n") + default: fmt.Fprintf(&buf, "#define REGISTER AX\n") } @@ -266,7 +275,7 @@ TestCases: size += 384 - 128 } - if goarch == "amd64" && size%8 == 4 { + if size%ptrSize == 4 { continue TestCases } nosplit := m[3] |