Commit bec2f51b authored by Ben Shi's avatar Ben Shi Committed by Cherry Zhang

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/112737Reviewed-by: 's avatarCherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
parent 3080b7d0
......@@ -951,13 +951,17 @@ jmp_label_3:
// MUL
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, R4 // 920414e0
MUL.S R2, R4 // 940214e0
MUL.S R2, R4, R4 // 940214e0
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, R7 // 950717e0
MULU.S R5, R7 // 970517e0
MULU.S R5, R7, R7 // 970517e0
MULLU R1, R2, (R4, R3) // 923184e0
MULLU.S R1, R2, (R4, R3) // 923194e0
MULL R1, R2, (R4, R3) // 9231c4e0
......
......@@ -2046,16 +2046,6 @@ func (c *ctxt5) asmout(p *obj.Prog, o *Optab, out []uint32) {
if r == 0 {
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
......
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