]> Cypherpunks.ru repositories - gostls13.git/blob - test/codegen/clobberdeadreg.go
2a93c410f9d3cde8506fdf596714c36ad21c6f49
[gostls13.git] / test / codegen / clobberdeadreg.go
1 // asmcheck -gcflags=-clobberdeadreg
2
3 // +build amd64
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 S struct {
12         a, b, c, d, e, f int
13 }
14
15 func F(a, b, c int, d S) {
16         // -2401018187971961171 is 0xdeaddeaddeaddead
17         // amd64:`MOVQ\t\$-2401018187971961171, AX`, `MOVQ\t\$-2401018187971961171, BX`, `MOVQ\t\$-2401018187971961171, CX`
18         // amd64:`MOVQ\t\$-2401018187971961171, DX`, `MOVQ\t\$-2401018187971961171, SI`, `MOVQ\t\$-2401018187971961171, DI`
19         // amd64:`MOVQ\t\$-2401018187971961171, R8`, `MOVQ\t\$-2401018187971961171, R9`, `MOVQ\t\$-2401018187971961171, R10`
20         // amd64:`MOVQ\t\$-2401018187971961171, R11`, `MOVQ\t\$-2401018187971961171, R12`, `MOVQ\t\$-2401018187971961171, R13`
21         // amd64:-`MOVQ\t\$-2401018187971961171, BP` // frame pointer is not clobbered
22         StackArgsCall([10]int{a, b, c})
23         // amd64:`MOVQ\t\$-2401018187971961171, R12`, `MOVQ\t\$-2401018187971961171, R13`, `MOVQ\t\$-2401018187971961171, DX`
24         // amd64:-`MOVQ\t\$-2401018187971961171, AX`, -`MOVQ\t\$-2401018187971961171, R11` // register args are not clobbered
25         RegArgsCall(a, b, c, d)
26 }
27
28 //go:noinline
29 func StackArgsCall([10]int) {}
30
31 //go:noinline
32 //go:registerparams
33 func RegArgsCall(int, int, int, S) {}