golang: what assembly instructions are available

I've got a program that I'm running on an ARM and I'm writing one function of it in assembly. I've made good progress on this, although I've found it difficult sometimes to figure out exactly how to write certain instructions for go's assembler, for example, I didn't expect a right shift to be written like this:

MOVW R3>>8, R3

Now I want to do a multiply and accumulate (MLA), according to this doc not all opcodes are supported, so maybe MLA isn't, but I don't know how to tell if it is or not. I see mentions of MLA with regards to ARM in the golang repo, but I'm not really sure what to make of what I see there.

Is there anywhere that documents what instructions are supported and how to write them? Can anyone give me any useful pointers?

Upvotes: 6

Views: 1493

Answers (1)

Nick Craig-Wood
Nick Craig-Wood

Reputation: 54089

Here is a bit of a scrappy doc i wrote on how to write ARM assembler

I wrote it from the point of view of an experienced ARM person trying to figure out how Go assembler works.

Here is an excerpt from the start. Feel free to email me if you have more questions!


The Go assembler is based on the plan 9 assembler which is documented here.

http://plan9.bell-labs.com/sys/doc/asm.html

Nice introduction to ARM

http://www.davespace.co.uk/arm/introduction-to-arm/index.html

Opcodes

http://simplemachines.it/doc/arm_inst.pdf

Instructions

  • Destination goes last not first
  • Parameters seem to be completely reversed
  • May be condensed to 2 operands, so
    • ADD r0, r0, r1 ; [ARM] r0 <- r0 + r1
    • is written as
    • ADD r1, r0, r0
    • or
    • ADD r1, r0
  • Constants denoted with '$' not '#'

Upvotes: 4

Related Questions