blob: 2a93c410f9d3cde8506fdf596714c36ad21c6f49 [file] [log] [blame]
Cherry Zhang6ae3b702021-03-17 19:15:38 -04001// 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
9package codegen
10
11type S struct {
12 a, b, c, d, e, f int
13}
14
15func 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
Cherry Zhang263e13d2021-04-12 14:00:49 -040022 StackArgsCall([10]int{a, b, c})
Cherry Zhang6ae3b702021-03-17 19:15:38 -040023 // 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
Cherry Zhang263e13d2021-04-12 14:00:49 -040029func StackArgsCall([10]int) {}
Cherry Zhang6ae3b702021-03-17 19:15:38 -040030
31//go:noinline
32//go:registerparams
33func RegArgsCall(int, int, int, S) {}