ARM Technical Support Knowledge Articles

GENERATING INSTRUCTIONS USING CERTAIN ADDRESSING MODES

Applies to: C166 C Compiler

Answer


Information in this article applies to:


QUESTION

Does the compiler generate assembler instructions with the following address modes?

MOV    [-Rw],  Rw
MOV    [Rw+],  [Rw]
MOV    [Rw],   [Rw+]
MOV    Rw,     [Rw+]
MOV    [Rw],   [Rw]
CMP    Rw,     [Rw+]
XOR    Rw,     [Rw+]
OR     Rw,     [Rw+]
ADD    Rw,     [Rw+]
SUB    Rw,     [Rw+]

If so, what C instructions/compiler optimizations can be used?

ANSWER

Changing the Memory Model *can* affect the addressing mode used by the compiler, however, the compiler will always generate the instructions necessary to obtain the most efficient method it can.

There is no way to force or coerce the compiler into using specific addressing modes. If it is essential that a particular addressing mode is used, then the only option is to write the assembler by hand.

Article last edited on: 2005-08-03 12:56:51

Rate this article

[Bad]
|
|
[Good]
Disagree? Move your mouse over the bar and click

Did you find this article helpful? Yes No

How can we improve this article?

Link to this article
Copyright © 2011 ARM Limited. All rights reserved. External (Open), Non-Confidential