From a37672bb7bef3d0163dd18f9f6914e2f829f1148 Mon Sep 17 00:00:00 2001 From: "Paul E. Murphy" Date: Wed, 18 Jan 2023 15:20:15 -0600 Subject: [PATCH] test/codegen: accept ppc64x as alias for ppc64le and ppc64 arches This helps simplify the noise when adding ppc codegen tests. ppc64x is used in other places to indicate something which runs on either endian. This helps cleanup existing codegen tests which are mostly identical between endian variants. condmove tests are converted as an example. Change-Id: I2b2d98a9a1859015f62db38d62d9d5d7593435b4 Reviewed-on: https://go-review.googlesource.com/c/go/+/462895 Reviewed-by: Cherry Mui Reviewed-by: Matthew Dempsky TryBot-Result: Gopher Robot Run-TryBot: Paul Murphy --- test/codegen/condmove.go | 41 ++++++++++++++-------------------------- test/run.go | 24 +++++++++++++++-------- 2 files changed, 30 insertions(+), 35 deletions(-) diff --git a/test/codegen/condmove.go b/test/codegen/condmove.go index 7b0f32e708..6c08116b2c 100644 --- a/test/codegen/condmove.go +++ b/test/codegen/condmove.go @@ -13,8 +13,7 @@ func cmovint(c int) int { } // amd64:"CMOVQLT" // arm64:"CSEL\tLT" - // ppc64:"ISEL\t[$]0" - // ppc64le:"ISEL\t[$]0" + // ppc64x:"ISEL\t[$]0" // wasm:"Select" return x } @@ -25,8 +24,7 @@ func cmovchan(x, y chan int) chan int { } // amd64:"CMOVQNE" // arm64:"CSEL\tNE" - // ppc64:"ISEL\t[$]2" - // ppc64le:"ISEL\t[$]2" + // ppc64x:"ISEL\t[$]2" // wasm:"Select" return x } @@ -37,8 +35,7 @@ func cmovuintptr(x, y uintptr) uintptr { } // amd64:"CMOVQ(HI|CS)" // arm64:"CSNEG\tLS" - // ppc64:"ISEL\t[$]1" - // ppc64le:"ISEL\t[$]1" + // ppc64x:"ISEL\t[$]1" // wasm:"Select" return x } @@ -49,8 +46,7 @@ func cmov32bit(x, y uint32) uint32 { } // amd64:"CMOVL(HI|CS)" // arm64:"CSNEG\t(LS|HS)" - // ppc64:"ISEL\t[$]1" - // ppc64le:"ISEL\t[$]1" + // ppc64x:"ISEL\t[$]1" // wasm:"Select" return x } @@ -61,8 +57,7 @@ func cmov16bit(x, y uint16) uint16 { } // amd64:"CMOVW(HI|CS)" // arm64:"CSNEG\t(LS|HS)" - // ppc64:"ISEL\t[$]0" - // ppc64le:"ISEL\t[$]0" + // ppc64x:"ISEL\t[$]0" // wasm:"Select" return x } @@ -76,8 +71,7 @@ func cmovfloateq(x, y float64) int { } // amd64:"CMOVQNE","CMOVQPC" // arm64:"CSEL\tEQ" - // ppc64:"ISEL\t[$]2" - // ppc64le:"ISEL\t[$]2" + // ppc64x:"ISEL\t[$]2" // wasm:"Select" return a } @@ -89,8 +83,7 @@ func cmovfloatne(x, y float64) int { } // amd64:"CMOVQNE","CMOVQPS" // arm64:"CSEL\tNE" - // ppc64:"ISEL\t[$]2" - // ppc64le:"ISEL\t[$]2" + // ppc64x:"ISEL\t[$]2" // wasm:"Select" return a } @@ -117,8 +110,7 @@ func cmovfloatint2(x, y float64) float64 { } // amd64:"CMOVQHI" // arm64:"CSEL\tMI" - // ppc64:"ISEL\t[$]0" - // ppc64le:"ISEL\t[$]0" + // ppc64x:"ISEL\t[$]0" // wasm:"Select" r = r - ldexp(y, rexp-yexp) } @@ -133,8 +125,7 @@ func cmovloaded(x [4]int, y int) int { } // amd64:"CMOVQNE" // arm64:"CSEL\tNE" - // ppc64:"ISEL\t[$]2" - // ppc64le:"ISEL\t[$]2" + // ppc64x:"ISEL\t[$]2" // wasm:"Select" return y } @@ -146,13 +137,12 @@ func cmovuintptr2(x, y uintptr) uintptr { } // amd64:"CMOVQEQ" // arm64:"CSEL\tEQ" - // ppc64:"ISEL\t[$]2" - // ppc64le:"ISEL\t[$]2" + // ppc64x:"ISEL\t[$]2" // wasm:"Select" return a } -// Floating point CMOVs are not supported by amd64/arm64/ppc64/ppc64le +// Floating point CMOVs are not supported by amd64/arm64/ppc64x func cmovfloatmove(x, y int) float64 { a := 1.0 if x <= y { @@ -160,8 +150,7 @@ func cmovfloatmove(x, y int) float64 { } // amd64:-"CMOV" // arm64:-"CSEL" - // ppc64:-"ISEL" - // ppc64le:-"ISEL" + // ppc64x:-"ISEL" // wasm:-"Select" return a } @@ -450,8 +439,7 @@ func cmovzeroreg0(a, b int) int { if a == b { x = a } - // ppc64:"ISEL\t[$]2, R[0-9]+, R0, R[0-9]+" - // ppc64le:"ISEL\t[$]2, R[0-9]+, R0, R[0-9]+" + // ppc64x:"ISEL\t[$]2, R[0-9]+, R0, R[0-9]+" return x } @@ -460,7 +448,6 @@ func cmovzeroreg1(a, b int) int { if a == b { x = 0 } - // ppc64:"ISEL\t[$]2, R0, R[0-9]+, R[0-9]+" - // ppc64le:"ISEL\t[$]2, R0, R[0-9]+, R[0-9]+" + // ppc64x:"ISEL\t[$]2, R0, R[0-9]+, R[0-9]+" return x } diff --git a/test/run.go b/test/run.go index 999aa4aeca..9a18f13672 100644 --- a/test/run.go +++ b/test/run.go @@ -1664,6 +1664,7 @@ var ( "mips64": {"GOMIPS64", "hardfloat", "softfloat"}, "ppc64": {"GOPPC64", "power8", "power9"}, "ppc64le": {"GOPPC64", "power8", "power9"}, + "ppc64x": {}, // A pseudo-arch representing both ppc64 and ppc64le "s390x": {}, "wasm": {}, "riscv64": {}, @@ -1756,15 +1757,22 @@ func (t *test) wantedAsmOpcodes(fn string) asmChecks { // Create the build environments corresponding the above specifiers envs := make([]buildEnv, 0, 4) - if subarch != "" { - envs = append(envs, buildEnv(os+"/"+arch+"/"+subarch)) - } else { - subarchs := archVariants[arch] - if len(subarchs) == 0 { - envs = append(envs, buildEnv(os+"/"+arch+"/")) + arches := []string{arch} + // ppc64x is a pseudo-arch, generate tests for both endian variants. + if arch == "ppc64x" { + arches = []string{"ppc64", "ppc64le"} + } + for _, arch := range arches { + if subarch != "" { + envs = append(envs, buildEnv(os+"/"+arch+"/"+subarch)) } else { - for _, sa := range archVariants[arch][1:] { - envs = append(envs, buildEnv(os+"/"+arch+"/"+sa)) + subarchs := archVariants[arch] + if len(subarchs) == 0 { + envs = append(envs, buildEnv(os+"/"+arch+"/")) + } else { + for _, sa := range archVariants[arch][1:] { + envs = append(envs, buildEnv(os+"/"+arch+"/"+sa)) + } } } } -- 2.50.0