mirror of
https://github.com/golang/go
synced 2024-09-15 22:20:06 +00:00
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>
This commit is contained in:
parent
8ec1c9e285
commit
390abbbbf1
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue