4 ms·
The set of representable ARM immediates is really nice. It's wonderfully useful for writing soft-float and math library routines, where you have very common va
by stephencanon 13y ago
The set of representable ARM immediates is really nice. It's wonderfully useful for writing soft-float and math library routines, where you have very common values with just some high-order bits set:
0x3f800000 // encoding of 1.0f
The set of immediate encodings, together with "shifts for free on most operations" (which are closely related features, as the OP points out), went a long way toward preserving my sanity when writing assembly.
Worth noting: thumb-2 immediates have a different (and even more interesting) encoding scheme. arm64 immediates are pretty interesting too (there the set of representable immediates is different depending on the instruction domain).
- marcosdumay 13y agoHonestly, with so few bits, I was expecting it to be a lookup table. (Yep, I've never wrote ARM assembly.) But then, this way you have a nice set of imediates (as you said), and can set any value at all with at most 3 instructions at the rare case you need something different.
- userbinator 13y ago> I was expecting it to be a lookup table. There's one ISA I've worked with before that does have -2, -1, 0, 1, 2, and some other "commonly used constants" like powers of 2 encoded specially in the immediate. I think it was an 8-bit, but I can't remember exactly which one. Anyone know what I'm referring to?
- stephencanon 13y agoSimilar, but not what you're thinking of: the x87 instruction set has instructions to push the values 1.0, lb(10), lb(e), pi, lg(2), ln(2), and 0.0.
- jmpe 13y agoMSP430?
- teh_klev 13y agoIf the reply link is missing on a comment (it does that after the comments get to a certain depth of nesting) then click on the comment's "link" and you'll get a text box you can reply into.
- jmpe 13y agoNot sure why you're telling me this, I suggested MSP430 to the parent post as an answer for the ISA he was looking for.
- teh_klev 13y agoAh ok, theatrus2 was the only mention of MSP430 in the discussion under userbinator and in the absence of a "How about " in front of "MSP430?" I assumed you meant "What's a MSP 430?" in reply to theatrus2....but then I should've checked the comment times :)
- theatrus2 13y agoThe MSP430 has a constant generator register, which depending on the access mode used will generate offsets and zero. I'm sure there are a few others.
- userbinator 13y agoThat's the scheme. Although probably MSP430 took its inspiration from the one I had in mind since I was thinking of an 8-bit MCU from the early 80s - might've been Motorola.
- Symmetry 13y agoDo you know a good place for finding out more about the arm64 encoding?
- stephencanon 13y agoARM's reference manual (http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.ddi0487a.b/index.html http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc....). You need to create a (free?) account with ARM to download it. Of course, the document has been out for long enough that I'm sure it's available elsewhere for those truly paranoid about creating accounts.