aboutsummaryrefslogtreecommitdiff
path: root/test/codegen
diff options
context:
space:
mode:
authorJorropo <jorropo.pgm@gmail.com>2026-03-29 05:06:28 +0200
committerGopher Robot <gobot@golang.org>2026-03-31 10:58:48 -0700
commitd9fbe4c90d956f7835224f4de1afcf799e8cc3ed (patch)
tree7abada6931391ebd4659ff941f4c8617064f66fa /test/codegen
parentde7f006df2a70df34d6bd814489ba675153e829e (diff)
downloadgo-d9fbe4c90d956f7835224f4de1afcf799e8cc3ed.tar.xz
cmd/compile: convert some condmoves in XOR
Similar to CL 685676 but for XOR. Change-Id: Ib5ffd4c13348f176a808b3218fdbbafc2c42794f Reviewed-on: https://go-review.googlesource.com/c/go/+/760921 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Junyang Shao <shaojunyang@google.com> Auto-Submit: Jorropo <jorropo.pgm@gmail.com> Reviewed-by: Keith Randall <khr@google.com> Reviewed-by: Keith Randall <khr@golang.org>
Diffstat (limited to 'test/codegen')
-rw-r--r--test/codegen/condmove.go11
1 files changed, 11 insertions, 0 deletions
diff --git a/test/codegen/condmove.go b/test/codegen/condmove.go
index 7ccdd6e3e1..5633da10fe 100644
--- a/test/codegen/condmove.go
+++ b/test/codegen/condmove.go
@@ -521,6 +521,17 @@ func cmovmathor(a uint, b bool) uint {
return a
}
+func cmovmathxor(a uint, b bool) uint {
+ if b {
+ a ^= 1
+ }
+ // amd64:"XORQ", -"CMOV"
+ // arm64:"EOR", -"CSEL"
+ // ppc64x:"XOR", -"ISEL"
+ // wasm:"I64Xor", -"Select"
+ return a
+}
+
func branchlessBoolToUint8(b bool) (r uint8) {
if b {
r = 1