Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Except it doesn't scale that well to all of the different operations. How do you distinguish between a signed and an unsigned high multiply? What do you do for operations like count-trailing-zeros or popcount, which don't map to standard operator symbols? How do you distinguish between nontemporal loads, atomic loads, sign-extended byte-to-word loads, etc.?

There are a couple of different ways to understand assembly. Writing it with C-like infix expressions is a superior way to look at the code if you're trying to understand what it's doing on an algorithmic level (there's a reason we don't really hand-write assembly, after all!). But if you're working on assembly-level tooling, usually, you want very clear indications of what instruction you're working with, and "out_operands = opcode in_operands" or "opcode operands" are much, much clearer representations for such work. Most of the people who work with assembly care about the latter, and so the latter representation is more useful for them, and that's why we write assembly the way we do.



I had a look at the TI SHARC manual at https://www.analog.com/media/en/dsp-documentation/processor-... to see how they did it. It seems to me that the SHARC assembly instructions would tell you the exact variant with the same precision as the traditional cryptic mnemonics.

Multiplication results are stored in a double-length result register called MRF. The type of inputs is indicated by a modifier word in parentheses, so that multiplication between two signed integers is indicated as MRF = R2 * R3 (SSI); whereas multiplication between a signed and unsigned integer is MRF = R2 * R3 (SUI); There is no popcount, but binary log is written like R2 = LOGB F3; and presumably similar notation could be used for popcount.

Cache access seems to be controlled by mode bits in a control register. Sign extension is supported in only a few instructions, but is indicated by the trailing modifier (SE).


> Except it doesn't scale that well to all of the different operations. How do you distinguish between a signed and an unsigned high multiply? What do you do for operations like count-trailing-zeros or popcount, which don't map to standard operator symbols? How do you distinguish between nontemporal loads, atomic loads, sign-extended byte-to-word loads, etc.?

Yes - that's where is falls down :(




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: