diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/clearfat.go | 68 | ||||
-rw-r--r-- | test/live.go | 2 | ||||
-rw-r--r-- | test/nilptr3.go | 2 | ||||
-rw-r--r-- | test/nosplit.go | 21 |
4 files changed, 86 insertions, 7 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/live.go b/test/live.go index f15bb74ba..f69d0a4c1 100644 --- a/test/live.go +++ b/test/live.go @@ -614,8 +614,8 @@ func newT40() *T40 { func bad40() { t := newT40() - println() _ = t + println() } func good40() { diff --git a/test/nilptr3.go b/test/nilptr3.go index 2757daef0..9d65e1e91 100644 --- a/test/nilptr3.go +++ b/test/nilptr3.go @@ -1,4 +1,6 @@ // errorcheck -0 -d=nil +// Fails on power64x because of incomplete optimization. See issue 9058. +// +build !power64,!power64le // Copyright 2013 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style 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] |