[dev.boringcrypto] all: merge go1.9 into dev.boringcrypto

Previously we were at Go 1.9 rc2.

Change-Id: I9bea028d7078676b0f1f1408e45e7e1d5e349d23
This commit is contained in:
Russ Cox 2017-09-22 14:27:50 -04:00
commit e6ad24cde7
18 changed files with 826 additions and 34 deletions

View File

@ -34,6 +34,7 @@ We encourage all Go users to subscribe to
<p>A <a href="/doc/devel/release.html">summary</a> of the changes between Go releases. Notes for the major releases:</p> <p>A <a href="/doc/devel/release.html">summary</a> of the changes between Go releases. Notes for the major releases:</p>
<ul> <ul>
<li><a href="/doc/go1.9">Go 1.9</a> <small>(August 2017)</small></li>
<li><a href="/doc/go1.8">Go 1.8</a> <small>(February 2017)</small></li> <li><a href="/doc/go1.8">Go 1.8</a> <small>(February 2017)</small></li>
<li><a href="/doc/go1.7">Go 1.7</a> <small>(August 2016)</small></li> <li><a href="/doc/go1.7">Go 1.7</a> <small>(August 2016)</small></li>
<li><a href="/doc/go1.6">Go 1.6</a> <small>(February 2016)</small></li> <li><a href="/doc/go1.6">Go 1.6</a> <small>(February 2016)</small></li>

View File

@ -20,7 +20,14 @@ For example, Go 1.8 is supported until Go 1.10 is released,
and Go 1.9 is supported until Go 1.11 is released. and Go 1.9 is supported until Go 1.11 is released.
We fix critical problems, including <a href="/security">critical security problems</a>, We fix critical problems, including <a href="/security">critical security problems</a>,
in supported releases as needed by issuing minor revisions in supported releases as needed by issuing minor revisions
(for example, Go 1.8.1, Go 1.8.2, and so on). (for example, Go 1.9.1, Go 1.9.2, and so on).
</p>
<h2 id="go1.9">go1.9 (released 2017/08/24)</h2>
<p>
Go 1.9 is a major release of Go.
Read the <a href="/doc/go1.9">Go 1.9 Release Notes</a> for more information.
</p> </p>
<h2 id="go1.8">go1.8 (released 2017/02/16)</h2> <h2 id="go1.8">go1.8 (released 2017/02/16)</h2>

View File

@ -15,12 +15,7 @@ Do not send CLs removing the interior tags from such phrases.
ul li { margin: 0.5em 0; } ul li { margin: 0.5em 0; }
</style> </style>
<h2 id="introduction">DRAFT RELEASE NOTES - Introduction to Go 1.9</h2> <h2 id="introduction">Introduction to Go 1.9</h2>
<p><strong>
Go 1.9 is not yet released. These are work-in-progress
release notes. Go 1.9 is expected to be released in August 2017.
</strong></p>
<p> <p>
The latest Go release, version 1.9, arrives six months The latest Go release, version 1.9, arrives six months
@ -163,7 +158,7 @@ type T1 = T2
was invoked to attempt to locate the root of the Go install tree. was invoked to attempt to locate the root of the Go install tree.
This means that if the entire Go installation is moved to a new This means that if the entire Go installation is moved to a new
location, the go tool should continue to work as usual. location, the go tool should continue to work as usual.
This may be overriden by setting <code>GOROOT</code> in the environment, This may be overridden by setting <code>GOROOT</code> in the environment,
which should only be done in unusual circumstances. which should only be done in unusual circumstances.
Note that this does not affect the result of Note that this does not affect the result of
the <a href="/pkg/runtime/#GOROOT">runtime.GOROOT</a> function, which the <a href="/pkg/runtime/#GOROOT">runtime.GOROOT</a> function, which
@ -490,7 +485,7 @@ version of gccgo.
<p><!-- CL 36696 --> <p><!-- CL 36696 -->
If any SAN extension, including with no DSN names, is present If any SAN extension, including with no DNS names, is present
in the certificate, then the Common Name from in the certificate, then the Common Name from
<a href="/pkg/crypto/x509/#Certificate.Subject"><code>Subject</code></a> is ignored. <a href="/pkg/crypto/x509/#Certificate.Subject"><code>Subject</code></a> is ignored.
In previous releases, the code tested only whether DNS-name SANs were In previous releases, the code tested only whether DNS-name SANs were

View File

@ -221,7 +221,7 @@ To build without <code>cgo</code>, set the environment variable
Change to the directory that will be its parent Change to the directory that will be its parent
and make sure the <code>go</code> directory does not exist. and make sure the <code>go</code> directory does not exist.
Then clone the repository and check out the latest release tag Then clone the repository and check out the latest release tag
(<code class="versionTag">go1.8.1</code>, for example):</p> (<code class="versionTag">go1.9</code>, for example):</p>
<pre> <pre>
$ git clone https://go.googlesource.com/go $ git clone https://go.googlesource.com/go
@ -409,7 +409,7 @@ New releases are announced on the
<a href="//groups.google.com/group/golang-announce">golang-announce</a> <a href="//groups.google.com/group/golang-announce">golang-announce</a>
mailing list. mailing list.
Each announcement mentions the latest release tag, for instance, Each announcement mentions the latest release tag, for instance,
<code class="versionTag">go1.8.1</code>. <code class="versionTag">go1.9</code>.
</p> </p>
<p> <p>

View File

@ -293,4 +293,8 @@ var (
typedmemmove, typedmemmove,
typedmemclr, typedmemclr,
Udiv *obj.LSym Udiv *obj.LSym
// GO386=387
ControlWord64trunc,
ControlWord32 *obj.LSym
) )

View File

@ -92,6 +92,10 @@ func initssaconfig() {
typedmemmove = Sysfunc("typedmemmove") typedmemmove = Sysfunc("typedmemmove")
typedmemclr = Sysfunc("typedmemclr") typedmemclr = Sysfunc("typedmemclr")
Udiv = Sysfunc("udiv") Udiv = Sysfunc("udiv")
// GO386=387 runtime functions
ControlWord64trunc = Sysfunc("controlWord64trunc")
ControlWord32 = Sysfunc("controlWord32")
} }
// buildssa builds an SSA function for fn. // buildssa builds an SSA function for fn.

View File

