mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
test: make codegen/memops.go work with both ABIs
Following CL 309335, this fixes memops.go. Change-Id: Ia2458b5267deee9f906f76c50e70a021ea2fcb5b Reviewed-on: https://go-review.googlesource.com/c/go/+/309552 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> Reviewed-by: Than McIntosh <thanm@google.com>
This commit is contained in:
parent
13a4e8c41c
commit
444d28295b
1 changed files with 18 additions and 34 deletions
|
|
@ -36,50 +36,34 @@ func compMem1() int {
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
//go:noinline
|
type T struct {
|
||||||
func f(x int) bool {
|
x bool
|
||||||
return false
|
x8 uint8
|
||||||
|
x16 uint16
|
||||||
|
x32 uint32
|
||||||
|
x64 uint64
|
||||||
|
a [2]int // force it passed in memory
|
||||||
}
|
}
|
||||||
|
|
||||||
//go:noinline
|
func compMem2(t T) int {
|
||||||
func f8(x int) int8 {
|
// amd64:`CMPB\t.*\(SP\), [$]0`
|
||||||
return 0
|
if t.x {
|
||||||
}
|
|
||||||
|
|
||||||
//go:noinline
|
|
||||||
func f16(x int) int16 {
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
//go:noinline
|
|
||||||
func f32(x int) int32 {
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
//go:noinline
|
|
||||||
func f64(x int) int64 {
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
func compMem2() int {
|
|
||||||
// amd64:`CMPB\t8\(SP\), [$]0`
|
|
||||||
if f(3) {
|
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
// amd64:`CMPB\t8\(SP\), [$]7`
|
// amd64:`CMPB\t.*\(SP\), [$]7`
|
||||||
if f8(3) == 7 {
|
if t.x8 == 7 {
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
// amd64:`CMPW\t8\(SP\), [$]7`
|
// amd64:`CMPW\t.*\(SP\), [$]7`
|
||||||
if f16(3) == 7 {
|
if t.x16 == 7 {
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
// amd64:`CMPL\t8\(SP\), [$]7`
|
// amd64:`CMPL\t.*\(SP\), [$]7`
|
||||||
if f32(3) == 7 {
|
if t.x32 == 7 {
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
// amd64:`CMPQ\t8\(SP\), [$]7`
|
// amd64:`CMPQ\t.*\(SP\), [$]7`
|
||||||
if f64(3) == 7 {
|
if t.x64 == 7 {
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
return 0
|
return 0
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue