mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/compile: fold boolean NOT into branches
Gets rid of an EOR $1 instruction. Change-Id: Ib032b0cee9ac484329c978af9b1305446f8d5dac Reviewed-on: https://go-review.googlesource.com/c/go/+/721501 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Junyang Shao <shaojunyang@google.com> Reviewed-by: Keith Randall <khr@google.com>
This commit is contained in:
parent
8806d53c10
commit
ba634ca5c7
3 changed files with 48 additions and 0 deletions
|
|
@ -313,3 +313,18 @@ func constantWrite(b bool, p *bool) {
|
|||
*p = b
|
||||
}
|
||||
}
|
||||
|
||||
func boolCompare1(p, q *bool) int {
|
||||
// arm64:-"EOR [$]1"
|
||||
if *p == *q {
|
||||
return 5
|
||||
}
|
||||
return 7
|
||||
}
|
||||
func boolCompare2(p, q *bool) int {
|
||||
// arm64:-"EOR [$]1"
|
||||
if *p != *q {
|
||||
return 5
|
||||
}
|
||||
return 7
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue