mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/compile: recognize bit test patterns on amd64
Updates #18943 Change-Id: If3080d6133bb6d2710b57294da24c90251ab4e08 Reviewed-on: https://go-review.googlesource.com/36329 Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Keith Randall <khr@golang.org>
This commit is contained in:
parent
ac7761e1a4
commit
2183135554
7 changed files with 852 additions and 2 deletions
|
|
@ -504,6 +504,45 @@ var linuxAMD64Tests = []*asmTest{
|
|||
`,
|
||||
[]string{"\"abc\""},
|
||||
},
|
||||
// Bit test ops on amd64, issue 18943.
|
||||
{
|
||||
`
|
||||
func f37(a, b uint64) int {
|
||||
if a&(1<<(b&63)) != 0 {
|
||||
return 1
|
||||
}
|
||||
return -1
|
||||
}
|
||||
`,
|
||||
[]string{"\tBTQ\t"},
|
||||
},
|
||||
{
|
||||
`
|
||||
func f38(a, b uint64) bool {
|
||||
return a&(1<<(b&63)) != 0
|
||||
}
|
||||
`,
|
||||
[]string{"\tBTQ\t"},
|
||||
},
|
||||
{
|
||||
`
|
||||
func f39(a uint64) int {
|
||||
if a&(1<<60) != 0 {
|
||||
return 1
|
||||
}
|
||||
return -1
|
||||
}
|
||||
`,
|
||||
[]string{"\tBTQ\t\\$60"},
|
||||
},
|
||||
{
|
||||
`
|
||||
func f40(a uint64) bool {
|
||||
return a&(1<<60) != 0
|
||||
}
|
||||
`,
|
||||
[]string{"\tBTQ\t\\$60"},
|
||||
},
|
||||
}
|
||||
|
||||
var linux386Tests = []*asmTest{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue