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

}<br />

rtn_addr = __builtin_return_address(0); // return the lr<br />

return rtn_addr;<br />

See also<br />

• __builtin_frame_address on page 4-66<br />

• __return_address on page 4-83.<br />

4.7.7 __builtin_popcount<br />

This builtin function returns the population count of a specified value, that is, the<br />

number of 1-bits in the value.<br />

Syntax<br />

int __builtin_popcount(unsigned int val)<br />

Where:<br />

val<br />

is an unsigned integer whose population is to be counted.<br />

Return value<br />

__builtin_popcount returns the number of bits set to 1 in val.<br />

Example<br />

void foo(void)<br />

{<br />

int i = __builtin_popcount(3); // returns 2<br />

int j = __builtin_popcount(5); // returns 2<br />

int k = __builtin_popcount(8); // returns 1<br />

}<br />

4.7.8 __cdp<br />

This intrinsic inserts a CDP or CDP2 instruction into the instruction stream generated by<br />

the compiler. It enables you to include coprocessor data operations in your C or C++<br />

code.<br />

Syntax<br />

__cdp(unsigned int coproc, unsigned int opcode1, unsigned int opcode2)<br />

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