Skip to content

Commit a37672b

Browse files
committed
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 <[email protected]> Reviewed-by: Matthew Dempsky <[email protected]> TryBot-Result: Gopher Robot <[email protected]> Run-TryBot: Paul Murphy <[email protected]>
1 parent 91c1c59 commit a37672b

File tree

2 files changed

+30
-35
lines changed

2 files changed

+30
-35
lines changed

test/codegen/condmove.go

Lines changed: 14 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@ func cmovint(c int) int {
1313
}
1414
// amd64:"CMOVQLT"
1515
// arm64:"CSEL\tLT"
16-
// ppc64:"ISEL\t[$]0"
17-
// ppc64le:"ISEL\t[$]0"
16+
// ppc64x:"ISEL\t[$]0"
1817
// wasm:"Select"
1918
return x
2019
}
@@ -25,8 +24,7 @@ func cmovchan(x, y chan int) chan int {
2524
}
2625
// amd64:"CMOVQNE"
2726
// arm64:"CSEL\tNE"
28-
// ppc64:"ISEL\t[$]2"
29-
// ppc64le:"ISEL\t[$]2"
27+
// ppc64x:"ISEL\t[$]2"
3028
// wasm:"Select"
3129
return x
3230
}
@@ -37,8 +35,7 @@ func cmovuintptr(x, y uintptr) uintptr {
3735
}
3836
// amd64:"CMOVQ(HI|CS)"
3937
// arm64:"CSNEG\tLS"
40-
// ppc64:"ISEL\t[$]1"
41-
// ppc64le:"ISEL\t[$]1"
38+
// ppc64x:"ISEL\t[$]1"
4239
// wasm:"Select"
4340
return x
4441
}
@@ -49,8 +46,7 @@ func cmov32bit(x, y uint32) uint32 {
4946
}
5047
// amd64:"CMOVL(HI|CS)"
5148
// arm64:"CSNEG\t(LS|HS)"
52-
// ppc64:"ISEL\t[$]1"
53-
// ppc64le:"ISEL\t[$]1"
49+
// ppc64x:"ISEL\t[$]1"
5450
// wasm:"Select"
5551
return x
5652
}
@@ -61,8 +57,7 @@ func cmov16bit(x, y uint16) uint16 {
6157
}
6258
// amd64:"CMOVW(HI|CS)"
6359
// arm64:"CSNEG\t(LS|HS)"
64-
// ppc64:"ISEL\t[$]0"
65-
// ppc64le:"ISEL\t[$]0"
60+
// ppc64x:"ISEL\t[$]0"
6661
// wasm:"Select"
6762
return x
6863
}
@@ -76,8 +71,7 @@ func cmovfloateq(x, y float64) int {
7671
}
7772
// amd64:"CMOVQNE","CMOVQPC"
7873
// arm64:"CSEL\tEQ"
79-
// ppc64:"ISEL\t[$]2"
80-
// ppc64le:"ISEL\t[$]2"
74+
// ppc64x:"ISEL\t[$]2"
8175
// wasm:"Select"
8276
return a
8377
}
@@ -89,8 +83,7 @@ func cmovfloatne(x, y float64) int {
8983
}
9084
// amd64:"CMOVQNE","CMOVQPS"
9185
// arm64:"CSEL\tNE"
92-
// ppc64:"ISEL\t[$]2"
93-
// ppc64le:"ISEL\t[$]2"
86+
// ppc64x:"ISEL\t[$]2"
9487
// wasm:"Select"
9588
return a
9689
}
@@ -117,8 +110,7 @@ func cmovfloatint2(x, y float64) float64 {
117110
}
118111
// amd64:"CMOVQHI"
119112
// arm64:"CSEL\tMI"
120-
// ppc64:"ISEL\t[$]0"
121-
// ppc64le:"ISEL\t[$]0"
113+
// ppc64x:"ISEL\t[$]0"
122114
// wasm:"Select"
123115
r = r - ldexp(y, rexp-yexp)
124116
}
@@ -133,8 +125,7 @@ func cmovloaded(x [4]int, y int) int {
133125
}
134126
// amd64:"CMOVQNE"
135127
// arm64:"CSEL\tNE"
136-
// ppc64:"ISEL\t[$]2"
137-
// ppc64le:"ISEL\t[$]2"
128+
// ppc64x:"ISEL\t[$]2"
138129
// wasm:"Select"
139130
return y
140131
}
@@ -146,22 +137,20 @@ func cmovuintptr2(x, y uintptr) uintptr {
146137
}
147138
// amd64:"CMOVQEQ"
148139
// arm64:"CSEL\tEQ"
149-
// ppc64:"ISEL\t[$]2"
150-
// ppc64le:"ISEL\t[$]2"
140+
// ppc64x:"ISEL\t[$]2"
151141
// wasm:"Select"
152142
return a
153143
}
154144

