"align" MIPS instructions

What exactly does this instruction do? I know that he is trying to align data with a multiple of a certain number, but why do you need this? Is there an equivalent instruction for other assemblers?

+7
assembly mips alignment memory instruction-set
source share
3 answers

You usually align data to improve performance. For most processors, memory access has some limitation in the absence of access to specific byte boundaries. For other assemblers, there is often a pseudo-op .align for this. Most compilers also align their data structures (although you can disable it for debugging purposes).

Also see the Wikipedia entry .

Note that unemulated MIPS systems may even crash if you try to access unaudited memory locations (see here and here ).

+9
source share

Is there an equivalent instruction in other assemblers?

MASM has an Align directive: http://msdn.microsoft.com/en-us/library/dwa9fwef(VS.80).aspx

+1
source share

It aligns everything to the nth power of two. This is not an instruction, its directive, which will be translated into instructions

Regarding its use, for example:

Instructions

mips32 is always 32 bits. Therefore, each instruction should begin with the word boundary. Adding the .align directive before running the code aligns things up to 32 bits. This has many advantages, including that only one memory access is required to receive a command, and that it is likely to be useful in the command cache.

0
source share

All Articles