From d9fbe4c90d956f7835224f4de1afcf799e8cc3ed Mon Sep 17 00:00:00 2001 From: Jorropo Date: Sun, 29 Mar 2026 05:06:28 +0200 Subject: 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 Reviewed-by: Junyang Shao Auto-Submit: Jorropo Reviewed-by: Keith Randall Reviewed-by: Keith Randall --- test/codegen/condmove.go | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'test/codegen') 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 -- cgit v1.3-5-g9baa