test/codegen: simplify asmcheck pattern matching

Separate patterns in asmcheck by spaces instead of commas.
Many patterns end in comma (like "MOV [$]123,") so separating
patterns by comma is not great; they're already quoted, so spaces are fine.

Also replace all tabs in the assembly lines with spaces before matching.
Finally, replace \$ or \\$ with [$] as the matching idiom.
The effect of all these is to make the patterns look like:

  	   // amd64:"BSFQ" "ORQ [$]256"

instead of the old:

  	   // amd64:"BSFQ","ORQ\t\\$256"

Update all tests as well.

Change-Id: Ia39febe5d7f67ba115846422789e11b185d5c807
Reviewed-on: https://go-review.googlesource.com/c/go/+/716060
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
Reviewed-by: Jorropo <jorropo.pgm@gmail.com>
This commit is contained in:
Russ Cox 2025-10-26 22:51:14 -04:00
parent 32ee3f3f73
commit 915c1839fe
48 changed files with 2035 additions and 2032 deletions

View file

@ -11,12 +11,12 @@ func dummy() {}
// Signed 64-bit compare-and-branch.
func si64(x, y chan int64) {
// s390x:"CGRJ\t[$](2|4), R[0-9]+, R[0-9]+, "
// s390x:"CGRJ [$](2|4), R[0-9]+, R[0-9]+, "
for <-x < <-y {
dummy()
}
// s390x:"CL?GRJ\t[$]8, R[0-9]+, R[0-9]+, "
// s390x:"CL?GRJ [$]8, R[0-9]+, R[0-9]+, "
for <-x == <-y {
dummy()
}
@ -25,22 +25,22 @@ func si64(x, y chan int64) {
// Signed 64-bit compare-and-branch with 8-bit immediate.
func si64x8(doNotOptimize int64) {
// take in doNotOptimize as an argument to avoid the loops being rewritten to count down
// s390x:"CGIJ\t[$]12, R[0-9]+, [$]127, "
// s390x:"CGIJ [$]12, R[0-9]+, [$]127, "
for i := doNotOptimize; i < 128; i++ {
dummy()
}
// s390x:"CGIJ\t[$]10, R[0-9]+, [$]-128, "
// s390x:"CGIJ [$]10, R[0-9]+, [$]-128, "
for i := doNotOptimize; i > -129; i-- {
dummy()
}
// s390x:"CGIJ\t[$]2, R[0-9]+, [$]127, "
// s390x:"CGIJ [$]2, R[0-9]+, [$]127, "
for i := doNotOptimize; i >= 128; i++ {
dummy()
}
// s390x:"CGIJ\t[$]4, R[0-9]+, [$]-128, "
// s390x:"CGIJ [$]4, R[0-9]+, [$]-128, "
for i := doNotOptimize; i <= -129; i-- {
dummy()
}
@ -48,12 +48,12 @@ func si64x8(doNotOptimize int64) {
// Unsigned 64-bit compare-and-branch.
func ui64(x, y chan uint64) {
// s390x:"CLGRJ\t[$](2|4), R[0-9]+, R[0-9]+, "
// s390x:"CLGRJ [$](2|4), R[0-9]+, R[0-9]+, "
for <-x > <-y {
dummy()
}
// s390x:"CL?GRJ\t[$]6, R[0-9]+, R[0-9]+, "
// s390x:"CL?GRJ [$]6, R[0-9]+, R[0-9]+, "
for <-x != <-y {
dummy()
}
@ -61,22 +61,22 @@ func ui64(x, y chan uint64) {
// Unsigned 64-bit comparison with 8-bit immediate.
func ui64x8() {
// s390x:"CLGIJ\t[$]4, R[0-9]+, [$]128, "
// s390x:"CLGIJ [$]4, R[0-9]+, [$]128, "
for i := uint64(0); i < 128; i++ {
dummy()
}
// s390x:"CLGIJ\t[$]12, R[0-9]+, [$]255, "
// s390x:"CLGIJ [$]12, R[0-9]+, [$]255, "
for i := uint64(0); i < 256; i++ {
dummy()
}
// s390x:"CLGIJ\t[$]2, R[0-9]+, [$]255, "
// s390x:"CLGIJ [$]2, R[0-9]+, [$]255, "
for i := uint64(257); i >= 256; i-- {
dummy()
}
// s390x:"CLGIJ\t[$]2, R[0-9]+, [$]0, "
// s390x:"CLGIJ [$]2, R[0-9]+, [$]0, "
for i := uint64(1024); i > 0; i-- {
dummy()
}
@ -84,12 +84,12 @@ func ui64x8() {
// Signed 32-bit compare-and-branch.
func si32(x, y chan int32) {
// s390x:"CRJ\t[$](2|4), R[0-9]+, R[0-9]+, "
// s390x:"CRJ [$](2|4), R[0-9]+, R[0-9]+, "
for <-x < <-y {
dummy()
}
// s390x:"CL?RJ\t[$]8, R[0-9]+, R[0-9]+, "
// s390x:"CL?RJ [$]8, R[0-9]+, R[0-9]+, "
for <-x == <-y {
dummy()
}
@ -98,22 +98,22 @@ func si32(x, y chan int32) {
// Signed 32-bit compare-and-branch with 8-bit immediate.
func si32x8(doNotOptimize int32) {
// take in doNotOptimize as an argument to avoid the loops being rewritten to count down
// s390x:"CIJ\t[$]12, R[0-9]+, [$]127, "
// s390x:"CIJ [$]12, R[0-9]+, [$]127, "
for i := doNotOptimize; i < 128; i++ {
dummy()
}
// s390x:"CIJ\t[$]10, R[0-9]+, [$]-128, "
// s390x:"CIJ [$]10, R[0-9]+, [$]-128, "
for i := doNotOptimize; i > -129; i-- {
dummy()
}
// s390x:"CIJ\t[$]2, R[0-9]+, [$]127, "
// s390x:"CIJ [$]2, R[0-9]+, [$]127, "
for i := doNotOptimize; i >= 128; i++ {
dummy()
}
// s390x:"CIJ\t[$]4, R[0-9]+, [$]-128, "
// s390x:"CIJ [$]4, R[0-9]+, [$]-128, "
for i := doNotOptimize; i <= -129; i-- {
dummy()
}
@ -121,12 +121,12 @@ func si32x8(doNotOptimize int32) {
// Unsigned 32-bit compare-and-branch.
func ui32(x, y chan uint32) {
// s390x:"CLRJ\t[$](2|4), R[0-9]+, R[0-9]+, "
// s390x:"CLRJ [$](2|4), R[0-9]+, R[0-9]+, "
for <-x > <-y {
dummy()
}
// s390x:"CL?RJ\t[$]6, R[0-9]+, R[0-9]+, "
// s390x:"CL?RJ [$]6, R[0-9]+, R[0-9]+, "
for <-x != <-y {
dummy()
}
@ -134,22 +134,22 @@ func ui32(x, y chan uint32) {
// Unsigned 32-bit comparison with 8-bit immediate.
func ui32x8() {
// s390x:"CLIJ\t[$]4, R[0-9]+, [$]128, "
// s390x:"CLIJ [$]4, R[0-9]+, [$]128, "
for i := uint32(0); i < 128; i++ {
dummy()
}
// s390x:"CLIJ\t[$]12, R[0-9]+, [$]255, "
// s390x:"CLIJ [$]12, R[0-9]+, [$]255, "
for i := uint32(0); i < 256; i++ {
dummy()
}
// s390x:"CLIJ\t[$]2, R[0-9]+, [$]255, "
// s390x:"CLIJ [$]2, R[0-9]+, [$]255, "
for i := uint32(257); i >= 256; i-- {
dummy()
}
// s390x:"CLIJ\t[$]2, R[0-9]+, [$]0, "
// s390x:"CLIJ [$]2, R[0-9]+, [$]0, "
for i := uint32(1024); i > 0; i-- {
dummy()
}
@ -157,12 +157,12 @@ func ui32x8() {
// Signed 64-bit comparison with unsigned 8-bit immediate.
func si64xu8(x chan int64) {
// s390x:"CLGIJ\t[$]8, R[0-9]+, [$]128, "
// s390x:"CLGIJ [$]8, R[0-9]+, [$]128, "
for <-x == 128 {
dummy()
}
// s390x:"CLGIJ\t[$]6, R[0-9]+, [$]255, "
// s390x:"CLGIJ [$]6, R[0-9]+, [$]255, "
for <-x != 255 {
dummy()
}
@ -170,12 +170,12 @@ func si64xu8(x chan int64) {
// Signed 32-bit comparison with unsigned 8-bit immediate.
func si32xu8(x chan int32) {
// s390x:"CLIJ\t[$]8, R[0-9]+, [$]255, "
// s390x:"CLIJ [$]8, R[0-9]+, [$]255, "
for <-x == 255 {
dummy()
}
// s390x:"CLIJ\t[$]6, R[0-9]+, [$]128, "
// s390x:"CLIJ [$]6, R[0-9]+, [$]128, "
for <-x != 128 {
dummy()
}
@ -183,12 +183,12 @@ func si32xu8(x chan int32) {
// Unsigned 64-bit comparison with signed 8-bit immediate.
func ui64xu8(x chan uint64) {
// s390x:"CGIJ\t[$]8, R[0-9]+, [$]-1, "
// s390x:"CGIJ [$]8, R[0-9]+, [$]-1, "
for <-x == ^uint64(0) {
dummy()
}
// s390x:"CGIJ\t[$]6, R[0-9]+, [$]-128, "
// s390x:"CGIJ [$]6, R[0-9]+, [$]-128, "
for <-x != ^uint64(127) {
dummy()
}
@ -196,12 +196,12 @@ func ui64xu8(x chan uint64) {
// Unsigned 32-bit comparison with signed 8-bit immediate.
func ui32xu8(x chan uint32) {
// s390x:"CIJ\t[$]8, R[0-9]+, [$]-128, "
// s390x:"CIJ [$]8, R[0-9]+, [$]-128, "
for <-x == ^uint32(127) {
dummy()
}
// s390x:"CIJ\t[$]6, R[0-9]+, [$]-1, "
// s390x:"CIJ [$]6, R[0-9]+, [$]-1, "
for <-x != ^uint32(0) {
dummy()
}