You copied the Doc URL to your clipboard.

__ldrexd intrinsic

This intrinsic inserts an LDREXD instruction into the instruction stream generated by the compiler. It enables you to load data from memory in your C or C++ code using an LDREXD instruction. It supports access to doubleword data.


unsigned long long __ldrexd(volatile void *ptr)



points to the address of the data to be loaded from memory. To specify the type of the data to be loaded, cast the parameter to an appropriate pointer type.

Table 16. Access widths supported by the __ldrex intrinsic
InstructionSize of data loadedC cast
LDREXDunsigned long long(unsigned long long *)
LDREXDsigned long long(signed long long *)

Return value

The __ldrexd intrinsic returns the data loaded from the memory address pointed to by ptr.


The compiler does not recognize the __ldrexd intrinsic when compiling for a target that does not support the LDREXD instruction. The compiler generates either a warning or an error in this case.

The __ldrexd intrinsic only supports access to doubleword data. The compiler generates an error if you specify an access width that is not supported.