mirror of
https://github.com/golang/go
synced 2024-11-07 05:56:18 -07:00
263e13d1f7
Some codegen tests were written with the assumption that arguments and results are in memory, and with a specific stack layout. With the register ABI, the assumption is no longer true. Adjust the tests to work with both cases. - For tests expecting in memory arguments/results, change to use global variables or memory-assigned argument/results. - Allow more registers. E.g. some tests expecting register names contain only letters (e.g. AX), but it can also contain numbers (e.g. R10). - Some instruction selection changes when operate on register vs. memory, e.g. ADDQ vs. LEAQ, MOVB vs. MOVL. Accept both. TODO: mathbits.go and memops.go still need fix. Change-Id: Ic5932b4b5dd3f5d30ed078d296476b641420c4c5 Reviewed-on: https://go-review.googlesource.com/c/go/+/309335 Trust: Cherry Zhang <cherryyz@google.com> Run-TryBot: Cherry Zhang <cherryyz@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: David Chase <drchase@google.com>
26 lines
610 B
Go
26 lines
610 B
Go
// asmcheck
|
|
|
|
// Copyright 2018 The Go Authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style
|
|
// license that can be found in the LICENSE file.
|
|
|
|
// Make sure a pointer variable and a zero-sized variable
|
|
// aren't allocated to the same stack slot.
|
|
// See issue 24993.
|
|
|
|
package codegen
|
|
|
|
func zeroSize() {
|
|
c := make(chan struct{})
|
|
// amd64:`MOVQ\t\$0, ""\.s\+56\(SP\)`
|
|
var s *int
|
|
// force s to be a stack object, also use some (fixed) stack space
|
|
g(&s, 1, 2, 3, 4, 5)
|
|
|
|
// amd64:`LEAQ\t""\..*\+55\(SP\)`
|
|
c <- struct{}{}
|
|
}
|
|
|
|
//go:noinline
|
|
func g(**int, int, int, int, int, int) {}
|