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

@ -22,8 +22,8 @@ func CountBytes(s []byte) int {
}
func ToByteSlice() []byte { // Issue #24698
// amd64:`LEAQ\ttype:\[3\]uint8`
// amd64:`CALL\truntime\.mallocTiny3`
// amd64:`LEAQ type:\[3\]uint8`
// amd64:`CALL runtime\.mallocTiny3`
// amd64:-`.*runtime.stringtoslicebyte`
return []byte("foo")
}
@ -37,56 +37,56 @@ func ConvertToByteSlice(a, b, c string) []byte {
func ConstantLoad() {
// 12592 = 0x3130
// 50 = 0x32
// amd64:`MOVW\t\$12592, \(`,`MOVB\t\$50, 2\(`
// 386:`MOVW\t\$12592, \(`,`MOVB\t\$50, 2\(`
// arm:`MOVW\t\$48`,`MOVW\t\$49`,`MOVW\t\$50`
// arm64:`MOVD\t\$12592`,`MOVD\t\$50`
// loong64:`MOVV\t\$12592`,`MOVV\t\$50`
// wasm:`I64Const\t\$12592`,`I64Store16\t\$0`,`I64Const\t\$50`,`I64Store8\t\$2`
// mips64:`MOVV\t\$48`,`MOVV\t\$49`,`MOVV\t\$50`
// amd64:`MOVW \$12592, \(`,`MOVB \$50, 2\(`
// 386:`MOVW \$12592, \(`,`MOVB \$50, 2\(`
// arm:`MOVW \$48`,`MOVW \$49`,`MOVW \$50`
// arm64:`MOVD \$12592`,`MOVD \$50`
// loong64:`MOVV \$12592`,`MOVV \$50`
// wasm:`I64Const \$12592`,`I64Store16 \$0`,`I64Const \$50`,`I64Store8 \$2`
// mips64:`MOVV \$48`,`MOVV \$49`,`MOVV \$50`
bsink = []byte("012")
// 858927408 = 0x33323130
// 13620 = 0x3534
// amd64:`MOVL\t\$858927408`,`MOVW\t\$13620, 4\(`
// 386:`MOVL\t\$858927408`,`MOVW\t\$13620, 4\(`
// arm64:`MOVD\t\$858927408`,`MOVD\t\$13620`
// loong64:`MOVV\t\$858927408`,`MOVV\t\$13620`
// wasm:`I64Const\t\$858927408`,`I64Store32\t\$0`,`I64Const\t\$13620`,`I64Store16\t\$4`
// amd64:`MOVL \$858927408`,`MOVW \$13620, 4\(`
// 386:`MOVL \$858927408`,`MOVW \$13620, 4\(`
// arm64:`MOVD \$858927408`,`MOVD \$13620`
// loong64:`MOVV \$858927408`,`MOVV \$13620`
// wasm:`I64Const \$858927408`,`I64Store32 \$0`,`I64Const \$13620`,`I64Store16 \$4`
bsink = []byte("012345")
// 3978425819141910832 = 0x3736353433323130
// 7306073769690871863 = 0x6564636261393837
// amd64:`MOVQ\t\$3978425819141910832`,`MOVQ\t\$7306073769690871863`
// 386:`MOVL\t\$858927408, \(`,`DUFFCOPY`
// arm64:`MOVD\t\$3978425819141910832`,`MOVD\t\$7306073769690871863`,`MOVD\t\$15`
// loong64:`MOVV\t\$3978425819141910832`,`MOVV\t\$7306073769690871863`,`MOVV\t\$15`
// wasm:`I64Const\t\$3978425819141910832`,`I64Store\t\$0`,`I64Const\t\$7306073769690871863`,`I64Store\t\$7`
// amd64:`MOVQ \$3978425819141910832`,`MOVQ \$7306073769690871863`
// 386:`MOVL \$858927408, \(`,`DUFFCOPY`
// arm64:`MOVD \$3978425819141910832`,`MOVD \$7306073769690871863`,`MOVD \$15`
// loong64:`MOVV \$3978425819141910832`,`MOVV \$7306073769690871863`,`MOVV \$15`
// wasm:`I64Const \$3978425819141910832`,`I64Store \$0`,`I64Const \$7306073769690871863`,`I64Store \$7`
bsink = []byte("0123456789abcde")
// 56 = 0x38
// amd64:`MOVQ\t\$3978425819141910832`,`MOVB\t\$56`
// loong64:`MOVV\t\$3978425819141910832`,`MOVV\t\$56`
// amd64:`MOVQ \$3978425819141910832`,`MOVB \$56`
// loong64:`MOVV \$3978425819141910832`,`MOVV \$56`
bsink = []byte("012345678")
// 14648 = 0x3938
// amd64:`MOVQ\t\$3978425819141910832`,`MOVW\t\$14648`
// loong64:`MOVV\t\$3978425819141910832`,`MOVV\t\$14648`
// amd64:`MOVQ \$3978425819141910832`,`MOVW \$14648`
// loong64:`MOVV \$3978425819141910832`,`MOVV \$14648`
bsink = []byte("0123456789")
// 1650538808 = 0x62613938
// amd64:`MOVQ\t\$3978425819141910832`,`MOVL\t\$1650538808`
// loong64:`MOVV\t\$3978425819141910832`,`MOVV\t\$1650538808`
// amd64:`MOVQ \$3978425819141910832`,`MOVL \$1650538808`
// loong64:`MOVV \$3978425819141910832`,`MOVV \$1650538808`
bsink = []byte("0123456789ab")
}
// self-equality is always true. See issue 60777.
func EqualSelf(s string) bool {
// amd64:`MOVL\t\$1, AX`,-`.*memequal.*`
// amd64:`MOVL \$1, AX`,-`.*memequal.*`
return s == s
}
func NotEqualSelf(s string) bool {
// amd64:`XORL\tAX, AX`,-`.*memequal.*`
// amd64:`XORL AX, AX`,-`.*memequal.*`
return s != s
}