Cherry Zhang | 6ae3b70 | 2021-03-17 19:15:38 -0400 | [diff] [blame] | 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 |
Cherry Zhang | 263e13d | 2021-04-12 14:00:49 -0400 | [diff] [blame] | 22 | StackArgsCall([10]int{a, b, c}) |
Cherry Zhang | 6ae3b70 | 2021-03-17 19:15:38 -0400 | [diff] [blame] | 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 |
Cherry Zhang | 263e13d | 2021-04-12 14:00:49 -0400 | [diff] [blame] | 29 | func StackArgsCall([10]int) {} |
Cherry Zhang | 6ae3b70 | 2021-03-17 19:15:38 -0400 | [diff] [blame] | 30 | |
| 31 | //go:noinline |
| 32 | //go:registerparams |
| 33 | func RegArgsCall(int, int, int, S) {} |