1
0
mirror of https://github.com/golang/go synced 2024-11-18 00:04:43 -07:00

cmd/internal/obj/arm: fix wrong encoding of MUL

The arm assembler incorrectly encodes the following instructions.
"MUL R2, R4" -> 0xe0040492 ("MUL R4, R2, R4")
"MUL R2, R4, R4" -> 0xe0040492 ("MUL R4, R2, R4")

The CL fixes that issue.

fixes #25347

Change-Id: I883716c7bc51c5f64837ae7d81342f94540a58cb
Reviewed-on: https://go-review.googlesource.com/112737
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
Ben Shi 2018-05-11 06:19:58 +00:00 committed by Cherry Zhang
parent 3080b7d0af
commit bec2f51b07
2 changed files with 8 additions and 14 deletions

View File

@ -951,13 +951,17 @@ jmp_label_3:
// MUL // MUL
MUL R2, R3, R4 // 930204e0 MUL R2, R3, R4 // 930204e0
MUL R2, R4 // 920404e0 MUL R2, R4 // 940204e0
MUL R2, R4, R4 // 940204e0
MUL.S R2, R3, R4 // 930214e0 MUL.S R2, R3, R4 // 930214e0
MUL.S R2, R4 // 920414e0 MUL.S R2, R4 // 940214e0
MUL.S R2, R4, R4 // 940214e0
MULU R5, R6, R7 // 960507e0 MULU R5, R6, R7 // 960507e0
MULU R5, R7 // 950707e0 MULU R5, R7 // 970507e0
MULU R5, R7, R7 // 970507e0
MULU.S R5, R6, R7 // 960517e0 MULU.S R5, R6, R7 // 960517e0
MULU.S R5, R7 // 950717e0 MULU.S R5, R7 // 970517e0
MULU.S R5, R7, R7 // 970517e0
MULLU R1, R2, (R4, R3) // 923184e0 MULLU R1, R2, (R4, R3) // 923184e0
MULLU.S R1, R2, (R4, R3) // 923194e0 MULLU.S R1, R2, (R4, R3) // 923194e0
MULL R1, R2, (R4, R3) // 9231c4e0 MULL R1, R2, (R4, R3) // 9231c4e0

View File

@ -2046,16 +2046,6 @@ func (c *ctxt5) asmout(p *obj.Prog, o *Optab, out []uint32) {
if r == 0 { if r == 0 {
r = rt r = rt
} }
if rt == r {
r = rf
rf = rt
}
if false {
if rt == r || rf == REGPC&15 || r == REGPC&15 || rt == REGPC&15 {
c.ctxt.Diag("%v: bad registers in MUL", p)
}
}
o1 |= (uint32(rf)&15)<<8 | (uint32(r)&15)<<0 | (uint32(rt)&15)<<16 o1 |= (uint32(rf)&15)<<8 | (uint32(r)&15)<<0 | (uint32(rt)&15)<<16