10.118 __ldrexd intrinsic

The __ldrexd intrinsic lets you load doubleword data from memory in your C or C++ code using an LDREXD instruction.

Note

The compiler does not guarantee that it will preserve the state of the exclusive monitor. It may generate load and store instructions between the LDREXD instruction generated for the __ldrexd intrinsic and the STREXD instruction generated for the __strexd intrinsic. Because memory accesses can clear the exclusive monitor, code using the __ldrexd and __strexd intrinsics can have unexpected behavior. Where LDREXD and STREXD instructions are needed, ARM recommends using embedded assembly.

Syntax

unsigned long long __ldrexd(volatile void *ptr)

Where:

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 10-9 Access widths that the __ldrex intrinsic supports

Instruction Size of data loaded Pointer type
LDREXD long long long long *

Return value

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

Errors

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, depending on the source language:

  • In C code: Warning: #223-D: function "__ldrexd" declared implicitly.
  • In C++ code: Error: #20: identifier "__ldrexd" is undefined.

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

Related reference
10.117 __ldrex intrinsic
10.139 __strex intrinsic
10.140 __strexd intrinsic
Related information
LDREX
Non-ConfidentialPDF file icon PDF versionARM DUI0472J
Copyright © 2010-2013 ARM. All rights reserved.