04.01.2015 Views

RealView Compilation Tools - ARM Information Center

RealView Compilation Tools - ARM Information Center

RealView Compilation Tools - ARM Information Center

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Compiler-specific Features<br />

See also<br />

• __usat on page 4-106<br />

• SSAT and USAT on page 4-96 in the Assembler Guide.<br />

4.7.36 __strex<br />

This intrinsic inserts an instruction of the form STREX[size] into the instruction stream<br />

generated by the compiler. It enables you to use an STREX instruction in your C or C++<br />

code to store data to memory.<br />

Syntax<br />

int __strex(unsigned int val, volatile void *ptr)<br />

Where:<br />

val<br />

ptr<br />

is the value to be written to memory.<br />

points to the address of the data to be written to in memory. To specify<br />

the size of the data to be written, cast the parameter to an appropriate<br />

integral type.<br />

Table 4-11 Access widths supported by the __strex intrinsic<br />

Instruction Size of data stored C cast<br />

STREXB unsigned byte (char *)<br />

STREXH unsigned halfword (short *)<br />

STREX word (int *)<br />

Return value<br />

The __strex intrinsic returns:<br />

0 if the STREX instruction succeeds<br />

1 if the STREX instruction is locked out.<br />

Errors<br />

The compiler does not recognize the __strex intrinsic when compiling for a target that<br />

does not support the STREX instruction. The compiler generates either a warning or an<br />

error in this case.<br />

<strong>ARM</strong> DUI 0348C Copyright © 2007-2010 <strong>ARM</strong>. All rights reserved. 4-101<br />

ID101213<br />

Non-Confidential,

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!