Unaligned Load Register (LDR)
instructions generated by the compiler
In some circumstances, the compiler might intentionally generate
unaligned LDR instructions. In particular, the
compiler can do this to load halfwords from memory, even where the
architecture supports dedicated halfword load instructions.
For example, to access an unaligned short within
a __packed structure, the compiler might load the
required halfword into the top half of a register and then shift
it down to the bottom half. This operation requires only one memory
access, whereas performing the same operation using LDRB instructions
requires two memory accesses, plus instructions to merge the two
bytes.
This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.
ARM websites use two types of cookie: (1) those that enable the site to function and perform as required; and (2) analytical cookies which anonymously track visitors only while using the site. If you are not happy with this use of these cookies please review our Privacy Policy to learn how they can be disabled. By disabling cookies some features of the site will not work.