@ -35,6 +35,16 @@ func add_4294967296_uint64_ssa(a uint64) uint64 {
return 4294967296 + a return 4294967296 + a
} }
//go:noinline
func add_uint64_9223372036854775808_ssa(a uint64) uint64 {
return a + 9223372036854775808
}
//go:noinline
func add_9223372036854775808_uint64_ssa(a uint64) uint64 {
return 9223372036854775808 + a
}
//go:noinline //go:noinline
func add_uint64_18446744073709551615_ssa(a uint64) uint64 { func add_uint64_18446744073709551615_ssa(a uint64) uint64 {
return a + 18446744073709551615 return a + 18446744073709551615
@ -75,6 +85,16 @@ func sub_4294967296_uint64_ssa(a uint64) uint64 {
return 4294967296 - a return 4294967296 - a
} }
//go:noinline
func sub_uint64_9223372036854775808_ssa(a uint64) uint64 {
return a - 9223372036854775808
}
//go:noinline
func sub_9223372036854775808_uint64_ssa(a uint64) uint64 {
return 9223372036854775808 - a
}
//go:noinline //go:noinline
func sub_uint64_18446744073709551615_ssa(a uint64) uint64 { func sub_uint64_18446744073709551615_ssa(a uint64) uint64 {
return a - 18446744073709551615 return a - 18446744073709551615
@ -110,6 +130,16 @@ func div_4294967296_uint64_ssa(a uint64) uint64 {
return 4294967296 / a return 4294967296 / a
} }
//go:noinline
func div_uint64_9223372036854775808_ssa(a uint64) uint64 {
return a / 9223372036854775808
}
//go:noinline
func div_9223372036854775808_uint64_ssa(a uint64) uint64 {
return 9223372036854775808 / a
}
//go:noinline //go:noinline
func div_uint64_18446744073709551615_ssa(a uint64) uint64 { func div_uint64_18446744073709551615_ssa(a uint64) uint64 {
return a / 18446744073709551615 return a / 18446744073709551615
@ -150,6 +180,16 @@ func mul_4294967296_uint64_ssa(a uint64) uint64 {
return 4294967296 * a return 4294967296 * a
} }
//go:noinline
func mul_uint64_9223372036854775808_ssa(a uint64) uint64 {
return a * 9223372036854775808
}
//go:noinline
func mul_9223372036854775808_uint64_ssa(a uint64) uint64 {
return 9223372036854775808 * a
}
//go:noinline //go:noinline
func mul_uint64_18446744073709551615_ssa(a uint64) uint64 { func mul_uint64_18446744073709551615_ssa(a uint64) uint64 {
return a * 18446744073709551615 return a * 18446744073709551615
@ -190,6 +230,16 @@ func lsh_4294967296_uint64_ssa(a uint64) uint64 {
return 4294967296 << a return 4294967296 << a
} }
//go:noinline
func lsh_uint64_9223372036854775808_ssa(a uint64) uint64 {
return a << uint64(9223372036854775808)
}
//go:noinline
func lsh_9223372036854775808_uint64_ssa(a uint64) uint64 {
return 9223372036854775808 << a
}
//go:noinline //go:noinline
func lsh_uint64_18446744073709551615_ssa(a uint64) uint64 { func lsh_uint64_18446744073709551615_ssa(a uint64) uint64 {
return a << uint64(18446744073709551615) return a << uint64(18446744073709551615)
@ -230,6 +280,16 @@ func rsh_4294967296_uint64_ssa(a uint64) uint64 {
return 4294967296 >> a return 4294967296 >> a
} }
//go:noinline
func rsh_uint64_9223372036854775808_ssa(a uint64) uint64 {
return a >> uint64(9223372036854775808)
}
//go:noinline
func rsh_9223372036854775808_uint64_ssa(a uint64) uint64 {
return 9223372036854775808 >> a
}
//go:noinline //go:noinline
func rsh_uint64_18446744073709551615_ssa(a uint64) uint64 { func rsh_uint64_18446744073709551615_ssa(a uint64) uint64 {
return a >> uint64(18446744073709551615) return a >> uint64(18446744073709551615)
@ -265,6 +325,16 @@ func mod_4294967296_uint64_ssa(a uint64) uint64 {
return 4294967296 % a return 4294967296 % a
} }
//go:noinline
func mod_uint64_9223372036854775808_ssa(a uint64) uint64 {
return a % 9223372036854775808
}
//go:noinline
func mod_9223372036854775808_uint64_ssa(a uint64) uint64 {
return 9223372036854775808 % a
}
//go:noinline //go:noinline
func mod_uint64_18446744073709551615_ssa(a uint64) uint64 { func mod_uint64_18446744073709551615_ssa(a uint64) uint64 {
return a % 18446744073709551615 return a % 18446744073709551615
@ -2319,6 +2389,16 @@ func main() {
failed = true failed = true
} }
if got := add_0_uint64_ssa(9223372036854775808); got != 9223372036854775808 {
fmt.Printf("add_uint64 0%s9223372036854775808 = %d, wanted 9223372036854775808\n", `+`, got)
failed = true
}
if got := add_uint64_0_ssa(9223372036854775808); got != 9223372036854775808 {
fmt.Printf("add_uint64 9223372036854775808%s0 = %d, wanted 9223372036854775808\n", `+`, got)
failed = true
}
if got := add_0_uint64_ssa(18446744073709551615); got != 18446744073709551615 { if got := add_0_uint64_ssa(18446744073709551615); got != 18446744073709551615 {
fmt.Printf("add_uint64 0%s18446744073709551615 = %d, wanted 18446744073709551615\n", `+`, got) fmt.Printf("add_uint64 0%s18446744073709551615 = %d, wanted 18446744073709551615\n", `+`, got)
failed = true failed = true
@ -2359,6 +2439,16 @@ func main() {
failed = true failed = true
} }
if got := add_1_uint64_ssa(9223372036854775808); got != 9223372036854775809 {
fmt.Printf("add_uint64 1%s9223372036854775808 = %d, wanted 9223372036854775809\n", `+`, got)
failed = true
}
if got := add_uint64_1_ssa(9223372036854775808); got != 9223372036854775809 {
fmt.Printf("add_uint64 9223372036854775808%s1 = %d, wanted 9223372036854775809\n", `+`, got)
failed = true
}
if got := add_1_uint64_ssa(18446744073709551615); got != 0 { if got := add_1_uint64_ssa(18446744073709551615); got != 0 {
fmt.Printf("add_uint64 1%s18446744073709551615 = %d, wanted 0\n", `+`, got) fmt.Printf("add_uint64 1%s18446744073709551615 = %d, wanted 0\n", `+`, got)
failed = true failed = true
@ -2399,6 +2489,16 @@ func main() {
failed = true failed = true
} }
if got := add_4294967296_uint64_ssa(9223372036854775808); got != 9223372041149743104 {
fmt.Printf("add_uint64 4294967296%s9223372036854775808 = %d, wanted 9223372041149743104\n", `+`, got)
failed = true
}
if got := add_uint64_4294967296_ssa(9223372036854775808); got != 9223372041149743104 {
fmt.Printf("add_uint64 9223372036854775808%s4294967296 = %d, wanted 9223372041149743104\n", `+`, got)
failed = true
}
if got := add_4294967296_uint64_ssa(18446744073709551615); got != 4294967295 { if got := add_4294967296_uint64_ssa(18446744073709551615); got != 4294967295 {
fmt.Printf("add_uint64 4294967296%s18446744073709551615 = %d, wanted 4294967295\n", `+`, got) fmt.Printf("add_uint64 4294967296%s18446744073709551615 = %d, wanted 4294967295\n", `+`, got)
failed = true failed = true
@ -2409,6 +2509,56 @@ func main() {
failed = true failed = true
} }
if got := add_9223372036854775808_uint64_ssa(0); got != 9223372036854775808 {
fmt.Printf("add_uint64 9223372036854775808%s0 = %d, wanted 9223372036854775808\n", `+`, got)
failed = true
}
if got := add_uint64_9223372036854775808_ssa(0); got != 9223372036854775808 {
fmt.Printf("add_uint64 0%s9223372036854775808 = %d, wanted 9223372036854775808\n", `+`, got)
failed = true
}
if got := add_9223372036854775808_uint64_ssa(1); got != 9223372036854775809 {
fmt.Printf("add_uint64 9223372036854775808%s1 = %d, wanted 9223372036854775809\n", `+`, got)
failed = true
}
if got := add_uint64_9223372036854775808_ssa(1); got != 9223372036854775809 {
fmt.Printf("add_uint64 1%s9223372036854775808 = %d, wanted 9223372036854775809\n", `+`, got)
failed = true
}
if got := add_9223372036854775808_uint64_ssa(4294967296); got != 9223372041149743104 {
fmt.Printf("add_uint64 9223372036854775808%s4294967296 = %d, wanted 9223372041149743104\n", `+`, got)
failed = true
}
if got := add_uint64_9223372036854775808_ssa(4294967296); got != 9223372041149743104 {
fmt.Printf("add_uint64 4294967296%s9223372036854775808 = %d, wanted 9223372041149743104\n", `+`, got)
failed = true
}
if got := add_9223372036854775808_uint64_ssa(9223372036854775808); got != 0 {
fmt.Printf("add_uint64 9223372036854775808%s9223372036854775808 = %d, wanted 0\n", `+`, got)
failed = true
}
if got := add_uint64_9223372036854775808_ssa(9223372036854775808); got != 0 {
fmt.Printf("add_uint64 9223372036854775808%s9223372036854775808 = %d, wanted 0\n", `+`, got)
failed = true
}
if got := add_9223372036854775808_uint64_ssa(18446744073709551615); got != 9223372036854775807 {
fmt.Printf("add_uint64 9223372036854775808%s18446744073709551615 = %d, wanted 9223372036854775807\n", `+`, got)
failed = true
}
if got := add_uint64_9223372036854775808_ssa(18446744073709551615); got != 9223372036854775807 {
fmt.Printf("add_uint64 18446744073709551615%s9223372036854775808 = %d, wanted 9223372036854775807\n", `+`, got)
failed = true
}
if got := add_18446744073709551615_uint64_ssa(0); got != 18446744073709551615 { if got := add_18446744073709551615_uint64_ssa(0); got != 18446744073709551615 {
fmt.Printf("add_uint64 18446744073709551615%s0 = %d, wanted 18446744073709551615\n", `+`, got) fmt.Printf("add_uint64 18446744073709551615%s0 = %d, wanted 18446744073709551615\n", `+`, got)
failed = true failed = true
@ -2439,6 +2589,16 @@ func main() {
failed = true failed = true
} }
if got := add_18446744073709551615_uint64_ssa(9223372036854775808); got != 9223372036854775807 {
fmt.Printf("add_uint64 18446744073709551615%s9223372036854775808 = %d, wanted 9223372036854775807\n", `+`, got)
failed = true
}
if got := add_uint64_18446744073709551615_ssa(9223372036854775808); got != 9223372036854775807 {
fmt.Printf("add_uint64 9223372036854775808%s18446744073709551615 = %d, wanted 9223372036854775807\n", `+`, got)
failed = true
}
if got := add_18446744073709551615_uint64_ssa(18446744073709551615); got != 18446744073709551614 { if got := add_18446744073709551615_uint64_ssa(18446744073709551615); got != 18446744073709551614 {
fmt.Printf("add_uint64 18446744073709551615%s18446744073709551615 = %d, wanted 18446744073709551614\n", `+`, got) fmt.Printf("add_uint64 18446744073709551615%s18446744073709551615 = %d, wanted 18446744073709551614\n", `+`, got)
failed = true failed = true
@ -2479,6 +2639,16 @@ func main() {
failed = true failed = true
} }
if got := sub_0_uint64_ssa(9223372036854775808); got != 9223372036854775808 {
fmt.Printf("sub_uint64 0%s9223372036854775808 = %d, wanted 9223372036854775808\n", `-`, got)
failed = true
}
if got := sub_uint64_0_ssa(9223372036854775808); got != 9223372036854775808 {
fmt.Printf("sub_uint64 9223372036854775808%s0 = %d, wanted 9223372036854775808\n", `-`, got)
failed = true
}
if got := sub_0_uint64_ssa(18446744073709551615); got != 1 { if got := sub_0_uint64_ssa(18446744073709551615); got != 1 {
fmt.Printf("sub_uint64 0%s18446744073709551615 = %d, wanted 1\n", `-`, got) fmt.Printf("sub_uint64 0%s18446744073709551615 = %d, wanted 1\n", `-`, got)
failed = true failed = true
@ -2519,6 +2689,16 @@ func main() {
failed = true failed = true
} }
if got := sub_1_uint64_ssa(9223372036854775808); got != 9223372036854775809 {
fmt.Printf("sub_uint64 1%s9223372036854775808 = %d, wanted 9223372036854775809\n", `-`, got)
failed = true
}
if got := sub_uint64_1_ssa(9223372036854775808); got != 9223372036854775807 {
fmt.Printf("sub_uint64 9223372036854775808%s1 = %d, wanted 9223372036854775807\n", `-`, got)
failed = true
}
if got := sub_1_uint64_ssa(18446744073709551615); got != 2 { if got := sub_1_uint64_ssa(18446744073709551615); got != 2 {
fmt.Printf("sub_uint64 1%s18446744073709551615 = %d, wanted 2\n", `-`, got) fmt.Printf("sub_uint64 1%s18446744073709551615 = %d, wanted 2\n", `-`, got)
failed = true failed = true
@ -2559,6 +2739,16 @@ func main() {
failed = true failed = true
} }
if got := sub_4294967296_uint64_ssa(9223372036854775808); got != 9223372041149743104 {
fmt.Printf("sub_uint64 4294967296%s9223372036854775808 = %d, wanted 9223372041149743104\n", `-`, got)
failed = true
}
if got := sub_uint64_4294967296_ssa(9223372036854775808); got != 9223372032559808512 {
fmt.Printf("sub_uint64 9223372036854775808%s4294967296 = %d, wanted 9223372032559808512\n", `-`, got)
failed = true
}
if got := sub_4294967296_uint64_ssa(18446744073709551615); got != 4294967297 { if got := sub_4294967296_uint64_ssa(18446744073709551615); got != 4294967297 {
fmt.Printf("sub_uint64 4294967296%s18446744073709551615 = %d, wanted 4294967297\n", `-`, got) fmt.Printf("sub_uint64 4294967296%s18446744073709551615 = %d, wanted 4294967297\n", `-`, got)
failed = true failed = true
@ -2569,6 +2759,56 @@ func main() {
failed = true failed = true
} }
if got := sub_9223372036854775808_uint64_ssa(0); got != 9223372036854775808 {
fmt.Printf("sub_uint64 9223372036854775808%s0 = %d, wanted 9223372036854775808\n", `-`, got)
failed = true
}
if got := sub_uint64_9223372036854775808_ssa(0); got != 9223372036854775808 {
fmt.Printf("sub_uint64 0%s9223372036854775808 = %d, wanted 9223372036854775808\n", `-`, got)
failed = true
}
if got := sub_9223372036854775808_uint64_ssa(1); got != 9223372036854775807 {
fmt.Printf("sub_uint64 9223372036854775808%s1 = %d, wanted 9223372036854775807\n", `-`, got)
failed = true
}
if got := sub_uint64_9223372036854775808_ssa(1); got != 9223372036854775809 {
fmt.Printf("sub_uint64 1%s9223372036854775808 = %d, wanted 9223372036854775809\n", `-`, got)
failed = true
}
if got := sub_9223372036854775808_uint64_ssa(4294967296); got != 9223372032559808512 {
fmt.Printf("sub_uint64 9223372036854775808%s4294967296 = %d, wanted 9223372032559808512\n", `-`, got)
failed = true
}
if got := sub_uint64_9223372036854775808_ssa(4294967296); got != 9223372041149743104 {
fmt.Printf("sub_uint64 4294967296%s9223372036854775808 = %d, wanted 9223372041149743104\n", `-`, got)
failed = true
}
if got := sub_9223372036854775808_uint64_ssa(9223372036854775808); got != 0 {
fmt.Printf("sub_uint64 9223372036854775808%s9223372036854775808 = %d, wanted 0\n", `-`, got)
failed = true
}
if got := sub_uint64_9223372036854775808_ssa(9223372036854775808); got != 0 {
fmt.Printf("sub_uint64 9223372036854775808%s9223372036854775808 = %d, wanted 0\n", `-`, got)
failed = true
}
if got := sub_9223372036854775808_uint64_ssa(18446744073709551615); got != 9223372036854775809 {
fmt.Printf("sub_uint64 9223372036854775808%s18446744073709551615 = %d, wanted 9223372036854775809\n", `-`, got)
failed = true
}
if got := sub_uint64_9223372036854775808_ssa(18446744073709551615); got != 9223372036854775807 {
fmt.Printf("sub_uint64 18446744073709551615%s9223372036854775808 = %d, wanted 9223372036854775807\n", `-`, got)
failed = true
}
if got := sub_18446744073709551615_uint64_ssa(0); got != 18446744073709551615 { if got := sub_18446744073709551615_uint64_ssa(0); got != 18446744073709551615 {
fmt.Printf("sub_uint64 18446744073709551615%s0 = %d, wanted 18446744073709551615\n", `-`, got) fmt.Printf("sub_uint64 18446744073709551615%s0 = %d, wanted 18446744073709551615\n", `-`, got)
failed = true failed = true
@ -2599,6 +2839,16 @@ func main() {
failed = true failed = true
} }
if got := sub_18446744073709551615_uint64_ssa(9223372036854775808); got != 9223372036854775807 {
fmt.Printf("sub_uint64 18446744073709551615%s9223372036854775808 = %d, wanted 9223372036854775807\n", `-`, got)
failed = true
}
if got := sub_uint64_18446744073709551615_ssa(9223372036854775808); got != 9223372036854775809 {
fmt.Printf("sub_uint64 9223372036854775808%s18446744073709551615 = %d, wanted 9223372036854775809\n", `-`, got)
failed = true
}
if got := sub_18446744073709551615_uint64_ssa(18446744073709551615); got != 0 { if got := sub_18446744073709551615_uint64_ssa(18446744073709551615); got != 0 {
fmt.Printf("sub_uint64 18446744073709551615%s18446744073709551615 = %d, wanted 0\n", `-`, got) fmt.Printf("sub_uint64 18446744073709551615%s18446744073709551615 = %d, wanted 0\n", `-`, got)
failed = true failed = true
@ -2619,6 +2869,11 @@ func main() {
failed = true failed = true
} }
if got := div_0_uint64_ssa(9223372036854775808); got != 0 {
fmt.Printf("div_uint64 0%s9223372036854775808 = %d, wanted 0\n", `/`, got)
failed = true
}
if got := div_0_uint64_ssa(18446744073709551615); got != 0 { if got := div_0_uint64_ssa(18446744073709551615); got != 0 {
fmt.Printf("div_uint64 0%s18446744073709551615 = %d, wanted 0\n", `/`, got) fmt.Printf("div_uint64 0%s18446744073709551615 = %d, wanted 0\n", `/`, got)
failed = true failed = true
@ -2649,6 +2904,16 @@ func main() {
failed = true failed = true
} }
if got := div_1_uint64_ssa(9223372036854775808); got != 0 {
fmt.Printf("div_uint64 1%s9223372036854775808 = %d, wanted 0\n", `/`, got)
failed = true
}
if got := div_uint64_1_ssa(9223372036854775808); got != 9223372036854775808 {
fmt.Printf("div_uint64 9223372036854775808%s1 = %d, wanted 9223372036854775808\n", `/`, got)
failed = true
}
if got := div_1_uint64_ssa(18446744073709551615); got != 0 { if got := div_1_uint64_ssa(18446744073709551615); got != 0 {
fmt.Printf("div_uint64 1%s18446744073709551615 = %d, wanted 0\n", `/`, got) fmt.Printf("div_uint64 1%s18446744073709551615 = %d, wanted 0\n", `/`, got)
failed = true failed = true
@ -2684,6 +2949,16 @@ func main() {
failed = true failed = true
} }
if got := div_4294967296_uint64_ssa(9223372036854775808); got != 0 {
fmt.Printf("div_uint64 4294967296%s9223372036854775808 = %d, wanted 0\n", `/`, got)
failed = true
}
if got := div_uint64_4294967296_ssa(9223372036854775808); got != 2147483648 {
fmt.Printf("div_uint64 9223372036854775808%s4294967296 = %d, wanted 2147483648\n", `/`, got)
failed = true
}
if got := div_4294967296_uint64_ssa(18446744073709551615); got != 0 { if got := div_4294967296_uint64_ssa(18446744073709551615); got != 0 {
fmt.Printf("div_uint64 4294967296%s18446744073709551615 = %d, wanted 0\n", `/`, got) fmt.Printf("div_uint64 4294967296%s18446744073709551615 = %d, wanted 0\n", `/`, got)
failed = true failed = true
@ -2694,6 +2969,51 @@ func main() {
failed = true failed = true
} }
if got := div_uint64_9223372036854775808_ssa(0); got != 0 {
fmt.Printf("div_uint64 0%s9223372036854775808 = %d, wanted 0\n", `/`, got)
failed = true
}
if got := div_9223372036854775808_uint64_ssa(1); got != 9223372036854775808 {
fmt.Printf("div_uint64 9223372036854775808%s1 = %d, wanted 9223372036854775808\n", `/`, got)
failed = true
}
if got := div_uint64_9223372036854775808_ssa(1); got != 0 {
fmt.Printf("div_uint64 1%s9223372036854775808 = %d, wanted 0\n", `/`, got)
failed = true
}
if got := div_9223372036854775808_uint64_ssa(4294967296); got != 2147483648 {
fmt.Printf("div_uint64 9223372036854775808%s4294967296 = %d, wanted 2147483648\n", `/`, got)
failed = true
}
if got := div_uint64_9223372036854775808_ssa(4294967296); got != 0 {
fmt.Printf("div_uint64 4294967296%s9223372036854775808 = %d, wanted 0\n", `/`, got)
failed = true
}
if got := div_9223372036854775808_uint64_ssa(9223372036854775808); got != 1 {
fmt.Printf("div_uint64 9223372036854775808%s9223372036854775808 = %d, wanted 1\n", `/`, got)
failed = true
}
if got := div_uint64_9223372036854775808_ssa(9223372036854775808); got != 1 {
fmt.Printf("div_uint64 9223372036854775808%s9223372036854775808 = %d, wanted 1\n", `/`, got)
failed = true
}
if got := div_9223372036854775808_uint64_ssa(18446744073709551615); got != 0 {
fmt.Printf("div_uint64 9223372036854775808%s18446744073709551615 = %d, wanted 0\n", `/`, got)
failed = true
}
if got := div_uint64_9223372036854775808_ssa(18446744073709551615); got != 1 {
fmt.Printf("div_uint64 18446744073709551615%s9223372036854775808 = %d, wanted 1\n", `/`, got)
failed = true
}
if got := div_uint64_18446744073709551615_ssa(0); got != 0 { if got := div_uint64_18446744073709551615_ssa(0); got != 0 {
fmt.Printf("div_uint64 0%s18446744073709551615 = %d, wanted 0\n", `/`, got) fmt.Printf("div_uint64 0%s18446744073709551615 = %d, wanted 0\n", `/`, got)
failed = true failed = true
@ -2719,6 +3039,16 @@ func main() {
failed = true failed = true
} }
if got := div_18446744073709551615_uint64_ssa(9223372036854775808); got != 1 {
fmt.Printf("div_uint64 18446744073709551615%s9223372036854775808 = %d, wanted 1\n", `/`, got)
failed = true
}
if got := div_uint64_18446744073709551615_ssa(9223372036854775808); got != 0 {
fmt.Printf("div_uint64 9223372036854775808%s18446744073709551615 = %d, wanted 0\n", `/`, got)
failed = true
}
if got := div_18446744073709551615_uint64_ssa(18446744073709551615); got != 1 { if got := div_18446744073709551615_uint64_ssa(18446744073709551615); got != 1 {
fmt.Printf("div_uint64 18446744073709551615%s18446744073709551615 = %d, wanted 1\n", `/`, got) fmt.Printf("div_uint64 18446744073709551615%s18446744073709551615 = %d, wanted 1\n", `/`, got)
failed = true failed = true
@ -2759,6 +3089,16 @@ func main() {
failed = true failed = true
} }
if got := mul_0_uint64_ssa(9223372036854775808); got != 0 {
fmt.Printf("mul_uint64 0%s9223372036854775808 = %d, wanted 0\n", `*`, got)
failed = true
}
if got := mul_uint64_0_ssa(9223372036854775808); got != 0 {
fmt.Printf("mul_uint64 9223372036854775808%s0 = %d, wanted 0\n", `*`, got)
failed = true
}
if got := mul_0_uint64_ssa(18446744073709551615); got != 0 { if got := mul_0_uint64_ssa(18446744073709551615); got != 0 {
fmt.Printf("mul_uint64 0%s18446744073709551615 = %d, wanted 0\n", `*`, got) fmt.Printf("mul_uint64 0%s18446744073709551615 = %d, wanted 0\n", `*`, got)
failed = true failed = true
@ -2799,6 +3139,16 @@ func main() {
failed = true failed = true
} }
if got := mul_1_uint64_ssa(9223372036854775808); got != 9223372036854775808 {
fmt.Printf("mul_uint64 1%s9223372036854775808 = %d, wanted 9223372036854775808\n", `*`, got)
failed = true
}
if got := mul_uint64_1_ssa(9223372036854775808); got != 9223372036854775808 {
fmt.Printf("mul_uint64 9223372036854775808%s1 = %d, wanted 9223372036854775808\n", `*`, got)
failed = true
}
if got := mul_1_uint64_ssa(18446744073709551615); got != 18446744073709551615 { if got := mul_1_uint64_ssa(18446744073709551615); got != 18446744073709551615 {
fmt.Printf("mul_uint64 1%s18446744073709551615 = %d, wanted 18446744073709551615\n", `*`, got) fmt.Printf("mul_uint64 1%s18446744073709551615 = %d, wanted 18446744073709551615\n", `*`, got)
failed = true failed = true
@ -2839,6 +3189,16 @@ func main() {
failed = true failed = true
} }
if got := mul_4294967296_uint64_ssa(9223372036854775808); got != 0 {
fmt.Printf("mul_uint64 4294967296%s9223372036854775808 = %d, wanted 0\n", `*`, got)
failed = true
}
if got := mul_uint64_4294967296_ssa(9223372036854775808); got != 0 {
fmt.Printf("mul_uint64 9223372036854775808%s4294967296 = %d, wanted 0\n", `*`, got)
failed = true
}
if got := mul_4294967296_uint64_ssa(18446744073709551615); got != 18446744069414584320 { if got := mul_4294967296_uint64_ssa(18446744073709551615); got != 18446744069414584320 {
fmt.Printf("mul_uint64 4294967296%s18446744073709551615 = %d, wanted 18446744069414584320\n", `*`, got) fmt.Printf("mul_uint64 4294967296%s18446744073709551615 = %d, wanted 18446744069414584320\n", `*`, got)
failed = true failed = true
@ -2849,6 +3209,56 @@ func main() {
failed = true failed = true
} }
if got := mul_9223372036854775808_uint64_ssa(0); got != 0 {
fmt.Printf("mul_uint64 9223372036854775808%s0 = %d, wanted 0\n", `*`, got)
failed = true
}
if got := mul_uint64_9223372036854775808_ssa(0); got != 0 {
fmt.Printf("mul_uint64 0%s9223372036854775808 = %d, wanted 0\n", `*`, got)
failed = true
}
if got := mul_9223372036854775808_uint64_ssa(1); got != 9223372036854775808 {
fmt.Printf("mul_uint64 9223372036854775808%s1 = %d, wanted 9223372036854775808\n", `*`, got)
failed = true
}
if got := mul_uint64_9223372036854775808_ssa(1); got != 9223372036854775808 {
fmt.Printf("mul_uint64 1%s9223372036854775808 = %d, wanted 9223372036854775808\n", `*`, got)
failed = true
}
if got := mul_9223372036854775808_uint64_ssa(4294967296); got != 0 {
fmt.Printf("mul_uint64 9223372036854775808%s4294967296 = %d, wanted 0\n", `*`, got)
failed = true
}
if got := mul_uint64_9223372036854775808_ssa(4294967296); got != 0 {
fmt.Printf("mul_uint64 4294967296%s9223372036854775808 = %d, wanted 0\n", `*`, got)
failed = true
}
if got := mul_9223372036854775808_uint64_ssa(9223372036854775808); got != 0 {
fmt.Printf("mul_uint64 9223372036854775808%s9223372036854775808 = %d, wanted 0\n", `*`, got)
failed = true
}
if got := mul_uint64_9223372036854775808_ssa(9223372036854775808); got != 0 {
fmt.Printf("mul_uint64 9223372036854775808%s9223372036854775808 = %d, wanted 0\n", `*`, got)
failed = true
}
if got := mul_9223372036854775808_uint64_ssa(18446744073709551615); got != 9223372036854775808 {
fmt.Printf("mul_uint64 9223372036854775808%s18446744073709551615 = %d, wanted 9223372036854775808\n", `*`, got)
failed = true
}
if got := mul_uint64_9223372036854775808_ssa(18446744073709551615); got != 9223372036854775808 {
fmt.Printf("mul_uint64 18446744073709551615%s9223372036854775808 = %d, wanted 9223372036854775808\n", `*`, got)
failed = true
}
if got := mul_18446744073709551615_uint64_ssa(0); got != 0 { if got := mul_18446744073709551615_uint64_ssa(0); got != 0 {
fmt.Printf("mul_uint64 18446744073709551615%s0 = %d, wanted 0\n", `*`, got) fmt.Printf("mul_uint64 18446744073709551615%s0 = %d, wanted 0\n", `*`, got)
failed = true failed = true
@ -2879,6 +3289,16 @@ func main() {
failed = true failed = true
} }
if got := mul_18446744073709551615_uint64_ssa(9223372036854775808); got != 9223372036854775808 {
fmt.Printf("mul_uint64 18446744073709551615%s9223372036854775808 = %d, wanted 9223372036854775808\n", `*`, got)
failed = true
}
if got := mul_uint64_18446744073709551615_ssa(9223372036854775808); got != 9223372036854775808 {
fmt.Printf("mul_uint64 9223372036854775808%s18446744073709551615 = %d, wanted 9223372036854775808\n", `*`, got)
failed = true
}
if got := mul_18446744073709551615_uint64_ssa(18446744073709551615); got != 1 { if got := mul_18446744073709551615_uint64_ssa(18446744073709551615); got != 1 {
fmt.Printf("mul_uint64 18446744073709551615%s18446744073709551615 = %d, wanted 1\n", `*`, got) fmt.Printf("mul_uint64 18446744073709551615%s18446744073709551615 = %d, wanted 1\n", `*`, got)
failed = true failed = true
@ -2919,6 +3339,16 @@ func main() {
failed = true failed = true
} }
if got := lsh_0_uint64_ssa(9223372036854775808); got != 0 {
fmt.Printf("lsh_uint64 0%s9223372036854775808 = %d, wanted 0\n", `<<`, got)
failed = true
}
if got := lsh_uint64_0_ssa(9223372036854775808); got != 9223372036854775808 {
fmt.Printf("lsh_uint64 9223372036854775808%s0 = %d, wanted 9223372036854775808\n", `<<`, got)
failed = true
}
if got := lsh_0_uint64_ssa(18446744073709551615); got != 0 { if got := lsh_0_uint64_ssa(18446744073709551615); got != 0 {
fmt.Printf("lsh_uint64 0%s18446744073709551615 = %d, wanted 0\n", `<<`, got) fmt.Printf("lsh_uint64 0%s18446744073709551615 = %d, wanted 0\n", `<<`, got)
failed = true failed = true
@ -2959,6 +3389,16 @@ func main() {
failed = true failed = true
} }
if got := lsh_1_uint64_ssa(9223372036854775808); got != 0 {
fmt.Printf("lsh_uint64 1%s9223372036854775808 = %d, wanted 0\n", `<<`, got)
failed = true
}
if got := lsh_uint64_1_ssa(9223372036854775808); got != 0 {
fmt.Printf("lsh_uint64 9223372036854775808%s1 = %d, wanted 0\n", `<<`, got)
failed = true
}
if got := lsh_1_uint64_ssa(18446744073709551615); got != 0 { if got := lsh_1_uint64_ssa(18446744073709551615); got != 0 {
fmt.Printf("lsh_uint64 1%s18446744073709551615 = %d, wanted 0\n", `<<`, got) fmt.Printf("lsh_uint64 1%s18446744073709551615 = %d, wanted 0\n", `<<`, got)
failed = true failed = true
@ -2999,6 +3439,16 @@ func main() {
failed = true failed = true
} }
if got := lsh_4294967296_uint64_ssa(9223372036854775808); got != 0 {
fmt.Printf("lsh_uint64 4294967296%s9223372036854775808 = %d, wanted 0\n", `<<`, got)
failed = true
}
if got := lsh_uint64_4294967296_ssa(9223372036854775808); got != 0 {
fmt.Printf("lsh_uint64 9223372036854775808%s4294967296 = %d, wanted 0\n", `<<`, got)
failed = true
}
if got := lsh_4294967296_uint64_ssa(18446744073709551615); got != 0 { if got := lsh_4294967296_uint64_ssa(18446744073709551615); got != 0 {
fmt.Printf("lsh_uint64 4294967296%s18446744073709551615 = %d, wanted 0\n", `<<`, got) fmt.Printf("lsh_uint64 4294967296%s18446744073709551615 = %d, wanted 0\n", `<<`, got)
failed = true failed = true
@ -3009,6 +3459,56 @@ func main() {
failed = true failed = true
} }
if got := lsh_9223372036854775808_uint64_ssa(0); got != 9223372036854775808 {
fmt.Printf("lsh_uint64 9223372036854775808%s0 = %d, wanted 9223372036854775808\n", `<<`, got)
failed = true
}
if got := lsh_uint64_9223372036854775808_ssa(0); got != 0 {
fmt.Printf("lsh_uint64 0%s9223372036854775808 = %d, wanted 0\n", `<<`, got)
failed = true
}
if got := lsh_9223372036854775808_uint64_ssa(1); got != 0 {
fmt.Printf("lsh_uint64 9223372036854775808%s1 = %d, wanted 0\n", `<<`, got)
failed = true
}
if got := lsh_uint64_9223372036854775808_ssa(1); got != 0 {
fmt.Printf("lsh_uint64 1%s9223372036854775808 = %d, wanted 0\n", `<<`, got)
failed = true
}
if got := lsh_9223372036854775808_uint64_ssa(4294967296); got != 0 {
fmt.Printf("lsh_uint64 9223372036854775808%s4294967296 = %d, wanted 0\n", `<<`, got)
failed = true
}
if got := lsh_uint64_9223372036854775808_ssa(4294967296); got != 0 {
fmt.Printf("lsh_uint64 4294967296%s9223372036854775808 = %d, wanted 0\n", `<<`, got)
failed = true
}
if got := lsh_9223372036854775808_uint64_ssa(9223372036854775808); got != 0 {
fmt.Printf("lsh_uint64 9223372036854775808%s9223372036854775808 = %d, wanted 0\n", `<<`, got)
failed = true
}
if got := lsh_uint64_9223372036854775808_ssa(9223372036854775808); got != 0 {
fmt.Printf("lsh_uint64 9223372036854775808%s9223372036854775808 = %d, wanted 0\n", `<<`, got)
failed = true
}
if got := lsh_9223372036854775808_uint64_ssa(18446744073709551615); got != 0 {
fmt.Printf("lsh_uint64 9223372036854775808%s18446744073709551615 = %d, wanted 0\n", `<<`, got)
failed = true
}
if got := lsh_uint64_9223372036854775808_ssa(18446744073709551615); got != 0 {
fmt.Printf("lsh_uint64 18446744073709551615%s9223372036854775808 = %d, wanted 0\n", `<<`, got)
failed = true
}
if got := lsh_18446744073709551615_uint64_ssa(0); got != 18446744073709551615 { if got := lsh_18446744073709551615_uint64_ssa(0); got != 18446744073709551615 {
fmt.Printf("lsh_uint64 18446744073709551615%s0 = %d, wanted 18446744073709551615\n", `<<`, got) fmt.Printf("lsh_uint64 18446744073709551615%s0 = %d, wanted 18446744073709551615\n", `<<`, got)
failed = true failed = true
@ -3039,6 +3539,16 @@ func main() {
failed = true failed = true
} }
if got := lsh_18446744073709551615_uint64_ssa(9223372036854775808); got != 0 {
fmt.Printf("lsh_uint64 18446744073709551615%s9223372036854775808 = %d, wanted 0\n", `<<`, got)
failed = true
}
if got := lsh_uint64_18446744073709551615_ssa(9223372036854775808); got != 0 {
fmt.Printf("lsh_uint64 9223372036854775808%s18446744073709551615 = %d, wanted 0\n", `<<`, got)
failed = true
}
if got := lsh_18446744073709551615_uint64_ssa(18446744073709551615); got != 0 { if got := lsh_18446744073709551615_uint64_ssa(18446744073709551615); got != 0 {
fmt.Printf("lsh_uint64 18446744073709551615%s18446744073709551615 = %d, wanted 0\n", `<<`, got) fmt.Printf("lsh_uint64 18446744073709551615%s18446744073709551615 = %d, wanted 0\n", `<<`, got)
failed = true failed = true
@ -3079,6 +3589,16 @@ func main() {
failed = true failed = true
} }
if got := rsh_0_uint64_ssa(9223372036854775808); got != 0 {
fmt.Printf("rsh_uint64 0%s9223372036854775808 = %d, wanted 0\n", `>>`, got)
failed = true
}
if got := rsh_uint64_0_ssa(9223372036854775808); got != 9223372036854775808 {
fmt.Printf("rsh_uint64 9223372036854775808%s0 = %d, wanted 9223372036854775808\n", `>>`, got)
failed = true
}
if got := rsh_0_uint64_ssa(18446744073709551615); got != 0 { if got := rsh_0_uint64_ssa(18446744073709551615); got != 0 {
fmt.Printf("rsh_uint64 0%s18446744073709551615 = %d, wanted 0\n", `>>`, got) fmt.Printf("rsh_uint64 0%s18446744073709551615 = %d, wanted 0\n", `>>`, got)
failed = true failed = true
@ -3119,6 +3639,16 @@ func main() {
failed = true failed = true
} }
if got := rsh_1_uint64_ssa(9223372036854775808); got != 0 {
fmt.Printf("rsh_uint64 1%s9223372036854775808 = %d, wanted 0\n", `>>`, got)
failed = true
}
if got := rsh_uint64_1_ssa(9223372036854775808); got != 4611686018427387904 {
fmt.Printf("rsh_uint64 9223372036854775808%s1 = %d, wanted 4611686018427387904\n", `>>`, got)
failed = true
}
if got := rsh_1_uint64_ssa(18446744073709551615); got != 0 { if got := rsh_1_uint64_ssa(18446744073709551615); got != 0 {
fmt.Printf("rsh_uint64 1%s18446744073709551615 = %d, wanted 0\n", `>>`, got) fmt.Printf("rsh_uint64 1%s18446744073709551615 = %d, wanted 0\n", `>>`, got)
failed = true failed = true
@ -3159,6 +3689,16 @@ func main() {
failed = true failed = true
} }
if got := rsh_4294967296_uint64_ssa(9223372036854775808); got != 0 {
fmt.Printf("rsh_uint64 4294967296%s9223372036854775808 = %d, wanted 0\n", `>>`, got)
failed = true
}
if got := rsh_uint64_4294967296_ssa(9223372036854775808); got != 0 {
fmt.Printf("rsh_uint64 9223372036854775808%s4294967296 = %d, wanted 0\n", `>>`, got)
failed = true
}
if got := rsh_4294967296_uint64_ssa(18446744073709551615); got != 0 { if got := rsh_4294967296_uint64_ssa(18446744073709551615); got != 0 {
fmt.Printf("rsh_uint64 4294967296%s18446744073709551615 = %d, wanted 0\n", `>>`, got) fmt.Printf("rsh_uint64 4294967296%s18446744073709551615 = %d, wanted 0\n", `>>`, got)
failed = true failed = true
@ -3169,6 +3709,56 @@ func main() {
failed = true failed = true
} }
if got := rsh_9223372036854775808_uint64_ssa(0); got != 9223372036854775808 {
fmt.Printf("rsh_uint64 9223372036854775808%s0 = %d, wanted 9223372036854775808\n", `>>`, got)
failed = true
}
if got := rsh_uint64_9223372036854775808_ssa(0); got != 0 {
fmt.Printf("rsh_uint64 0%s9223372036854775808 = %d, wanted 0\n", `>>`, got)
failed = true
}
if got := rsh_9223372036854775808_uint64_ssa(1); got != 4611686018427387904 {
fmt.Printf("rsh_uint64 9223372036854775808%s1 = %d, wanted 4611686018427387904\n", `>>`, got)
failed = true
}
if got := rsh_uint64_9223372036854775808_ssa(1); got != 0 {
fmt.Printf("rsh_uint64 1%s9223372036854775808 = %d, wanted 0\n", `>>`, got)
failed = true
}
if got := rsh_9223372036854775808_uint64_ssa(4294967296); got != 0 {
fmt.Printf("rsh_uint64 9223372036854775808%s4294967296 = %d, wanted 0\n", `>>`, got)
failed = true
}
if got := rsh_uint64_9223372036854775808_ssa(4294967296); got != 0 {
fmt.Printf("rsh_uint64 4294967296%s9223372036854775808 = %d, wanted 0\n", `>>`, got)
failed = true
}
if got := rsh_9223372036854775808_uint64_ssa(9223372036854775808); got != 0 {
fmt.Printf("rsh_uint64 9223372036854775808%s9223372036854775808 = %d, wanted 0\n", `>>`, got)
failed = true
}
if got := rsh_uint64_9223372036854775808_ssa(9223372036854775808); got != 0 {
fmt.Printf("rsh_uint64 9223372036854775808%s9223372036854775808 = %d, wanted 0\n", `>>`, got)
failed = true
}
if got := rsh_9223372036854775808_uint64_ssa(18446744073709551615); got != 0 {
fmt.Printf("rsh_uint64 9223372036854775808%s18446744073709551615 = %d, wanted 0\n", `>>`, got)
failed = true
}
if got := rsh_uint64_9223372036854775808_ssa(18446744073709551615); got != 0 {
fmt.Printf("rsh_uint64 18446744073709551615%s9223372036854775808 = %d, wanted 0\n", `>>`, got)
failed = true
}
if got := rsh_18446744073709551615_uint64_ssa(0); got != 18446744073709551615 { if got := rsh_18446744073709551615_uint64_ssa(0); got != 18446744073709551615 {
fmt.Printf("rsh_uint64 18446744073709551615%s0 = %d, wanted 18446744073709551615\n", `>>`, got) fmt.Printf("rsh_uint64 18446744073709551615%s0 = %d, wanted 18446744073709551615\n", `>>`, got)
failed = true failed = true
@ -3199,6 +3789,16 @@ func main() {
failed = true failed = true
} }
if got := rsh_18446744073709551615_uint64_ssa(9223372036854775808); got != 0 {
fmt.Printf("rsh_uint64 18446744073709551615%s9223372036854775808 = %d, wanted 0\n", `>>`, got)
failed = true
}
if got := rsh_uint64_18446744073709551615_ssa(9223372036854775808); got != 0 {
fmt.Printf("rsh_uint64 9223372036854775808%s18446744073709551615 = %d, wanted 0\n", `>>`, got)
failed = true
}
if got := rsh_18446744073709551615_uint64_ssa(18446744073709551615); got != 0 { if got := rsh_18446744073709551615_uint64_ssa(18446744073709551615); got != 0 {
fmt.Printf("rsh_uint64 18446744073709551615%s18446744073709551615 = %d, wanted 0\n", `>>`, got) fmt.Printf("rsh_uint64 18446744073709551615%s18446744073709551615 = %d, wanted 0\n", `>>`, got)
failed = true failed = true
@ -3219,6 +3819,11 @@ func main() {
failed = true failed = true
} }
if got := mod_0_uint64_ssa(9223372036854775808); got != 0 {
fmt.Printf("mod_uint64 0%s9223372036854775808 = %d, wanted 0\n", `%`, got)
failed = true
}
if got := mod_0_uint64_ssa(18446744073709551615); got != 0 { if got := mod_0_uint64_ssa(18446744073709551615); got != 0 {
fmt.Printf("mod_uint64 0%s18446744073709551615 = %d, wanted 0\n", `%`, got) fmt.Printf("mod_uint64 0%s18446744073709551615 = %d, wanted 0\n", `%`, got)
failed = true failed = true
@ -3249,6 +3854,16 @@ func main() {
failed = true failed = true
} }
if got := mod_1_uint64_ssa(9223372036854775808); got != 1 {
fmt.Printf("mod_uint64 1%s9223372036854775808 = %d, wanted 1\n", `%`, got)
failed = true
}
if got := mod_uint64_1_ssa(9223372036854775808); got != 0 {
fmt.Printf("mod_uint64 9223372036854775808%s1 = %d, wanted 0\n", `%`, got)
failed = true
}
if got := mod_1_uint64_ssa(18446744073709551615); got != 1 { if got := mod_1_uint64_ssa(18446744073709551615); got != 1 {
fmt.Printf("mod_uint64 1%s18446744073709551615 = %d, wanted 1\n", `%`, got) fmt.Printf("mod_uint64 1%s18446744073709551615 = %d, wanted 1\n", `%`, got)
failed = true failed = true
@ -3284,6 +3899,16 @@ func main() {
failed = true failed = true
} }
if got := mod_4294967296_uint64_ssa(9223372036854775808); got != 4294967296 {
fmt.Printf("mod_uint64 4294967296%s9223372036854775808 = %d, wanted 4294967296\n", `%`, got)
failed = true
}
if got := mod_uint64_4294967296_ssa(9223372036854775808); got != 0 {
fmt.Printf("mod_uint64 9223372036854775808%s4294967296 = %d, wanted 0\n", `%`, got)
failed = true
}
if got := mod_4294967296_uint64_ssa(18446744073709551615); got != 4294967296 { if got := mod_4294967296_uint64_ssa(18446744073709551615); got != 4294967296 {
fmt.Printf("mod_uint64 4294967296%s18446744073709551615 = %d, wanted 4294967296\n", `%`, got) fmt.Printf("mod_uint64 4294967296%s18446744073709551615 = %d, wanted 4294967296\n", `%`, got)
failed = true failed = true
@ -3294,6 +3919,51 @@ func main() {
failed = true failed = true
} }
if got := mod_uint64_9223372036854775808_ssa(0); got != 0 {
fmt.Printf("mod_uint64 0%s9223372036854775808 = %d, wanted 0\n", `%`, got)
failed = true
}
if got := mod_9223372036854775808_uint64_ssa(1); got != 0 {
fmt.Printf("mod_uint64 9223372036854775808%s1 = %d, wanted 0\n", `%`, got)
failed = true
}
if got := mod_uint64_9223372036854775808_ssa(1); got != 1 {
fmt.Printf("mod_uint64 1%s9223372036854775808 = %d, wanted 1\n", `%`, got)
failed = true
}
if got := mod_9223372036854775808_uint64_ssa(4294967296); got != 0 {
fmt.Printf("mod_uint64 9223372036854775808%s4294967296 = %d, wanted 0\n", `%`, got)
failed = true
}
if got := mod_uint64_9223372036854775808_ssa(4294967296); got != 4294967296 {
fmt.Printf("mod_uint64 4294967296%s9223372036854775808 = %d, wanted 4294967296\n", `%`, got)
failed = true
}
if got := mod_9223372036854775808_uint64_ssa(9223372036854775808); got != 0 {
fmt.Printf("mod_uint64 9223372036854775808%s9223372036854775808 = %d, wanted 0\n", `%`, got)
failed = true
}
if got := mod_uint64_9223372036854775808_ssa(9223372036854775808); got != 0 {
fmt.Printf("mod_uint64 9223372036854775808%s9223372036854775808 = %d, wanted 0\n", `%`, got)
failed = true
}
if got := mod_9223372036854775808_uint64_ssa(18446744073709551615); got != 9223372036854775808 {
fmt.Printf("mod_uint64 9223372036854775808%s18446744073709551615 = %d, wanted 9223372036854775808\n", `%`, got)
failed = true
}
if got := mod_uint64_9223372036854775808_ssa(18446744073709551615); got != 9223372036854775807 {
fmt.Printf("mod_uint64 18446744073709551615%s9223372036854775808 = %d, wanted 9223372036854775807\n", `%`, got)
failed = true
}
if got := mod_uint64_18446744073709551615_ssa(0); got != 0 { if got := mod_uint64_18446744073709551615_ssa(0); got != 0 {
fmt.Printf("mod_uint64 0%s18446744073709551615 = %d, wanted 0\n", `%`, got) fmt.Printf("mod_uint64 0%s18446744073709551615 = %d, wanted 0\n", `%`, got)
failed = true failed = true
@ -3319,6 +3989,16 @@ func main() {
failed = true failed = true
} }
if got := mod_18446744073709551615_uint64_ssa(9223372036854775808); got != 9223372036854775807 {
fmt.Printf("mod_uint64 18446744073709551615%s9223372036854775808 = %d, wanted 9223372036854775807\n", `%`, got)
failed = true
}
if got := mod_uint64_18446744073709551615_ssa(9223372036854775808); got != 9223372036854775808 {
fmt.Printf("mod_uint64 9223372036854775808%s18446744073709551615 = %d, wanted 9223372036854775808\n", `%`, got)
failed = true
}
if got := mod_18446744073709551615_uint64_ssa(18446744073709551615); got != 0 { if got := mod_18446744073709551615_uint64_ssa(18446744073709551615); got != 0 {
fmt.Printf("mod_uint64 18446744073709551615%s18446744073709551615 = %d, wanted 0\n", `%`, got) fmt.Printf("mod_uint64 18446744073709551615%s18446744073709551615 = %d, wanted 0\n", `%`, got)
failed = true failed = true

View File

@ -31,7 +31,7 @@ type szD struct {
} }
var szs = []szD{ var szs = []szD{
{name: "uint64", sn: "64", u: []uint64{0, 1, 4294967296, 0xffffFFFFffffFFFF}}, {name: "uint64", sn: "64", u: []uint64{0, 1, 4294967296, 0x8000000000000000, 0xffffFFFFffffFFFF}},
{name: "int64", sn: "64", i: []int64{-0x8000000000000000, -0x7FFFFFFFFFFFFFFF, {name: "int64", sn: "64", i: []int64{-0x8000000000000000, -0x7FFFFFFFFFFFFFFF,
-4294967296, -1, 0, 1, 4294967296, 0x7FFFFFFFFFFFFFFE, 0x7FFFFFFFFFFFFFFF}}, -4294967296, -1, 0, 1, 4294967296, 0x7FFFFFFFFFFFFFFE, 0x7FFFFFFFFFFFFFFF}},

View File

@ -945,6 +945,7 @@
(Div16u n (Const16 [c])) && isPowerOfTwo(c&0xffff) -> (Rsh16Ux64 n (Const64 <typ.UInt64> [log2(c&0xffff)])) (Div16u n (Const16 [c])) && isPowerOfTwo(c&0xffff) -> (Rsh16Ux64 n (Const64 <typ.UInt64> [log2(c&0xffff)]))
(Div32u n (Const32 [c])) && isPowerOfTwo(c&0xffffffff) -> (Rsh32Ux64 n (Const64 <typ.UInt64> [log2(c&0xffffffff)])) (Div32u n (Const32 [c])) && isPowerOfTwo(c&0xffffffff) -> (Rsh32Ux64 n (Const64 <typ.UInt64> [log2(c&0xffffffff)]))
(Div64u n (Const64 [c])) && isPowerOfTwo(c) -> (Rsh64Ux64 n (Const64 <typ.UInt64> [log2(c)])) (Div64u n (Const64 [c])) && isPowerOfTwo(c) -> (Rsh64Ux64 n (Const64 <typ.UInt64> [log2(c)]))
(Div64u n (Const64 [-1<<63])) -> (Rsh64Ux64 n (Const64 <typ.UInt64> [63]))
// Unsigned divide, not a power of 2. Strength reduce to a multiply. // Unsigned divide, not a power of 2. Strength reduce to a multiply.
// For 8-bit divides, we just do a direct 9-bit by 8-bit multiply. // For 8-bit divides, we just do a direct 9-bit by 8-bit multiply.
@ -1177,6 +1178,7 @@
(Mod16u <t> n (Const16 [c])) && isPowerOfTwo(c&0xffff) -> (And16 n (Const16 <t> [(c&0xffff)-1])) (Mod16u <t> n (Const16 [c])) && isPowerOfTwo(c&0xffff) -> (And16 n (Const16 <t> [(c&0xffff)-1]))
(Mod32u <t> n (Const32 [c])) && isPowerOfTwo(c&0xffffffff) -> (And32 n (Const32 <t> [(c&0xffffffff)-1])) (Mod32u <t> n (Const32 [c])) && isPowerOfTwo(c&0xffffffff) -> (And32 n (Const32 <t> [(c&0xffffffff)-1]))
(Mod64u <t> n (Const64 [c])) && isPowerOfTwo(c) -> (And64 n (Const64 <t> [c-1])) (Mod64u <t> n (Const64 [c])) && isPowerOfTwo(c) -> (And64 n (Const64 <t> [c-1]))
(Mod64u <t> n (Const64 [-1<<63])) -> (And64 n (Const64 <t> [1<<63-1]))
// Signed mod by negative constant. // Signed mod by negative constant.
(Mod8 <t> n (Const8 [c])) && c < 0 && c != -1<<7 -> (Mod8 <t> n (Const8 <t> [-c])) (Mod8 <t> n (Const8 [c])) && c < 0 && c != -1<<7 -> (Mod8 <t> n (Const8 <t> [-c]))

View File

@ -7240,6 +7240,26 @@ func rewriteValuegeneric_OpDiv64u_0(v *Value) bool {
v.AddArg(v0) v.AddArg(v0)
return true return true
} }
// match: (Div64u n (Const64 [-1<<63]))
// cond:
// result: (Rsh64Ux64 n (Const64 <typ.UInt64> [63]))
for {
_ = v.Args[1]
n := v.Args[0]
v_1 := v.Args[1]
if v_1.Op != OpConst64 {
break
}
if v_1.AuxInt != -1<<63 {
break
}
v.reset(OpRsh64Ux64)
v.AddArg(n)
v0 := b.NewValue0(v.Pos, OpConst64, typ.UInt64)
v0.AuxInt = 63
v.AddArg(v0)
return true
}
// match: (Div64u x (Const64 [c])) // match: (Div64u x (Const64 [c]))
// cond: umagicOK(64, c) && config.RegSize == 8 && umagic(64,c).m&1 == 0 // cond: umagicOK(64, c) && config.RegSize == 8 && umagic(64,c).m&1 == 0
// result: (Rsh64Ux64 <typ.UInt64> (Hmul64u <typ.UInt64> (Const64 <typ.UInt64> [int64(1<<63+umagic(64,c).m/2)]) x) (Const64 <typ.UInt64> [umagic(64,c).s-1])) // result: (Rsh64Ux64 <typ.UInt64> (Hmul64u <typ.UInt64> (Const64 <typ.UInt64> [int64(1<<63+umagic(64,c).m/2)]) x) (Const64 <typ.UInt64> [umagic(64,c).s-1]))
@ -12061,6 +12081,27 @@ func rewriteValuegeneric_OpMod64u_0(v *Value) bool {
v.AddArg(v0) v.AddArg(v0)
return true return true
} }
// match: (Mod64u <t> n (Const64 [-1<<63]))
// cond:
// result: (And64 n (Const64 <t> [1<<63-1]))
for {
t := v.Type
_ = v.Args[1]
n := v.Args[0]
v_1 := v.Args[1]
if v_1.Op != OpConst64 {
break
}
if v_1.AuxInt != -1<<63 {
break
}
v.reset(OpAnd64)
v.AddArg(n)
v0 := b.NewValue0(v.Pos, OpConst64, t)
v0.AuxInt = 1<<63 - 1
v.AddArg(v0)
return true
}
// match: (Mod64u <t> x (Const64 [c])) // match: (Mod64u <t> x (Const64 [c]))
// cond: x.Op != OpConst64 && c > 0 && umagicOK(64,c) // cond: x.Op != OpConst64 && c > 0 && umagicOK(64,c)
// result: (Sub64 x (Mul64 <t> (Div64u <t> x (Const64 <t> [c])) (Const64 <t> [c]))) // result: (Sub64 x (Mul64 <t> (Div64u <t> x (Const64 <t> [c])) (Const64 <t> [c])))

View File

@ -120,7 +120,7 @@ func ssaGenValue387(s *gc.SSAGenState, v *ssa.Value) {
p = s.Prog(x86.AFLDCW) p = s.Prog(x86.AFLDCW)
p.From.Type = obj.TYPE_MEM p.From.Type = obj.TYPE_MEM
p.From.Name = obj.NAME_EXTERN p.From.Name = obj.NAME_EXTERN
p.From.Sym = gc.Sysfunc("controlWord32") p.From.Sym = gc.ControlWord32
} }
var op obj.As var op obj.As
@ -210,7 +210,7 @@ func ssaGenValue387(s *gc.SSAGenState, v *ssa.Value) {
p = s.Prog(x86.AFLDCW) p = s.Prog(x86.AFLDCW)
p.From.Type = obj.TYPE_MEM p.From.Type = obj.TYPE_MEM
p.From.Name = obj.NAME_EXTERN p.From.Name = obj.NAME_EXTERN
p.From.Sym = gc.Sysfunc("controlWord64trunc") p.From.Sym = gc.ControlWord64trunc
// Now do the conversion. // Now do the conversion.
p = s.Prog(x86.AFMOVLP) p = s.Prog(x86.AFMOVLP)

18
src/cmd/dist/deps.go vendored
View File

@ -31,8 +31,8 @@ var builddeps = map[string][]string{
"cmd/internal/objabi": {"errors", "flag", "fmt", "internal/cpu", "internal/poll", "internal/race", "internal/syscall/windows", "internal/syscall/windows/registry", "internal/syscall/windows/sysdll", "io", "log", "math", "os", "path/filepath", "reflect", "runtime", "runtime/internal/atomic", "runtime/internal/sys", "sort", "strconv", "strings", "sync", "sync/atomic", "syscall", "time", "unicode", "unicode/utf16", "unicode/utf8"}, "cmd/internal/objabi": {"errors", "flag", "fmt", "internal/cpu", "internal/poll", "internal/race", "internal/syscall/windows", "internal/syscall/windows/registry", "internal/syscall/windows/sysdll", "io", "log", "math", "os", "path/filepath", "reflect", "runtime", "runtime/internal/atomic", "runtime/internal/sys", "sort", "strconv", "strings", "sync", "sync/atomic", "syscall", "time", "unicode", "unicode/utf16", "unicode/utf8"},
"compress/flate": {"bufio", "bytes", "errors", "fmt", "internal/cpu", "internal/poll", "internal/race", "internal/syscall/windows", "internal/syscall/windows/registry", "internal/syscall/windows/sysdll", "io", "math", "math/bits", "os", "reflect", "runtime", "runtime/internal/atomic", "runtime/internal/sys", "sort", "strconv", "sync", "sync/atomic", "syscall", "time", "unicode", "unicode/utf16", "unicode/utf8"}, "compress/flate": {"bufio", "bytes", "errors", "fmt", "internal/cpu", "internal/poll", "internal/race", "internal/syscall/windows", "internal/syscall/windows/registry", "internal/syscall/windows/sysdll", "io", "math", "math/bits", "os", "reflect", "runtime", "runtime/internal/atomic", "runtime/internal/sys", "sort", "strconv", "sync", "sync/atomic", "syscall", "time", "unicode", "unicode/utf16", "unicode/utf8"},
"compress/zlib": {"bufio", "bytes", "compress/flate", "errors", "fmt", "hash", "hash/adler32", "internal/cpu", "internal/poll", "internal/race", "internal/syscall/windows", "internal/syscall/windows/registry", "internal/syscall/windows/sysdll", "io", "math", "math/bits", "os", "reflect", "runtime", "runtime/internal/atomic", "runtime/internal/sys", "sort", "strconv", "sync", "sync/atomic", "syscall", "time", "unicode", "unicode/utf16", "unicode/utf8"}, "compress/zlib": {"bufio", "bytes", "compress/flate", "errors", "fmt", "hash", "hash/adler32", "internal/cpu", "internal/poll", "internal/race", "internal/syscall/windows", "internal/syscall/windows/registry", "internal/syscall/windows/sysdll", "io", "math", "math/bits", "os", "reflect", "runtime", "runtime/internal/atomic", "runtime/internal/sys", "sort", "strconv", "sync", "sync/atomic", "syscall", "time", "unicode", "unicode/utf16", "unicode/utf8"},
"container/heap": {"errors", "internal/cpu", "internal/race", "math", "reflect", "runtime", "runtime/internal/atomic", "runtime/internal/sys", "sort", "strconv", "sync", "sync/atomic", "unicode/utf8"}, "container/heap": {"errors", "internal/cpu", "internal/race", "math", "reflect", "runtime", "runtime/internal/atomic", "runtime/internal/sys", "sort", "strconv", "sync", "sync/atomic", "unicode", "unicode/utf8"},
"context": {"errors", "fmt", "internal/cpu", "internal/poll", "internal/race", "internal/syscall/windows", "internal/syscall/windows/registry", "internal/syscall/windows/sysdll", "io", "math", "os", "reflect", "runtime", "runtime/internal/atomic", "runtime/internal/sys", "strconv", "sync", "sync/atomic", "syscall", "time", "unicode/utf16", "unicode/utf8"}, "context": {"errors", "fmt", "internal/cpu", "internal/poll", "internal/race", "internal/syscall/windows", "internal/syscall/windows/registry", "internal/syscall/windows/sysdll", "io", "math", "os", "reflect", "runtime", "runtime/internal/atomic", "runtime/internal/sys", "strconv", "sync", "sync/atomic", "syscall", "time", "unicode", "unicode/utf16", "unicode/utf8"},
"crypto": {"errors", "hash", "internal/cpu", "internal/race", "io", "math", "runtime", "runtime/internal/atomic", "runtime/internal/sys", "strconv", "sync", "sync/atomic", "unicode/utf8"}, "crypto": {"errors", "hash", "internal/cpu", "internal/race", "io", "math", "runtime", "runtime/internal/atomic", "runtime/internal/sys", "strconv", "sync", "sync/atomic", "unicode/utf8"},
"crypto/sha1": {"crypto", "errors", "hash", "internal/cpu", "internal/race", "io", "math", "runtime", "runtime/internal/atomic", "runtime/internal/sys", "strconv", "sync", "sync/atomic", "unicode/utf8"}, "crypto/sha1": {"crypto", "errors", "hash", "internal/cpu", "internal/race", "io", "math", "runtime", "runtime/internal/atomic", "runtime/internal/sys", "strconv", "sync", "sync/atomic", "unicode/utf8"},
"debug/dwarf": {"encoding/binary", "errors", "fmt", "internal/cpu", "internal/poll", "internal/race", "internal/syscall/windows", "internal/syscall/windows/registry", "internal/syscall/windows/sysdll", "io", "math", "os", "path", "reflect", "runtime", "runtime/internal/atomic", "runtime/internal/sys", "sort", "strconv", "strings", "sync", "sync/atomic", "syscall", "time", "unicode", "unicode/utf16", "unicode/utf8"}, "debug/dwarf": {"encoding/binary", "errors", "fmt", "internal/cpu", "internal/poll", "internal/race", "internal/syscall/windows", "internal/syscall/windows/registry", "internal/syscall/windows/sysdll", "io", "math", "os", "path", "reflect", "runtime", "runtime/internal/atomic", "runtime/internal/sys", "sort", "strconv", "strings", "sync", "sync/atomic", "syscall", "time", "unicode", "unicode/utf16", "unicode/utf8"},
@ -40,18 +40,18 @@ var builddeps = map[string][]string{
"debug/macho": {"bytes", "debug/dwarf", "encoding/binary", "errors", "fmt", "internal/cpu", "internal/poll", "internal/race", "internal/syscall/windows", "internal/syscall/windows/registry", "internal/syscall/windows/sysdll", "io", "math", "os", "path", "reflect", "runtime", "runtime/internal/atomic", "runtime/internal/sys", "sort", "strconv", "strings", "sync", "sync/atomic", "syscall", "time", "unicode", "unicode/utf16", "unicode/utf8"}, "debug/macho": {"bytes", "debug/dwarf", "encoding/binary", "errors", "fmt", "internal/cpu", "internal/poll", "internal/race", "internal/syscall/windows", "internal/syscall/windows/registry", "internal/syscall/windows/sysdll", "io", "math", "os", "path", "reflect", "runtime", "runtime/internal/atomic", "runtime/internal/sys", "sort", "strconv", "strings", "sync", "sync/atomic", "syscall", "time", "unicode", "unicode/utf16", "unicode/utf8"},
"encoding": {"runtime", "runtime/internal/atomic", "runtime/internal/sys"}, "encoding": {"runtime", "runtime/internal/atomic", "runtime/internal/sys"},
"encoding/base64": {"errors", "internal/cpu", "internal/race", "io", "math", "runtime", "runtime/internal/atomic", "runtime/internal/sys", "strconv", "sync", "sync/atomic", "unicode/utf8"}, "encoding/base64": {"errors", "internal/cpu", "internal/race", "io", "math", "runtime", "runtime/internal/atomic", "runtime/internal/sys", "strconv", "sync", "sync/atomic", "unicode/utf8"},
"encoding/binary": {"errors", "internal/cpu", "internal/race", "io", "math", "reflect", "runtime", "runtime/internal/atomic", "runtime/internal/sys", "strconv", "sync", "sync/atomic", "unicode/utf8"}, "encoding/binary": {"errors", "internal/cpu", "internal/race", "io", "math", "reflect", "runtime", "runtime/internal/atomic", "runtime/internal/sys", "strconv", "sync", "sync/atomic", "unicode", "unicode/utf8"},
"encoding/json": {"bytes", "encoding", "encoding/base64", "errors", "fmt", "internal/cpu", "internal/poll", "internal/race", "internal/syscall/windows", "internal/syscall/windows/registry", "internal/syscall/windows/sysdll", "io", "math", "os", "reflect", "runtime", "runtime/internal/atomic", "runtime/internal/sys", "sort", "strconv", "strings", "sync", "sync/atomic", "syscall", "time", "unicode", "unicode/utf16", "unicode/utf8"}, "encoding/json": {"bytes", "encoding", "encoding/base64", "errors", "fmt", "internal/cpu", "internal/poll", "internal/race", "internal/syscall/windows", "internal/syscall/windows/registry", "internal/syscall/windows/sysdll", "io", "math", "os", "reflect", "runtime", "runtime/internal/atomic", "runtime/internal/sys", "sort", "strconv", "strings", "sync", "sync/atomic", "syscall", "time", "unicode", "unicode/utf16", "unicode/utf8"},
"encoding/xml": {"bufio", "bytes", "encoding", "errors", "fmt", "internal/cpu", "internal/poll", "internal/race", "internal/syscall/windows", "internal/syscall/windows/registry", "internal/syscall/windows/sysdll", "io", "math", "os", "reflect", "runtime", "runtime/internal/atomic", "runtime/internal/sys", "strconv", "strings", "sync", "sync/atomic", "syscall", "time", "unicode", "unicode/utf16", "unicode/utf8"}, "encoding/xml": {"bufio", "bytes", "encoding", "errors", "fmt", "internal/cpu", "internal/poll", "internal/race", "internal/syscall/windows", "internal/syscall/windows/registry", "internal/syscall/windows/sysdll", "io", "math", "os", "reflect", "runtime", "runtime/internal/atomic", "runtime/internal/sys", "strconv", "strings", "sync", "sync/atomic", "syscall", "time", "unicode", "unicode/utf16", "unicode/utf8"},
"errors": {"runtime", "runtime/internal/atomic", "runtime/internal/sys"}, "errors": {"runtime", "runtime/internal/atomic", "runtime/internal/sys"},
"flag": {"errors", "fmt", "internal/cpu", "internal/poll", "internal/race", "internal/syscall/windows", "internal/syscall/windows/registry", "internal/syscall/windows/sysdll", "io", "math", "os", "reflect", "runtime", "runtime/internal/atomic", "runtime/internal/sys", "sort", "strconv", "sync", "sync/atomic", "syscall", "time", "unicode/utf16", "unicode/utf8"}, "flag": {"errors", "fmt", "internal/cpu", "internal/poll", "internal/race", "internal/syscall/windows", "internal/syscall/windows/registry", "internal/syscall/windows/sysdll", "io", "math", "os", "reflect", "runtime", "runtime/internal/atomic", "runtime/internal/sys", "sort", "strconv", "sync", "sync/atomic", "syscall", "time", "unicode", "unicode/utf16", "unicode/utf8"},
"fmt": {"errors", "internal/cpu", "internal/poll", "internal/race", "internal/syscall/windows", "internal/syscall/windows/registry", "internal/syscall/windows/sysdll", "io", "math", "os", "reflect", "runtime", "runtime/internal/atomic", "runtime/internal/sys", "strconv", "sync", "sync/atomic", "syscall", "time", "unicode/utf16", "unicode/utf8"}, "fmt": {"errors", "internal/cpu", "internal/poll", "internal/race", "internal/syscall/windows", "internal/syscall/windows/registry", "internal/syscall/windows/sysdll", "io", "math", "os", "reflect", "runtime", "runtime/internal/atomic", "runtime/internal/sys", "strconv", "sync", "sync/atomic", "syscall", "time", "unicode", "unicode/utf16", "unicode/utf8"},
"go/ast": {"bytes", "errors", "fmt", "go/scanner", "go/token", "internal/cpu", "internal/poll", "internal/race", "internal/syscall/windows", "internal/syscall/windows/registry", "internal/syscall/windows/sysdll", "io", "math", "os", "path/filepath", "reflect", "runtime", "runtime/internal/atomic", "runtime/internal/sys", "sort", "strconv", "strings", "sync", "sync/atomic", "syscall", "time", "unicode", "unicode/utf16", "unicode/utf8"}, "go/ast": {"bytes", "errors", "fmt", "go/scanner", "go/token", "internal/cpu", "internal/poll", "internal/race", "internal/syscall/windows", "internal/syscall/windows/registry", "internal/syscall/windows/sysdll", "io", "math", "os", "path/filepath", "reflect", "runtime", "runtime/internal/atomic", "runtime/internal/sys", "sort", "strconv", "strings", "sync", "sync/atomic", "syscall", "time", "unicode", "unicode/utf16", "unicode/utf8"},
"go/build": {"bufio", "bytes", "errors", "fmt", "go/ast", "go/doc", "go/parser", "go/scanner", "go/token", "internal/cpu", "internal/poll", "internal/race", "internal/syscall/windows", "internal/syscall/windows/registry", "internal/syscall/windows/sysdll", "io", "io/ioutil", "log", "math", "net/url", "os", "path", "path/filepath", "reflect", "regexp", "regexp/syntax", "runtime", "runtime/internal/atomic", "runtime/internal/sys", "sort", "strconv", "strings", "sync", "sync/atomic", "syscall", "text/template", "text/template/parse", "time", "unicode", "unicode/utf16", "unicode/utf8"}, "go/build": {"bufio", "bytes", "errors", "fmt", "go/ast", "go/doc", "go/parser", "go/scanner", "go/token", "internal/cpu", "internal/poll", "internal/race", "internal/syscall/windows", "internal/syscall/windows/registry", "internal/syscall/windows/sysdll", "io", "io/ioutil", "log", "math", "net/url", "os", "path", "path/filepath", "reflect", "regexp", "regexp/syntax", "runtime", "runtime/internal/atomic", "runtime/internal/sys", "sort", "strconv", "strings", "sync", "sync/atomic", "syscall", "text/template", "text/template/parse", "time", "unicode", "unicode/utf16", "unicode/utf8"},
"go/doc": {"bytes", "errors", "fmt", "go/ast", "go/scanner", "go/token", "internal/cpu", "internal/poll", "internal/race", "internal/syscall/windows", "internal/syscall/windows/registry", "internal/syscall/windows/sysdll", "io", "io/ioutil", "math", "net/url", "os", "path", "path/filepath", "reflect", "regexp", "regexp/syntax", "runtime", "runtime/internal/atomic", "runtime/internal/sys", "sort", "strconv", "strings", "sync", "sync/atomic", "syscall", "text/template", "text/template/parse", "time", "unicode", "unicode/utf16", "unicode/utf8"}, "go/doc": {"bytes", "errors", "fmt", "go/ast", "go/scanner", "go/token", "internal/cpu", "internal/poll", "internal/race", "internal/syscall/windows", "internal/syscall/windows/registry", "internal/syscall/windows/sysdll", "io", "io/ioutil", "math", "net/url", "os", "path", "path/filepath", "reflect", "regexp", "regexp/syntax", "runtime", "runtime/internal/atomic", "runtime/internal/sys", "sort", "strconv", "strings", "sync", "sync/atomic", "syscall", "text/template", "text/template/parse", "time", "unicode", "unicode/utf16", "unicode/utf8"},
"go/parser": {"bytes", "errors", "fmt", "go/ast", "go/scanner", "go/token", "internal/cpu", "internal/poll", "internal/race", "internal/syscall/windows", "internal/syscall/windows/registry", "internal/syscall/windows/sysdll", "io", "io/ioutil", "math", "os", "path/filepath", "reflect", "runtime", "runtime/internal/atomic", "runtime/internal/sys", "sort", "strconv", "strings", "sync", "sync/atomic", "syscall", "time", "unicode", "unicode/utf16", "unicode/utf8"}, "go/parser": {"bytes", "errors", "fmt", "go/ast", "go/scanner", "go/token", "internal/cpu", "internal/poll", "internal/race", "internal/syscall/windows", "internal/syscall/windows/registry", "internal/syscall/windows/sysdll", "io", "io/ioutil", "math", "os", "path/filepath", "reflect", "runtime", "runtime/internal/atomic", "runtime/internal/sys", "sort", "strconv", "strings", "sync", "sync/atomic", "syscall", "time", "unicode", "unicode/utf16", "unicode/utf8"},
"go/scanner": {"bytes", "errors", "fmt", "go/token", "internal/cpu", "internal/poll", "internal/race", "internal/syscall/windows", "internal/syscall/windows/registry", "internal/syscall/windows/sysdll", "io", "math", "os", "path/filepath", "reflect", "runtime", "runtime/internal/atomic", "runtime/internal/sys", "sort", "strconv", "strings", "sync", "sync/atomic", "syscall", "time", "unicode", "unicode/utf16", "unicode/utf8"}, "go/scanner": {"bytes", "errors", "fmt", "go/token", "internal/cpu", "internal/poll", "internal/race", "internal/syscall/windows", "internal/syscall/windows/registry", "internal/syscall/windows/sysdll", "io", "math", "os", "path/filepath", "reflect", "runtime", "runtime/internal/atomic", "runtime/internal/sys", "sort", "strconv", "strings", "sync", "sync/atomic", "syscall", "time", "unicode", "unicode/utf16", "unicode/utf8"},
"go/token": {"errors", "fmt", "internal/cpu", "internal/poll", "internal/race", "internal/syscall/windows", "internal/syscall/windows/registry", "internal/syscall/windows/sysdll", "io", "math", "os", "reflect", "runtime", "runtime/internal/atomic", "runtime/internal/sys", "sort", "strconv", "sync", "sync/atomic", "syscall", "time", "unicode/utf16", "unicode/utf8"}, "go/token": {"errors", "fmt", "internal/cpu", "internal/poll", "internal/race", "internal/syscall/windows", "internal/syscall/windows/registry", "internal/syscall/windows/sysdll", "io", "math", "os", "reflect", "runtime", "runtime/internal/atomic", "runtime/internal/sys", "sort", "strconv", "sync", "sync/atomic", "syscall", "time", "unicode", "unicode/utf16", "unicode/utf8"},
"hash": {"errors", "internal/race", "io", "runtime", "runtime/internal/atomic", "runtime/internal/sys", "sync", "sync/atomic"}, "hash": {"errors", "internal/race", "io", "runtime", "runtime/internal/atomic", "runtime/internal/sys", "sync", "sync/atomic"},
"hash/adler32": {"errors", "hash", "internal/race", "io", "runtime", "runtime/internal/atomic", "runtime/internal/sys", "sync", "sync/atomic"}, "hash/adler32": {"errors", "hash", "internal/race", "io", "runtime", "runtime/internal/atomic", "runtime/internal/sys", "sync", "sync/atomic"},
"internal/cpu": {"runtime", "runtime/internal/atomic", "runtime/internal/sys"}, "internal/cpu": {"runtime", "runtime/internal/atomic", "runtime/internal/sys"},
@ -63,7 +63,7 @@ var builddeps = map[string][]string{
"internal/syscall/windows/sysdll": {"runtime", "runtime/internal/atomic", "runtime/internal/sys"}, "internal/syscall/windows/sysdll": {"runtime", "runtime/internal/atomic", "runtime/internal/sys"},
"io": {"errors", "internal/race", "runtime", "runtime/internal/atomic", "runtime/internal/sys", "sync", "sync/atomic"}, "io": {"errors", "internal/race", "runtime", "runtime/internal/atomic", "runtime/internal/sys", "sync", "sync/atomic"},
"io/ioutil": {"bytes", "errors", "internal/cpu", "internal/poll", "internal/race", "internal/syscall/windows", "internal/syscall/windows/registry", "internal/syscall/windows/sysdll", "io", "math", "os", "path/filepath", "reflect", "runtime", "runtime/internal/atomic", "runtime/internal/sys", "sort", "strconv", "strings", "sync", "sync/atomic", "syscall", "time", "unicode", "unicode/utf16", "unicode/utf8"}, "io/ioutil": {"bytes", "errors", "internal/cpu", "internal/poll", "internal/race", "internal/syscall/windows", "internal/syscall/windows/registry", "internal/syscall/windows/sysdll", "io", "math", "os", "path/filepath", "reflect", "runtime", "runtime/internal/atomic", "runtime/internal/sys", "sort", "strconv", "strings", "sync", "sync/atomic", "syscall", "time", "unicode", "unicode/utf16", "unicode/utf8"},
"log": {"errors", "fmt", "internal/cpu", "internal/poll", "internal/race", "internal/syscall/windows", "internal/syscall/windows/registry", "internal/syscall/windows/sysdll", "io", "math", "os", "reflect", "runtime", "runtime/internal/atomic", "runtime/internal/sys", "strconv", "sync", "sync/atomic", "syscall", "time", "unicode/utf16", "unicode/utf8"}, "log": {"errors", "fmt", "internal/cpu", "internal/poll", "internal/race", "internal/syscall/windows", "internal/syscall/windows/registry", "internal/syscall/windows/sysdll", "io", "math", "os", "reflect", "runtime", "runtime/internal/atomic", "runtime/internal/sys", "strconv", "sync", "sync/atomic", "syscall", "time", "unicode", "unicode/utf16", "unicode/utf8"},
"math": {"internal/cpu", "runtime", "runtime/internal/atomic", "runtime/internal/sys"}, "math": {"internal/cpu", "runtime", "runtime/internal/atomic", "runtime/internal/sys"},
"math/bits": {"runtime", "runtime/internal/atomic", "runtime/internal/sys"}, "math/bits": {"runtime", "runtime/internal/atomic", "runtime/internal/sys"},
"net/url": {"bytes", "errors", "fmt", "internal/cpu", "internal/poll", "internal/race", "internal/syscall/windows", "internal/syscall/windows/registry", "internal/syscall/windows/sysdll", "io", "math", "os", "reflect", "runtime", "runtime/internal/atomic", "runtime/internal/sys", "sort", "strconv", "strings", "sync", "sync/atomic", "syscall", "time", "unicode", "unicode/utf16", "unicode/utf8"}, "net/url": {"bytes", "errors", "fmt", "internal/cpu", "internal/poll", "internal/race", "internal/syscall/windows", "internal/syscall/windows/registry", "internal/syscall/windows/sysdll", "io", "math", "os", "reflect", "runtime", "runtime/internal/atomic", "runtime/internal/sys", "sort", "strconv", "strings", "sync", "sync/atomic", "syscall", "time", "unicode", "unicode/utf16", "unicode/utf8"},
@ -72,13 +72,13 @@ var builddeps = map[string][]string{
"os/signal": {"errors", "internal/poll", "internal/race", "internal/syscall/windows", "internal/syscall/windows/registry", "internal/syscall/windows/sysdll", "io", "os", "runtime", "runtime/internal/atomic", "runtime/internal/sys", "sync", "sync/atomic", "syscall", "time", "unicode/utf16", "unicode/utf8"}, "os/signal": {"errors", "internal/poll", "internal/race", "internal/syscall/windows", "internal/syscall/windows/registry", "internal/syscall/windows/sysdll", "io", "os", "runtime", "runtime/internal/atomic", "runtime/internal/sys", "sync", "sync/atomic", "syscall", "time", "unicode/utf16", "unicode/utf8"},
"path": {"errors", "internal/cpu", "internal/race", "io", "runtime", "runtime/internal/atomic", "runtime/internal/sys", "strings", "sync", "sync/atomic", "unicode", "unicode/utf8"}, "path": {"errors", "internal/cpu", "internal/race", "io", "runtime", "runtime/internal/atomic", "runtime/internal/sys", "strings", "sync", "sync/atomic", "unicode", "unicode/utf8"},
"path/filepath": {"errors", "internal/cpu", "internal/poll", "internal/race", "internal/syscall/windows", "internal/syscall/windows/registry", "internal/syscall/windows/sysdll", "io", "math", "os", "reflect", "runtime", "runtime/internal/atomic", "runtime/internal/sys", "sort", "strconv", "strings", "sync", "sync/atomic", "syscall", "time", "unicode", "unicode/utf16", "unicode/utf8"}, "path/filepath": {"errors", "internal/cpu", "internal/poll", "internal/race", "internal/syscall/windows", "internal/syscall/windows/registry", "internal/syscall/windows/sysdll", "io", "math", "os", "reflect", "runtime", "runtime/internal/atomic", "runtime/internal/sys", "sort", "strconv", "strings", "sync", "sync/atomic", "syscall", "time", "unicode", "unicode/utf16", "unicode/utf8"},
"reflect": {"errors", "internal/cpu", "internal/race", "math", "runtime", "runtime/internal/atomic", "runtime/internal/sys", "strconv", "sync", "sync/atomic", "unicode/utf8"}, "reflect": {"errors", "internal/cpu", "internal/race", "math", "runtime", "runtime/internal/atomic", "runtime/internal/sys", "strconv", "sync", "sync/atomic", "unicode", "unicode/utf8"},
"regexp": {"bytes", "errors", "internal/cpu", "internal/race", "io", "math", "reflect", "regexp/syntax", "runtime", "runtime/internal/atomic", "runtime/internal/sys", "sort", "strconv", "strings", "sync", "sync/atomic", "unicode", "unicode/utf8"}, "regexp": {"bytes", "errors", "internal/cpu", "internal/race", "io", "math", "reflect", "regexp/syntax", "runtime", "runtime/internal/atomic", "runtime/internal/sys", "sort", "strconv", "strings", "sync", "sync/atomic", "unicode", "unicode/utf8"},
"regexp/syntax": {"bytes", "errors", "internal/cpu", "internal/race", "io", "math", "reflect", "runtime", "runtime/internal/atomic", "runtime/internal/sys", "sort", "strconv", "strings", "sync", "sync/atomic", "unicode", "unicode/utf8"}, "regexp/syntax": {"bytes", "errors", "internal/cpu", "internal/race", "io", "math", "reflect", "runtime", "runtime/internal/atomic", "runtime/internal/sys", "sort", "strconv", "strings", "sync", "sync/atomic", "unicode", "unicode/utf8"},
"runtime": {"runtime/internal/atomic", "runtime/internal/sys"}, "runtime": {"runtime/internal/atomic", "runtime/internal/sys"},
"runtime/internal/atomic": {"runtime/internal/sys"}, "runtime/internal/atomic": {"runtime/internal/sys"},
"runtime/internal/sys": {}, "runtime/internal/sys": {},
"sort": {"errors", "internal/cpu", "internal/race", "math", "reflect", "runtime", "runtime/internal/atomic", "runtime/internal/sys", "strconv", "sync", "sync/atomic", "unicode/utf8"}, "sort": {"errors", "internal/cpu", "internal/race", "math", "reflect", "runtime", "runtime/internal/atomic", "runtime/internal/sys", "strconv", "sync", "sync/atomic", "unicode", "unicode/utf8"},
"strconv": {"errors", "internal/cpu", "math", "runtime", "runtime/internal/atomic", "runtime/internal/sys", "unicode/utf8"}, "strconv": {"errors", "internal/cpu", "math", "runtime", "runtime/internal/atomic", "runtime/internal/sys", "unicode/utf8"},
"strings": {"errors", "internal/cpu", "internal/race", "io", "runtime", "runtime/internal/atomic", "runtime/internal/sys", "sync", "sync/atomic", "unicode", "unicode/utf8"}, "strings": {"errors", "internal/cpu", "internal/race", "io", "runtime", "runtime/internal/atomic", "runtime/internal/sys", "sync", "sync/atomic", "unicode", "unicode/utf8"},
"sync": {"internal/race", "runtime", "runtime/internal/atomic", "runtime/internal/sys", "sync/atomic"}, "sync": {"internal/race", "runtime", "runtime/internal/atomic", "runtime/internal/sys", "sync/atomic"},

View File

@ -26,7 +26,7 @@ import (
"time" "time"
) )
func cpuHogger(f func(), dur time.Duration) { func cpuHogger(f func() int, dur time.Duration) {
// We only need to get one 100 Hz clock tick, so we've got // We only need to get one 100 Hz clock tick, so we've got
// a large safety buffer. // a large safety buffer.
// But do at least 500 iterations (which should take about 100ms), // But do at least 500 iterations (which should take about 100ms),
@ -46,7 +46,7 @@ var (
// The actual CPU hogging function. // The actual CPU hogging function.
// Must not call other functions nor access heap/globals in the loop, // Must not call other functions nor access heap/globals in the loop,
// otherwise under race detector the samples will be in the race runtime. // otherwise under race detector the samples will be in the race runtime.
func cpuHog1() { func cpuHog1() int {
foo := salt1 foo := salt1
for i := 0; i < 1e5; i++ { for i := 0; i < 1e5; i++ {
if foo > 0 { if foo > 0 {
@ -55,10 +55,10 @@ func cpuHog1() {
foo *= foo + 1 foo *= foo + 1
} }
} }
salt1 = foo return foo
} }
func cpuHog2() { func cpuHog2() int {
foo := salt2 foo := salt2
for i := 0; i < 1e5; i++ { for i := 0; i < 1e5; i++ {
if foo > 0 { if foo > 0 {
@ -67,7 +67,7 @@ func cpuHog2() {
foo *= foo + 2 foo *= foo + 2
} }
} }
salt2 = foo return foo
} }
func TestCPUProfile(t *testing.T) { func TestCPUProfile(t *testing.T) {
@ -95,8 +95,9 @@ func TestCPUProfileInlining(t *testing.T) {
}) })
} }
func inlinedCaller() { func inlinedCaller() int {
inlinedCallee() inlinedCallee()
return 0
} }
func inlinedCallee() { func inlinedCallee() {
@ -716,6 +717,28 @@ func TestCPUProfileLabel(t *testing.T) {
}) })
} }
func TestLabelRace(t *testing.T) {
// Test the race detector annotations for synchronization
// between settings labels and consuming them from the
// profile.
testCPUProfile(t, []string{"runtime/pprof.cpuHogger;key=value"}, func(dur time.Duration) {
start := time.Now()
var wg sync.WaitGroup
for time.Since(start) < dur {
for i := 0; i < 10; i++ {
wg.Add(1)
go func() {
Do(context.Background(), Labels("key", "value"), func(context.Context) {
cpuHogger(cpuHog1, time.Millisecond)
})
wg.Done()
}()
}
wg.Wait()
}
})
}
// Check that there is no deadlock when the program receives SIGPROF while in // Check that there is no deadlock when the program receives SIGPROF while in
// 64bit atomics' critical section. Used to happen on mips{,le}. See #20146. // 64bit atomics' critical section. Used to happen on mips{,le}. See #20146.
func TestAtomicLoadStore64(t *testing.T) { func TestAtomicLoadStore64(t *testing.T) {

View File

@ -545,7 +545,7 @@ Read:
b.rNext = br.addCountsAndClearFlags(skip+di, ti) b.rNext = br.addCountsAndClearFlags(skip+di, ti)
if raceenabled { if raceenabled {
// Match racewritepc in runtime_setProfLabel, // Match racereleasemerge in runtime_setProfLabel,
// so that the setting of the labels in runtime_setProfLabel // so that the setting of the labels in runtime_setProfLabel
// is treated as happening before any use of the labels // is treated as happening before any use of the labels
// by our caller. The synchronization on labelSync itself is a fiction // by our caller. The synchronization on labelSync itself is a fiction

View File

@ -13,8 +13,23 @@ func runtime_setProfLabel(labels unsafe.Pointer) {
// Introduce race edge for read-back via profile. // Introduce race edge for read-back via profile.
// This would more properly use &getg().labels as the sync address, // This would more properly use &getg().labels as the sync address,
// but we do the read in a signal handler and can't call the race runtime then. // but we do the read in a signal handler and can't call the race runtime then.
//
// This uses racereleasemerge rather than just racerelease so
// the acquire in profBuf.read synchronizes with *all* prior
// setProfLabel operations, not just the most recent one. This
// is important because profBuf.read will observe different
// labels set by different setProfLabel operations on
// different goroutines, so it needs to synchronize with all
// of them (this wouldn't be an issue if we could synchronize
// on &getg().labels since we would synchronize with each
// most-recent labels write separately.)
//
// racereleasemerge is like a full read-modify-write on
// labelSync, rather than just a store-release, so it carries
// a dependency on the previous racereleasemerge, which
// ultimately carries forward to the acquire in profBuf.read.
if raceenabled { if raceenabled {
racerelease(unsafe.Pointer(&labelSync)) racereleasemerge(unsafe.Pointer(&labelSync))
} }
getg().labels = labels getg().labels = labels
} }

View File

@ -259,4 +259,25 @@ Goroutine [0-9] \(running\) created at:
runtime\.newextram\(\) runtime\.newextram\(\)
.*/runtime/proc.go:[0-9]+ \+0x[0-9,a-f]+ .*/runtime/proc.go:[0-9]+ \+0x[0-9,a-f]+
==================`}, ==================`},
{"second_test_passes", "test", "", "atexit_sleep_ms=0", `
package main_test
import "testing"
func TestFail(t *testing.T) {
done := make(chan bool)
x := 0
go func() {
x = 42
done <- true
}()
x = 43
<-done
}
func TestPass(t *testing.T) {
}
`, `
==================
--- FAIL: TestFail \(0...s\)
.*testing.go:.*: race detected during execution of test
FAIL`},
} }

View File

@ -100,7 +100,7 @@ TEXT runtime·usleep(SB),NOSPLIT,$8
MOVL AX, 0(SP) MOVL AX, 0(SP)
MOVL $1000, AX // usec to nsec MOVL $1000, AX // usec to nsec
MULL DX MULL DX
MOVL DX, 4(SP) MOVL AX, 4(SP)
// pselect6(0, 0, 0, 0, &ts, 0) // pselect6(0, 0, 0, 0, &ts, 0)
MOVL $308, AX MOVL $308, AX

View File

@ -695,8 +695,7 @@ func tRunner(t *T, fn func(t *T)) {
// a call to runtime.Goexit, record the duration and send // a call to runtime.Goexit, record the duration and send
// a signal saying that the test is done. // a signal saying that the test is done.
defer func() { defer func() {
t.raceErrors += race.Errors() if t.raceErrors+race.Errors() > 0 {
if t.raceErrors > 0 {
t.Errorf("race detected during execution of test") t.Errorf("race detected during execution of test")
} }