github.com/hikaru7719/go@v0.0.0-20181025140707-c8b2ac68906a/test/codegen/structs.go (about)

     1  // asmcheck
     2  
     3  // Copyright 2018 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  // This file contains code generation tests related to the handling of
    10  // struct types.
    11  
    12  // ------------- //
    13  //    Zeroing    //
    14  // ------------- //
    15  
    16  type Z1 struct {
    17  	a, b, c int
    18  }
    19  
    20  func Zero1(t *Z1) { // Issue #18370
    21  	// amd64:`XORPS\tX., X`,`MOVUPS\tX., \(.*\)`,`MOVQ\t\$0, 16\(.*\)`
    22  	*t = Z1{}
    23  }
    24  
    25  type Z2 struct {
    26  	a, b, c *int
    27  }
    28  
    29  func Zero2(t *Z2) {
    30  	// amd64:`XORPS\tX., X`,`MOVUPS\tX., \(.*\)`,`MOVQ\t\$0, 16\(.*\)`
    31  	// amd64:`.*runtime[.]gcWriteBarrier\(SB\)`
    32  	*t = Z2{}
    33  }
    34  
    35  // ------------------ //
    36  //    Initializing    //
    37  // ------------------ //
    38  
    39  type I1 struct {
    40  	a, b, c, d int
    41  }
    42  
    43  func Init1(p *I1) { // Issue #18872
    44  	// amd64:`MOVQ\t[$]1`,`MOVQ\t[$]2`,`MOVQ\t[$]3`,`MOVQ\t[$]4`
    45  	*p = I1{1, 2, 3, 4}
    46  }