155-
// Floating point CMOVs are not supported by amd64/arm64/ppc64/ppc64le
145+
// Floating point CMOVs are not supported by amd64/arm64/ppc64x
156146
func cmovfloatmove(x, y int) float64 {
157147
a := 1.0
158148
if x <= y {
159149
a = 2.0
160150
}
161151
// amd64:-"CMOV"
162152
// arm64:-"CSEL"
163-
// ppc64:-"ISEL"
164-
// ppc64le:-"ISEL"
153+
// ppc64x:-"ISEL"
165154
// wasm:-"Select"
166155
return a
167156
}
@@ -450,8 +439,7 @@ func cmovzeroreg0(a, b int) int {
450439
if a == b {
451440
x = a
452441
}
453-
// ppc64:"ISEL\t[$]2, R[0-9]+, R0, R[0-9]+"
454-
// ppc64le:"ISEL\t[$]2, R[0-9]+, R0, R[0-9]+"
442+
// ppc64x:"ISEL\t[$]2, R[0-9]+, R0, R[0-9]+"
455443
return x
456444
}
457445

@@ -460,7 +448,6 @@ func cmovzeroreg1(a, b int) int {
460448
if a == b {
461449
x = 0
462450
}
463-
// ppc64:"ISEL\t[$]2, R0, R[0-9]+, R[0-9]+"
464-
// ppc64le:"ISEL\t[$]2, R0, R[0-9]+, R[0-9]+"
451+
// ppc64x:"ISEL\t[$]2, R0, R[0-9]+, R[0-9]+"
465452
return x
466453
}

test/run.go

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1664,6 +1664,7 @@ var (
16641664
"mips64": {"GOMIPS64", "hardfloat", "softfloat"},
16651665
"ppc64": {"GOPPC64", "power8", "power9"},
16661666
"ppc64le": {"GOPPC64", "power8", "power9"},
1667+
"ppc64x": {}, // A pseudo-arch representing both ppc64 and ppc64le
16671668
"s390x": {},
16681669
"wasm": {},
16691670
"riscv64": {},
@@ -1756,15 +1757,22 @@ func (t *test) wantedAsmOpcodes(fn string) asmChecks {
17561757

17571758
// Create the build environments corresponding the above specifiers
17581759
envs := make([]buildEnv, 0, 4)
1759-
if subarch != "" {
1760-
envs = append(envs, buildEnv(os+"/"+arch+"/"+subarch))
1761-
} else {
1762-
subarchs := archVariants[arch]
1763-
if len(subarchs) == 0 {
1764-
envs = append(envs, buildEnv(os+"/"+arch+"/"))
1760+
arches := []string{arch}
1761+
// ppc64x is a pseudo-arch, generate tests for both endian variants.
1762+
if arch == "ppc64x" {
1763+
arches = []string{"ppc64", "ppc64le"}
1764+
}
1765+
for _, arch := range arches {
1766+
if subarch != "" {
1767+
envs = append(envs, buildEnv(os+"/"+arch+"/"+subarch))
17651768
} else {
1766-
for _, sa := range archVariants[arch][1:] {
1767-
envs = append(envs, buildEnv(os+"/"+arch+"/"+sa))
1769+
subarchs := archVariants[arch]
1770+
if len(subarchs) == 0 {
1771+
envs = append(envs, buildEnv(os+"/"+arch+"/"))
1772+
} else {
1773+
for _, sa := range archVariants[arch][1:] {
1774+
envs = append(envs, buildEnv(os+"/"+arch+"/"+sa))
1775+
}
17681776
}
17691777
}
17701778
}

0 commit comments

Comments
 (0)