1// asmcheck -gcflags=-clobberdead
2
3//go:build amd64 || arm64
4
5// Copyright 2021 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
11type T [2]*int // contain pointer, not SSA-able (so locals are not registerized)
12
13var p1, p2, p3 T
14
15func F() {
16	// 3735936685 is 0xdeaddead. On ARM64 R27 is REGTMP.
17	// clobber x, y at entry. not clobber z (stack object).
18	// amd64:`MOVL\t\$3735936685, command-line-arguments\.x`, `MOVL\t\$3735936685, command-line-arguments\.y`, -`MOVL\t\$3735936685, command-line-arguments\.z`
19	// arm64:`MOVW\tR27, command-line-arguments\.x`, `MOVW\tR27, command-line-arguments\.y`, -`MOVW\tR27, command-line-arguments\.z`
20	x, y, z := p1, p2, p3
21	addrTaken(&z)
22	// x is dead at the call (the value of x is loaded before the CALL), y is not
23	// amd64:`MOVL\t\$3735936685, command-line-arguments\.x`, -`MOVL\t\$3735936685, command-line-arguments\.y`
24	// arm64:`MOVW\tR27, command-line-arguments\.x`, -`MOVW\tR27, command-line-arguments\.y`
25	use(x)
26	// amd64:`MOVL\t\$3735936685, command-line-arguments\.x`, `MOVL\t\$3735936685, command-line-arguments\.y`
27	// arm64:`MOVW\tR27, command-line-arguments\.x`, `MOVW\tR27, command-line-arguments\.y`
28	use(y)
29}
30
31//go:noinline
32func use(T) {}
33
34//go:noinline
35func addrTaken(*T) {}
36