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