]> Cypherpunks.ru repositories - gostls13.git/blob - test/codegen/ifaces.go
cmd/compile: use cache in front of type assert runtime call
[gostls13.git] / test / codegen / ifaces.go
1 // asmcheck
2
3 // Copyright 2022 The Go Authors. All rights reserved.
4 // Use of this source code is governed by a BSD-style
5 // license that can be found in the LICENSE file.
6
7 package codegen
8
9 type I interface{ M() }
10
11 func NopConvertIface(x I) I {
12         // amd64:-`.*runtime.convI2I`
13         return I(x)
14 }
15
16 func NopConvertGeneric[T any](x T) T {
17         // amd64:-`.*runtime.convI2I`
18         return T(x)
19 }
20
21 var NopConvertGenericIface = NopConvertGeneric[I]
22
23 func ConvToM(x any) I {
24         // amd64:`CALL\truntime.typeAssert`,`MOVL\t16\(.*\)`,`MOVQ\t8\(.*\)(.*\*1)`
25         // arm64:`CALL\truntime.typeAssert`,`LDAR`,`MOVWU`,`MOVD\t\(R.*\)\(R.*\)`
26         return x.(I)
27 }