Commit a175fa3b authored by Shenghou Ma's avatar Shenghou Ma Committed by Minux Ma

cmd/asm/internal/asm: parse arm64 register pairs for LDP/STP

Add test, and while we're at here, also add a test for ARM.

Fixes #10343.

Change-Id: Ic914df8233d4f1f495e2cc0743fbd37b7671bc91
Signed-off-by: 's avatarShenghou Ma <minux@golang.org>
Reviewed-on: https://go-review.googlesource.com/8472Reviewed-by: 's avatarAram Hăvărneanu <aram@mgk.ro>
Reviewed-by: 's avatarRob Pike <r@golang.org>
parent 35599e28
......@@ -287,6 +287,7 @@ var armOperandTests = []operandTest{
{"retlo+12(FP)", "retlo+12(FP)"},
{"runtime·_sfloat2(SB)", "runtime._sfloat2(SB)"},
{"·AddUint32(SB)", "\"\".AddUint32(SB)"},
{"(R1, R3)", "(R1, R3)"},
}
var ppc64OperandTests = []operandTest{
......@@ -424,4 +425,5 @@ var arm64OperandTests = []operandTest{
{"$runtime·badsystemstack(SB)", "$runtime.badsystemstack(SB)"},
{"ZR", "ZR"},
{"(ZR)", "(ZR)"},
{"(R29, RSP)", "(R29, RSP)"},
}
......@@ -461,7 +461,7 @@ func (p *Parser) register(name string, prefix rune) (r1, r2 int16, scale int8, o
char := p.arch.Thechar
switch p.next().ScanToken {
case ',':
if char != '5' {
if char != '5' && char != '7' {
p.errorf("illegal register pair syntax")
return
}
......@@ -629,15 +629,17 @@ func (p *Parser) registerIndirect(a *obj.Addr, prefix rune) {
a.Reg = r1
if r2 != 0 {
// TODO: Consistency in the encoding would be nice here.
if p.arch.Thechar == '5' {
// Special form for ARM: destination register pair (R1, R2).
if p.arch.Thechar == '5' || p.arch.Thechar == '7' {
// Special form
// ARM: destination register pair (R1, R2).
// ARM64: register pair (R1, R2) for LDP/STP.
if prefix != 0 || scale != 0 {
p.errorf("illegal address mode for register pair")
return
}
a.Type = obj.TYPE_REGREG
a.Offset = int64(r2)
// Nothing may follow; this is always a pure destination.
// Nothing may follow
return
}
if p.arch.Thechar == '9' {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment