2022-09-01 16:06:11 -07:00
|
|
|
// asmcheck
|
|
|
|
|
|
|
|
// Copyright 2022 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
|
|
|
|
|
2023-09-18 13:31:49 -07:00
|
|
|
type I interface{ M() }
|
2022-09-01 16:06:11 -07:00
|
|
|
|
|
|
|
func NopConvertIface(x I) I {
|
2023-09-18 13:31:49 -07:00
|
|
|
// amd64:-`.*runtime.convI2I`
|
2022-09-01 16:06:11 -07:00
|
|
|
return I(x)
|
|
|
|
}
|
|
|
|
|
|
|
|
func NopConvertGeneric[T any](x T) T {
|
2023-09-18 13:31:49 -07:00
|
|
|
// amd64:-`.*runtime.convI2I`
|
|
|
|
return T(x)
|
2022-09-01 16:06:11 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
var NopConvertGenericIface = NopConvertGeneric[I]
|
2023-09-18 13:31:49 -07:00
|
|
|
|
|
|
|
func ConvToM(x any) I {
|
|
|
|
// amd64:`CALL\truntime.typeAssert`,`MOVL\t16\(.*\)`,`MOVQ\t8\(.*\)(.*\*1)`
|
|
|
|
// arm64:`CALL\truntime.typeAssert`,`LDAR`,`MOVWU`,`MOVD\t\(R.*\)\(R.*\)`
|
|
|
|
return x.(I)
|
|
|
|
}
|
2024-12-09 12:55:33 -08:00
|
|
|
|
|
|
|
func e1(x any, y *int) bool {
|
|
|
|
// amd64:-`.*faceeq`,`SETEQ`
|
|
|
|
// arm64:-`.*faceeq`,`CSET\tEQ`
|
|
|
|
return x == y
|
|
|
|
}
|
|
|
|
|
|
|
|
func e2(x any, y *int) bool {
|
|
|
|
// amd64:-`.*faceeq`,`SETEQ`
|
|
|
|
// arm64:-`.*faceeq`,`CSET\tEQ`
|
|
|
|
return y == x
|
|
|
|
}
|
|
|
|
|
|
|
|
type E *int
|
|
|
|
|
|
|
|
func e3(x any, y E) bool {
|
|
|
|
// amd64:-`.*faceeq`,`SETEQ`
|
|
|
|
// arm64:-`.*faceeq`,`CSET\tEQ`
|
|
|
|
return x == y
|
|
|
|
}
|
|
|
|
|
|
|
|
type T int
|
|
|
|
|
|
|
|
func (t *T) M() {}
|
|
|
|
|
|
|
|
func i1(x I, y *T) bool {
|
|
|
|
// amd64:-`.*faceeq`,`SETEQ`
|
|
|
|
// arm64:-`.*faceeq`,`CSET\tEQ`
|
|
|
|
return x == y
|
|
|
|
}
|
|
|
|
|
|
|
|
func i2(x I, y *T) bool {
|
|
|
|
// amd64:-`.*faceeq`,`SETEQ`
|
|
|
|
// arm64:-`.*faceeq`,`CSET\tEQ`
|
|
|
|
return y == x
|
|
|
|
}
|