]> Cypherpunks.ru repositories - gostls13.git/blob - test/codegen/clobberdead.go
732be5f73b9954a01438f380f9ce6724e5a32c86
[gostls13.git] / test / codegen / clobberdead.go
1 // asmcheck -gcflags=-clobberdead
2
3 // +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
9 package codegen
10
11 type T [2]*int // contain pointer, not SSA-able (so locals are not registerized)
12
13 var p1, p2, p3 T
14
15 func 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
32 func use(T) {}
33
34 //go:noinline
35 func addrTaken(*T) {}