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