29.12.2014 Views

RealView Compilation Tools Compiler Reference Guide - ARM ...

RealView Compilation Tools Compiler Reference Guide - ARM ...

RealView Compilation Tools Compiler Reference Guide - ARM ...

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>Compiler</strong>-specific Features<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 />

The __strex intrinsic does not support access to doubleword data. The compiler<br />

generates an error if you specify an access width that is not supported.<br />

Example<br />

int foo(void)<br />

{<br />

int loc=0xff;<br />

}<br />

return(!__strex(0x20, (volatile char *)loc));<br />

Compiling this code with the command-line option --cpu=6k produces<br />

||foo|| PROC<br />

MOV<br />

MOV<br />

STREXB<br />

RSBS<br />

MOVCC<br />

BX<br />

ENDP<br />

r0,#0xff<br />

r2,#0x20<br />

r1,r2,[r0]<br />

r0,r1,#1<br />

r0,#0<br />

lr<br />

See also<br />

• __ldrex on page 4-75<br />

• LDREX and STREX on page 4-35 in the Assembler <strong>Guide</strong>.<br />

4.7.40 __strt<br />

This intrinsic inserts an assembly language instruction of the form STR{size}T into the<br />

instruction stream generated by the compiler. It enables you to store data to memory in<br />

your C or C++ code using an STRT instruction.<br />

4-90 Copyright © 2007, 2010 <strong>ARM</strong> Limited. All rights reserved. <strong>ARM</strong> DUI 0348A<br />

Non-Confidential

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

Saved successfully!

Ooh no, something went wrong!