Commit 9e28ea0c authored by Robert Griesemer's avatar Robert Griesemer

cmd/compile: use std "DO NOT EDIT" comment for generated files

Also: Fix (testdata/gen/) copyGen.go, zeroGen.go, and arithConstGen.go
to actually match (testdata/) copy.go, zero.go, and arithConst.go, all
of which were manually edited in https://go-review.googlesource.com/20823
and https://go-review.googlesource.com/22748 despite the 'do not edit'
(or perhaps because it was missing in the case of arithConst.go).

For #13560.

Change-Id: I366e1b521e51885e0d318ae848760e5e14ccd488
Reviewed-on: https://go-review.googlesource.com/39172Reviewed-by: default avatarRob Pike <r@golang.org>
parent 654c977b
// AUTO-GENERATED by mkbuiltin.go; DO NOT EDIT
// Code generated by mkbuiltin.go. DO NOT EDIT.
package gc
......
// run
// Code generated by gen/constFoldGen.go. DO NOT EDIT.
package gc
import "testing"
......
......@@ -31,7 +31,7 @@ func main() {
flag.Parse()
var b bytes.Buffer
fmt.Fprintln(&b, "// AUTO-GENERATED by mkbuiltin.go; DO NOT EDIT")
fmt.Fprintln(&b, "// Code generated by mkbuiltin.go. DO NOT EDIT.")
fmt.Fprintln(&b)
fmt.Fprintln(&b, "package gc")
......
// run
// Code generated by gen/arithBoundaryGen.go. DO NOT EDIT.
package main
import "fmt"
......
// run
// Code generated by gen/arithConstGen.go. DO NOT EDIT.
package main
import "fmt"
......
// run
// autogenerated from gen/copyGen.go - do not edit!
// Code generated by gen/copyGen.go. DO NOT EDIT.
package main
import "fmt"
......
......@@ -90,8 +90,9 @@ type op struct {
var ops = []op{op{"add", "+"}, op{"sub", "-"}, op{"div", "/"}, op{"mod", "%%"}, op{"mul", "*"}}
func main() {
w := new(bytes.Buffer)
fmt.Fprintf(w, "// run\n")
fmt.Fprintf(w, "// Code generated by gen/arithBoundaryGen.go. DO NOT EDIT.\n\n")
fmt.Fprintf(w, "package main;\n")
fmt.Fprintf(w, "import \"fmt\"\n")
......
......@@ -30,24 +30,31 @@ type szD struct {
i []int64
}
var szs []szD = []szD{
szD{name: "uint64", sn: "64", u: []uint64{0, 1, 4294967296, 0xffffFFFFffffFFFF}},
szD{name: "int64", sn: "64", i: []int64{-0x8000000000000000, -0x7FFFFFFFFFFFFFFF,
var szs = []szD{
{name: "uint64", sn: "64", u: []uint64{0, 1, 4294967296, 0xffffFFFFffffFFFF}},
{name: "int64", sn: "64", i: []int64{-0x8000000000000000, -0x7FFFFFFFFFFFFFFF,
-4294967296, -1, 0, 1, 4294967296, 0x7FFFFFFFFFFFFFFE, 0x7FFFFFFFFFFFFFFF}},
szD{name: "uint32", sn: "32", u: []uint64{0, 1, 4294967295}},
szD{name: "int32", sn: "32", i: []int64{-0x80000000, -0x7FFFFFFF, -1, 0,
{name: "uint32", sn: "32", u: []uint64{0, 1, 4294967295}},
{name: "int32", sn: "32", i: []int64{-0x80000000, -0x7FFFFFFF, -1, 0,
1, 0x7FFFFFFF}},
szD{name: "uint16", sn: "16", u: []uint64{0, 1, 65535}},
szD{name: "int16", sn: "16", i: []int64{-32768, -32767, -1, 0, 1, 32766, 32767}},
{name: "uint16", sn: "16", u: []uint64{0, 1, 65535}},
{name: "int16", sn: "16", i: []int64{-32768, -32767, -1, 0, 1, 32766, 32767}},
szD{name: "uint8", sn: "8", u: []uint64{0, 1, 255}},
szD{name: "int8", sn: "8", i: []int64{-128, -127, -1, 0, 1, 126, 127}},
{name: "uint8", sn: "8", u: []uint64{0, 1, 255}},
{name: "int8", sn: "8", i: []int64{-128, -127, -1, 0, 1, 126, 127}},
}
var ops []op = []op{op{"add", "+"}, op{"sub", "-"}, op{"div", "/"}, op{"mul", "*"},
op{"lsh", "<<"}, op{"rsh", ">>"}, op{"mod", "%"}}
var ops = []op{
{"add", "+"},
{"sub", "-"},
{"div", "/"},
{"mul", "*"},
{"lsh", "<<"},
{"rsh", ">>"},
{"mod", "%"},
}
// compute the result of i op j, cast as type t.
func ansU(i, j uint64, t, op string) string {
......@@ -118,9 +125,9 @@ func ansS(i, j int64, t, op string) string {
}
func main() {
w := new(bytes.Buffer)
fmt.Fprintf(w, "// run\n")
fmt.Fprintf(w, "// Code generated by gen/arithConstGen.go. DO NOT EDIT.\n\n")
fmt.Fprintf(w, "package main;\n")
fmt.Fprintf(w, "import \"fmt\"\n")
......@@ -160,7 +167,14 @@ func main() {
// avoid division by zero
if o.name != "mod" && o.name != "div" || i != 0 {
// introduce uint64 cast for rhs shift operands
// if they are too large for default uint type
number := fd.Number
if (o.name == "lsh" || o.name == "rsh") && uint64(uint32(i)) != i {
fd.Number = fmt.Sprintf("uint64(%s)", number)
}
fncCnst1.Execute(w, fd)
fd.Number = number
}
fncCnst2.Execute(w, fd)
......
......@@ -118,9 +118,9 @@ func ansS(i, j int64, t, op string) string {
}
func main() {
w := new(bytes.Buffer)
fmt.Fprintf(w, "// run\n")
fmt.Fprintf(w, "// Code generated by gen/constFoldGen.go. DO NOT EDIT.\n\n")
fmt.Fprintf(w, "package gc\n")
fmt.Fprintf(w, "import \"testing\"\n")
......
......@@ -23,7 +23,7 @@ var sizes = [...]int{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 15, 16, 17, 23, 24, 25, 31,
func main() {
w := new(bytes.Buffer)
fmt.Fprintf(w, "// run\n")
fmt.Fprintf(w, "// autogenerated from gen/copyGen.go - do not edit!\n")
fmt.Fprintf(w, "// Code generated by gen/copyGen.go. DO NOT EDIT.\n\n")
fmt.Fprintf(w, "package main\n")
fmt.Fprintf(w, "import \"fmt\"\n")
......@@ -36,8 +36,8 @@ func main() {
fmt.Fprintf(w, "}\n")
// function being tested
fmt.Fprintf(w, "//go:noinline\n")
fmt.Fprintf(w, "func t%dcopy_ssa(y, x *[%d]byte) {\n", s, s)
fmt.Fprintf(w, " switch{}\n")
fmt.Fprintf(w, " *y = *x\n")
fmt.Fprintf(w, "}\n")
......
......@@ -23,7 +23,7 @@ var sizes = [...]int{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 15, 16, 17, 23, 24, 25, 31,
func main() {
w := new(bytes.Buffer)
fmt.Fprintf(w, "// run\n")
fmt.Fprintf(w, "// autogenerated from gen/zeroGen.go - do not edit!\n")
fmt.Fprintf(w, "// Code generated by gen/zeroGen.go. DO NOT EDIT.\n\n")
fmt.Fprintf(w, "package main\n")
fmt.Fprintf(w, "import \"fmt\"\n")
......@@ -36,8 +36,8 @@ func main() {
fmt.Fprintf(w, "}\n")
// function being tested
fmt.Fprintf(w, "//go:noinline\n")
fmt.Fprintf(w, "func zero%d_ssa(x *[%d]byte) {\n", s, s)
fmt.Fprintf(w, " switch{}\n")
fmt.Fprintf(w, " *x = [%d]byte{}\n", s)
fmt.Fprintf(w, "}\n")
......
// run
// autogenerated from gen/zeroGen.go - do not edit!
// Code generated by gen/zeroGen.go. DO NOT EDIT.
package main
import "fmt"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment