From: Paul E. Murphy Date: Mon, 24 Oct 2022 22:12:57 +0000 (-0500) Subject: codegen: check for PPC64 ISEL in condmove tests X-Git-Tag: go1.20rc1~404 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=390abbbbf1018f9bb814baf6ab38e31efaf58666;p=gostls13.git 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 Reviewed-by: Bryan Mills TryBot-Result: Gopher Robot Run-TryBot: Paul Murphy Reviewed-by: Than McIntosh --- 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 }