Keil Logo

Load immediate values using LDR Rd, =const

4.6 Load immediate values using LDR Rd, =const

The LDR Rd,=const pseudo-instruction generates the most efficient single instruction to load any 32-bit number.

You can use this pseudo-instruction to generate constants that are out of range of the MOV and MVN instructions.
The LDR pseudo-instruction generates the most efficient single instruction for the specified immediate value:
  • If the immediate value can be constructed with a single MOV or MVN instruction, the assembler generates the appropriate instruction.
  • If the immediate value cannot be constructed with a single MOV or MVN instruction, the assembler:
    • Places the value in a literal pool (a portion of memory embedded in the code to hold constant values).
    • Generates an LDR instruction with a PC-relative address that reads the constant from the literal pool.
    For example:
        LDR      rn, [pc, #offset to literal pool]
                              ; load register n with one word
                              ; from the address [pc + offset]
    You must ensure that there is a literal pool within range of the LDR instruction generated by the assembler.
Related concepts
Non-ConfidentialPDF file icon PDF versionARM DUI0379H
Copyright © 2007, 2008, 2011, 2012, 2014-2016 ARM. All rights reserved. 
  Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings

Privacy Policy Update

Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.