Commit d0ff9ece authored by Ben Shi's avatar Ben Shi Committed by Brad Fitzpatrick

cmd/internal/obj/arm: Fix wrong assembly in the arm assembler

As #19357 reported,

TST has 3 different sub forms
TST $imme, Rx
TST Ry << imme, Rx
TST Ry << Rz, Rx

just like CMP/CMN/TEQ has. But current arm assembler assembles all TST
instructions wrongly. This patch fixes it and adds more tests.

Fixes #19357

Change-Id: Iafedccfaab2cbb2631e7acf259837a782e2e8e2f
Reviewed-on: https://go-review.googlesource.com/37662
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
parent c46226a6
This diff is collapsed.
......@@ -239,7 +239,6 @@ var optab = []Optab{
{AMOVWF, C_REG, C_NONE, C_FREG, 87, 8, 0, 0, 0},
{AMOVW, C_REG, C_NONE, C_FREG, 88, 4, 0, 0, 0},
{AMOVW, C_FREG, C_NONE, C_REG, 89, 4, 0, 0, 0},
{ATST, C_REG, C_NONE, C_NONE, 90, 4, 0, 0, 0},
{ALDREXD, C_SOREG, C_NONE, C_REG, 91, 4, 0, 0, 0},
{ASTREXD, C_SOREG, C_REG, C_REG, 92, 4, 0, 0, 0},
{APLD, C_SOREG, C_NONE, C_NONE, 95, 4, 0, 0, 0},
......@@ -1354,6 +1353,7 @@ func buildop(ctxt *obj.Link) {
case ACMP:
opset(ATEQ, r0)
opset(ACMN, r0)
opset(ATST, r0)
case AMVN:
break
......@@ -2287,11 +2287,6 @@ func asmout(ctxt *obj.Link, p *obj.Prog, o *Optab, out []uint32) {
o1 |= (uint32(p.From.Reg) & 15) << 16
o1 |= (uint32(p.To.Reg) & 15) << 12
case 90: /* tst reg */
o1 = oprrr(ctxt, -ACMP, int(p.Scond))
o1 |= (uint32(p.From.Reg) & 15) << 16
case 91: /* ldrexd oreg,reg */
aclass(ctxt, &p.From)
......
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