Debian Codegraph @

test/codegen/structs.go

raw
1 // asmcheck
2
3 //go:build !goexperiment.cgocheck2
4
5 // Copyright 2018 The Go Authors. All rights reserved.
6 // Use of this source code is governed by a BSD-style
7 // license that can be found in the LICENSE file.
8
9 package codegen
10
11 // This file contains code generation tests related to the handling of
12 // struct types.
13
14 // ------------- //
15 // Zeroing //
16 // ------------- //
17
18 type Z1 struct {
19 a, b, c int
20 }
21
22 func Zero1(t *Z1) { // Issue #18370
23 // amd64:`MOVUPS X[0-9]+, \(.*\)`,`MOVQ \$0, 16\(.*\)`
24 *t = Z1{}
25 }
26
27 type Z2 struct {
28 a, b, c *int
29 }
30
31 func Zero2(t *Z2) {
32 // amd64:`MOVUPS X[0-9]+, \(.*\)`,`MOVQ \$0, 16\(.*\)`
33 // amd64:`.*runtime[.]gcWriteBarrier.*\(SB\)`
34 *t = Z2{}
35 }
36
37 // ------------------ //
38 // Initializing //
39 // ------------------ //
40
41 type I1 struct {
42 a, b, c, d int
43 }
44
45 func Init1(p *I1) { // Issue #18872
46 // amd64:`MOVQ [$]1`,`MOVQ [$]2`,`MOVQ [$]3`,`MOVQ [$]4`
47 *p = I1{1, 2, 3, 4}
48 }