aboutsummaryrefslogtreecommitdiff
path: root/test/codegen
diff options
context:
space:
mode:
authorJorropo <jorropo.pgm@gmail.com>2026-04-07 11:57:56 +0200
committerGopher Robot <gobot@golang.org>2026-04-09 04:42:54 -0700
commit455d4f41fb1c2bf48645b4904a8ee293272c90db (patch)
tree6c845ced29a36abeccabbc6e092691b1f7e0631d /test/codegen
parent996b985008c7615004c0dbe8b031928faff3c993 (diff)
downloadgo-455d4f41fb1c2bf48645b4904a8ee293272c90db.tar.xz
cmd/compile: run CondSelect into math rules on all arches
Fixes #78558 I've also added tests to make sure PPC still generate ISEL when the constant isn't 1. This is to make sure we aren't generating a sequence that wouldn't work right now. But it does not mean we couldn't try to optimize other constants on PPC64 if a fast sequence exists; for example like arm64's inline register shifts. Change-Id: Ic241d593149b7a11533948f5d4c52db357cc134f Reviewed-on: https://go-review.googlesource.com/c/go/+/763340 Reviewed-by: Keith Randall <khr@google.com> Auto-Submit: Jorropo <jorropo.pgm@gmail.com> Reviewed-by: David Chase <drchase@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Jayanth Krishnamurthy <jayanth.krishnamurthy@ibm.com> Reviewed-by: Paul Murphy <paumurph@redhat.com>
Diffstat (limited to 'test/codegen')
-rw-r--r--test/codegen/condmove.go20
1 files changed, 20 insertions, 0 deletions
diff --git a/test/codegen/condmove.go b/test/codegen/condmove.go
index 43ca9a961f..8527ff2896 100644
--- a/test/codegen/condmove.go
+++ b/test/codegen/condmove.go
@@ -481,6 +481,7 @@ func cmovmathadd2(a uint, b bool) uint {
}
// amd64:"LEAQ" -"CMOV" -"MUL"
// arm64:"ADD R[0-9]+<<1" -"CSEL" -"MUL"
+ // ppc64x: "ISEL" -"MUL"
return a
}
func cmovmathadd2else(a uint, b bool) uint {
@@ -489,6 +490,7 @@ func cmovmathadd2else(a uint, b bool) uint {
}
// amd64:"LEAQ" -"CMOV" -"MUL"
// arm64:"ADD R[0-9]+<<1" -"CSEL" -"MUL"
+ // ppc64x: "ISEL" -"MUL"
return a
}
@@ -498,6 +500,7 @@ func cmovmathadd4(a uint, b bool) uint {
}
// amd64:"LEAQ" -"CMOV" -"MUL"
// arm64:"ADD R[0-9]+<<2" -"CSEL" -"MUL"
+ // ppc64x: "ISEL" -"MUL"
return a
}
func cmovmathadd4else(a uint, b bool) uint {
@@ -506,6 +509,7 @@ func cmovmathadd4else(a uint, b bool) uint {
}
// amd64:"LEAQ" -"CMOV" -"MUL"
// arm64:"ADD R[0-9]+<<2" -"CSEL" -"MUL"
+ // ppc64x: "ISEL" -"MUL"
return a
}
@@ -515,6 +519,7 @@ func cmovmathadd8(a uint, b bool) uint {
}
// amd64:"LEAQ" -"CMOV" -"MUL"
// arm64:"ADD R[0-9]+<<3" -"CSEL" -"MUL"
+ // ppc64x: "ISEL" -"MUL"
return a
}
func cmovmathadd8else(a uint, b bool) uint {
@@ -523,6 +528,7 @@ func cmovmathadd8else(a uint, b bool) uint {
}
// amd64:"LEAQ" -"CMOV" -"MUL"
// arm64:"ADD R[0-9]+<<3" -"CSEL" -"MUL"
+ // ppc64x: "ISEL" -"MUL"
return a
}
@@ -531,6 +537,7 @@ func cmovmathadd9223372036854775808(a uint, b bool) uint {
a += 1 << 63
}
// arm64:"ADD R[0-9]+<<63" -"CSEL" -"MUL"
+ // ppc64x: "ISEL" -"MUL"
return a
}
func cmovmathadd9223372036854775808else(a uint, b bool) uint {
@@ -538,6 +545,7 @@ func cmovmathadd9223372036854775808else(a uint, b bool) uint {
a += 1 << 63
}
// arm64:"ADD R[0-9]+<<63" -"CSEL" -"MUL"
+ // ppc64x: "ISEL" -"MUL"
return a
}
@@ -567,6 +575,7 @@ func cmovmathsub2(a uint, b bool) uint {
a -= 2
}
// arm64 :"SUB R[0-9]+<<1" -"CSEL" -"MUL"
+ // ppc64x: "ISEL" -"MUL"
return a
}
func cmovmathsub2else(a uint, b bool) uint {
@@ -574,6 +583,7 @@ func cmovmathsub2else(a uint, b bool) uint {
a -= 2
}
// arm64 :"SUB R[0-9]+<<1" -"CSEL" -"MUL"
+ // ppc64x: "ISEL" -"MUL"
return a
}
@@ -584,6 +594,7 @@ func cmovmathsub9223372036854775808(a uint, b bool) uint {
a -= 1 << 63
}
// arm64:"(SUB|ADD) R[0-9]+<<63" -"CSEL" -"MUL"
+ // ppc64x: "ISEL" -"MUL"
return a
}
func cmovmathsub9223372036854775808else(a uint, b bool) uint {
@@ -591,6 +602,7 @@ func cmovmathsub9223372036854775808else(a uint, b bool) uint {
a -= 1 << 63
}
// arm64:"(SUB|ADD) R[0-9]+<<63" -"CSEL" -"MUL"
+ // ppc64x: "ISEL" -"MUL"
return a
}
@@ -685,6 +697,7 @@ func cmovmathor2(a uint, b bool) uint {
a |= 2
}
// arm64:"ORR R[0-9]+<<1" -"CSEL" -"MUL"
+ // ppc64x:"ISEL" -"MUL"
return a
}
func cmovmathor2else(a uint, b bool) uint {
@@ -692,6 +705,7 @@ func cmovmathor2else(a uint, b bool) uint {
a |= 2
}
// arm64:"ORR R[0-9]+<<1" -"CSEL" -"MUL"
+ // ppc64x:"ISEL" -"MUL"
return a
}
@@ -700,6 +714,7 @@ func cmovmathor9223372036854775808(a uint, b bool) uint {
a |= 1 << 63
}
// arm64:"ORR R[0-9]+<<63" -"CSEL" -"MUL"
+ // ppc64x:"ISEL" -"MUL"
return a
}
func cmovmathor9223372036854775808else(a uint, b bool) uint {
@@ -707,6 +722,7 @@ func cmovmathor9223372036854775808else(a uint, b bool) uint {
a |= 1 << 63
}
// arm64:"ORR R[0-9]+<<63" -"CSEL" -"MUL"
+ // ppc64x:"ISEL" -"MUL"
return a
}
@@ -736,6 +752,7 @@ func cmovmathxor2(a uint, b bool) uint {
a ^= 2
}
// arm64:"EOR R[0-9]+<<1" -"CSEL" -"MUL"
+ // ppc64x: "ISEL" -"MUL"
return a
}
func cmovmathxor2else(a uint, b bool) uint {
@@ -743,6 +760,7 @@ func cmovmathxor2else(a uint, b bool) uint {
a ^= 2
}
// arm64:"EOR R[0-9]+<<1" -"CSEL" -"MUL"
+ // ppc64x: "ISEL" -"MUL"
return a
}
@@ -751,6 +769,7 @@ func cmovmathxor9223372036854775808(a uint, b bool) uint {
a ^= 1 << 63
}
// arm64:"EOR R[0-9]+<<63" -"CSEL" -"MUL"
+ // ppc64x: "ISEL" -"MUL"
return a
}
func cmovmathxor9223372036854775808else(a uint, b bool) uint {
@@ -758,6 +777,7 @@ func cmovmathxor9223372036854775808else(a uint, b bool) uint {
a ^= 1 << 63
}
// arm64:"EOR R[0-9]+<<63" -"CSEL" -"MUL"
+ // ppc64x: "ISEL" -"MUL"
return a
}