aboutsummaryrefslogtreecommitdiff
path: root/test/codegen
diff options
context:
space:
mode:
authorKeith Randall <khr@golang.org>2025-11-17 22:40:26 -0800
committerKeith Randall <khr@golang.org>2025-11-18 09:31:58 -0800
commitba634ca5c7f19105c853db5752cc0f6d3ca76e45 (patch)
treec3d7685b0e82b214764e560dae42f2fdb4bf00dc /test/codegen
parent8806d53c106ba9d797a4383b2a49418c509a42c2 (diff)
downloadgo-ba634ca5c7f19105c853db5752cc0f6d3ca76e45.tar.xz
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>
Diffstat (limited to 'test/codegen')
-rw-r--r--test/codegen/bool.go15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/codegen/bool.go b/test/codegen/bool.go
index 37f85a45b7..8fe7a94687 100644
--- a/test/codegen/bool.go
+++ b/test/codegen/bool.go
@@ -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
+}