]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/internal/obj/arm: fix wrong encoding of MUL
authorBen Shi <powerman1st@163.com>
Fri, 11 May 2018 06:19:58 +0000 (06:19 +0000)
committerCherry Zhang <cherryyz@google.com>
Mon, 14 May 2018 01:53:39 +0000 (01:53 +0000)
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>

src/cmd/asm/internal/asm/testdata/arm.s
src/cmd/internal/obj/arm/asm5.go

index 0b3363e17e46359d8600b0052de14c4d852d4e5f..cc8e25ef7c7a5559798a78392259ac813bf1124a 100644 (file)
@@ -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
index 96f6b90e8d5eb2e4434c85bd564366f8c1b061aa..3427ea9161c62c0b268fb5956de90adeff771602 100644 (file)
@@ -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