Debian Codegraph @

test/codegen/ifaces.go

raw
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 }
28
29 func e1(x any, y *int) bool {
30 // amd64:-`.*faceeq`,`SETEQ`
31 // arm64:-`.*faceeq`,`CSET\tEQ`
32 return x == y
33 }
34
35 func e2(x any, y *int) bool {
36 // amd64:-`.*faceeq`,`SETEQ`
37 // arm64:-`.*faceeq`,`CSET\tEQ`
38 return y == x
39 }
40
41 type E *int
42
43 func e3(x any, y E) bool {
44 // amd64:-`.*faceeq`,`SETEQ`
45 // arm64:-`.*faceeq`,`CSET\tEQ`
46 return x == y
47 }
48
49 type T int
50
51 func (t *T) M() {}
52
53 func i1(x I, y *T) bool {
54 // amd64:-`.*faceeq`,`SETEQ`
55 // arm64:-`.*faceeq`,`CSET\tEQ`
56 return x == y
57 }
58
59 func i2(x I, y *T) bool {
60 // amd64:-`.*faceeq`,`SETEQ`
61 // arm64:-`.*faceeq`,`CSET\tEQ`
62 return y == x
63 }