<pre class="notranslate">5l seems to explode on the TST instruction

        TST $3, R0

5a is quite happy to assemble this, but 5l then produces

main.tst: illegal combination TST C_RCON C_REG C_NONE, 8 1
(3) TST $3,R0,
main.tst: illegal combination TST C_RCON C_REG C_NONE, 8 1
(3) TST $3,R0,

I conjecture this might be easy to fix since the very similar TEQ instruction works fine.

-------------------

What steps will reproduce the problem?

Save the attached files into a temporary directory

Run

GOARCH="arm" GOOS="linux" go build

What is the expected output?

Nothing (it compiles)

What do you see instead?

# _/tmp/tst
main.tst: illegal combination TST C_RCON C_REG C_NONE, 8 1
(3) TST $3,R0,
main.tst: illegal combination TST C_RCON C_REG C_NONE, 8 1
(3) TST $3,R0,


Which compiler are you using (5g, 6g, 8g, gccgo)?

5a &amp; 5l

Which operating system are you using?

Cross compiling for arm linux on amd64 linux

$ go-linux-arm env
GOARCH="arm"
GOBIN=""
GOCHAR="5"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/ncw/Code/Go"
GORACE=""
GOROOT="/home/ncw/Code/go"
GOTOOLDIR="/home/ncw/Code/go/pkg/tool/linux_amd64"
CC="gcc"
GOGCCFLAGS="-g -O2 -fPIC -marm"
CGO_ENABLED="0"

Which version are you using?  (run 'go version')

go version devel +77be25034f84 Fri Jul 19 01:22:26 2013 +0400 linux/amd64</pre>
<p dir="auto">Attachments:</p>
<ol dir="auto">
<li><a href="https://storage.googleapis.com/go-attachment/5921/0/tst.s" rel="nofollow">tst.s</a> (74 bytes)</li>
<li><a href="https://storage.googleapis.com/go-attachment/5921/0/tst.go" rel="nofollow">tst.go</a> (49 bytes)</li>
</ol>
<p dir="auto">The following go function</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="func ss(u, q uint32) uint32 {
        if u &amp; q == 0 {
                return 2
        }
        if u + q == 0  {
                return 3
        }
        if q ^ u == 0 {
                return 9
        }
        return 1
}"><pre class="notranslate"><code class="notranslate">func ss(u, q uint32) uint32 {
        if u &amp; q == 0 {
                return 2
        }
        if u + q == 0  {
                return 3
        }
        if q ^ u == 0 {
                return 9
        }
        return 1
}
</code></pre></div>
<p dir="auto">is compiled to</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="......
  a.go:7                0x9ca50                 e0002001                AND R1, R0, R2
  a.go:7                0x9ca54                 e3520000                CMP $0, R2
  a.go:7                0x9ca58                 0a00000e                B.EQ 0x9ca98
  a.go:10               0x9ca5c                 e0802001                ADD R1, R0, R2
  a.go:10               0x9ca60                 e3520000                CMP $0, R2
  a.go:10               0x9ca64                 0a000008                B.EQ 0x9ca8c
  a.go:13               0x9ca68                 e0210000                EOR R0, R1, R0
  a.go:13               0x9ca6c                 e3500000                CMP $0, R0
  a.go:13               0x9ca70                 1a000002                B.NE 0x9ca80
......"><pre class="notranslate"><code class="notranslate">......
  a.go:7                0x9ca50                 e0002001                AND R1, R0, R2
  a.go:7                0x9ca54                 e3520000                CMP $0, R2
  a.go:7                0x9ca58                 0a00000e                B.EQ 0x9ca98
  a.go:10               0x9ca5c                 e0802001                ADD R1, R0, R2
  a.go:10               0x9ca60                 e3520000                CMP $0, R2
  a.go:10               0x9ca64                 0a000008                B.EQ 0x9ca8c
  a.go:13               0x9ca68                 e0210000                EOR R0, R1, R0
  a.go:13               0x9ca6c                 e3500000                CMP $0, R0
  a.go:13               0x9ca70                 1a000002                B.NE 0x9ca80
......
</code></pre></div>
<p dir="auto">But can be optimized to</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="CMN	R1, R0, R2
B.EQ	xxx
TST	R1, R0, R2
B.EQ	XXX
TEQ	R0, R1, r2
B.NE	xxx"><pre class="notranslate"><code class="notranslate">CMN	R1, R0, R2
B.EQ	xxx
TST	R1, R0, R2
B.EQ	XXX
TEQ	R0, R1, r2
B.NE	xxx
</code></pre></div>