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 />

See also<br />

• --thumb on page 2-86<br />

• LDR and STR (User mode) on page 4-18 in the Assembler <strong>Guide</strong>.<br />

4.7.41 __swp<br />

This intrinsic inserts a SWP{size} instruction into the instruction stream generated by the<br />

compiler. It enables you to swap data between memory locations from your C or C++<br />

code.<br />

Note<br />

The use of SWP and SWPB is deprecated in <strong>ARM</strong>v6 and above.<br />

Syntax<br />

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

where:<br />

val<br />

ptr<br />

Is the data 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-12 Access widths supported by the __swp intrinsic<br />

Instruction Size of data loaded C cast<br />

SWPB unsigned byte (char *)<br />

SWP word (int *)<br />

Return value<br />

The __swp intrinsic returns the data value that previously, is in the memory address<br />

pointed to by ptr, before this value is overwitten by val.<br />

4-92 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!