]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/asm: handle CMPF and CMPD on ARM
authorRob Pike <r@golang.org>
Wed, 2 Sep 2015 20:11:26 +0000 (13:11 -0700)
committerRob Pike <r@golang.org>
Thu, 3 Sep 2015 19:40:11 +0000 (19:40 +0000)
These instructions are special cases that were missed in the translation.
The second argument must go into the Reg field not the To field.

Fixes #12458

For Go 1.5.1

Change-Id: Iad57c60c7e38e3bcfafda483ed5037ce670e8816
Reviewed-on: https://go-review.googlesource.com/14183
Reviewed-by: Dave Cheney <dave@cheney.net>
Reviewed-by: Russ Cox <rsc@golang.org>
src/cmd/asm/internal/arch/arm.go
src/cmd/asm/internal/asm/asm.go
src/cmd/asm/internal/asm/testdata/arm.out
src/cmd/asm/internal/asm/testdata/arm.s

index c03021446061a7bd0aaf5bd234ca36c8516d7cbe..8df994e8d19ee7a8d2835ca3abee6939f054bbf2 100644 (file)
@@ -121,6 +121,15 @@ func IsARMMRC(op int) bool {
        return false
 }
 
+// IsARMFloatCmp reports whether the op is a floating comparison instruction.
+func IsARMFloatCmp(op int) bool {
+       switch op {
+       case arm.ACMPF, arm.ACMPD:
+               return true
+       }
+       return false
+}
+
 // ARMMRCOffset implements the peculiar encoding of the MRC and MCR instructions.
 // The difference between MRC and MCR is represented by a bit high in the word, not
 // in the usual way by the opcode itself. Asm must use AMRC for both instructions, so
index 0d2c12f00b1ecf5f07101c416cf9a13d86789c5e..e098961cc558cbc2c1deb05be9aa19375ea9433f 100644 (file)
@@ -469,6 +469,11 @@ func (p *Parser) asmInstruction(op int, cond string, a []obj.Addr) {
                                }
                                p.errorf("unrecognized addressing for %s", obj.Aconv(op))
                        }
+                       if arch.IsARMFloatCmp(op) {
+                               prog.From = a[0]
+                               prog.Reg = p.getRegister(prog, op, &a[1])
+                               break
+                       }
                } else if p.arch.Thechar == '7' && arch.IsARM64CMP(op) {
                        prog.From = a[0]
                        prog.Reg = p.getRegister(prog, op, &a[1])
index ffd520d729caaa078ff1ee5e5468f3859eb5aeaa..7d79bf31816a746f61938d74c53574cd9140b40b 100644 (file)
@@ -55,4 +55,6 @@
 273 00055 (testdata/arm.s:273) CALL    foo(SB)
 274 00056 (testdata/arm.s:274) JMP     foo(SB)
 275 00057 (testdata/arm.s:275) CALL    foo(SB)
-284 00058 (testdata/arm.s:284) END
+278 00058 (testdata/arm.s:278) CMPF    F1, F2
+279 00059 (testdata/arm.s:279) CMPD    F1, F2
+288 00060 (testdata/arm.s:288) END
index 93557923b0752e104485afe574d0907914632134..f5ba3a85759d7c33be35809a12208b8725115e8f 100644 (file)
@@ -274,6 +274,10 @@ TEXT       foo(SB), 0, $0
        JMP     foo(SB)
        CALL    foo(SB)
 
+// CMPF and CMPD are special.
+       CMPF F1, F2
+       CMPD F1, F2
+
 //
 // END
 //