mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
Separate patterns in asmcheck by spaces instead of commas. Many patterns end in comma (like "MOV [$]123,") so separating patterns by comma is not great; they're already quoted, so spaces are fine. Also replace all tabs in the assembly lines with spaces before matching. Finally, replace \$ or \\$ with [$] as the matching idiom. The effect of all these is to make the patterns look like: // amd64:"BSFQ" "ORQ [$]256" instead of the old: // amd64:"BSFQ","ORQ\t\\$256" Update all tests as well. Change-Id: Ia39febe5d7f67ba115846422789e11b185d5c807 Reviewed-on: https://go-review.googlesource.com/c/go/+/716060 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Alan Donovan <adonovan@google.com> Reviewed-by: Jorropo <jorropo.pgm@gmail.com>
67 lines
1 KiB
Go
67 lines
1 KiB
Go
// asmcheck
|
|
|
|
// 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.
|
|
|
|
package codegen
|
|
|
|
type Ix interface {
|
|
X()
|
|
}
|
|
|
|
type Iy interface {
|
|
Y()
|
|
}
|
|
|
|
type Iz interface {
|
|
Z()
|
|
}
|
|
|
|
func swXYZ(a Ix) {
|
|
switch t := a.(type) {
|
|
case Iy: // amd64:-".*typeAssert"
|
|
t.Y()
|
|
case Iz: // amd64:-".*typeAssert"
|
|
t.Z()
|
|
}
|
|
}
|
|
|
|
type Ig[T any] interface {
|
|
G() T
|
|
}
|
|
|
|
func swGYZ[T any](a Ig[T]) {
|
|
switch t := a.(type) {
|
|
case Iy: // amd64:-".*typeAssert"
|
|
t.Y()
|
|
case Iz: // amd64:-".*typeAssert"
|
|
t.Z()
|
|
case interface{ G() T }: // amd64:-".*typeAssert" -".*assertE2I\\(" ".*assertE2I2"
|
|
t.G()
|
|
}
|
|
}
|
|
|
|
func swE2G[T any](a any) {
|
|
switch t := a.(type) {
|
|
case Iy:
|
|
t.Y()
|
|
case Ig[T]: // amd64:-".*assertE2I\\(" ".*assertE2I2"
|
|
t.G()
|
|
}
|
|
}
|
|
|
|
func swI2G[T any](a Ix) {
|
|
switch t := a.(type) {
|
|
case Iy:
|
|
t.Y()
|
|
case Ig[T]: // amd64:-".*assertE2I\\(" ".*assertE2I2"
|
|
t.G()
|
|
}
|
|
}
|
|
|
|
func swCaller() {
|
|
swGYZ[int]((Ig[int])(nil))
|
|
swE2G[int]((Ig[int])(nil))
|
|
swI2G[int]((Ix)(nil))
|
|
}
|