aboutsummaryrefslogtreecommitdiff
path: root/test/codegen
diff options
context:
space:
mode:
authorPaul E. Murphy <murp@ibm.com>2022-10-24 17:12:57 -0500
committerPaul Murphy <murp@ibm.com>2022-11-07 15:19:20 +0000
commit390abbbbf1018f9bb814baf6ab38e31efaf58666 (patch)
tree518b289186f9ed64f81ae5eb5911c46c5429be92 /test/codegen
parent8ec1c9e2850c642e3ebd0ea3a9749dd13cd4545a (diff)
downloadgo-390abbbbf1018f9bb814baf6ab38e31efaf58666.tar.xz
codegen: check for PPC64 ISEL in condmove tests
ISEL is roughly equivalent to CMOV on PPC64. Verify ISEL generation in all reasonable cases. Note "ISEL test x y z" is the same as "ISEL !test y x z". test is always one of LT (0), GT (1), EQ (2), SO (3). Sometimes x and y are swapped if GE/LE/NE is desired. Change-Id: Ie1bf029224064e004d855099731fe5e8d05aa990 Reviewed-on: https://go-review.googlesource.com/c/go/+/445215 Reviewed-by: Lynn Boger <laboger@linux.vnet.ibm.com> Reviewed-by: Bryan Mills <bcmills@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Paul Murphy <murp@ibm.com> Reviewed-by: Than McIntosh <thanm@google.com>
Diffstat (limited to 'test/codegen')
-rw-r--r--test/codegen/condmove.go24
1 files changed, 23 insertions, 1 deletions
diff --git a/test/codegen/condmove.go b/test/codegen/condmove.go
index 707f223fa3..793bd7f973 100644
--- a/test/codegen/condmove.go
+++ b/test/codegen/condmove.go
@@ -13,6 +13,8 @@ func cmovint(c int) int {
}
// amd64:"CMOVQLT"
// arm64:"CSEL\tLT"
+ // ppc64:"ISEL\t[$]0"
+ // ppc64le:"ISEL\t[$]0"
// wasm:"Select"
return x
}
@@ -23,6 +25,8 @@ func cmovchan(x, y chan int) chan int {
}
// amd64:"CMOVQNE"
// arm64:"CSEL\tNE"
+ // ppc64:"ISEL\t[$]2"
+ // ppc64le:"ISEL\t[$]2"
// wasm:"Select"
return x
}
@@ -33,6 +37,8 @@ func cmovuintptr(x, y uintptr) uintptr {
}
// amd64:"CMOVQ(HI|CS)"
// arm64:"CSNEG\tLS"
+ // ppc64:"ISEL\t[$]1"
+ // ppc64le:"ISEL\t[$]1"
// wasm:"Select"
return x
}
@@ -43,6 +49,8 @@ func cmov32bit(x, y uint32) uint32 {
}
// amd64:"CMOVL(HI|CS)"
// arm64:"CSNEG\t(LS|HS)"
+ // ppc64:"ISEL\t[$]1"
+ // ppc64le:"ISEL\t[$]1"
// wasm:"Select"
return x
}
@@ -53,6 +61,8 @@ func cmov16bit(x, y uint16) uint16 {
}
// amd64:"CMOVW(HI|CS)"
// arm64:"CSNEG\t(LS|HS)"
+ // ppc64:"ISEL\t[$]0"
+ // ppc64le:"ISEL\t[$]0"
// wasm:"Select"
return x
}
@@ -66,6 +76,8 @@ func cmovfloateq(x, y float64) int {
}
// amd64:"CMOVQNE","CMOVQPC"
// arm64:"CSEL\tEQ"
+ // ppc64:"ISEL\t[$]2"
+ // ppc64le:"ISEL\t[$]2"
// wasm:"Select"
return a
}
@@ -77,6 +89,8 @@ func cmovfloatne(x, y float64) int {
}
// amd64:"CMOVQNE","CMOVQPS"
// arm64:"CSEL\tNE"
+ // ppc64:"ISEL\t[$]2"
+ // ppc64le:"ISEL\t[$]2"
// wasm:"Select"
return a
}
@@ -103,6 +117,8 @@ func cmovfloatint2(x, y float64) float64 {
}
// amd64:"CMOVQHI"
// arm64:"CSEL\tMI"
+ // ppc64:"ISEL\t[$]0"
+ // ppc64le:"ISEL\t[$]0"
// wasm:"Select"
r = r - ldexp(y, rexp-yexp)
}
@@ -117,6 +133,8 @@ func cmovloaded(x [4]int, y int) int {
}
// amd64:"CMOVQNE"
// arm64:"CSEL\tNE"
+ // ppc64:"ISEL\t[$]2"
+ // ppc64le:"ISEL\t[$]2"
// wasm:"Select"
return y
}
@@ -128,11 +146,13 @@ func cmovuintptr2(x, y uintptr) uintptr {
}
// amd64:"CMOVQEQ"
// arm64:"CSEL\tEQ"
+ // ppc64:"ISEL\t[$]2"
+ // ppc64le:"ISEL\t[$]2"
// wasm:"Select"
return a
}
-// Floating point CMOVs are not supported by amd64/arm64
+// Floating point CMOVs are not supported by amd64/arm64/ppc64/ppc64le
func cmovfloatmove(x, y int) float64 {
a := 1.0
if x <= y {
@@ -140,6 +160,8 @@ func cmovfloatmove(x, y int) float64 {
}
// amd64:-"CMOV"
// arm64:-"CSEL"
+ // ppc64:-"ISEL"
+ // ppc64le:-"ISEL"
// wasm:-"Select"
return a
}