arm64/arm64asm: strip comments of objdump 2.29

Objdump (2.29) generates new format of comments starting with "//"
instead of original ";", e.g: "csinv x23, x2, x19, cc // cc = lo, ul, last".
Improve test generation framework to recognize and strip such comments.

Fixes golang/go#23237

Change-Id: I0ccf70791f43d696b0e20ded7f284eb277bea31c
Reviewed-on: https://go-review.googlesource.com/85476
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
diff --git a/arm64/arm64asm/objdumpext_test.go b/arm64/arm64asm/objdumpext_test.go
index d3a3480..533ef67 100644
--- a/arm64/arm64asm/objdumpext_test.go
+++ b/arm64/arm64asm/objdumpext_test.go
@@ -172,6 +172,7 @@
 var (
 	undefined     = []byte("undefined")
 	unpredictable = []byte("unpredictable")
+	slashslash    = []byte("//")
 )
 
 func parseLine(line []byte, encstart []byte) (addr uint64, enc []byte, text string) {
@@ -204,9 +205,16 @@
 		text = "unpredictable"
 		return
 	}
+	// Strip trailing comment starting with ';'
+	//   e.g: "csinv x23, x2, x19, cc ; xxx"
 	if i := bytes.IndexByte(line, ';'); i >= 0 {
 		line = bytes.TrimSpace(line[:i])
 	}
+	// Strip trailing comment starting with "//"
+	//   e.g:  "fccmpe s2, s9, #0x7, ne // xxx"
+	if i := bytes.Index(line, slashslash); i >= 0 {
+		line = bytes.TrimSpace(line[:i])
+	}
 	text = string(fixSpace(line))
 	return
 }