diff options
| author | Carlos Amedee <carlos@golang.org> | 2026-01-21 15:45:40 -0500 |
|---|---|---|
| committer | Carlos Amedee <carlos@golang.org> | 2026-01-21 15:56:01 -0500 |
| commit | eec3c0ca956803db8a90dfd92ce4ebffebdaf9b4 (patch) | |
| tree | 14ed37a5aa0fd9e80b547fd43086b2b137457726 | |
| parent | 4606a931d2b099f2c5e5619b797352607ee42225 (diff) | |
| parent | 2baa1d17628bb2f09757617382b1e61f1f9f0ddd (diff) | |
| download | go-eec3c0ca956803db8a90dfd92ce4ebffebdaf9b4.tar.xz | |
[release-branch.go1.26] all: merge master (2baa1d1) into release-branch.go1.26
For #76474.
Change-Id: Ic50e288f99b731b62af9aa73ce6721f0f2f3596d
61 files changed, 651 insertions, 970 deletions
diff --git a/doc/go_spec.html b/doc/go_spec.html index f47f5a6e3e..478aefd4a6 100644 --- a/doc/go_spec.html +++ b/doc/go_spec.html @@ -1,6 +1,6 @@ <!--{ "Title": "The Go Programming Language Specification", - "Subtitle": "Language version go1.26 (Dec 2, 2025)", + "Subtitle": "Language version go1.26 (Jan 12, 2026)", "Path": "/ref/spec" }--> @@ -3143,7 +3143,8 @@ math.Sin // denotes the Sin function in package math <p> Composite literals construct new values for structs, arrays, slices, and maps each time they are evaluated. -They consist of the type of the literal followed by a brace-bound list of elements. +They consist of the type of the literal followed by a (possibly empty) +brace-bound list of elements. Each element may optionally be preceded by a corresponding key. </p> @@ -3168,35 +3169,53 @@ as a TypeName). If the LiteralType is a type parameter, all types in its type set must have the same underlying type which must be a valid composite literal type. +</p> + +<p> The types of the elements and keys must be <a href="#Assignability">assignable</a> -to the respective field, element, and key types of type <code>T</code>; +to the respective field, element, and key types of the LiteralType; there is no additional conversion. The key is interpreted as a field name for struct literals, an index for array and slice literals, and a key for map literals. -For map literals, all elements must have a key. It is an error -to specify multiple elements with the same field name or -constant key value. For non-constant map keys, see the section on -<a href="#Order_of_evaluation">evaluation order</a>. +It is an error to specify multiple elements with the same field name +or constant key value. +A literal may omit the element list; such a literal evaluates +to the zero value for its type. </p> <p> -For struct literals the following rules apply: +A parsing ambiguity arises when a composite literal using the +TypeName form of the LiteralType appears as an operand between the +<a href="#Keywords">keyword</a> and the opening brace of the block +of an "if", "for", or "switch" statement, and the composite literal +is not enclosed in parentheses, square brackets, or curly braces. +In this rare case, the opening brace of the literal is erroneously parsed +as the one introducing the block of statements. To resolve the ambiguity, +the composite literal must appear within parentheses. +</p> + +<pre> +if x == (T{a,b,c}[i]) { … } +if (x == T{a,b,c}[i]) { … } +</pre> + +<h4>Struct literals</h4> + +<p> +For struct literals without keys, the element list must contain an element +for each struct field in the order in which the fields are declared. +</p> + +<p> +For struct literals with keys the following rules apply: </p> <ul> - <li>A key must be a field name declared in the struct type. - </li> - <li>An element list that does not contain any keys must - list an element for each struct field in the - order in which the fields are declared. + <li>Every element must have a key. </li> - <li>If any element has a key, every element must have a key. + <li>Each key must be a field name declared in the struct type. </li> - <li>An element list that contains keys does not need to - have an element for each struct field. Omitted fields - get the zero value for that field. - </li> - <li>A literal may omit the element list; such a literal evaluates - to the zero value for its type. + <li>The element list does not need to have an element for each struct field. + Omitted fields get the zero value for that field. </li> <li>It is an error to specify an element for a non-exported field of a struct belonging to a different package. @@ -3220,6 +3239,8 @@ origin := Point3D{} // zero value for Point3D line := Line{origin, Point3D{y: -4, z: 12.3}} // zero value for line.q.x </pre> +<h4>Array and slice literals</h4> + <p> For array and slice literals the following rules apply: </p> @@ -3295,6 +3316,16 @@ tmp := [n]T{x1, x2, … xn} tmp[0 : n] </pre> +<h4>Map literals</h4> + +<p> +For map literals, each element must have a key. +For non-constant map keys, see the section on +<a href="#Order_of_evaluation">evaluation order</a>. +</p> + +<h4>Elision of element types</h4> + <p> Within a composite literal of array, slice, or map type <code>T</code>, elements or map keys that are themselves composite literals may elide the respective @@ -3316,22 +3347,6 @@ type PPoint *Point </pre> <p> -A parsing ambiguity arises when a composite literal using the -TypeName form of the LiteralType appears as an operand between the -<a href="#Keywords">keyword</a> and the opening brace of the block -of an "if", "for", or "switch" statement, and the composite literal -is not enclosed in parentheses, square brackets, or curly braces. -In this rare case, the opening brace of the literal is erroneously parsed -as the one introducing the block of statements. To resolve the ambiguity, -the composite literal must appear within parentheses. -</p> - -<pre> -if x == (T{a,b,c}[i]) { … } -if (x == T{a,b,c}[i]) { … } -</pre> - -<p> Examples of valid array, slice, and map literals: </p> diff --git a/doc/godebug.md b/doc/godebug.md index 184e161c40..90ed63a01a 100644 --- a/doc/godebug.md +++ b/doc/godebug.md @@ -167,8 +167,8 @@ Go 1.26 added a new `urlmaxqueryparams` setting that controls the maximum number of query parameters that net/url will accept when parsing a URL-encoded query string. If the number of parameters exceeds the number set in `urlmaxqueryparams`, parsing will fail early. The default value is `urlmaxqueryparams=10000`. -Setting `urlmaxqueryparams=0`bles the limit. To avoid denial of service attacks, -this setting and default was backported to Go 1.25.4 and Go 1.24.10. +Setting `urlmaxqueryparams=0` disables the limit. To avoid denial of service +attacks, this setting and default was backported to Go 1.25.6 and Go 1.24.12. Go 1.26 added a new `urlstrictcolons` setting that controls whether `net/url.Parse` allows malformed hostnames containing colons outside of a bracketed IPv6 address. diff --git a/src/cmd/compile/internal/amd64/simdssa.go b/src/cmd/compile/internal/amd64/simdssa.go index a028cbe86d..ea33808a1c 100644 --- a/src/cmd/compile/internal/amd64/simdssa.go +++ b/src/cmd/compile/internal/amd64/simdssa.go @@ -1959,23 +1959,11 @@ func ssaGenSIMDValue(s *ssagen.State, v *ssa.Value) bool { ssa.OpAMD64VPERMI2Q256load, ssa.OpAMD64VPERMI2PD512load, ssa.OpAMD64VPERMI2Q512load, - ssa.OpAMD64VFMADD213PS128load, - ssa.OpAMD64VFMADD213PS256load, ssa.OpAMD64VFMADD213PS512load, - ssa.OpAMD64VFMADD213PD128load, - ssa.OpAMD64VFMADD213PD256load, ssa.OpAMD64VFMADD213PD512load, - ssa.OpAMD64VFMADDSUB213PS128load, - ssa.OpAMD64VFMADDSUB213PS256load, ssa.OpAMD64VFMADDSUB213PS512load, - ssa.OpAMD64VFMADDSUB213PD128load, - ssa.OpAMD64VFMADDSUB213PD256load, ssa.OpAMD64VFMADDSUB213PD512load, - ssa.OpAMD64VFMSUBADD213PS128load, - ssa.OpAMD64VFMSUBADD213PS256load, ssa.OpAMD64VFMSUBADD213PS512load, - ssa.OpAMD64VFMSUBADD213PD128load, - ssa.OpAMD64VFMSUBADD213PD256load, ssa.OpAMD64VFMSUBADD213PD512load, ssa.OpAMD64VPSHLDVD128load, ssa.OpAMD64VPSHLDVD256load, diff --git a/src/cmd/compile/internal/ssa/_gen/simdAMD64.rules b/src/cmd/compile/internal/ssa/_gen/simdAMD64.rules index 799461610d..63b37f99cb 100644 --- a/src/cmd/compile/internal/ssa/_gen/simdAMD64.rules +++ b/src/cmd/compile/internal/ssa/_gen/simdAMD64.rules @@ -2771,11 +2771,7 @@ (VPMULLQ128 x l:(VMOVDQUload128 {sym} [off] ptr mem)) && canMergeLoad(v, l) && clobber(l) => (VPMULLQ128load {sym} [off] x ptr mem) (VPMULLQ256 x l:(VMOVDQUload256 {sym} [off] ptr mem)) && canMergeLoad(v, l) && clobber(l) => (VPMULLQ256load {sym} [off] x ptr mem) (VPMULLQ512 x l:(VMOVDQUload512 {sym} [off] ptr mem)) && canMergeLoad(v, l) && clobber(l) => (VPMULLQ512load {sym} [off] x ptr mem) -(VFMADD213PS128 x y l:(VMOVDQUload128 {sym} [off] ptr mem)) && canMergeLoad(v, l) && clobber(l) => (VFMADD213PS128load {sym} [off] x y ptr mem) -(VFMADD213PS256 x y l:(VMOVDQUload256 {sym} [off] ptr mem)) && canMergeLoad(v, l) && clobber(l) => (VFMADD213PS256load {sym} [off] x y ptr mem) (VFMADD213PS512 x y l:(VMOVDQUload512 {sym} [off] ptr mem)) && canMergeLoad(v, l) && clobber(l) => (VFMADD213PS512load {sym} [off] x y ptr mem) -(VFMADD213PD128 x y l:(VMOVDQUload128 {sym} [off] ptr mem)) && canMergeLoad(v, l) && clobber(l) => (VFMADD213PD128load {sym} [off] x y ptr mem) -(VFMADD213PD256 x y l:(VMOVDQUload256 {sym} [off] ptr mem)) && canMergeLoad(v, l) && clobber(l) => (VFMADD213PD256load {sym} [off] x y ptr mem) (VFMADD213PD512 x y l:(VMOVDQUload512 {sym} [off] ptr mem)) && canMergeLoad(v, l) && clobber(l) => (VFMADD213PD512load {sym} [off] x y ptr mem) (VFMADD213PSMasked128 x y l:(VMOVDQUload128 {sym} [off] ptr mem) mask) && canMergeLoad(v, l) && clobber(l) => (VFMADD213PSMasked128load {sym} [off] x y ptr mask mem) (VFMADD213PSMasked256 x y l:(VMOVDQUload256 {sym} [off] ptr mem) mask) && canMergeLoad(v, l) && clobber(l) => (VFMADD213PSMasked256load {sym} [off] x y ptr mask mem) @@ -2783,11 +2779,7 @@ (VFMADD213PDMasked128 x y l:(VMOVDQUload128 {sym} [off] ptr mem) mask) && canMergeLoad(v, l) && clobber(l) => (VFMADD213PDMasked128load {sym} [off] x y ptr mask mem) (VFMADD213PDMasked256 x y l:(VMOVDQUload256 {sym} [off] ptr mem) mask) && canMergeLoad(v, l) && clobber(l) => (VFMADD213PDMasked256load {sym} [off] x y ptr mask mem) (VFMADD213PDMasked512 x y l:(VMOVDQUload512 {sym} [off] ptr mem) mask) && canMergeLoad(v, l) && clobber(l) => (VFMADD213PDMasked512load {sym} [off] x y ptr mask mem) -(VFMADDSUB213PS128 x y l:(VMOVDQUload128 {sym} [off] ptr mem)) && canMergeLoad(v, l) && clobber(l) => (VFMADDSUB213PS128load {sym} [off] x y ptr mem) -(VFMADDSUB213PS256 x y l:(VMOVDQUload256 {sym} [off] ptr mem)) && canMergeLoad(v, l) && clobber(l) => (VFMADDSUB213PS256load {sym} [off] x y ptr mem) (VFMADDSUB213PS512 x y l:(VMOVDQUload512 {sym} [off] ptr mem)) && canMergeLoad(v, l) && clobber(l) => (VFMADDSUB213PS512load {sym} [off] x y ptr mem) -(VFMADDSUB213PD128 x y l:(VMOVDQUload128 {sym} [off] ptr mem)) && canMergeLoad(v, l) && clobber(l) => (VFMADDSUB213PD128load {sym} [off] x y ptr mem) -(VFMADDSUB213PD256 x y l:(VMOVDQUload256 {sym} [off] ptr mem)) && canMergeLoad(v, l) && clobber(l) => (VFMADDSUB213PD256load {sym} [off] x y ptr mem) (VFMADDSUB213PD512 x y l:(VMOVDQUload512 {sym} [off] ptr mem)) && canMergeLoad(v, l) && clobber(l) => (VFMADDSUB213PD512load {sym} [off] x y ptr mem) (VFMADDSUB213PSMasked128 x y l:(VMOVDQUload128 {sym} [off] ptr mem) mask) && canMergeLoad(v, l) && clobber(l) => (VFMADDSUB213PSMasked128load {sym} [off] x y ptr mask mem) (VFMADDSUB213PSMasked256 x y l:(VMOVDQUload256 {sym} [off] ptr mem) mask) && canMergeLoad(v, l) && clobber(l) => (VFMADDSUB213PSMasked256load {sym} [off] x y ptr mask mem) @@ -2807,11 +2799,7 @@ (VPMULLQMasked128 x l:(VMOVDQUload128 {sym} [off] ptr mem) mask) && canMergeLoad(v, l) && clobber(l) => (VPMULLQMasked128load {sym} [off] x ptr mask mem) (VPMULLQMasked256 x l:(VMOVDQUload256 {sym} [off] ptr mem) mask) && canMergeLoad(v, l) && clobber(l) => (VPMULLQMasked256load {sym} [off] x ptr mask mem) (VPMULLQMasked512 x l:(VMOVDQUload512 {sym} [off] ptr mem) mask) && canMergeLoad(v, l) && clobber(l) => (VPMULLQMasked512load {sym} [off] x ptr mask mem) -(VFMSUBADD213PS128 x y l:(VMOVDQUload128 {sym} [off] ptr mem)) && canMergeLoad(v, l) && clobber(l) => (VFMSUBADD213PS128load {sym} [off] x y ptr mem) -(VFMSUBADD213PS256 x y l:(VMOVDQUload256 {sym} [off] ptr mem)) && canMergeLoad(v, l) && clobber(l) => (VFMSUBADD213PS256load {sym} [off] x y ptr mem) (VFMSUBADD213PS512 x y l:(VMOVDQUload512 {sym} [off] ptr mem)) && canMergeLoad(v, l) && clobber(l) => (VFMSUBADD213PS512load {sym} [off] x y ptr mem) -(VFMSUBADD213PD128 x y l:(VMOVDQUload128 {sym} [off] ptr mem)) && canMergeLoad(v, l) && clobber(l) => (VFMSUBADD213PD128load {sym} [off] x y ptr mem) -(VFMSUBADD213PD256 x y l:(VMOVDQUload256 {sym} [off] ptr mem)) && canMergeLoad(v, l) && clobber(l) => (VFMSUBADD213PD256load {sym} [off] x y ptr mem) (VFMSUBADD213PD512 x y l:(VMOVDQUload512 {sym} [off] ptr mem)) && canMergeLoad(v, l) && clobber(l) => (VFMSUBADD213PD512load {sym} [off] x y ptr mem) (VFMSUBADD213PSMasked128 x y l:(VMOVDQUload128 {sym} [off] ptr mem) mask) && canMergeLoad(v, l) && clobber(l) => (VFMSUBADD213PSMasked128load {sym} [off] x y ptr mask mem) (VFMSUBADD213PSMasked256 x y l:(VMOVDQUload256 {sym} [off] ptr mem) mask) && canMergeLoad(v, l) && clobber(l) => (VFMSUBADD213PSMasked256load {sym} [off] x y ptr mask mem) diff --git a/src/cmd/compile/internal/ssa/_gen/simdAMD64ops.go b/src/cmd/compile/internal/ssa/_gen/simdAMD64ops.go index 648e372fb4..339ec7fce3 100644 --- a/src/cmd/compile/internal/ssa/_gen/simdAMD64ops.go +++ b/src/cmd/compile/internal/ssa/_gen/simdAMD64ops.go @@ -172,38 +172,38 @@ func simdAMD64Ops(v11, v21, v2k, vkv, v2kv, v2kk, v31, v3kv, vgpv, vgp, vfpv, vf {name: "VEXPANDPSMasked128", argLength: 2, reg: wkw, asm: "VEXPANDPS", commutative: false, typ: "Vec128", resultInArg0: false}, {name: "VEXPANDPSMasked256", argLength: 2, reg: wkw, asm: "VEXPANDPS", commutative: false, typ: "Vec256", resultInArg0: false}, {name: "VEXPANDPSMasked512", argLength: 2, reg: wkw, asm: "VEXPANDPS", commutative: false, typ: "Vec512", resultInArg0: false}, - {name: "VFMADD213PD128", argLength: 3, reg: w31, asm: "VFMADD213PD", commutative: false, typ: "Vec128", resultInArg0: true}, - {name: "VFMADD213PD256", argLength: 3, reg: w31, asm: "VFMADD213PD", commutative: false, typ: "Vec256", resultInArg0: true}, + {name: "VFMADD213PD128", argLength: 3, reg: v31, asm: "VFMADD213PD", commutative: false, typ: "Vec128", resultInArg0: true}, + {name: "VFMADD213PD256", argLength: 3, reg: v31, asm: "VFMADD213PD", commutative: false, typ: "Vec256", resultInArg0: true}, {name: "VFMADD213PD512", argLength: 3, reg: w31, asm: "VFMADD213PD", commutative: false, typ: "Vec512", resultInArg0: true}, {name: "VFMADD213PDMasked128", argLength: 4, reg: w3kw, asm: "VFMADD213PD", commutative: false, typ: "Vec128", resultInArg0: true}, {name: "VFMADD213PDMasked256", argLength: 4, reg: w3kw, asm: "VFMADD213PD", commutative: false, typ: "Vec256", resultInArg0: true}, {name: "VFMADD213PDMasked512", argLength: 4, reg: w3kw, asm: "VFMADD213PD", commutative: false, typ: "Vec512", resultInArg0: true}, - {name: "VFMADD213PS128", argLength: 3, reg: w31, asm: "VFMADD213PS", commutative: false, typ: "Vec128", resultInArg0: true}, - {name: "VFMADD213PS256", argLength: 3, reg: w31, asm: "VFMADD213PS", commutative: false, typ: "Vec256", resultInArg0: true}, + {name: "VFMADD213PS128", argLength: 3, reg: v31, asm: "VFMADD213PS", commutative: false, typ: "Vec128", resultInArg0: true}, + {name: "VFMADD213PS256", argLength: 3, reg: v31, asm: "VFMADD213PS", commutative: false, typ: "Vec256", resultInArg0: true}, {name: "VFMADD213PS512", argLength: 3, reg: w31, asm: "VFMADD213PS", commutative: false, typ: "Vec512", resultInArg0: true}, {name: "VFMADD213PSMasked128", argLength: 4, reg: w3kw, asm: "VFMADD213PS", commutative: false, typ: "Vec128", resultInArg0: true}, {name: "VFMADD213PSMasked256", argLength: 4, reg: w3kw, asm: "VFMADD213PS", commutative: false, typ: "Vec256", resultInArg0: true}, {name: "VFMADD213PSMasked512", argLength: 4, reg: w3kw, asm: "VFMADD213PS", commutative: false, typ: "Vec512", resultInArg0: true}, - {name: "VFMADDSUB213PD128", argLength: 3, reg: w31, asm: "VFMADDSUB213PD", commutative: false, typ: "Vec128", resultInArg0: true}, - {name: "VFMADDSUB213PD256", argLength: 3, reg: w31, asm: "VFMADDSUB213PD", commutative: false, typ: "Vec256", resultInArg0: true}, + {name: "VFMADDSUB213PD128", argLength: 3, reg: v31, asm: "VFMADDSUB213PD", commutative: false, typ: "Vec128", resultInArg0: true}, + {name: "VFMADDSUB213PD256", argLength: 3, reg: v31, asm: "VFMADDSUB213PD", commutative: false, typ: "Vec256", resultInArg0: true}, {name: "VFMADDSUB213PD512", argLength: 3, reg: w31, asm: "VFMADDSUB213PD", commutative: false, typ: "Vec512", resultInArg0: true}, {name: "VFMADDSUB213PDMasked128", argLength: 4, reg: w3kw, asm: "VFMADDSUB213PD", commutative: false, typ: "Vec128", resultInArg0: true}, {name: "VFMADDSUB213PDMasked256", argLength: 4, reg: w3kw, asm: "VFMADDSUB213PD", commutative: false, typ: "Vec256", resultInArg0: true}, {name: "VFMADDSUB213PDMasked512", argLength: 4, reg: w3kw, asm: "VFMADDSUB213PD", commutative: false, typ: "Vec512", resultInArg0: true}, - {name: "VFMADDSUB213PS128", argLength: 3, reg: w31, asm: "VFMADDSUB213PS", commutative: false, typ: "Vec128", resultInArg0: true}, - {name: "VFMADDSUB213PS256", argLength: 3, reg: w31, asm: "VFMADDSUB213PS", commutative: false, typ: "Vec256", resultInArg0: true}, + {name: "VFMADDSUB213PS128", argLength: 3, reg: v31, asm: "VFMADDSUB213PS", commutative: false, typ: "Vec128", resultInArg0: true}, + {name: "VFMADDSUB213PS256", argLength: 3, reg: v31, asm: "VFMADDSUB213PS", commutative: false, typ: "Vec256", resultInArg0: true}, {name: "VFMADDSUB213PS512", argLength: 3, reg: w31, asm: "VFMADDSUB213PS", commutative: false, typ: "Vec512", resultInArg0: true}, {name: "VFMADDSUB213PSMasked128", argLength: 4, reg: w3kw, asm: "VFMADDSUB213PS", commutative: false, typ: "Vec128", resultInArg0: true}, {name: "VFMADDSUB213PSMasked256", argLength: 4, reg: w3kw, asm: "VFMADDSUB213PS", commutative: false, typ: "Vec256", resultInArg0: true}, {name: "VFMADDSUB213PSMasked512", argLength: 4, reg: w3kw, asm: "VFMADDSUB213PS", commutative: false, typ: "Vec512", resultInArg0: true}, - {name: "VFMSUBADD213PD128", argLength: 3, reg: w31, asm: "VFMSUBADD213PD", commutative: false, typ: "Vec128", resultInArg0: true}, - {name: "VFMSUBADD213PD256", argLength: 3, reg: w31, asm: "VFMSUBADD213PD", commutative: false, typ: "Vec256", resultInArg0: true}, + {name: "VFMSUBADD213PD128", argLength: 3, reg: v31, asm: "VFMSUBADD213PD", commutative: false, typ: "Vec128", resultInArg0: true}, + {name: "VFMSUBADD213PD256", argLength: 3, reg: v31, asm: "VFMSUBADD213PD", commutative: false, typ: "Vec256", resultInArg0: true}, {name: "VFMSUBADD213PD512", argLength: 3, reg: w31, asm: "VFMSUBADD213PD", commutative: false, typ: "Vec512", resultInArg0: true}, {name: "VFMSUBADD213PDMasked128", argLength: 4, reg: w3kw, asm: "VFMSUBADD213PD", commutative: false, typ: "Vec128", resultInArg0: true}, {name: "VFMSUBADD213PDMasked256", argLength: 4, reg: w3kw, asm: "VFMSUBADD213PD", commutative: false, typ: "Vec256", resultInArg0: true}, {name: "VFMSUBADD213PDMasked512", argLength: 4, reg: w3kw, asm: "VFMSUBADD213PD", commutative: false, typ: "Vec512", resultInArg0: true}, - {name: "VFMSUBADD213PS128", argLength: 3, reg: w31, asm: "VFMSUBADD213PS", commutative: false, typ: "Vec128", resultInArg0: true}, - {name: "VFMSUBADD213PS256", argLength: 3, reg: w31, asm: "VFMSUBADD213PS", commutative: false, typ: "Vec256", resultInArg0: true}, + {name: "VFMSUBADD213PS128", argLength: 3, reg: v31, asm: "VFMSUBADD213PS", commutative: false, typ: "Vec128", resultInArg0: true}, + {name: "VFMSUBADD213PS256", argLength: 3, reg: v31, asm: "VFMSUBADD213PS", commutative: false, typ: "Vec256", resultInArg0: true}, {name: "VFMSUBADD213PS512", argLength: 3, reg: w31, asm: "VFMSUBADD213PS", commutative: false, typ: "Vec512", resultInArg0: true}, {name: "VFMSUBADD213PSMasked128", argLength: 4, reg: w3kw, asm: "VFMSUBADD213PS", commutative: false, typ: "Vec128", resultInArg0: true}, {name: "VFMSUBADD213PSMasked256", argLength: 4, reg: w3kw, asm: "VFMSUBADD213PS", commutative: false, typ: "Vec256", resultInArg0: true}, @@ -1594,38 +1594,26 @@ func simdAMD64Ops(v11, v21, v2k, vkv, v2kv, v2kk, v31, v3kv, vgpv, vgp, vfpv, vf {name: "VDIVPSMasked128load", argLength: 4, reg: w2kwload, asm: "VDIVPS", commutative: false, typ: "Vec128", aux: "SymOff", symEffect: "Read", resultInArg0: false}, {name: "VDIVPSMasked256load", argLength: 4, reg: w2kwload, asm: "VDIVPS", commutative: false, typ: "Vec256", aux: "SymOff", symEffect: "Read", resultInArg0: false}, {name: "VDIVPSMasked512load", argLength: 4, reg: w2kwload, asm: "VDIVPS", commutative: false, typ: "Vec512", aux: "SymOff", symEffect: "Read", resultInArg0: false}, - {name: "VFMADD213PD128load", argLength: 4, reg: w31load, asm: "VFMADD213PD", commutative: false, typ: "Vec128", aux: "SymOff", symEffect: "Read", resultInArg0: true}, - {name: "VFMADD213PD256load", argLength: 4, reg: w31load, asm: "VFMADD213PD", commutative: false, typ: "Vec256", aux: "SymOff", symEffect: "Read", resultInArg0: true}, {name: "VFMADD213PD512load", argLength: 4, reg: w31load, asm: "VFMADD213PD", commutative: false, typ: "Vec512", aux: "SymOff", symEffect: "Read", resultInArg0: true}, {name: "VFMADD213PDMasked128load", argLength: 5, reg: w3kwload, asm: "VFMADD213PD", commutative: false, typ: "Vec128", aux: "SymOff", symEffect: "Read", resultInArg0: true}, {name: "VFMADD213PDMasked256load", argLength: 5, reg: w3kwload, asm: "VFMADD213PD", commutative: false, typ: "Vec256", aux: "SymOff", symEffect: "Read", resultInArg0: true}, {name: "VFMADD213PDMasked512load", argLength: 5, reg: w3kwload, asm: "VFMADD213PD", commutative: false, typ: "Vec512", aux: "SymOff", symEffect: "Read", resultInArg0: true}, - {name: "VFMADD213PS128load", argLength: 4, reg: w31load, asm: "VFMADD213PS", commutative: false, typ: "Vec128", aux: "SymOff", symEffect: "Read", resultInArg0: true}, - {name: "VFMADD213PS256load", argLength: 4, reg: w31load, asm: "VFMADD213PS", commutative: false, typ: "Vec256", aux: "SymOff", symEffect: "Read", resultInArg0: true}, {name: "VFMADD213PS512load", argLength: 4, reg: w31load, asm: "VFMADD213PS", commutative: false, typ: "Vec512", aux: "SymOff", symEffect: "Read", resultInArg0: true}, {name: "VFMADD213PSMasked128load", argLength: 5, reg: w3kwload, asm: "VFMADD213PS", commutative: false, typ: "Vec128", aux: "SymOff", symEffect: "Read", resultInArg0: true}, {name: "VFMADD213PSMasked256load", argLength: 5, reg: w3kwload, asm: "VFMADD213PS", commutative: false, typ: "Vec256", aux: "SymOff", symEffect: "Read", resultInArg0: true}, {name: "VFMADD213PSMasked512load", argLength: 5, reg: w3kwload, asm: "VFMADD213PS", commutative: false, typ: "Vec512", aux: "SymOff", symEffect: "Read", resultInArg0: true}, - {name: "VFMADDSUB213PD128load", argLength: 4, reg: w31load, asm: "VFMADDSUB213PD", commutative: false, typ: "Vec128", aux: "SymOff", symEffect: "Read", resultInArg0: true}, - {name: "VFMADDSUB213PD256load", argLength: 4, reg: w31load, asm: "VFMADDSUB213PD", commutative: false, typ: "Vec256", aux: "SymOff", symEffect: "Read", resultInArg0: true}, {name: "VFMADDSUB213PD512load", argLength: 4, reg: w31load, asm: "VFMADDSUB213PD", commutative: false, typ: "Vec512", aux: "SymOff", symEffect: "Read", resultInArg0: true}, {name: "VFMADDSUB213PDMasked128load", argLength: 5, reg: w3kwload, asm: "VFMADDSUB213PD", commutative: false, typ: "Vec128", aux: "SymOff", symEffect: "Read", resultInArg0: true}, {name: "VFMADDSUB213PDMasked256load", argLength: 5, reg: w3kwload, asm: "VFMADDSUB213PD", commutative: false, typ: "Vec256", aux: "SymOff", symEffect: "Read", resultInArg0: true}, {name: "VFMADDSUB213PDMasked512load", argLength: 5, reg: w3kwload, asm: "VFMADDSUB213PD", commutative: false, typ: "Vec512", aux: "SymOff", symEffect: "Read", resultInArg0: true}, - {name: "VFMADDSUB213PS128load", argLength: 4, reg: w31load, asm: "VFMADDSUB213PS", commutative: false, typ: "Vec128", aux: "SymOff", symEffect: "Read", resultInArg0: true}, - {name: "VFMADDSUB213PS256load", argLength: 4, reg: w31load, asm: "VFMADDSUB213PS", commutative: false, typ: "Vec256", aux: "SymOff", symEffect: "Read", resultInArg0: true}, {name: "VFMADDSUB213PS512load", argLength: 4, reg: w31load, asm: "VFMADDSUB213PS", commutative: false, typ: "Vec512", aux: "SymOff", symEffect: "Read", resultInArg0: true}, {name: "VFMADDSUB213PSMasked128load", argLength: 5, reg: w3kwload, asm: "VFMADDSUB213PS", commutative: false, typ: "Vec128", aux: "SymOff", symEffect: "Read", resultInArg0: true}, {name: "VFMADDSUB213PSMasked256load", argLength: 5, reg: w3kwload, asm: "VFMADDSUB213PS", commutative: false, typ: "Vec256", aux: "SymOff", symEffect: "Read", resultInArg0: true}, {name: "VFMADDSUB213PSMasked512load", argLength: 5, reg: w3kwload, asm: "VFMADDSUB213PS", commutative: false, typ: "Vec512", aux: "SymOff", symEffect: "Read", resultInArg0: true}, - {name: "VFMSUBADD213PD128load", argLength: 4, reg: w31load, asm: "VFMSUBADD213PD", commutative: false, typ: "Vec128", aux: "SymOff", symEffect: "Read", resultInArg0: true}, - {name: "VFMSUBADD213PD256load", argLength: 4, reg: w31load, asm: "VFMSUBADD213PD", commutative: false, typ: "Vec256", aux: "SymOff", symEffect: "Read", resultInArg0: true}, {name: "VFMSUBADD213PD512load", argLength: 4, reg: w31load, asm: "VFMSUBADD213PD", commutative: false, typ: "Vec512", aux: "SymOff", symEffect: "Read", resultInArg0: true}, {name: "VFMSUBADD213PDMasked128load", argLength: 5, reg: w3kwload, asm: "VFMSUBADD213PD", commutative: false, typ: "Vec128", aux: "SymOff", symEffect: "Read", resultInArg0: true}, {name: "VFMSUBADD213PDMasked256load", argLength: 5, reg: w3kwload, asm: "VFMSUBADD213PD", commutative: false, typ: "Vec256", aux: "SymOff", symEffect: "Read", resultInArg0: true}, {name: "VFMSUBADD213PDMasked512load", argLength: 5, reg: w3kwload, asm: "VFMSUBADD213PD", commutative: false, typ: "Vec512", aux: "SymOff", symEffect: "Read", resultInArg0: true}, - {name: "VFMSUBADD213PS128load", argLength: 4, reg: w31load, asm: "VFMSUBADD213PS", commutative: false, typ: "Vec128", aux: "SymOff", symEffect: "Read", resultInArg0: true}, - {name: "VFMSUBADD213PS256load", argLength: 4, reg: w31load, asm: "VFMSUBADD213PS", commutative: false, typ: "Vec256", aux: "SymOff", symEffect: "Read", resultInArg0: true}, {name: "VFMSUBADD213PS512load", argLength: 4, reg: w31load, asm: "VFMSUBADD213PS", commutative: false, typ: "Vec512", aux: "SymOff", symEffect: "Read", resultInArg0: true}, {name: "VFMSUBADD213PSMasked128load", argLength: 5, reg: w3kwload, asm: "VFMSUBADD213PS", commutative: false, typ: "Vec128", aux: "SymOff", symEffect: "Read", resultInArg0: true}, {name: "VFMSUBADD213PSMasked256load", argLength: 5, reg: w3kwload, asm: "VFMSUBADD213PS", commutative: false, typ: "Vec256", aux: "SymOff", symEffect: "Read", resultInArg0: true}, diff --git a/src/cmd/compile/internal/ssa/opGen.go b/src/cmd/compile/internal/ssa/opGen.go index 9e5fdb1fc1..a84fc161e9 100644 --- a/src/cmd/compile/internal/ssa/opGen.go +++ b/src/cmd/compile/internal/ssa/opGen.go @@ -2841,38 +2841,26 @@ const ( OpAMD64VDIVPSMasked128load OpAMD64VDIVPSMasked256load OpAMD64VDIVPSMasked512load - OpAMD64VFMADD213PD128load - OpAMD64VFMADD213PD256load OpAMD64VFMADD213PD512load OpAMD64VFMADD213PDMasked128load OpAMD64VFMADD213PDMasked256load OpAMD64VFMADD213PDMasked512load - OpAMD64VFMADD213PS128load - OpAMD64VFMADD213PS256load OpAMD64VFMADD213PS512load OpAMD64VFMADD213PSMasked128load OpAMD64VFMADD213PSMasked256load OpAMD64VFMADD213PSMasked512load - OpAMD64VFMADDSUB213PD128load - OpAMD64VFMADDSUB213PD256load OpAMD64VFMADDSUB213PD512load OpAMD64VFMADDSUB213PDMasked128load OpAMD64VFMADDSUB213PDMasked256load OpAMD64VFMADDSUB213PDMasked512load - OpAMD64VFMADDSUB213PS128load - OpAMD64VFMADDSUB213PS256load OpAMD64VFMADDSUB213PS512load OpAMD64VFMADDSUB213PSMasked128load OpAMD64VFMADDSUB213PSMasked256load OpAMD64VFMADDSUB213PSMasked512load - OpAMD64VFMSUBADD213PD128load - OpAMD64VFMSUBADD213PD256load OpAMD64VFMSUBADD213PD512load OpAMD64VFMSUBADD213PDMasked128load OpAMD64VFMSUBADD213PDMasked256load OpAMD64VFMSUBADD213PDMasked512load - OpAMD64VFMSUBADD213PS128load - OpAMD64VFMSUBADD213PS256load OpAMD64VFMSUBADD213PS512load OpAMD64VFMSUBADD213PSMasked128load OpAMD64VFMSUBADD213PSMasked256load @@ -23179,12 +23167,12 @@ var opcodeTable = [...]opInfo{ asm: x86.AVFMADD213PD, reg: regInfo{ inputs: []inputInfo{ - {0, 281472829161472}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X16 X17 X18 X19 X20 X21 X22 X23 X24 X25 X26 X27 X28 X29 X30 X31 - {1, 281474976645120}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 X16 X17 X18 X19 X20 X21 X22 X23 X24 X25 X26 X27 X28 X29 X30 X31 - {2, 281474976645120}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 X16 X17 X18 X19 X20 X21 X22 X23 X24 X25 X26 X27 X28 X29 X30 X31 + {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 + {1, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 + {2, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 }, outputs: []outputInfo{ - {0, 281472829161472}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X16 X17 X18 X19 X20 X21 X22 X23 X24 X25 X26 X27 X28 X29 X30 X31 + {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 }, }, }, @@ -23195,12 +23183,12 @@ var opcodeTable = [...]opInfo{ asm: x86.AVFMADD213PD, reg: regInfo{ inputs: []inputInfo{ - {0, 281472829161472}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X16 X17 X18 X19 X20 X21 X22 X23 X24 X25 X26 X27 X28 X29 X30 X31 - {1, 281474976645120}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 X16 X17 X18 X19 X20 X21 X22 X23 X24 X25 X26 X27 X28 X29 X30 X31 - {2, 281474976645120}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 X16 X17 X18 X19 X20 X21 X22 X23 X24 X25 X26 X27 X28 X29 X30 X31 + {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 + {1, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 + {2, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 }, outputs: []outputInfo{ - {0, 281472829161472}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X16 X17 X18 X19 X20 X21 X22 X23 X24 X25 X26 X27 X28 X29 X30 X31 + {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 }, }, }, @@ -23278,12 +23266,12 @@ var opcodeTable = [...]opInfo{ asm: x86.AVFMADD213PS, reg: regInfo{ inputs: []inputInfo{ - {0, 281472829161472}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X16 X17 X18 X19 X20 X21 X22 X23 X24 X25 X26 X27 X28 X29 X30 X31 - {1, 281474976645120}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 X16 X17 X18 X19 X20 X21 X22 X23 X24 X25 X26 X27 X28 X29 X30 X31 - {2, 281474976645120}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 X16 X17 X18 X19 X20 X21 X22 X23 X24 X25 X26 X27 X28 X29 X30 X31 + {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 + {1, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 + {2, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 }, outputs: []outputInfo{ - {0, 281472829161472}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X16 X17 X18 X19 X20 X21 X22 X23 X24 X25 X26 X27 X28 X29 X30 X31 + {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 }, }, }, @@ -23294,12 +23282,12 @@ var opcodeTable = [...]opInfo{ asm: x86.AVFMADD213PS, reg: regInfo{ inputs: []inputInfo{ - {0, 281472829161472}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X16 X17 X18 X19 X20 X21 X22 X23 X24 X25 X26 X27 X28 X29 X30 X31 - {1, 281474976645120}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 X16 X17 X18 X19 X20 X21 X22 X23 X24 X25 X26 X27 X28 X29 X30 X31 - {2, 281474976645120}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 X16 X17 X18 X19 X20 X21 X22 X23 X24 X25 X26 X27 X28 X29 X30 X31 + {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 + {1, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 + {2, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 }, outputs: []outputInfo{ - {0, 281472829161472}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X16 X17 X18 X19 X20 X21 X22 X23 X24 X25 X26 X27 X28 X29 X30 X31 + {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 }, }, }, @@ -23377,12 +23365,12 @@ var opcodeTable = [...]opInfo{ asm: x86.AVFMADDSUB213PD, reg: regInfo{ inputs: []inputInfo{ - {0, 281472829161472}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X16 X17 X18 X19 X20 X21 X22 X23 X24 X25 X26 X27 X28 X29 X30 X31 - {1, 281474976645120}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 X16 X17 X18 X19 X20 X21 X22 X23 X24 X25 X26 X27 X28 X29 X30 X31 - {2, 281474976645120}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 X16 X17 X18 X19 X20 X21 X22 X23 X24 X25 X26 X27 X28 X29 X30 X31 + {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 + {1, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 + {2, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 }, outputs: []outputInfo{ - {0, 281472829161472}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X16 X17 X18 X19 X20 X21 X22 X23 X24 X25 X26 X27 X28 X29 X30 X31 + {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 }, }, }, @@ -23393,12 +23381,12 @@ var opcodeTable = [...]opInfo{ asm: x86.AVFMADDSUB213PD, reg: regInfo{ inputs: []inputInfo{ - {0, 281472829161472}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X16 X17 X18 X19 X20 X21 X22 X23 X24 X25 X26 X27 X28 X29 X30 X31 - {1, 281474976645120}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 X16 X17 X18 X19 X20 X21 X22 X23 X24 X25 X26 X27 X28 X29 X30 X31 - {2, 281474976645120}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 X16 X17 X18 X19 X20 X21 X22 X23 X24 X25 X26 X27 X28 X29 X30 X31 + {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 + {1, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 + {2, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 }, outputs: []outputInfo{ - {0, 281472829161472}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X16 X17 X18 X19 X20 X21 X22 X23 X24 X25 X26 X27 X28 X29 X30 X31 + {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 }, }, }, @@ -23476,12 +23464,12 @@ var opcodeTable = [...]opInfo{ asm: x86.AVFMADDSUB213PS, reg: regInfo{ inputs: []inputInfo{ - {0, 281472829161472}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X16 X17 X18 X19 X20 X21 X22 X23 X24 X25 X26 X27 X28 X29 X30 X31 - {1, 281474976645120}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 X16 X17 X18 X19 X20 X21 X22 X23 X24 X25 X26 X27 X28 X29 X30 X31 - {2, 281474976645120}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 X16 X17 X18 X19 X20 X21 X22 X23 X24 X25 X26 X27 X28 X29 X30 X31 + {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 + {1, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 + {2, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 }, outputs: []outputInfo{ - {0, 281472829161472}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X16 X17 X18 X19 X20 X21 X22 X23 X24 X25 X26 X27 X28 X29 X30 X31 + {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 }, }, }, @@ -23492,12 +23480,12 @@ var opcodeTable = [...]opInfo{ asm: x86.AVFMADDSUB213PS, reg: regInfo{ inputs: []inputInfo{ - {0, 281472829161472}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X16 X17 X18 X19 X20 X21 X22 X23 X24 X25 X26 X27 X28 X29 X30 X31 - {1, 281474976645120}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 X16 X17 X18 X19 X20 X21 X22 X23 X24 X25 X26 X27 X28 X29 X30 X31 - {2, 281474976645120}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 X16 X17 X18 X19 X20 X21 X22 X23 X24 X25 X26 X27 X28 X29 X30 X31 + {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 + {1, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 + {2, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 }, outputs: []outputInfo{ - {0, 281472829161472}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X16 X17 X18 X19 X20 X21 X22 X23 X24 X25 X26 X27 X28 X29 X30 X31 + {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 }, }, }, @@ -23575,12 +23563,12 @@ var opcodeTable = [...]opInfo{ asm: x86.AVFMSUBADD213PD, reg: regInfo{ inputs: []inputInfo{ - {0, 281472829161472}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X16 X17 X18 X19 X20 X21 X22 X23 X24 X25 X26 X27 X28 X29 X30 X31 - {1, 281474976645120}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 X16 X17 X18 X19 X20 X21 X22 X23 X24 X25 X26 X27 X28 X29 X30 X31 - {2, 281474976645120}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 X16 X17 X18 X19 X20 X21 X22 X23 X24 X25 X26 X27 X28 X29 X30 X31 + {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 + {1, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 + {2, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 }, outputs: []outputInfo{ - {0, 281472829161472}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X16 X17 X18 X19 X20 X21 X22 X23 X24 X25 X26 X27 X28 X29 X30 X31 + {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 }, }, }, @@ -23591,12 +23579,12 @@ var opcodeTable = [...]opInfo{ asm: x86.AVFMSUBADD213PD, reg: regInfo{ inputs: []inputInfo{ - {0, 281472829161472}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X16 X17 X18 X19 X20 X21 X22 X23 X24 X25 X26 X27 X28 X29 X30 X31 - {1, 281474976645120}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 X16 X17 X18 X19 X20 X21 X22 X23 X24 X25 X26 X27 X28 X29 X30 X31 - {2, 281474976645120}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 X16 X17 X18 X19 X20 X21 X22 X23 X24 X25 X26 X27 X28 X29 X30 X31 + {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 + {1, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 + {2, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 }, outputs: []outputInfo{ - {0, 281472829161472}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X16 X17 X18 X19 X20 X21 X22 X23 X24 X25 X26 X27 X28 X29 X30 X31 + {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 }, }, }, @@ -23674,12 +23662,12 @@ var opcodeTable = [...]opInfo{ asm: x86.AVFMSUBADD213PS, reg: regInfo{ inputs: []inputInfo{ - {0, 281472829161472}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X16 X17 X18 X19 X20 X21 X22 X23 X24 X25 X26 X27 X28 X29 X30 X31 - {1, 281474976645120}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 X16 X17 X18 X19 X20 X21 X22 X23 X24 X25 X26 X27 X28 X29 X30 X31 - {2, 281474976645120}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 X16 X17 X18 X19 X20 X21 X22 X23 X24 X25 X26 X27 X28 X29 X30 X31 + {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 + {1, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 + {2, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 }, outputs: []outputInfo{ - {0, 281472829161472}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X16 X17 X18 X19 X20 X21 X22 X23 X24 X25 X26 X27 X28 X29 X30 X31 + {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 }, }, }, @@ -23690,12 +23678,12 @@ var opcodeTable = [...]opInfo{ asm: x86.AVFMSUBADD213PS, reg: regInfo{ inputs: []inputInfo{ - {0, 281472829161472}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X16 X17 X18 X19 X20 X21 X22 X23 X24 X25 X26 X27 X28 X29 X30 X31 - {1, 281474976645120}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 X16 X17 X18 X19 X20 X21 X22 X23 X24 X25 X26 X27 X28 X29 X30 X31 - {2, 281474976645120}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 X16 X17 X18 X19 X20 X21 X22 X23 X24 X25 X26 X27 X28 X29 X30 X31 + {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 + {1, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 + {2, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 }, outputs: []outputInfo{ - {0, 281472829161472}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X16 X17 X18 X19 X20 X21 X22 X23 X24 X25 X26 X27 X28 X29 X30 X31 + {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 }, }, }, @@ -44194,42 +44182,6 @@ var opcodeTable = [...]opInfo{ }, }, { - name: "VFMADD213PD128load", - auxType: auxSymOff, - argLen: 4, - resultInArg0: true, - symEffect: SymRead, - asm: x86.AVFMADD213PD, - reg: regInfo{ - inputs: []inputInfo{ - {2, 72057594037977087}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 SB - {0, 281472829161472}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X16 X17 X18 X19 X20 X21 X22 X23 X24 X25 X26 X27 X28 X29 X30 X31 - {1, 281474976645120}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 X16 X17 X18 X19 X20 X21 X22 X23 X24 X25 X26 X27 X28 X29 X30 X31 - }, - outputs: []outputInfo{ - {0, 281472829161472}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X16 X17 X18 X19 X20 X21 X22 X23 X24 X25 X26 X27 X28 X29 X30 X31 - }, - }, - }, - { - name: "VFMADD213PD256load", - auxType: auxSymOff, - argLen: 4, - resultInArg0: true, - symEffect: SymRead, - asm: x86.AVFMADD213PD, - reg: regInfo{ - inputs: []inputInfo{ - {2, 72057594037977087}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 SB - {0, 281472829161472}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X16 X17 X18 X19 X20 X21 X22 X23 X24 X25 X26 X27 X28 X29 X30 X31 - {1, 281474976645120}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 X16 X17 X18 X19 X20 X21 X22 X23 X24 X25 X26 X27 X28 X29 X30 X31 - }, - outputs: []outputInfo{ - {0, 281472829161472}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X16 X17 X18 X19 X20 X21 X22 X23 X24 X25 X26 X27 X28 X29 X30 X31 - }, - }, - }, - { name: "VFMADD213PD512load", auxType: auxSymOff, argLen: 4, @@ -44305,42 +44257,6 @@ var opcodeTable = [...]opInfo{ }, }, { - name: "VFMADD213PS128load", - auxType: auxSymOff, - argLen: 4, - resultInArg0: true, - symEffect: SymRead, - asm: x86.AVFMADD213PS, - reg: regInfo{ - inputs: []inputInfo{ - {2, 72057594037977087}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 SB - {0, 281472829161472}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X16 X17 X18 X19 X20 X21 X22 X23 X24 X25 X26 X27 X28 X29 X30 X31 - {1, 281474976645120}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 X16 X17 X18 X19 X20 X21 X22 X23 X24 X25 X26 X27 X28 X29 X30 X31 - }, - outputs: []outputInfo{ - {0, 281472829161472}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X16 X17 X18 X19 X20 X21 X22 X23 X24 X25 X26 X27 X28 X29 X30 X31 - }, - }, - }, - { - name: "VFMADD213PS256load", - auxType: auxSymOff, - argLen: 4, - resultInArg0: true, - symEffect: SymRead, - asm: x86.AVFMADD213PS, - reg: regInfo{ - inputs: []inputInfo{ - {2, 72057594037977087}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 SB - {0, 281472829161472}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X16 X17 X18 X19 X20 X21 X22 X23 X24 X25 X26 X27 X28 X29 X30 X31 - {1, 281474976645120}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 X16 X17 X18 X19 X20 X21 X22 X23 X24 X25 X26 X27 X28 X29 X30 X31 - }, - outputs: []outputInfo{ - {0, 281472829161472}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X16 X17 X18 X19 X20 X21 X22 X23 X24 X25 X26 X27 X28 X29 X30 X31 - }, - }, - }, - { name: "VFMADD213PS512load", auxType: auxSymOff, argLen: 4, @@ -44416,42 +44332,6 @@ var opcodeTable = [...]opInfo{ }, }, { - name: "VFMADDSUB213PD128load", - auxType: auxSymOff, - argLen: 4, - resultInArg0: true, - symEffect: SymRead, - asm: x86.AVFMADDSUB213PD, - reg: regInfo{ - inputs: []inputInfo{ - {2, 72057594037977087}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 SB - {0, 281472829161472}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X16 X17 X18 X19 X20 X21 X22 X23 X24 X25 X26 X27 X28 X29 X30 X31 - {1, 281474976645120}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 X16 X17 X18 X19 X20 X21 X22 X23 X24 X25 X26 X27 X28 X29 X30 X31 - }, - outputs: []outputInfo{ - {0, 281472829161472}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X16 X17 X18 X19 X20 X21 X22 X23 X24 X25 X26 X27 X28 X29 X30 X31 - }, - }, - }, - { - name: "VFMADDSUB213PD256load", - auxType: auxSymOff, - argLen: 4, - resultInArg0: true, - symEffect: SymRead, - asm: x86.AVFMADDSUB213PD, - reg: regInfo{ - inputs: []inputInfo{ - {2, 72057594037977087}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 SB - {0, 281472829161472}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X16 X17 X18 X19 X20 X21 X22 X23 X24 X25 X26 X27 X28 X29 X30 X31 - {1, 281474976645120}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 X16 X17 X18 X19 X20 X21 X22 X23 X24 X25 X26 X27 X28 X29 X30 X31 - }, - outputs: []outputInfo{ - {0, 281472829161472}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X16 X17 X18 X19 X20 X21 X22 X23 X24 X25 X26 X27 X28 X29 X30 X31 - }, - }, - }, - { name: "VFMADDSUB213PD512load", auxType: auxSymOff, argLen: 4, @@ -44527,42 +44407,6 @@ var opcodeTable = [...]opInfo{ }, }, { - name: "VFMADDSUB213PS128load", - auxType: auxSymOff, - argLen: 4, - resultInArg0: true, - symEffect: SymRead, - asm: x86.AVFMADDSUB213PS, - reg: regInfo{ - inputs: []inputInfo{ - {2, 72057594037977087}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 SB - {0, 281472829161472}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X16 X17 X18 X19 X20 X21 X22 X23 X24 X25 X26 X27 X28 X29 X30 X31 - {1, 281474976645120}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 X16 X17 X18 X19 X20 X21 X22 X23 X24 X25 X26 X27 X28 X29 X30 X31 - }, - outputs: []outputInfo{ - {0, 281472829161472}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X16 X17 X18 X19 X20 X21 X22 X23 X24 X25 X26 X27 X28 X29 X30 X31 - }, - }, - }, - { - name: "VFMADDSUB213PS256load", - auxType: auxSymOff, - argLen: 4, - resultInArg0: true, - symEffect: SymRead, - asm: x86.AVFMADDSUB213PS, - reg: regInfo{ - inputs: []inputInfo{ - {2, 72057594037977087}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 SB - {0, 281472829161472}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X16 X17 X18 X19 X20 X21 X22 X23 X24 X25 X26 X27 X28 X29 X30 X31 - {1, 281474976645120}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 X16 X17 X18 X19 X20 X21 X22 X23 X24 X25 X26 X27 X28 X29 X30 X31 - }, - outputs: []outputInfo{ - {0, 281472829161472}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X16 X17 X18 X19 X20 X21 X22 X23 X24 X25 X26 X27 X28 X29 X30 X31 - }, - }, - }, - { name: "VFMADDSUB213PS512load", auxType: auxSymOff, argLen: 4, @@ -44638,42 +44482,6 @@ var opcodeTable = [...]opInfo{ }, }, { - name: "VFMSUBADD213PD128load", - auxType: auxSymOff, - argLen: 4, - resultInArg0: true, - symEffect: SymRead, - asm: x86.AVFMSUBADD213PD, - reg: regInfo{ - inputs: []inputInfo{ - {2, 72057594037977087}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 SB - {0, 281472829161472}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X16 X17 X18 X19 X20 X21 X22 X23 X24 X25 X26 X27 X28 X29 X30 X31 - {1, 281474976645120}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 X16 X17 X18 X19 X20 X21 X22 X23 X24 X25 X26 X27 X28 X29 X30 X31 - }, - outputs: []outputInfo{ - {0, 281472829161472}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X16 X17 X18 X19 X20 X21 X22 X23 X24 X25 X26 X27 X28 X29 X30 X31 - }, - }, - }, - { - name: "VFMSUBADD213PD256load", - auxType: auxSymOff, - argLen: 4, - resultInArg0: true, - symEffect: SymRead, - asm: x86.AVFMSUBADD213PD, - reg: regInfo{ - inputs: []inputInfo{ - {2, 72057594037977087}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 SB - {0, 281472829161472}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X16 X17 X18 X19 X20 X21 X22 X23 X24 X25 X26 X27 X28 X29 X30 X31 - {1, 281474976645120}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 X16 X17 X18 X19 X20 X21 X22 X23 X24 X25 X26 X27 X28 X29 X30 X31 - }, - outputs: []outputInfo{ - {0, 281472829161472}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X16 X17 X18 X19 X20 X21 X22 X23 X24 X25 X26 X27 X28 X29 X30 X31 - }, - }, - }, - { name: "VFMSUBADD213PD512load", auxType: auxSymOff, argLen: 4, @@ -44749,42 +44557,6 @@ var opcodeTable = [...]opInfo{ }, }, { - name: "VFMSUBADD213PS128load", - auxType: auxSymOff, - argLen: 4, - resultInArg0: true, - symEffect: SymRead, - asm: x86.AVFMSUBADD213PS, - reg: regInfo{ - inputs: []inputInfo{ - {2, 72057594037977087}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 SB - {0, 281472829161472}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X16 X17 X18 X19 X20 X21 X22 X23 X24 X25 X26 X27 X28 X29 X30 X31 - {1, 281474976645120}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 X16 X17 X18 X19 X20 X21 X22 X23 X24 X25 X26 X27 X28 X29 X30 X31 - }, - outputs: []outputInfo{ - {0, 281472829161472}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X16 X17 X18 X19 X20 X21 X22 X23 X24 X25 X26 X27 X28 X29 X30 X31 - }, - }, - }, - { - name: "VFMSUBADD213PS256load", - auxType: auxSymOff, - argLen: 4, - resultInArg0: true, - symEffect: SymRead, - asm: x86.AVFMSUBADD213PS, - reg: regInfo{ - inputs: []inputInfo{ - {2, 72057594037977087}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 SB - {0, 281472829161472}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X16 X17 X18 X19 X20 X21 X22 X23 X24 X25 X26 X27 X28 X29 X30 X31 - {1, 281474976645120}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 X16 X17 X18 X19 X20 X21 X22 X23 X24 X25 X26 X27 X28 X29 X30 X31 - }, - outputs: []outputInfo{ - {0, 281472829161472}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X16 X17 X18 X19 X20 X21 X22 X23 X24 X25 X26 X27 X28 X29 X30 X31 - }, - }, - }, - { name: "VFMSUBADD213PS512load", auxType: auxSymOff, argLen: 4, diff --git a/src/cmd/compile/internal/ssa/rewrite.go b/src/cmd/compile/internal/ssa/rewrite.go index af2568ae89..032915f701 100644 --- a/src/cmd/compile/internal/ssa/rewrite.go +++ b/src/cmd/compile/internal/ssa/rewrite.go @@ -480,7 +480,7 @@ func isSpecializedMalloc(aux Aux) bool { name := fn.String() return strings.HasPrefix(name, "runtime.mallocgcSmallNoScanSC") || strings.HasPrefix(name, "runtime.mallocgcSmallScanNoHeaderSC") || - strings.HasPrefix(name, "runtime.mallocTiny") + strings.HasPrefix(name, "runtime.mallocgcTinySize") } // canLoadUnaligned reports if the architecture supports unaligned load operations. diff --git a/src/cmd/compile/internal/ssa/rewriteAMD64.go b/src/cmd/compile/internal/ssa/rewriteAMD64.go index fe0005bb05..b1b1c84046 100644 --- a/src/cmd/compile/internal/ssa/rewriteAMD64.go +++ b/src/cmd/compile/internal/ssa/rewriteAMD64.go @@ -782,10 +782,6 @@ func rewriteValueAMD64(v *Value) bool { return rewriteValueAMD64_OpAMD64VDIVPSMasked256(v) case OpAMD64VDIVPSMasked512: return rewriteValueAMD64_OpAMD64VDIVPSMasked512(v) - case OpAMD64VFMADD213PD128: - return rewriteValueAMD64_OpAMD64VFMADD213PD128(v) - case OpAMD64VFMADD213PD256: - return rewriteValueAMD64_OpAMD64VFMADD213PD256(v) case OpAMD64VFMADD213PD512: return rewriteValueAMD64_OpAMD64VFMADD213PD512(v) case OpAMD64VFMADD213PDMasked128: @@ -794,10 +790,6 @@ func rewriteValueAMD64(v *Value) bool { return rewriteValueAMD64_OpAMD64VFMADD213PDMasked256(v) case OpAMD64VFMADD213PDMasked512: return rewriteValueAMD64_OpAMD64VFMADD213PDMasked512(v) - case OpAMD64VFMADD213PS128: - return rewriteValueAMD64_OpAMD64VFMADD213PS128(v) - case OpAMD64VFMADD213PS256: - return rewriteValueAMD64_OpAMD64VFMADD213PS256(v) case OpAMD64VFMADD213PS512: return rewriteValueAMD64_OpAMD64VFMADD213PS512(v) case OpAMD64VFMADD213PSMasked128: @@ -806,10 +798,6 @@ func rewriteValueAMD64(v *Value) bool { return rewriteValueAMD64_OpAMD64VFMADD213PSMasked256(v) case OpAMD64VFMADD213PSMasked512: return rewriteValueAMD64_OpAMD64VFMADD213PSMasked512(v) - case OpAMD64VFMADDSUB213PD128: - return rewriteValueAMD64_OpAMD64VFMADDSUB213PD128(v) - case OpAMD64VFMADDSUB213PD256: - return rewriteValueAMD64_OpAMD64VFMADDSUB213PD256(v) case OpAMD64VFMADDSUB213PD512: return rewriteValueAMD64_OpAMD64VFMADDSUB213PD512(v) case OpAMD64VFMADDSUB213PDMasked128: @@ -818,10 +806,6 @@ func rewriteValueAMD64(v *Value) bool { return rewriteValueAMD64_OpAMD64VFMADDSUB213PDMasked256(v) case OpAMD64VFMADDSUB213PDMasked512: return rewriteValueAMD64_OpAMD64VFMADDSUB213PDMasked512(v) - case OpAMD64VFMADDSUB213PS128: - return rewriteValueAMD64_OpAMD64VFMADDSUB213PS128(v) - case OpAMD64VFMADDSUB213PS256: - return rewriteValueAMD64_OpAMD64VFMADDSUB213PS256(v) case OpAMD64VFMADDSUB213PS512: return rewriteValueAMD64_OpAMD64VFMADDSUB213PS512(v) case OpAMD64VFMADDSUB213PSMasked128: @@ -830,10 +814,6 @@ func rewriteValueAMD64(v *Value) bool { return rewriteValueAMD64_OpAMD64VFMADDSUB213PSMasked256(v) case OpAMD64VFMADDSUB213PSMasked512: return rewriteValueAMD64_OpAMD64VFMADDSUB213PSMasked512(v) - case OpAMD64VFMSUBADD213PD128: - return rewriteValueAMD64_OpAMD64VFMSUBADD213PD128(v) - case OpAMD64VFMSUBADD213PD256: - return rewriteValueAMD64_OpAMD64VFMSUBADD213PD256(v) case OpAMD64VFMSUBADD213PD512: return rewriteValueAMD64_OpAMD64VFMSUBADD213PD512(v) case OpAMD64VFMSUBADD213PDMasked128: @@ -842,10 +822,6 @@ func rewriteValueAMD64(v *Value) bool { return rewriteValueAMD64_OpAMD64VFMSUBADD213PDMasked256(v) case OpAMD64VFMSUBADD213PDMasked512: return rewriteValueAMD64_OpAMD64VFMSUBADD213PDMasked512(v) - case OpAMD64VFMSUBADD213PS128: - return rewriteValueAMD64_OpAMD64VFMSUBADD213PS128(v) - case OpAMD64VFMSUBADD213PS256: - return rewriteValueAMD64_OpAMD64VFMSUBADD213PS256(v) case OpAMD64VFMSUBADD213PS512: return rewriteValueAMD64_OpAMD64VFMSUBADD213PS512(v) case OpAMD64VFMSUBADD213PSMasked128: @@ -31492,64 +31468,6 @@ func rewriteValueAMD64_OpAMD64VDIVPSMasked512(v *Value) bool { } return false } -func rewriteValueAMD64_OpAMD64VFMADD213PD128(v *Value) bool { - v_2 := v.Args[2] - v_1 := v.Args[1] - v_0 := v.Args[0] - // match: (VFMADD213PD128 x y l:(VMOVDQUload128 {sym} [off] ptr mem)) - // cond: canMergeLoad(v, l) && clobber(l) - // result: (VFMADD213PD128load {sym} [off] x y ptr mem) - for { - x := v_0 - y := v_1 - l := v_2 - if l.Op != OpAMD64VMOVDQUload128 { - break - } - off := auxIntToInt32(l.AuxInt) - sym := auxToSym(l.Aux) - mem := l.Args[1] - ptr := l.Args[0] - if !(canMergeLoad(v, l) && clobber(l)) { - break - } - v.reset(OpAMD64VFMADD213PD128load) - v.AuxInt = int32ToAuxInt(off) - v.Aux = symToAux(sym) - v.AddArg4(x, y, ptr, mem) - return true - } - return false -} -func rewriteValueAMD64_OpAMD64VFMADD213PD256(v *Value) bool { - v_2 := v.Args[2] - v_1 := v.Args[1] - v_0 := v.Args[0] - // match: (VFMADD213PD256 x y l:(VMOVDQUload256 {sym} [off] ptr mem)) - // cond: canMergeLoad(v, l) && clobber(l) - // result: (VFMADD213PD256load {sym} [off] x y ptr mem) - for { - x := v_0 - y := v_1 - l := v_2 - if l.Op != OpAMD64VMOVDQUload256 { - break - } - off := auxIntToInt32(l.AuxInt) - sym := auxToSym(l.Aux) - mem := l.Args[1] - ptr := l.Args[0] - if !(canMergeLoad(v, l) && clobber(l)) { - break - } - v.reset(OpAMD64VFMADD213PD256load) - v.AuxInt = int32ToAuxInt(off) - v.Aux = symToAux(sym) - v.AddArg4(x, y, ptr, mem) - return true - } - return false -} func rewriteValueAMD64_OpAMD64VFMADD213PD512(v *Value) bool { v_2 := v.Args[2] v_1 := v.Args[1] @@ -31672,64 +31590,6 @@ func rewriteValueAMD64_OpAMD64VFMADD213PDMasked512(v *Value) bool { } return false } -func rewriteValueAMD64_OpAMD64VFMADD213PS128(v *Value) bool { - v_2 := v.Args[2] - v_1 := v.Args[1] - v_0 := v.Args[0] - // match: (VFMADD213PS128 x y l:(VMOVDQUload128 {sym} [off] ptr mem)) - // cond: canMergeLoad(v, l) && clobber(l) - // result: (VFMADD213PS128load {sym} [off] x y ptr mem) - for { - x := v_0 - y := v_1 - l := v_2 - if l.Op != OpAMD64VMOVDQUload128 { - break - } - off := auxIntToInt32(l.AuxInt) - sym := auxToSym(l.Aux) - mem := l.Args[1] - ptr := l.Args[0] - if !(canMergeLoad(v, l) && clobber(l)) { - break - } - v.reset(OpAMD64VFMADD213PS128load) - v.AuxInt = int32ToAuxInt(off) - v.Aux = symToAux(sym) - v.AddArg4(x, y, ptr, mem) - return true - } - return false -} -func rewriteValueAMD64_OpAMD64VFMADD213PS256(v *Value) bool { - v_2 := v.Args[2] - v_1 := v.Args[1] - v_0 := v.Args[0] - // match: (VFMADD213PS256 x y l:(VMOVDQUload256 {sym} [off] ptr mem)) - // cond: canMergeLoad(v, l) && clobber(l) - // result: (VFMADD213PS256load {sym} [off] x y ptr mem) - for { - x := v_0 - y := v_1 - l := v_2 - if l.Op != OpAMD64VMOVDQUload256 { - break - } - off := auxIntToInt32(l.AuxInt) - sym := auxToSym(l.Aux) - mem := l.Args[1] - ptr := l.Args[0] - if !(canMergeLoad(v, l) && clobber(l)) { - break - } - v.reset(OpAMD64VFMADD213PS256load) - v.AuxInt = int32ToAuxInt(off) - v.Aux = symToAux(sym) - v.AddArg4(x, y, ptr, mem) - return true - } - return false -} func rewriteValueAMD64_OpAMD64VFMADD213PS512(v *Value) bool { v_2 := v.Args[2] v_1 := v.Args[1] @@ -31852,64 +31712,6 @@ func rewriteValueAMD64_OpAMD64VFMADD213PSMasked512(v *Value) bool { } return false } -func rewriteValueAMD64_OpAMD64VFMADDSUB213PD128(v *Value) bool { - v_2 := v.Args[2] - v_1 := v.Args[1] - v_0 := v.Args[0] - // match: (VFMADDSUB213PD128 x y l:(VMOVDQUload128 {sym} [off] ptr mem)) - // cond: canMergeLoad(v, l) && clobber(l) - // result: (VFMADDSUB213PD128load {sym} [off] x y ptr mem) - for { - x := v_0 - y := v_1 - l := v_2 - if l.Op != OpAMD64VMOVDQUload128 { - break - } - off := auxIntToInt32(l.AuxInt) - sym := auxToSym(l.Aux) - mem := l.Args[1] - ptr := l.Args[0] - if !(canMergeLoad(v, l) && clobber(l)) { - break - } - v.reset(OpAMD64VFMADDSUB213PD128load) - v.AuxInt = int32ToAuxInt(off) - v.Aux = symToAux(sym) - v.AddArg4(x, y, ptr, mem) - return true - } - return false -} -func rewriteValueAMD64_OpAMD64VFMADDSUB213PD256(v *Value) bool { - v_2 := v.Args[2] - v_1 := v.Args[1] - v_0 := v.Args[0] - // match: (VFMADDSUB213PD256 x y l:(VMOVDQUload256 {sym} [off] ptr mem)) - // cond: canMergeLoad(v, l) && clobber(l) - // result: (VFMADDSUB213PD256load {sym} [off] x y ptr mem) - for { - x := v_0 - y := v_1 - l := v_2 - if l.Op != OpAMD64VMOVDQUload256 { - break - } - off := auxIntToInt32(l.AuxInt) - sym := auxToSym(l.Aux) - mem := l.Args[1] - ptr := l.Args[0] - if !(canMergeLoad(v, l) && clobber(l)) { - break - } - v.reset(OpAMD64VFMADDSUB213PD256load) - v.AuxInt = int32ToAuxInt(off) - v.Aux = symToAux(sym) - v.AddArg4(x, y, ptr, mem) - return true - } - return false -} func rewriteValueAMD64_OpAMD64VFMADDSUB213PD512(v *Value) bool { v_2 := v.Args[2] v_1 := v.Args[1] @@ -32032,64 +31834,6 @@ func rewriteValueAMD64_OpAMD64VFMADDSUB213PDMasked512(v *Value) bool { } return false } -func rewriteValueAMD64_OpAMD64VFMADDSUB213PS128(v *Value) bool { - v_2 := v.Args[2] - v_1 := v.Args[1] - v_0 := v.Args[0] - // match: (VFMADDSUB213PS128 x y l:(VMOVDQUload128 {sym} [off] ptr mem)) - // cond: canMergeLoad(v, l) && clobber(l) - // result: (VFMADDSUB213PS128load {sym} [off] x y ptr mem) - for { - x := v_0 - y := v_1 - l := v_2 - if l.Op != OpAMD64VMOVDQUload128 { - break - } - off := auxIntToInt32(l.AuxInt) - sym := auxToSym(l.Aux) - mem := l.Args[1] - ptr := l.Args[0] - if !(canMergeLoad(v, l) && clobber(l)) { - break - } - v.reset(OpAMD64VFMADDSUB213PS128load) - v.AuxInt = int32ToAuxInt(off) - v.Aux = symToAux(sym) - v.AddArg4(x, y, ptr, mem) - return true - } - return false -} -func rewriteValueAMD64_OpAMD64VFMADDSUB213PS256(v *Value) bool { - v_2 := v.Args[2] - v_1 := v.Args[1] - v_0 := v.Args[0] - // match: (VFMADDSUB213PS256 x y l:(VMOVDQUload256 {sym} [off] ptr mem)) - // cond: canMergeLoad(v, l) && clobber(l) - // result: (VFMADDSUB213PS256load {sym} [off] x y ptr mem) - for { - x := v_0 - y := v_1 - l := v_2 - if l.Op != OpAMD64VMOVDQUload256 { - break - } - off := auxIntToInt32(l.AuxInt) - sym := auxToSym(l.Aux) - mem := l.Args[1] - ptr := l.Args[0] - if !(canMergeLoad(v, l) && clobber(l)) { - break - } - v.reset(OpAMD64VFMADDSUB213PS256load) - v.AuxInt = int32ToAuxInt(off) - v.Aux = symToAux(sym) - v.AddArg4(x, y, ptr, mem) - return true - } - return false -} func rewriteValueAMD64_OpAMD64VFMADDSUB213PS512(v *Value) bool { v_2 := v.Args[2] v_1 := v.Args[1] @@ -32212,64 +31956,6 @@ func rewriteValueAMD64_OpAMD64VFMADDSUB213PSMasked512(v *Value) bool { } return false } -func rewriteValueAMD64_OpAMD64VFMSUBADD213PD128(v *Value) bool { - v_2 := v.Args[2] - v_1 := v.Args[1] - v_0 := v.Args[0] - // match: (VFMSUBADD213PD128 x y l:(VMOVDQUload128 {sym} [off] ptr mem)) - // cond: canMergeLoad(v, l) && clobber(l) - // result: (VFMSUBADD213PD128load {sym} [off] x y ptr mem) - for { - x := v_0 - y := v_1 - l := v_2 - if l.Op != OpAMD64VMOVDQUload128 { - break - } - off := auxIntToInt32(l.AuxInt) - sym := auxToSym(l.Aux) - mem := l.Args[1] - ptr := l.Args[0] - if !(canMergeLoad(v, l) && clobber(l)) { - break - } - v.reset(OpAMD64VFMSUBADD213PD128load) - v.AuxInt = int32ToAuxInt(off) - v.Aux = symToAux(sym) - v.AddArg4(x, y, ptr, mem) - return true - } - return false -} -func rewriteValueAMD64_OpAMD64VFMSUBADD213PD256(v *Value) bool { - v_2 := v.Args[2] - v_1 := v.Args[1] - v_0 := v.Args[0] - // match: (VFMSUBADD213PD256 x y l:(VMOVDQUload256 {sym} [off] ptr mem)) - // cond: canMergeLoad(v, l) && clobber(l) - // result: (VFMSUBADD213PD256load {sym} [off] x y ptr mem) - for { - x := v_0 - y := v_1 - l := v_2 - if l.Op != OpAMD64VMOVDQUload256 { - break - } - off := auxIntToInt32(l.AuxInt) - sym := auxToSym(l.Aux) - mem := l.Args[1] - ptr := l.Args[0] - if !(canMergeLoad(v, l) && clobber(l)) { - break - } - v.reset(OpAMD64VFMSUBADD213PD256load) - v.AuxInt = int32ToAuxInt(off) - v.Aux = symToAux(sym) - v.AddArg4(x, y, ptr, mem) - return true - } - return false -} func rewriteValueAMD64_OpAMD64VFMSUBADD213PD512(v *Value) bool { v_2 := v.Args[2] v_1 := v.Args[1] @@ -32392,64 +32078,6 @@ func rewriteValueAMD64_OpAMD64VFMSUBADD213PDMasked512(v *Value) bool { } return false } -func rewriteValueAMD64_OpAMD64VFMSUBADD213PS128(v *Value) bool { - v_2 := v.Args[2] - v_1 := v.Args[1] - v_0 := v.Args[0] - // match: (VFMSUBADD213PS128 x y l:(VMOVDQUload128 {sym} [off] ptr mem)) - // cond: canMergeLoad(v, l) && clobber(l) - // result: (VFMSUBADD213PS128load {sym} [off] x y ptr mem) - for { - x := v_0 - y := v_1 - l := v_2 - if l.Op != OpAMD64VMOVDQUload128 { - break - } - off := auxIntToInt32(l.AuxInt) - sym := auxToSym(l.Aux) - mem := l.Args[1] - ptr := l.Args[0] - if !(canMergeLoad(v, l) && clobber(l)) { - break - } - v.reset(OpAMD64VFMSUBADD213PS128load) - v.AuxInt = int32ToAuxInt(off) - v.Aux = symToAux(sym) - v.AddArg4(x, y, ptr, mem) - return true - } - return false -} -func rewriteValueAMD64_OpAMD64VFMSUBADD213PS256(v *Value) bool { - v_2 := v.Args[2] - v_1 := v.Args[1] - v_0 := v.Args[0] - // match: (VFMSUBADD213PS256 x y l:(VMOVDQUload256 {sym} [off] ptr mem)) - // cond: canMergeLoad(v, l) && clobber(l) - // result: (VFMSUBADD213PS256load {sym} [off] x y ptr mem) - for { - x := v_0 - y := v_1 - l := v_2 - if l.Op != OpAMD64VMOVDQUload256 { - break - } - off := auxIntToInt32(l.AuxInt) - sym := auxToSym(l.Aux) - mem := l.Args[1] - ptr := l.Args[0] - if !(canMergeLoad(v, l) && clobber(l)) { - break - } - v.reset(OpAMD64VFMSUBADD213PS256load) - v.AuxInt = int32ToAuxInt(off) - v.Aux = symToAux(sym) - v.AddArg4(x, y, ptr, mem) - return true - } - return false -} func rewriteValueAMD64_OpAMD64VFMSUBADD213PS512(v *Value) bool { v_2 := v.Args[2] v_1 := v.Args[1] diff --git a/src/cmd/compile/internal/ssagen/ssa.go b/src/cmd/compile/internal/ssagen/ssa.go index 33fcf979c5..17feb90df7 100644 --- a/src/cmd/compile/internal/ssagen/ssa.go +++ b/src/cmd/compile/internal/ssagen/ssa.go @@ -140,7 +140,7 @@ func InitConfig() { ir.Syms.MallocGCSmallScanNoHeader[i] = typecheck.LookupRuntimeFunc(fmt.Sprintf("mallocgcSmallScanNoHeaderSC%d", i)) } for i := 1; i < len(ir.Syms.MallocGCTiny); i++ { - ir.Syms.MallocGCTiny[i] = typecheck.LookupRuntimeFunc(fmt.Sprintf("mallocTiny%d", i)) + ir.Syms.MallocGCTiny[i] = typecheck.LookupRuntimeFunc(fmt.Sprintf("mallocgcTinySize%d", i)) } ir.Syms.MallocGC = typecheck.LookupRuntimeFunc("mallocgc") ir.Syms.Memmove = typecheck.LookupRuntimeFunc("memmove") @@ -7795,7 +7795,7 @@ func AddrAuto(a *obj.Addr, v *ssa.Value) { // Call returns a new CALL instruction for the SSA value v. // It uses PrepareCall to prepare the call. func (s *State) Call(v *ssa.Value) *obj.Prog { - pPosIsStmt := s.pp.Pos.IsStmt() // The statement-ness fo the call comes from ssaGenState + pPosIsStmt := s.pp.Pos.IsStmt() // The statement-ness of the call comes from ssaGenState s.PrepareCall(v) p := s.Prog(obj.ACALL) diff --git a/src/cmd/compile/internal/staticinit/sched.go b/src/cmd/compile/internal/staticinit/sched.go index 5e39bb512f..c79715be46 100644 --- a/src/cmd/compile/internal/staticinit/sched.go +++ b/src/cmd/compile/internal/staticinit/sched.go @@ -228,6 +228,9 @@ func (s *Schedule) staticcopy(l *ir.Name, loff int64, rn *ir.Name, typ *types.Ty case ir.OADDR: r := r.(*ir.AddrExpr) if a, ok := r.X.(*ir.Name); ok && a.Op() == ir.ONAME { + if a.Class != ir.PEXTERN { + return false // e.g. local from new(expr) + } staticdata.InitAddr(l, loff, staticdata.GlobalLinksym(a)) return true } diff --git a/src/cmd/compile/internal/types2/object.go b/src/cmd/compile/internal/types2/object.go index dd2d415790..5d284ee61b 100644 --- a/src/cmd/compile/internal/types2/object.go +++ b/src/cmd/compile/internal/types2/object.go @@ -671,3 +671,52 @@ func writeFuncName(buf *bytes.Buffer, f *Func, qf Qualifier) { } buf.WriteString(f.name) } + +// objectKind returns a description of the object's kind. +func objectKind(obj Object) string { + switch obj := obj.(type) { + case *PkgName: + return "package name" + case *Const: + return "constant" + case *TypeName: + if obj.IsAlias() { + return "type alias" + } else if _, ok := obj.Type().(*TypeParam); ok { + return "type parameter" + } else { + return "defined type" + } + case *Var: + switch obj.Kind() { + case PackageVar: + return "package-level variable" + case LocalVar: + return "local variable" + case RecvVar: + return "receiver" + case ParamVar: + return "parameter" + case ResultVar: + return "result variable" + case FieldVar: + return "struct field" + } + case *Func: + if obj.Signature().Recv() != nil { + return "method" + } else { + return "function" + } + case *Label: + return "label" + case *Builtin: + return "built-in function" + case *Nil: + return "untyped nil" + } + if debug { + panic(fmt.Sprintf("unknown symbol (%T)", obj)) + } + return "unknown symbol" +} diff --git a/src/cmd/compile/internal/types2/typexpr.go b/src/cmd/compile/internal/types2/typexpr.go index a79b54eacc..7d5932eec1 100644 --- a/src/cmd/compile/internal/types2/typexpr.go +++ b/src/cmd/compile/internal/types2/typexpr.go @@ -50,7 +50,8 @@ func (check *Checker) ident(x *operand, e *syntax.Name, wantType bool) { // (see go.dev/issue/65344). _, gotType := obj.(*TypeName) if !gotType && wantType { - check.errorf(e, NotAType, "%s is not a type", obj.Name()) + check.errorf(e, NotAType, "%s (%s) is not a type", obj.Name(), objectKind(obj)) + // avoid "declared but not used" errors // (don't use Checker.use - we don't want to evaluate too much) if v, _ := obj.(*Var); v != nil && v.pkg == check.pkg /* see Checker.use1 */ { diff --git a/src/cmd/dist/imports.go b/src/cmd/dist/imports.go index 0ec2b06c4f..c00369a6ba 100644 --- a/src/cmd/dist/imports.go +++ b/src/cmd/dist/imports.go @@ -259,6 +259,6 @@ func resolveVendor(imp, srcDir string) string { } else if strings.HasPrefix(srcDir, filepath.Join(goroot, "src")) { return path.Join("vendor", imp) } else { - panic(fmt.Sprintf("srcDir %q not in GOOROT/src", srcDir)) + panic(fmt.Sprintf("srcDir %q not in GOROOT/src", srcDir)) } } diff --git a/src/cmd/go/internal/work/exec.go b/src/cmd/go/internal/work/exec.go index 311e961308..c497135612 100644 --- a/src/cmd/go/internal/work/exec.go +++ b/src/cmd/go/internal/work/exec.go @@ -627,7 +627,7 @@ func (b *Builder) checkCacheForBuild(a, buildAction *Action, covMetaFileName str // If we are going to do a full build anyway, // we're going to regenerate the files in the build action anyway. if need == needVet { - if err := b.loadCachedVet(buildAction); err == nil { + if err := b.loadCachedVet(buildAction, a.Deps); err == nil { need &^= needVet } } @@ -841,7 +841,7 @@ func (b *Builder) build(ctx context.Context, a *Action) (err error) { // Prepare Go vet config if needed. if need&needVet != 0 { - buildVetConfig(a, srcfiles) + buildVetConfig(a, srcfiles, a.Deps) need &^= needVet } if need&needCompiledGoFiles != 0 { @@ -1121,7 +1121,7 @@ func (b *Builder) cacheSrcFiles(a *Action, srcfiles []string) { cache.PutBytes(c, cache.Subkey(a.actionID, "srcfiles"), buf.Bytes()) } -func (b *Builder) loadCachedVet(a *Action) error { +func (b *Builder) loadCachedVet(a *Action, vetDeps []*Action) error { c := cache.Default() list, _, err := cache.GetBytes(c, cache.Subkey(a.actionID, "srcfiles")) if err != nil { @@ -1141,7 +1141,7 @@ func (b *Builder) loadCachedVet(a *Action) error { } srcfiles = append(srcfiles, a.Objdir+name) } - buildVetConfig(a, srcfiles) + buildVetConfig(a, srcfiles, vetDeps) return nil } @@ -1197,7 +1197,7 @@ type vetConfig struct { SucceedOnTypecheckFailure bool // awful hack; see #18395 and below } -func buildVetConfig(a *Action, srcfiles []string) { +func buildVetConfig(a *Action, srcfiles []string, vetDeps []*Action) { // Classify files based on .go extension. // srcfiles does not include raw cgo files. var gofiles, nongofiles []string @@ -1253,7 +1253,7 @@ func buildVetConfig(a *Action, srcfiles []string) { vcfgMapped[p] = true } - for _, a1 := range a.Deps { + for _, a1 := range vetDeps { p1 := a1.Package if p1 == nil || p1.ImportPath == "" || p1 == a.Package { continue diff --git a/src/crypto/internal/fips140test/acvp_test.go b/src/crypto/internal/fips140test/acvp_test.go index e94bab74fd..6a0b46af2b 100644 --- a/src/crypto/internal/fips140test/acvp_test.go +++ b/src/crypto/internal/fips140test/acvp_test.go @@ -2146,7 +2146,7 @@ func TestACVP(t *testing.T) { } configPath := filepath.Join(cwd, testConfigFile) t.Logf("running check_expected.go\ncwd: %q\ndata_dir: %q\nconfig: %q\ntool: %q\nmodule-wrapper: %q\n", - cwd, dataDir, configPath, toolPath, os.Args[0]) + cwd, dataDir, configPath, toolPath, testenv.Executable(t)) // Run the check_expected test driver using the acvptool we built, and this test binary as the // module wrapper. The file paths in the config file are specified relative to the dataDir root @@ -2157,7 +2157,7 @@ func TestACVP(t *testing.T) { "-tool", toolPath, // Note: module prefix must match Wrapper value in testConfigFile. - "-module-wrappers", "go:" + os.Args[0], + "-module-wrappers", "go:" + testenv.Executable(t), "-tests", configPath, } cmd = testenv.Command(t, testenv.GoToolPath(t), args...) diff --git a/src/crypto/internal/fips140test/cast_fips140v1.26_test.go b/src/crypto/internal/fips140test/cast_fips140v1.26_test.go deleted file mode 100644 index ef79068c38..0000000000 --- a/src/crypto/internal/fips140test/cast_fips140v1.26_test.go +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright 2024 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. - -//go:build !fips140v1.0 - -package fipstest - -import "crypto/internal/fips140/mldsa" - -func fips140v126Conditionals() { - // ML-DSA sign and verify PCT - kMLDSA := mldsa.GenerateKey44() - // ML-DSA-44 - mldsa.SignDeterministic(kMLDSA, make([]byte, 32), "") -} diff --git a/src/crypto/internal/fips140test/check_test.go b/src/crypto/internal/fips140test/check_test.go index 8aef1f9b9b..d70ffbb77f 100644 --- a/src/crypto/internal/fips140test/check_test.go +++ b/src/crypto/internal/fips140test/check_test.go @@ -46,7 +46,7 @@ func TestIntegrityCheckFailure(t *testing.T) { moduleStatus(t) cryptotest.MustSupportFIPS140(t) - bin, err := os.ReadFile(os.Args[0]) + bin, err := os.ReadFile(testenv.Executable(t)) if err != nil { t.Fatal(err) } diff --git a/src/crypto/internal/fips140test/cast_fips140v1.0_test.go b/src/crypto/internal/fips140test/fips140v1.0_test.go index b9ddfe4d8b..262ef61d5c 100644 --- a/src/crypto/internal/fips140test/cast_fips140v1.0_test.go +++ b/src/crypto/internal/fips140test/fips140v1.0_test.go @@ -6,4 +6,8 @@ package fipstest +import "testing" + func fips140v126Conditionals() {} + +func testFIPS140v126(t *testing.T, plaintext []byte) {} diff --git a/src/crypto/internal/fips140test/fips140v1.26_test.go b/src/crypto/internal/fips140test/fips140v1.26_test.go new file mode 100644 index 0000000000..6cd9f4fe40 --- /dev/null +++ b/src/crypto/internal/fips140test/fips140v1.26_test.go @@ -0,0 +1,33 @@ +// Copyright 2024 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. + +//go:build !fips140v1.0 + +package fipstest + +import ( + "crypto/internal/fips140/mldsa" + "testing" +) + +func fips140v126Conditionals() { + // ML-DSA sign and verify PCT + kMLDSA := mldsa.GenerateKey44() + // ML-DSA-44 + mldsa.SignDeterministic(kMLDSA, make([]byte, 32), "") +} + +func testFIPS140v126(t *testing.T, plaintext []byte) { + t.Run("ML-DSA KeyGen, SigGen, SigVer", func(t *testing.T) { + ensureServiceIndicator(t) + k := mldsa.GenerateKey44() + + sig, err := mldsa.SignDeterministic(k, plaintext, "") + fatalIfErr(t, err) + t.Logf("ML-DSA signature: %x", sig) + + err = mldsa.Verify(k.PublicKey(), plaintext, sig, "") + fatalIfErr(t, err) + }) +} diff --git a/src/crypto/internal/fips140test/fips_test.go b/src/crypto/internal/fips140test/fips_test.go index 52fc9d3488..7f2824ca9a 100644 --- a/src/crypto/internal/fips140test/fips_test.go +++ b/src/crypto/internal/fips140test/fips_test.go @@ -101,6 +101,8 @@ func TestFIPS140(t *testing.T) { aesBlock, err := aes.New(aesKey) fatalIfErr(t, err) + testFIPS140v126(t, plaintext) + t.Run("AES-CTR", func(t *testing.T) { ensureServiceIndicator(t) ctr := aes.NewCTR(aesBlock, aesIV) diff --git a/src/crypto/rsa/rsa_test.go b/src/crypto/rsa/rsa_test.go index 5ae4c1dd20..124fba1e8a 100644 --- a/src/crypto/rsa/rsa_test.go +++ b/src/crypto/rsa/rsa_test.go @@ -145,6 +145,12 @@ d8Y7 } func testKeyBasics(t *testing.T, priv *PrivateKey) { + defer func() { + if t.Failed() { + t.Logf("failed key: %#v", priv) + } + }() + if err := priv.Validate(); err != nil { t.Errorf("Validate() failed: %s", err) } diff --git a/src/crypto/tls/bogo_shim_test.go b/src/crypto/tls/bogo_shim_test.go index 1b5fc49c4f..ccac47c271 100644 --- a/src/crypto/tls/bogo_shim_test.go +++ b/src/crypto/tls/bogo_shim_test.go @@ -577,7 +577,7 @@ func TestBogoSuite(t *testing.T) { "test", ".", fmt.Sprintf("-shim-config=%s", filepath.Join(cwd, "bogo_config.json")), - fmt.Sprintf("-shim-path=%s", os.Args[0]), + fmt.Sprintf("-shim-path=%s", testenv.Executable(t)), "-shim-extra-flags=-bogo-mode", "-allow-unimplemented", "-loose-errors", // TODO(roland): this should be removed eventually diff --git a/src/go/types/object.go b/src/go/types/object.go index 57158c1595..e12bf7285a 100644 --- a/src/go/types/object.go +++ b/src/go/types/object.go @@ -674,3 +674,52 @@ func writeFuncName(buf *bytes.Buffer, f *Func, qf Qualifier) { } buf.WriteString(f.name) } + +// objectKind returns a description of the object's kind. +func objectKind(obj Object) string { + switch obj := obj.(type) { + case *PkgName: + return "package name" + case *Const: + return "constant" + case *TypeName: + if obj.IsAlias() { + return "type alias" + } else if _, ok := obj.Type().(*TypeParam); ok { + return "type parameter" + } else { + return "defined type" + } + case *Var: + switch obj.Kind() { + case PackageVar: + return "package-level variable" + case LocalVar: + return "local variable" + case RecvVar: + return "receiver" + case ParamVar: + return "parameter" + case ResultVar: + return "result variable" + case FieldVar: + return "struct field" + } + case *Func: + if obj.Signature().Recv() != nil { + return "method" + } else { + return "function" + } + case *Label: + return "label" + case *Builtin: + return "built-in function" + case *Nil: + return "untyped nil" + } + if debug { + panic(fmt.Sprintf("unknown symbol (%T)", obj)) + } + return "unknown symbol" +} diff --git a/src/go/types/typexpr.go b/src/go/types/typexpr.go index 346ff18e9a..549c307487 100644 --- a/src/go/types/typexpr.go +++ b/src/go/types/typexpr.go @@ -49,7 +49,8 @@ func (check *Checker) ident(x *operand, e *ast.Ident, wantType bool) { // (see go.dev/issue/65344). _, gotType := obj.(*TypeName) if !gotType && wantType { - check.errorf(e, NotAType, "%s is not a type", obj.Name()) + check.errorf(e, NotAType, "%s (%s) is not a type", obj.Name(), objectKind(obj)) + // avoid "declared but not used" errors // (don't use Checker.use - we don't want to evaluate too much) if v, _ := obj.(*Var); v != nil && v.pkg == check.pkg /* see Checker.use1 */ { diff --git a/src/internal/cpu/cpu_x86.go b/src/internal/cpu/cpu_x86.go index 711fb045c3..0e97651e3d 100644 --- a/src/internal/cpu/cpu_x86.go +++ b/src/internal/cpu/cpu_x86.go @@ -136,12 +136,6 @@ func doinit() { // e.g. setting the xsavedisable boot option on Windows 10. X86.HasOSXSAVE = isSet(ecx1, cpuid_OSXSAVE) - // The FMA instruction set extension only has VEX prefixed instructions. - // VEX prefixed instructions require OSXSAVE to be enabled. - // See Intel 64 and IA-32 Architecture Software Developer’s Manual Volume 2 - // Section 2.4 "AVX and SSE Instruction Exception Specification" - X86.HasFMA = isSet(ecx1, cpuid_FMA) && X86.HasOSXSAVE - osSupportsAVX := false osSupportsAVX512 := false // For XGETBV, OSXSAVE bit is required and sufficient. @@ -159,6 +153,14 @@ func doinit() { X86.HasAVX = isSet(ecx1, cpuid_AVX) && osSupportsAVX + // The FMA instruction set extension requires both the FMA and AVX flags. + // + // Furthermore, the FMA instructions are all VEX prefixed instructions. + // VEX prefixed instructions require OSXSAVE to be enabled. + // See Intel 64 and IA-32 Architecture Software Developer’s Manual Volume 2 + // Section 2.4 "AVX and SSE Instruction Exception Specification" + X86.HasFMA = isSet(ecx1, cpuid_FMA) && X86.HasAVX && X86.HasOSXSAVE + if maxID < 7 { osInit() return diff --git a/src/internal/types/testdata/check/cycles5.go b/src/internal/types/testdata/check/cycles5.go index de85c03d8a..9605f8ded4 100644 --- a/src/internal/types/testdata/check/cycles5.go +++ b/src/internal/types/testdata/check/cycles5.go @@ -162,7 +162,7 @@ func makeArray() (res T12) { return } // issue #20770 var r = newReader() -func newReader() r // ERROR "r is not a type" +func newReader() r // ERROR "r (package-level variable) is not a type" // variations of the theme of #8699 and #20770 var arr /* ERROR "cycle" */ = f() diff --git a/src/internal/types/testdata/check/cycles5a.go b/src/internal/types/testdata/check/cycles5a.go index e10f554e5c..a8cad50243 100644 --- a/src/internal/types/testdata/check/cycles5a.go +++ b/src/internal/types/testdata/check/cycles5a.go @@ -162,7 +162,7 @@ func makeArray() (res T12) { return } // issue #20770 var r = newReader() -func newReader() r // ERROR "r is not a type" +func newReader() r // ERROR "r (package-level variable) is not a type" // variations of the theme of #8699 and #20770 var arr /* ERROR "cycle" */ = f() diff --git a/src/internal/types/testdata/check/decls1.go b/src/internal/types/testdata/check/decls1.go index 6cdbf27f4c..5e4ba86cb0 100644 --- a/src/internal/types/testdata/check/decls1.go +++ b/src/internal/types/testdata/check/decls1.go @@ -63,7 +63,7 @@ var ( t12 complex64 = -(u + *t11) / *&v t13 int = a /* ERROR "shifted operand" */ << d t14 int = i << j - t15 math /* ERROR "math is not a type" */ + t15 math /* ERROR "math (package name) is not a type" */ t16 math.xxx /* ERROR "undefined" */ t17 math /* ERROR "not a type" */ .Pi t18 float64 = math.Pi * 10.0 @@ -144,3 +144,10 @@ func init /* ERROR "no arguments and no return values" */ (int) {} func init /* ERROR "no arguments and no return values" */ () int { return 0 } func init /* ERROR "no arguments and no return values" */ (int) int { return 0 } func (T) init(int) int { return 0 } + +func _() { + var error error + var _ error /* ERROR "error (local variable) is not a type" */ + _ = error +} + diff --git a/src/internal/types/testdata/check/issues0.go b/src/internal/types/testdata/check/issues0.go index 6117f7a8b9..fb4e1282f9 100644 --- a/src/internal/types/testdata/check/issues0.go +++ b/src/internal/types/testdata/check/issues0.go @@ -104,7 +104,7 @@ func issue10979() { // issue11347 // These should not crash. -var a1, b1, c1 /* ERROR "cycle" */ b1 /* ERROR "b1 is not a type" */ = 0 > 0<<""[""[c1]]>c1 +var a1, b1, c1 /* ERROR "cycle" */ b1 /* ERROR "b1 (package-level variable) is not a type" */ = 0 > 0<<""[""[c1]]>c1 var a2, b2 /* ERROR "cycle" */ = 0 /* ERROR "assignment mismatch" */ /* ERROR "assignment mismatch" */ > 0<<""[b2] var a3, b3 /* ERROR "cycle" */ = int /* ERROR "assignment mismatch" */ /* ERROR "assignment mismatch" */ (1<<""[b3]) diff --git a/src/internal/types/testdata/check/issues1.go b/src/internal/types/testdata/check/issues1.go index 72c6cf7757..482bdb08e1 100644 --- a/src/internal/types/testdata/check/issues1.go +++ b/src/internal/types/testdata/check/issues1.go @@ -246,5 +246,5 @@ var _ = append[context.CancelFunc, []context.CancelFunc, context.CancelFunc](can func g[T any](T) T { panic(0) } var _ = g[int] -var _ = g[nil /* ERROR "is not a type" */ ] +var _ = g[nil /* ERROR "nil (untyped nil) is not a type" */ ] var _ = g(0) diff --git a/src/internal/types/testdata/fixedbugs/issue39634.go b/src/internal/types/testdata/fixedbugs/issue39634.go index 58fc43eea6..5392f903c2 100644 --- a/src/internal/types/testdata/fixedbugs/issue39634.go +++ b/src/internal/types/testdata/fixedbugs/issue39634.go @@ -43,7 +43,7 @@ type foo9[A any] interface { foo9 /* ERROR "invalid recursive type" */ [A] } func _() { var _ = new(foo9[int]) } // crash 12 -var u, i [func /* ERROR "used as value" */ /* ERROR "used as value" */ (u /* ERROR "u is not a type" */ /* ERROR "u is not a type" */ , c /* ERROR "undefined" */ /* ERROR "undefined" */ ) {}(0, len /* ERROR "must be called" */ /* ERROR "must be called" */ )]c /* ERROR "undefined" */ /* ERROR "undefined" */ +var u, i [func /* ERROR "used as value" */ /* ERROR "used as value" */ (u /* ERROR "u (package-level variable) is not a type" */ /* ERROR "u (package-level variable) is not a type" */ , c /* ERROR "undefined" */ /* ERROR "undefined" */ ) {}(0, len /* ERROR "must be called" */ /* ERROR "must be called" */ )]c /* ERROR "undefined" */ /* ERROR "undefined" */ // crash 15 func y15() { var a /* ERROR "declared and not used" */ interface{ p() } = G15[string]{} } diff --git a/src/internal/types/testdata/fixedbugs/issue65344.go b/src/internal/types/testdata/fixedbugs/issue65344.go index 9f8337cf2b..4db97c04ff 100644 --- a/src/internal/types/testdata/fixedbugs/issue65344.go +++ b/src/internal/types/testdata/fixedbugs/issue65344.go @@ -4,12 +4,12 @@ package p -type T1 C /* ERROR "C is not a type" */ +type T1 C /* ERROR "C (constant) is not a type" */ // TODO(gri) try to avoid this follow-on error const C = T1(0 /* ERROR "cannot convert 0 (untyped int constant) to type T1" */) -type T2 V /* ERROR "V is not a type" */ +type T2 V /* ERROR "V (package-level variable) is not a type" */ var V T2 diff --git a/src/net/fd_windows.go b/src/net/fd_windows.go index 52985be8e6..c28ce045c4 100644 --- a/src/net/fd_windows.go +++ b/src/net/fd_windows.go @@ -248,7 +248,7 @@ func (fd *netFD) dup() (*os.File, error) { err := fd.pfd.RawControl(func(fd uintptr) { h, syserr = dupSocket(syscall.Handle(fd)) }) - if err != nil { + if err == nil { err = syserr } if err != nil { diff --git a/src/net/file_posix.go b/src/net/file_posix.go index 132d03e9e3..b28ff5845d 100644 --- a/src/net/file_posix.go +++ b/src/net/file_posix.go @@ -23,7 +23,11 @@ func newFileFD(f *os.File) (*netFD, error) { poll.CloseFunc(s) return nil, os.NewSyscallError("getsockopt", err) } - lsa, _ := syscall.Getsockname(s) + lsa, err := syscall.Getsockname(s) + if err != nil { + poll.CloseFunc(s) + return nil, os.NewSyscallError("getsockname", err) + } rsa, _ := syscall.Getpeername(s) switch lsa.(type) { case *syscall.SockaddrInet4: diff --git a/src/net/file_windows.go b/src/net/file_windows.go index b4eb00e564..6a6305035a 100644 --- a/src/net/file_windows.go +++ b/src/net/file_windows.go @@ -39,7 +39,7 @@ func dupFileSocket(f *os.File) (syscall.Handle, error) { err = sc.Control(func(fd uintptr) { h, syserr = dupSocket(syscall.Handle(fd)) }) - if err != nil { + if err == nil { err = syserr } if err != nil { diff --git a/src/net/unixsock_test.go b/src/net/unixsock_test.go index f6c5679f42..3e4a14b255 100644 --- a/src/net/unixsock_test.go +++ b/src/net/unixsock_test.go @@ -375,6 +375,17 @@ func TestUnixUnlink(t *testing.T) { } return l.(*UnixListener) } + fileListener := func(t *testing.T, l *UnixListener) (*os.File, Listener) { + f, err := l.File() + if err != nil { + t.Fatal(err) + } + ln, err := FileListener(f) + if err != nil { + t.Fatal(err) + } + return f, ln + } checkExists := func(t *testing.T, desc string) { if _, err := os.Stat(name); err != nil { t.Fatalf("unix socket does not exist %s: %v", desc, err) @@ -397,8 +408,7 @@ func TestUnixUnlink(t *testing.T) { // FileListener should not. t.Run("FileListener", func(t *testing.T) { l := listen(t) - f, _ := l.File() - l1, _ := FileListener(f) + f, l1 := fileListener(t, l) checkExists(t, "after FileListener") f.Close() checkExists(t, "after File close") @@ -444,8 +454,7 @@ func TestUnixUnlink(t *testing.T) { t.Run("FileListener/SetUnlinkOnClose(true)", func(t *testing.T) { l := listen(t) - f, _ := l.File() - l1, _ := FileListener(f) + f, l1 := fileListener(t, l) checkExists(t, "after FileListener") l1.(*UnixListener).SetUnlinkOnClose(true) f.Close() @@ -457,8 +466,7 @@ func TestUnixUnlink(t *testing.T) { t.Run("FileListener/SetUnlinkOnClose(false)", func(t *testing.T) { l := listen(t) - f, _ := l.File() - l1, _ := FileListener(f) + f, l1 := fileListener(t, l) checkExists(t, "after FileListener") l1.(*UnixListener).SetUnlinkOnClose(false) f.Close() diff --git a/src/os/exec/exec_test.go b/src/os/exec/exec_test.go index bf2f3da535..2746ad8783 100644 --- a/src/os/exec/exec_test.go +++ b/src/os/exec/exec_test.go @@ -1845,23 +1845,13 @@ func TestStart_twice(t *testing.T) { testenv.MustHaveExec(t) cmd := exec.Command("/bin/nonesuch") - for i, want := range []string{ - cond(runtime.GOOS == "windows", - `exec: "/bin/nonesuch": executable file not found in %PATH%`, - "fork/exec /bin/nonesuch: no such file or directory"), - "exec: already started", - } { - err := cmd.Start() - if got := fmt.Sprint(err); got != want { - t.Errorf("Start call #%d return err %q, want %q", i+1, got, want) - } + if err := cmd.Start(); err == nil { + t.Fatalf("running invalid command succeeded") } -} - -func cond[T any](cond bool, t, f T) T { - if cond { - return t - } else { - return f + err := cmd.Start() + got := fmt.Sprint(err) + want := "exec: already started" + if got != want { + t.Fatalf("Start call returned err %q, want %q", got, want) } } diff --git a/src/os/exec/lookpath.go b/src/os/exec/lookpath.go new file mode 100644 index 0000000000..71f86b994f --- /dev/null +++ b/src/os/exec/lookpath.go @@ -0,0 +1,30 @@ +// Copyright 2026 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. + +package exec + +// LookPath searches for an executable named file in the current path, +// following the conventions of the host operating system. +// If file contains a slash, it is tried directly and the default path is not consulted. +// Otherwise, on success the result is an absolute path. +// +// LookPath returns an error satisfying [errors.Is](err, [ErrDot]) +// if the resolved path is relative to the current directory. +// See the package documentation for more details. +// +// LookPath looks for an executable named file in the +// directories named by the PATH environment variable, +// except as described below. +// +// - On Windows, the file must have an extension named by +// the PATHEXT environment variable. +// When PATHEXT is unset, the file must have +// a ".com", ".exe", ".bat", or ".cmd" extension. +// - On Plan 9, LookPath consults the path environment variable. +// If file begins with "/", "#", "./", or "../", it is tried +// directly and the path is not consulted. +// - On Wasm, LookPath always returns an error. +func LookPath(file string) (string, error) { + return lookPath(file) +} diff --git a/src/os/exec/lp_plan9.go b/src/os/exec/lp_plan9.go index f713a6905c..711aad11bd 100644 --- a/src/os/exec/lp_plan9.go +++ b/src/os/exec/lp_plan9.go @@ -26,16 +26,7 @@ func findExecutable(file string) error { return fs.ErrPermission } -// LookPath searches for an executable named file in the -// directories named by the path environment variable. -// If file begins with "/", "#", "./", or "../", it is tried -// directly and the path is not consulted. -// On success, the result is an absolute path. -// -// In older versions of Go, LookPath could return a path relative to the current directory. -// As of Go 1.19, LookPath will instead return that path along with an error satisfying -// [errors.Is](err, [ErrDot]). See the package documentation for more details. -func LookPath(file string) (string, error) { +func lookPath(file string) (string, error) { if err := validateLookPath(filepath.Clean(file)); err != nil { return "", &Error{file, err} } diff --git a/src/os/exec/lp_unix.go b/src/os/exec/lp_unix.go index e5fddbafe2..d3b10cc43d 100644 --- a/src/os/exec/lp_unix.go +++ b/src/os/exec/lp_unix.go @@ -41,15 +41,7 @@ func findExecutable(file string) error { return fs.ErrPermission } -// LookPath searches for an executable named file in the -// directories named by the PATH environment variable. -// If file contains a slash, it is tried directly and the PATH is not consulted. -// Otherwise, on success, the result is an absolute path. -// -// In older versions of Go, LookPath could return a path relative to the current directory. -// As of Go 1.19, LookPath will instead return that path along with an error satisfying -// [errors.Is](err, [ErrDot]). See the package documentation for more details. -func LookPath(file string) (string, error) { +func lookPath(file string) (string, error) { // NOTE(rsc): I wish we could use the Plan 9 behavior here // (only bypass the path if file begins with / or ./ or ../) // but that would not match all the Unix shells. diff --git a/src/os/exec/lp_wasm.go b/src/os/exec/lp_wasm.go index 3c819049ba..1de9076e53 100644 --- a/src/os/exec/lp_wasm.go +++ b/src/os/exec/lp_wasm.go @@ -17,7 +17,7 @@ var ErrNotFound = errors.New("executable file not found in $PATH") // directories named by the PATH environment variable. // If file contains a slash, it is tried directly and the PATH is not consulted. // The result may be an absolute path or a path relative to the current directory. -func LookPath(file string) (string, error) { +func lookPath(file string) (string, error) { // Wasm can not execute processes, so act as if there are no executables at all. return "", &Error{file, ErrNotFound} } diff --git a/src/os/exec/lp_windows.go b/src/os/exec/lp_windows.go index 74537dec68..f58aabc19f 100644 --- a/src/os/exec/lp_windows.go +++ b/src/os/exec/lp_windows.go @@ -56,22 +56,12 @@ func findExecutable(file string, exts []string) (string, error) { return "", ErrNotFound } -// LookPath searches for an executable named file in the -// directories named by the PATH environment variable. -// LookPath also uses PATHEXT environment variable to match -// a suitable candidate. -// If file contains a slash, it is tried directly and the PATH is not consulted. -// Otherwise, on success, the result is an absolute path. -// -// In older versions of Go, LookPath could return a path relative to the current directory. -// As of Go 1.19, LookPath will instead return that path along with an error satisfying -// [errors.Is](err, [ErrDot]). See the package documentation for more details. -func LookPath(file string) (string, error) { +func lookPath(file string) (string, error) { if err := validateLookPath(file); err != nil { return "", &Error{file, err} } - return lookPath(file, pathExt()) + return lookPathExts(file, pathExt()) } // lookExtensions finds windows executable by its dir and path. @@ -101,17 +91,17 @@ func lookExtensions(path, dir string) (string, error) { } } if dir == "" { - return lookPath(path, exts) + return lookPathExts(path, exts) } if filepath.VolumeName(path) != "" { - return lookPath(path, exts) + return lookPathExts(path, exts) } if len(path) > 1 && os.IsPathSeparator(path[0]) { - return lookPath(path, exts) + return lookPathExts(path, exts) } dirandpath := filepath.Join(dir, path) // We assume that LookPath will only add file extension. - lp, err := lookPath(dirandpath, exts) + lp, err := lookPathExts(dirandpath, exts) if err != nil { return "", err } @@ -138,8 +128,8 @@ func pathExt() []string { return exts } -// lookPath implements LookPath for the given PATHEXT list. -func lookPath(file string, exts []string) (string, error) { +// lookPathExts implements LookPath for the given PATHEXT list. +func lookPathExts(file string, exts []string) (string, error) { if strings.ContainsAny(file, `:\/`) { f, err := findExecutable(file, exts) if err == nil { diff --git a/src/path/filepath/match.go b/src/path/filepath/match.go index 7ccf71ee0c..3c1c22bb8a 100644 --- a/src/path/filepath/match.go +++ b/src/path/filepath/match.go @@ -28,13 +28,15 @@ var ErrBadPattern = errors.New("syntax error in pattern") // '[' [ '^' ] { character-range } ']' // character class (must be non-empty) // c matches character c (c != '*', '?', '\\', '[') -// '\\' c matches character c +// '\\' c matches character c (except on Windows) // // character-range: // c matches character c (c != '\\', '-', ']') -// '\\' c matches character c +// '\\' c matches character c (except on Windows) // lo '-' hi matches character c for lo <= c <= hi // +// Path segments in the pattern must be separated by [Separator]. +// // Match requires pattern to match all of name, not just a substring. // The only possible returned error is [ErrBadPattern], when pattern // is malformed. diff --git a/src/runtime/_mkmalloc/mkmalloc.go b/src/runtime/_mkmalloc/mkmalloc.go index 434eaad767..450608a7a4 100644 --- a/src/runtime/_mkmalloc/mkmalloc.go +++ b/src/runtime/_mkmalloc/mkmalloc.go @@ -130,7 +130,7 @@ func tinyFuncName(size uintptr) string { if size == 0 || size > smallScanNoHeaderMax { return "mallocPanic" } - return fmt.Sprintf("mallocTiny%d", size) + return fmt.Sprintf("mallocgcTinySize%d", size) } func smallNoScanSCFuncName(sc, scMax uint8) string { diff --git a/src/runtime/malloc_generated.go b/src/runtime/malloc_generated.go index 2be6a5b6f5..8d7112646f 100644 --- a/src/runtime/malloc_generated.go +++ b/src/runtime/malloc_generated.go @@ -4300,7 +4300,7 @@ func mallocgcSmallScanNoHeaderSC26(size uintptr, typ *_type, needzero bool) unsa return x } -func mallocTiny1(size uintptr, typ *_type, needzero bool) unsafe.Pointer { +func mallocgcTinySize1(size uintptr, typ *_type, needzero bool) unsafe.Pointer { gp := getg() if goexperiment.RuntimeSecret && gp.secret > 0 { @@ -4456,7 +4456,7 @@ func mallocTiny1(size uintptr, typ *_type, needzero bool) unsafe.Pointer { return x } -func mallocTiny2(size uintptr, typ *_type, needzero bool) unsafe.Pointer { +func mallocgcTinySize2(size uintptr, typ *_type, needzero bool) unsafe.Pointer { gp := getg() if goexperiment.RuntimeSecret && gp.secret > 0 { @@ -4612,7 +4612,7 @@ func mallocTiny2(size uintptr, typ *_type, needzero bool) unsafe.Pointer { return x } -func mallocTiny3(size uintptr, typ *_type, needzero bool) unsafe.Pointer { +func mallocgcTinySize3(size uintptr, typ *_type, needzero bool) unsafe.Pointer { gp := getg() if goexperiment.RuntimeSecret && gp.secret > 0 { @@ -4768,7 +4768,7 @@ func mallocTiny3(size uintptr, typ *_type, needzero bool) unsafe.Pointer { return x } -func mallocTiny4(size uintptr, typ *_type, needzero bool) unsafe.Pointer { +func mallocgcTinySize4(size uintptr, typ *_type, needzero bool) unsafe.Pointer { gp := getg() if goexperiment.RuntimeSecret && gp.secret > 0 { @@ -4924,7 +4924,7 @@ func mallocTiny4(size uintptr, typ *_type, needzero bool) unsafe.Pointer { return x } -func mallocTiny5(size uintptr, typ *_type, needzero bool) unsafe.Pointer { +func mallocgcTinySize5(size uintptr, typ *_type, needzero bool) unsafe.Pointer { gp := getg() if goexperiment.RuntimeSecret && gp.secret > 0 { @@ -5080,7 +5080,7 @@ func mallocTiny5(size uintptr, typ *_type, needzero bool) unsafe.Pointer { return x } -func mallocTiny6(size uintptr, typ *_type, needzero bool) unsafe.Pointer { +func mallocgcTinySize6(size uintptr, typ *_type, needzero bool) unsafe.Pointer { gp := getg() if goexperiment.RuntimeSecret && gp.secret > 0 { @@ -5236,7 +5236,7 @@ func mallocTiny6(size uintptr, typ *_type, needzero bool) unsafe.Pointer { return x } -func mallocTiny7(size uintptr, typ *_type, needzero bool) unsafe.Pointer { +func mallocgcTinySize7(size uintptr, typ *_type, needzero bool) unsafe.Pointer { gp := getg() if goexperiment.RuntimeSecret && gp.secret > 0 { @@ -5392,7 +5392,7 @@ func mallocTiny7(size uintptr, typ *_type, needzero bool) unsafe.Pointer { return x } -func mallocTiny8(size uintptr, typ *_type, needzero bool) unsafe.Pointer { +func mallocgcTinySize8(size uintptr, typ *_type, needzero bool) unsafe.Pointer { gp := getg() if goexperiment.RuntimeSecret && gp.secret > 0 { @@ -5548,7 +5548,7 @@ func mallocTiny8(size uintptr, typ *_type, needzero bool) unsafe.Pointer { return x } -func mallocTiny9(size uintptr, typ *_type, needzero bool) unsafe.Pointer { +func mallocgcTinySize9(size uintptr, typ *_type, needzero bool) unsafe.Pointer { gp := getg() if goexperiment.RuntimeSecret && gp.secret > 0 { @@ -5704,7 +5704,7 @@ func mallocTiny9(size uintptr, typ *_type, needzero bool) unsafe.Pointer { return x } -func mallocTiny10(size uintptr, typ *_type, needzero bool) unsafe.Pointer { +func mallocgcTinySize10(size uintptr, typ *_type, needzero bool) unsafe.Pointer { gp := getg() if goexperiment.RuntimeSecret && gp.secret > 0 { @@ -5860,7 +5860,7 @@ func mallocTiny10(size uintptr, typ *_type, needzero bool) unsafe.Pointer { return x } -func mallocTiny11(size uintptr, typ *_type, needzero bool) unsafe.Pointer { +func mallocgcTinySize11(size uintptr, typ *_type, needzero bool) unsafe.Pointer { gp := getg() if goexperiment.RuntimeSecret && gp.secret > 0 { @@ -6016,7 +6016,7 @@ func mallocTiny11(size uintptr, typ *_type, needzero bool) unsafe.Pointer { return x } -func mallocTiny12(size uintptr, typ *_type, needzero bool) unsafe.Pointer { +func mallocgcTinySize12(size uintptr, typ *_type, needzero bool) unsafe.Pointer { gp := getg() if goexperiment.RuntimeSecret && gp.secret > 0 { @@ -6172,7 +6172,7 @@ func mallocTiny12(size uintptr, typ *_type, needzero bool) unsafe.Pointer { return x } -func mallocTiny13(size uintptr, typ *_type, needzero bool) unsafe.Pointer { +func mallocgcTinySize13(size uintptr, typ *_type, needzero bool) unsafe.Pointer { gp := getg() if goexperiment.RuntimeSecret && gp.secret > 0 { @@ -6328,7 +6328,7 @@ func mallocTiny13(size uintptr, typ *_type, needzero bool) unsafe.Pointer { return x } -func mallocTiny14(size uintptr, typ *_type, needzero bool) unsafe.Pointer { +func mallocgcTinySize14(size uintptr, typ *_type, needzero bool) unsafe.Pointer { gp := getg() if goexperiment.RuntimeSecret && gp.secret > 0 { @@ -6484,7 +6484,7 @@ func mallocTiny14(size uintptr, typ *_type, needzero bool) unsafe.Pointer { return x } -func mallocTiny15(size uintptr, typ *_type, needzero bool) unsafe.Pointer { +func mallocgcTinySize15(size uintptr, typ *_type, needzero bool) unsafe.Pointer { gp := getg() if goexperiment.RuntimeSecret && gp.secret > 0 { diff --git a/src/runtime/malloc_tables_generated.go b/src/runtime/malloc_tables_generated.go index 36650881fe..b1ddde2aad 100644 --- a/src/runtime/malloc_tables_generated.go +++ b/src/runtime/malloc_tables_generated.go @@ -523,21 +523,21 @@ var mallocScanTable = [513]func(size uintptr, typ *_type, needzero bool) unsafe. var mallocNoScanTable = [513]func(size uintptr, typ *_type, needzero bool) unsafe.Pointer{ mallocPanic, - mallocTiny1, - mallocTiny2, - mallocTiny3, - mallocTiny4, - mallocTiny5, - mallocTiny6, - mallocTiny7, - mallocTiny8, - mallocTiny9, - mallocTiny10, - mallocTiny11, - mallocTiny12, - mallocTiny13, - mallocTiny14, - mallocTiny15, + mallocgcTinySize1, + mallocgcTinySize2, + mallocgcTinySize3, + mallocgcTinySize4, + mallocgcTinySize5, + mallocgcTinySize6, + mallocgcTinySize7, + mallocgcTinySize8, + mallocgcTinySize9, + mallocgcTinySize10, + mallocgcTinySize11, + mallocgcTinySize12, + mallocgcTinySize13, + mallocgcTinySize14, + mallocgcTinySize15, mallocgcSmallNoScanSC2, mallocgcSmallNoScanSC3, mallocgcSmallNoScanSC3, diff --git a/src/runtime/mheap.go b/src/runtime/mheap.go index 68dfca4668..9b62ee4273 100644 --- a/src/runtime/mheap.go +++ b/src/runtime/mheap.go @@ -457,12 +457,6 @@ type mspan struct { // mallocgc, and issue 54596). freeIndexForScan uint16 - // Temporary storage for the object index that caused this span to - // be queued for scanning. - // - // Used only with goexperiment.GreenTeaGC. - scanIdx uint16 - // Cache of the allocBits at freeindex. allocCache is shifted // such that the lowest bit corresponds to the bit freeindex. // allocCache holds the complement of allocBits, thus allowing diff --git a/src/runtime/trace/recorder.go b/src/runtime/trace/recorder.go index a18d764141..8617231aaa 100644 --- a/src/runtime/trace/recorder.go +++ b/src/runtime/trace/recorder.go @@ -112,7 +112,7 @@ func runtime_traceClockNow() uint64 // frequency is nanoseconds per timestamp unit. type frequency float64 -// mul multiplies an unprocessed to produce a time in nanoseconds. +// mul multiplies an unprocessed timestamp to produce a time in nanoseconds. func (f frequency) mul(t timestamp) eventTime { return eventTime(float64(t) * float64(f)) } diff --git a/src/simd/archsimd/_gen/simdgen/gen_simdMachineOps.go b/src/simd/archsimd/_gen/simdgen/gen_simdMachineOps.go index 3d99dd2a81..94b122ac39 100644 --- a/src/simd/archsimd/_gen/simdgen/gen_simdMachineOps.go +++ b/src/simd/archsimd/_gen/simdgen/gen_simdMachineOps.go @@ -181,7 +181,7 @@ func writeSIMDMachineOps(ops []Operation) *bytes.Buffer { } hasMerging = gOp.hasMaskedMerging(maskType, shapeOut) if hasMerging && !resultInArg0 { - // We have to copy the slice here becasue the sort will be visible from other + // We have to copy the slice here because the sort will be visible from other // aliases when no reslicing is happening. newIn := make([]Operand, len(op.In), len(op.In)+1) copy(newIn, op.In) diff --git a/src/simd/archsimd/_gen/simdgen/gen_simdTypes.go b/src/simd/archsimd/_gen/simdgen/gen_simdTypes.go index dd3a75eb44..4f1c70e211 100644 --- a/src/simd/archsimd/_gen/simdgen/gen_simdTypes.go +++ b/src/simd/archsimd/_gen/simdgen/gen_simdTypes.go @@ -189,6 +189,7 @@ type X86Features struct {} var X86 X86Features {{range .}} +{{$f := .}} {{- if eq .Feature "AVX512"}} // {{.Feature}} returns whether the CPU supports the AVX512F+CD+BW+DQ+VL features. // @@ -199,11 +200,19 @@ var X86 X86Features {{- else -}} // {{.Feature}} returns whether the CPU supports the {{.Feature}} feature. {{- end}} +{{- if ne .ImpliesAll ""}} +// +// If it returns true, then the CPU also supports {{.ImpliesAll}}. +{{- end}} // // {{.Feature}} is defined on all GOARCHes, but will only return true on // GOARCH {{.GoArch}}. -func (X86Features) {{.Feature}}() bool { - return cpu.X86.Has{{.Feature}} +func ({{.FeatureVar}}Features) {{.Feature}}() bool { +{{- if .Virtual}} + return {{range $i, $dep := .Implies}}{{if $i}} && {{end}}cpu.{{$f.FeatureVar}}.Has{{$dep}}{{end}} +{{- else}} + return cpu.{{.FeatureVar}}.Has{{.Feature}} +{{- end}} } {{end}} ` @@ -591,6 +600,65 @@ func writeSIMDTypes(typeMap simdTypeMap) *bytes.Buffer { return buffer } +type goarchFeatures struct { + // featureVar is the name of the exported feature-check variable for this + // architecture. + featureVar string + + // features records per-feature information. + features map[string]featureInfo +} + +type featureInfo struct { + // Implies is a list of other CPU features that are required for this + // feature. These are allowed to chain. + // + // For example, if the Frob feature lists "Baz", then if X.Frob() returns + // true, it must also be true that the CPU has feature Baz. + Implies []string + + // Virtual means this feature is not represented directly in internal/cpu, + // but is instead the logical AND of the features in Implies. + Virtual bool +} + +// goarchFeatureInfo maps from GOARCH to CPU feature to additional information +// about that feature. Not all features need to be in this map. +var goarchFeatureInfo = make(map[string]goarchFeatures) + +func registerFeatureInfo(goArch string, features goarchFeatures) { + goarchFeatureInfo[goArch] = features +} + +func featureImplies(goarch string, base string) string { + // Compute the transitive closure of base. + var list []string + var visit func(f string) + visit = func(f string) { + list = append(list, f) + for _, dep := range goarchFeatureInfo[goarch].features[f].Implies { + visit(dep) + } + } + visit(base) + // Drop base + list = list[1:] + // Put in "nice" order + slices.Reverse(list) + // Combine into a comment-ready form + switch len(list) { + case 0: + return "" + case 1: + return list[0] + case 2: + return list[0] + " and " + list[1] + default: + list[len(list)-1] = "and " + list[len(list)-1] + return strings.Join(list, ", ") + } +} + func writeSIMDFeatures(ops []Operation) *bytes.Buffer { // Gather all features type featureKey struct { @@ -606,13 +674,36 @@ func writeSIMDFeatures(ops []Operation) *bytes.Buffer { featureSet[featureKey{op.GoArch, feature}] = struct{}{} } } - features := slices.SortedFunc(maps.Keys(featureSet), func(a, b featureKey) int { + featureKeys := slices.SortedFunc(maps.Keys(featureSet), func(a, b featureKey) int { if c := cmp.Compare(a.GoArch, b.GoArch); c != 0 { return c } return compareNatural(a.Feature, b.Feature) }) + // TODO: internal/cpu doesn't enforce these at all. You can even do + // GODEBUG=cpu.avx=off and it will happily turn off AVX without turning off + // AVX2. We need to push these dependencies into it somehow. + type feature struct { + featureKey + FeatureVar string + Virtual bool + Implies []string + ImpliesAll string + } + var features []feature + for _, k := range featureKeys { + featureVar := goarchFeatureInfo[k.GoArch].featureVar + fi := goarchFeatureInfo[k.GoArch].features[k.Feature] + features = append(features, feature{ + featureKey: k, + FeatureVar: featureVar, + Virtual: fi.Virtual, + Implies: fi.Implies, + ImpliesAll: featureImplies(k.GoArch, k.Feature), + }) + } + // If we ever have the same feature name on more than one GOARCH, we'll have // to be more careful about this. t := templateOf(simdFeaturesTemplate, "features") diff --git a/src/simd/archsimd/_gen/simdgen/gen_simdssa.go b/src/simd/archsimd/_gen/simdgen/gen_simdssa.go index 876ffabe3d..96d096688f 100644 --- a/src/simd/archsimd/_gen/simdgen/gen_simdssa.go +++ b/src/simd/archsimd/_gen/simdgen/gen_simdssa.go @@ -133,7 +133,7 @@ func writeSIMDSSA(ops []Operation) *bytes.Buffer { if mem == NoMem && op.hasMaskedMerging(maskType, shapeOut) { regShapeMerging := regShape if shapeOut != OneVregOutAtIn { - // We have to copy the slice here becasue the sort will be visible from other + // We have to copy the slice here because the sort will be visible from other // aliases when no reslicing is happening. newIn := make([]Operand, len(op.In), len(op.In)+1) copy(newIn, op.In) diff --git a/src/simd/archsimd/_gen/simdgen/xed.go b/src/simd/archsimd/_gen/simdgen/xed.go index 4ba6738e7e..5d6fac64d0 100644 --- a/src/simd/archsimd/_gen/simdgen/xed.go +++ b/src/simd/archsimd/_gen/simdgen/xed.go @@ -5,7 +5,6 @@ package main import ( - "cmp" "fmt" "log" "maps" @@ -78,7 +77,7 @@ func loadXED(xedPath string) []*unify.Value { switch { case inst.RealOpcode == "N": return // Skip unstable instructions - case !(strings.HasPrefix(inst.Extension, "AVX") || strings.HasPrefix(inst.Extension, "SHA")): + case !(strings.HasPrefix(inst.Extension, "AVX") || strings.HasPrefix(inst.Extension, "SHA") || inst.Extension == "FMA"): // We're only interested in AVX and SHA instructions. return } @@ -210,16 +209,9 @@ func loadXED(xedPath string) []*unify.Value { } log.Printf("%d unhandled CPU features for %d instructions (use -v for details)", len(unknownFeatures), nInst) } else { - keys := slices.SortedFunc(maps.Keys(unknownFeatures), func(a, b cpuFeatureKey) int { - return cmp.Or(cmp.Compare(a.Extension, b.Extension), - cmp.Compare(a.ISASet, b.ISASet)) - }) + keys := slices.Sorted(maps.Keys(unknownFeatures)) for _, key := range keys { - if key.ISASet == "" || key.ISASet == key.Extension { - log.Printf("unhandled Extension %s", key.Extension) - } else { - log.Printf("unhandled Extension %s and ISASet %s", key.Extension, key.ISASet) - } + log.Printf("unhandled ISASet %s", key) log.Printf(" opcodes: %s", slices.Sorted(maps.Keys(unknownFeatures[key]))) } } @@ -763,16 +755,24 @@ func instToUVal1(inst *xeddata.Inst, ops []operand, feature string, variant inst // decodeCPUFeature returns the CPU feature name required by inst. These match // the names of the "Has*" feature checks in the simd package. func decodeCPUFeature(inst *xeddata.Inst) (string, bool) { - key := cpuFeatureKey{ - Extension: inst.Extension, - ISASet: isaSetStrip.ReplaceAllLiteralString(inst.ISASet, ""), + isaSet := inst.ISASet + if isaSet == "" { + // Older instructions don't have an ISA set. Use their "extension" + // instead. + isaSet = inst.Extension } - feat, ok := cpuFeatureMap[key] + // We require AVX512VL to use AVX512 at all, so strip off the vector length + // suffixes. + if strings.HasPrefix(isaSet, "AVX512") { + isaSet = isaSetVL.ReplaceAllLiteralString(isaSet, "") + } + + feat, ok := cpuFeatureMap[isaSet] if !ok { - imap := unknownFeatures[key] + imap := unknownFeatures[isaSet] if imap == nil { imap = make(map[string]struct{}) - unknownFeatures[key] = imap + unknownFeatures[isaSet] = imap } imap[inst.Opcode()] = struct{}{} return "", false @@ -783,45 +783,76 @@ func decodeCPUFeature(inst *xeddata.Inst) (string, bool) { return feat, true } -var isaSetStrip = regexp.MustCompile("_(128N?|256N?|512)$") +var isaSetVL = regexp.MustCompile("_(128N?|256N?|512)$") -type cpuFeatureKey struct { - Extension, ISASet string -} - -// cpuFeatureMap maps from XED's "EXTENSION" and "ISA_SET" to a CPU feature name -// that can be used in the SIMD API. -var cpuFeatureMap = map[cpuFeatureKey]string{ - {"SHA", "SHA"}: "SHA", - - {"AVX", ""}: "AVX", - {"AVX_VNNI", "AVX_VNNI"}: "AVXVNNI", - {"AVX2", ""}: "AVX2", - {"AVXAES", ""}: "AVX, AES", +// cpuFeatureMap maps from XED's "ISA_SET" (or "EXTENSION") to a CPU feature +// name to expose in the SIMD feature check API. +// +// See XED's datafiles/*/cpuid.xed.txt for how ISA set names map to CPUID flags. +var cpuFeatureMap = map[string]string{ + "AVX": "AVX", + "AVX_VNNI": "AVXVNNI", + "AVX2": "AVX2", + "AVXAES": "AVXAES", + "SHA": "SHA", + "FMA": "FMA", // AVX-512 foundational features. We combine all of these into one "AVX512" feature. - {"AVX512EVEX", "AVX512F"}: "AVX512", - {"AVX512EVEX", "AVX512CD"}: "AVX512", - {"AVX512EVEX", "AVX512BW"}: "AVX512", - {"AVX512EVEX", "AVX512DQ"}: "AVX512", - // AVX512VL doesn't appear explicitly in the ISASet. I guess it's implied by - // the vector length suffix. + "AVX512F": "AVX512", + "AVX512BW": "AVX512", + "AVX512CD": "AVX512", + "AVX512DQ": "AVX512", + // AVX512VL doesn't appear as its own ISASet; instead, the CPUID flag is + // required by the *_128 and *_256 ISASets. We fold it into "AVX512" anyway. // AVX-512 extension features - {"AVX512EVEX", "AVX512_BITALG"}: "AVX512BITALG", - {"AVX512EVEX", "AVX512_GFNI"}: "AVX512GFNI", - {"AVX512EVEX", "AVX512_VBMI2"}: "AVX512VBMI2", - {"AVX512EVEX", "AVX512_VBMI"}: "AVX512VBMI", - {"AVX512EVEX", "AVX512_VNNI"}: "AVX512VNNI", - {"AVX512EVEX", "AVX512_VPOPCNTDQ"}: "AVX512VPOPCNTDQ", - {"AVX512EVEX", "AVX512_VAES"}: "AVX512VAES", - {"AVX512EVEX", "AVX512_VPCLMULQDQ"}: "AVX512VPCLMULQDQ", + "AVX512_BITALG": "AVX512BITALG", + "AVX512_GFNI": "AVX512GFNI", + "AVX512_VBMI": "AVX512VBMI", + "AVX512_VBMI2": "AVX512VBMI2", + "AVX512_VNNI": "AVX512VNNI", + "AVX512_VPOPCNTDQ": "AVX512VPOPCNTDQ", + "AVX512_VAES": "AVX512VAES", + "AVX512_VPCLMULQDQ": "AVX512VPCLMULQDQ", // AVX 10.2 (not yet supported) - {"AVX512EVEX", "AVX10_2_RC"}: "ignore", + "AVX10_2_RC": "ignore", +} + +func init() { + // TODO: In general, Intel doesn't make any guarantees about what flags are + // set, so this means our feature checks need to ensure these, just to be + // sure. + var features = map[string]featureInfo{ + "AVX2": {Implies: []string{"AVX"}}, + "AVX512": {Implies: []string{"AVX2"}}, + + "AVXAES": {Virtual: true, Implies: []string{"AVX", "AES"}}, + "FMA": {Implies: []string{"AVX"}}, + + // AVX-512 subfeatures. + "AVX512BITALG": {Implies: []string{"AVX512"}}, + "AVX512GFNI": {Implies: []string{"AVX512"}}, + "AVX512VBMI": {Implies: []string{"AVX512"}}, + "AVX512VBMI2": {Implies: []string{"AVX512"}}, + "AVX512VNNI": {Implies: []string{"AVX512"}}, + "AVX512VPOPCNTDQ": {Implies: []string{"AVX512"}}, + "AVX512VAES": {Implies: []string{"AVX512"}}, + + // AVX-VNNI and AVX-IFMA are "backports" of the AVX512-VNNI/IFMA + // instructions to VEX encoding, limited to 256 bit vectors. They're + // intended for lower end CPUs that want to support VNNI/IFMA without + // supporting AVX-512. As such, they're built on AVX2's VEX encoding. + "AVXVNNI": {Implies: []string{"AVX2"}}, + "AVXIFMA": {Implies: []string{"AVX2"}}, + } + registerFeatureInfo("amd64", goarchFeatures{ + featureVar: "X86", + features: features, + }) } -var unknownFeatures = map[cpuFeatureKey]map[string]struct{}{} +var unknownFeatures = map[string]map[string]struct{}{} // hasOptionalMask returns whether there is an optional mask operand in ops. func hasOptionalMask(ops []operand) bool { diff --git a/src/simd/archsimd/cpu.go b/src/simd/archsimd/cpu.go index d0c0ff5426..8069ee7f26 100644 --- a/src/simd/archsimd/cpu.go +++ b/src/simd/archsimd/cpu.go @@ -10,14 +10,6 @@ type X86Features struct{} var X86 X86Features -// AES returns whether the CPU supports the AES feature. -// -// AES is defined on all GOARCHes, but will only return true on -// GOARCH amd64. -func (X86Features) AES() bool { - return cpu.X86.HasAES -} - // AVX returns whether the CPU supports the AVX feature. // // AVX is defined on all GOARCHes, but will only return true on @@ -28,6 +20,8 @@ func (X86Features) AVX() bool { // AVX2 returns whether the CPU supports the AVX2 feature. // +// If it returns true, then the CPU also supports AVX. +// // AVX2 is defined on all GOARCHes, but will only return true on // GOARCH amd64. func (X86Features) AVX2() bool { @@ -41,6 +35,8 @@ func (X86Features) AVX2() bool { // Nearly every CPU that has shipped with any support for AVX-512 has // supported all five of these features. // +// If it returns true, then the CPU also supports AVX and AVX2. +// // AVX512 is defined on all GOARCHes, but will only return true on // GOARCH amd64. func (X86Features) AVX512() bool { @@ -49,6 +45,8 @@ func (X86Features) AVX512() bool { // AVX512BITALG returns whether the CPU supports the AVX512BITALG feature. // +// If it returns true, then the CPU also supports AVX, AVX2, and AVX512. +// // AVX512BITALG is defined on all GOARCHes, but will only return true on // GOARCH amd64. func (X86Features) AVX512BITALG() bool { @@ -57,6 +55,8 @@ func (X86Features) AVX512BITALG() bool { // AVX512GFNI returns whether the CPU supports the AVX512GFNI feature. // +// If it returns true, then the CPU also supports AVX, AVX2, and AVX512. +// // AVX512GFNI is defined on all GOARCHes, but will only return true on // GOARCH amd64. func (X86Features) AVX512GFNI() bool { @@ -65,6 +65,8 @@ func (X86Features) AVX512GFNI() bool { // AVX512VAES returns whether the CPU supports the AVX512VAES feature. // +// If it returns true, then the CPU also supports AVX, AVX2, and AVX512. +// // AVX512VAES is defined on all GOARCHes, but will only return true on // GOARCH amd64. func (X86Features) AVX512VAES() bool { @@ -73,6 +75,8 @@ func (X86Features) AVX512VAES() bool { // AVX512VBMI returns whether the CPU supports the AVX512VBMI feature. // +// If it returns true, then the CPU also supports AVX, AVX2, and AVX512. +// // AVX512VBMI is defined on all GOARCHes, but will only return true on // GOARCH amd64. func (X86Features) AVX512VBMI() bool { @@ -81,6 +85,8 @@ func (X86Features) AVX512VBMI() bool { // AVX512VBMI2 returns whether the CPU supports the AVX512VBMI2 feature. // +// If it returns true, then the CPU also supports AVX, AVX2, and AVX512. +// // AVX512VBMI2 is defined on all GOARCHes, but will only return true on // GOARCH amd64. func (X86Features) AVX512VBMI2() bool { @@ -89,6 +95,8 @@ func (X86Features) AVX512VBMI2() bool { // AVX512VNNI returns whether the CPU supports the AVX512VNNI feature. // +// If it returns true, then the CPU also supports AVX, AVX2, and AVX512. +// // AVX512VNNI is defined on all GOARCHes, but will only return true on // GOARCH amd64. func (X86Features) AVX512VNNI() bool { @@ -105,20 +113,44 @@ func (X86Features) AVX512VPCLMULQDQ() bool { // AVX512VPOPCNTDQ returns whether the CPU supports the AVX512VPOPCNTDQ feature. // +// If it returns true, then the CPU also supports AVX, AVX2, and AVX512. +// // AVX512VPOPCNTDQ is defined on all GOARCHes, but will only return true on // GOARCH amd64. func (X86Features) AVX512VPOPCNTDQ() bool { return cpu.X86.HasAVX512VPOPCNTDQ } +// AVXAES returns whether the CPU supports the AVXAES feature. +// +// If it returns true, then the CPU also supports AES and AVX. +// +// AVXAES is defined on all GOARCHes, but will only return true on +// GOARCH amd64. +func (X86Features) AVXAES() bool { + return cpu.X86.HasAVX && cpu.X86.HasAES +} + // AVXVNNI returns whether the CPU supports the AVXVNNI feature. // +// If it returns true, then the CPU also supports AVX and AVX2. +// // AVXVNNI is defined on all GOARCHes, but will only return true on // GOARCH amd64. func (X86Features) AVXVNNI() bool { return cpu.X86.HasAVXVNNI } +// FMA returns whether the CPU supports the FMA feature. +// +// If it returns true, then the CPU also supports AVX. +// +// FMA is defined on all GOARCHes, but will only return true on +// GOARCH amd64. +func (X86Features) FMA() bool { + return cpu.X86.HasFMA +} + // SHA returns whether the CPU supports the SHA feature. // // SHA is defined on all GOARCHes, but will only return true on diff --git a/src/simd/archsimd/ops_amd64.go b/src/simd/archsimd/ops_amd64.go index bb162c4ff9..ec50cc72c5 100644 --- a/src/simd/archsimd/ops_amd64.go +++ b/src/simd/archsimd/ops_amd64.go @@ -11,7 +11,7 @@ package archsimd // y is the chunk of dw array in use. // result = AddRoundKey(InvShiftRows(InvSubBytes(x)), y) // -// Asm: VAESDECLAST, CPU Feature: AVX, AES +// Asm: VAESDECLAST, CPU Feature: AVXAES func (x Uint8x16) AESDecryptLastRound(y Uint32x4) Uint8x16 // AESDecryptLastRound performs a series of operations in AES cipher algorithm defined in FIPS 197. @@ -37,7 +37,7 @@ func (x Uint8x64) AESDecryptLastRound(y Uint32x16) Uint8x64 // y is the chunk of dw array in use. // result = AddRoundKey(InvMixColumns(InvShiftRows(InvSubBytes(x))), y) // -// Asm: VAESDEC, CPU Feature: AVX, AES +// Asm: VAESDEC, CPU Feature: AVXAES func (x Uint8x16) AESDecryptOneRound(y Uint32x4) Uint8x16 // AESDecryptOneRound performs a series of operations in AES cipher algorithm defined in FIPS 197. @@ -63,7 +63,7 @@ func (x Uint8x64) AESDecryptOneRound(y Uint32x16) Uint8x64 // y is the chunk of w array in use. // result = AddRoundKey((ShiftRows(SubBytes(x))), y) // -// Asm: VAESENCLAST, CPU Feature: AVX, AES +// Asm: VAESENCLAST, CPU Feature: AVXAES func (x Uint8x16) AESEncryptLastRound(y Uint32x4) Uint8x16 // AESEncryptLastRound performs a series of operations in AES cipher algorithm defined in FIPS 197. @@ -89,7 +89,7 @@ func (x Uint8x64) AESEncryptLastRound(y Uint32x16) Uint8x64 // y is the chunk of w array in use. // result = AddRoundKey(MixColumns(ShiftRows(SubBytes(x))), y) // -// Asm: VAESENC, CPU Feature: AVX, AES +// Asm: VAESENC, CPU Feature: AVXAES func (x Uint8x16) AESEncryptOneRound(y Uint32x4) Uint8x16 // AESEncryptOneRound performs a series of operations in AES cipher algorithm defined in FIPS 197. @@ -114,7 +114,7 @@ func (x Uint8x64) AESEncryptOneRound(y Uint32x16) Uint8x64 // x is the chunk of w array in use. // result = InvMixColumns(x) // -// Asm: VAESIMC, CPU Feature: AVX, AES +// Asm: VAESIMC, CPU Feature: AVXAES func (x Uint32x4) AESInvMixColumns() Uint32x4 /* AESRoundKeyGenAssist */ @@ -129,7 +129,7 @@ func (x Uint32x4) AESInvMixColumns() Uint32x4 // // rconVal results in better performance when it's a constant, a non-constant value will be translated into a jump table. // -// Asm: VAESKEYGENASSIST, CPU Feature: AVX, AES +// Asm: VAESKEYGENASSIST, CPU Feature: AVXAES func (x Uint32x4) AESRoundKeyGenAssist(rconVal uint8) Uint32x4 /* Abs */ @@ -4088,12 +4088,12 @@ func (x Uint64x8) Mul(y Uint64x8) Uint64x8 // MulAdd performs a fused (x * y) + z. // -// Asm: VFMADD213PS, CPU Feature: AVX512 +// Asm: VFMADD213PS, CPU Feature: FMA func (x Float32x4) MulAdd(y Float32x4, z Float32x4) Float32x4 // MulAdd performs a fused (x * y) + z. // -// Asm: VFMADD213PS, CPU Feature: AVX512 +// Asm: VFMADD213PS, CPU Feature: FMA func (x Float32x8) MulAdd(y Float32x8, z Float32x8) Float32x8 // MulAdd performs a fused (x * y) + z. @@ -4103,12 +4103,12 @@ func (x Float32x16) MulAdd(y Float32x16, z Float32x16) Float32x16 // MulAdd performs a fused (x * y) + z. // -// Asm: VFMADD213PD, CPU Feature: AVX512 +// Asm: VFMADD213PD, CPU Feature: FMA func (x Float64x2) MulAdd(y Float64x2, z Float64x2) Float64x2 // MulAdd performs a fused (x * y) + z. // -// Asm: VFMADD213PD, CPU Feature: AVX512 +// Asm: VFMADD213PD, CPU Feature: FMA func (x Float64x4) MulAdd(y Float64x4, z Float64x4) Float64x4 // MulAdd performs a fused (x * y) + z. @@ -4120,12 +4120,12 @@ func (x Float64x8) MulAdd(y Float64x8, z Float64x8) Float64x8 // MulAddSub performs a fused (x * y) - z for odd-indexed elements, and (x * y) + z for even-indexed elements. // -// Asm: VFMADDSUB213PS, CPU Feature: AVX512 +// Asm: VFMADDSUB213PS, CPU Feature: FMA func (x Float32x4) MulAddSub(y Float32x4, z Float32x4) Float32x4 // MulAddSub performs a fused (x * y) - z for odd-indexed elements, and (x * y) + z for even-indexed elements. // -// Asm: VFMADDSUB213PS, CPU Feature: AVX512 +// Asm: VFMADDSUB213PS, CPU Feature: FMA func (x Float32x8) MulAddSub(y Float32x8, z Float32x8) Float32x8 // MulAddSub performs a fused (x * y) - z for odd-indexed elements, and (x * y) + z for even-indexed elements. @@ -4135,12 +4135,12 @@ func (x Float32x16) MulAddSub(y Float32x16, z Float32x16) Float32x16 // MulAddSub performs a fused (x * y) - z for odd-indexed elements, and (x * y) + z for even-indexed elements. // -// Asm: VFMADDSUB213PD, CPU Feature: AVX512 +// Asm: VFMADDSUB213PD, CPU Feature: FMA func (x Float64x2) MulAddSub(y Float64x2, z Float64x2) Float64x2 // MulAddSub performs a fused (x * y) - z for odd-indexed elements, and (x * y) + z for even-indexed elements. // -// Asm: VFMADDSUB213PD, CPU Feature: AVX512 +// Asm: VFMADDSUB213PD, CPU Feature: FMA func (x Float64x4) MulAddSub(y Float64x4, z Float64x4) Float64x4 // MulAddSub performs a fused (x * y) - z for odd-indexed elements, and (x * y) + z for even-indexed elements. @@ -4210,12 +4210,12 @@ func (x Uint16x32) MulHigh(y Uint16x32) Uint16x32 // MulSubAdd performs a fused (x * y) + z for odd-indexed elements, and (x * y) - z for even-indexed elements. // -// Asm: VFMSUBADD213PS, CPU Feature: AVX512 +// Asm: VFMSUBADD213PS, CPU Feature: FMA func (x Float32x4) MulSubAdd(y Float32x4, z Float32x4) Float32x4 // MulSubAdd performs a fused (x * y) + z for odd-indexed elements, and (x * y) - z for even-indexed elements. // -// Asm: VFMSUBADD213PS, CPU Feature: AVX512 +// Asm: VFMSUBADD213PS, CPU Feature: FMA func (x Float32x8) MulSubAdd(y Float32x8, z Float32x8) Float32x8 // MulSubAdd performs a fused (x * y) + z for odd-indexed elements, and (x * y) - z for even-indexed elements. @@ -4225,12 +4225,12 @@ func (x Float32x16) MulSubAdd(y Float32x16, z Float32x16) Float32x16 // MulSubAdd performs a fused (x * y) + z for odd-indexed elements, and (x * y) - z for even-indexed elements. // -// Asm: VFMSUBADD213PD, CPU Feature: AVX512 +// Asm: VFMSUBADD213PD, CPU Feature: FMA func (x Float64x2) MulSubAdd(y Float64x2, z Float64x2) Float64x2 // MulSubAdd performs a fused (x * y) + z for odd-indexed elements, and (x * y) - z for even-indexed elements. // -// Asm: VFMSUBADD213PD, CPU Feature: AVX512 +// Asm: VFMSUBADD213PD, CPU Feature: FMA func (x Float64x4) MulSubAdd(y Float64x4, z Float64x4) Float64x4 // MulSubAdd performs a fused (x * y) + z for odd-indexed elements, and (x * y) - z for even-indexed elements. diff --git a/src/sort/sort.go b/src/sort/sort.go index fd3cd6dabf..087e7d033d 100644 --- a/src/sort/sort.go +++ b/src/sort/sort.go @@ -197,7 +197,7 @@ func Float64sAreSorted(x []float64) bool { return slices.IsSorted(x) } func StringsAreSorted(x []string) bool { return slices.IsSorted(x) } // Notes on stable sorting: -// The used algorithms are simple and provable correct on all input and use +// The used algorithms are simple and provably correct on all input and use // only logarithmic additional stack space. They perform well if compared // experimentally to other stable in-place sorting algorithms. // diff --git a/src/strconv/number.go b/src/strconv/number.go index 3fa625c35f..acaed1c96e 100644 --- a/src/strconv/number.go +++ b/src/strconv/number.go @@ -148,7 +148,7 @@ func Atoi(s string) (int, error) { if err != nil { return x, toError("Atoi", s, 0, 0, err) } - return strconv.Atoi(s) + return x, nil } // FormatComplex converts the complex number c to a string of the diff --git a/test/codegen/strings.go b/test/codegen/strings.go index 0c5ee2f8f5..1c14021150 100644 --- a/test/codegen/strings.go +++ b/test/codegen/strings.go @@ -23,7 +23,7 @@ func CountBytes(s []byte) int { func ToByteSlice() []byte { // Issue #24698 // amd64:`LEAQ type:\[3\]uint8` - // amd64:`CALL runtime\.(newobject|mallocTiny3)` + // amd64:`CALL runtime\.(newobject|mallocgcTinySize3)` // amd64:-`.*runtime.stringtoslicebyte` return []byte("foo") } diff --git a/test/fixedbugs/issue4610.go b/test/fixedbugs/issue4610.go index d56c6d3e8c..8993f9882b 100644 --- a/test/fixedbugs/issue4610.go +++ b/test/fixedbugs/issue4610.go @@ -14,4 +14,3 @@ func main() { var foo bar _ = &foo{} // ERROR "is not a type|expected .;." } // GCCGO_ERROR "expected declaration" - diff --git a/test/live.go b/test/live.go index f8ad8df1ca..6561b20925 100644 --- a/test/live.go +++ b/test/live.go @@ -665,14 +665,14 @@ func f39a() (x []int) { func f39b() (x [10]*int) { x = [10]*int{} - x[0] = new(int) // ERROR "live at call to (newobject|mallocTiny[48]): x$" + x[0] = new(int) // ERROR "live at call to (newobject|mallocgcTinySize[48]): x$" printnl() // ERROR "live at call to printnl: x$" return x } func f39c() (x [10]*int) { x = [10]*int{} - x[0] = new(int) // ERROR "live at call to (newobject|mallocTiny[48]): x$" + x[0] = new(int) // ERROR "live at call to (newobject|mallocgcTinySize[48]): x$" printnl() // ERROR "live at call to printnl: x$" return } diff --git a/test/live_regabi.go b/test/live_regabi.go index 9809353f1b..75b842d732 100644 --- a/test/live_regabi.go +++ b/test/live_regabi.go @@ -663,14 +663,14 @@ func f39a() (x []int) { func f39b() (x [10]*int) { x = [10]*int{} - x[0] = new(int) // ERROR "live at call to (newobject|mallocTiny[48]): x$" + x[0] = new(int) // ERROR "live at call to (newobject|mallocgcTinySize[48]): x$" printnl() // ERROR "live at call to printnl: x$" return x } func f39c() (x [10]*int) { x = [10]*int{} - x[0] = new(int) // ERROR "live at call to (newobject|mallocTiny[48]): x$" + x[0] = new(int) // ERROR "live at call to (newobject|mallocgcTinySize[48]): x$" printnl() // ERROR "live at call to printnl: x$" return } diff --git a/test/newexpr.go b/test/newexpr.go index c9a8804d4e..00d753c572 100644 --- a/test/newexpr.go +++ b/test/newexpr.go @@ -37,3 +37,10 @@ func main() { } } } + +// Regression test for ICE in staticdata.GlobalLinksym from +// use of autotemp outside a function (go.dev/issue/77237). +var ( + x = new(0) + y = x +) |
