arm/armasm: fix bug of plan9 register list argument
If the register list contains multiple sub-lists, e.g., [R0,R2-R3,R5-R7],
current implementation just flushes the last sub-list, i.e., [R5-R7].
The fix flushes previous sub-lists if any.
Fixes golang/go#19142
Change-Id: Ic4eaec76e4f654bf0b92b398b71b2050cede3cbb
Reviewed-on: https://go-review.googlesource.com/37172
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
diff --git a/arm/armasm/plan9x.go b/arm/armasm/plan9x.go
index fae0ca6..d43cc96 100644
--- a/arm/armasm/plan9x.go
+++ b/arm/armasm/plan9x.go
@@ -185,6 +185,8 @@
} else {
fmt.Fprintf(&buf, "R%d-R%d", start, end)
}
+ start = -2
+ end = -2
}
}
for i := 0; i < 16; i++ {
@@ -195,6 +197,8 @@
}
start = i
end = i
+ } else {
+ flush()
}
}
flush()
diff --git a/arm/armasm/testdata/decode.txt b/arm/armasm/testdata/decode.txt
index cc1ea0a..2048e50 100644
--- a/arm/armasm/testdata/decode.txt
+++ b/arm/armasm/testdata/decode.txt
@@ -304,3 +304,4 @@
|6b5721d3 1 gnu error: unknown instruction
|76452001 1 gnu error: unknown instruction
|97acd647 1 gnu error: unknown instruction
+ed003be9| 1 plan9 LDMDB [R0,R2-R3,R5-R7], R11!