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

4.7.87 __uhadd16 intrinsic<br />

This intrinsic inserts a UHADD16 instruction into the instruction stream generated by the<br />

compiler. It enables you to perform two unsigned 16-bit integer additions, halving the<br />

results.<br />

unsigned int __uhadd16(unsigned int val1, unsigned int val2)<br />

Where:<br />

val1<br />

val2<br />

holds the first two 16-bit summands<br />

holds the second two 16-bit summands.<br />

The __uhadd16 intrinsic returns:<br />

• the halved addition of the low halfwords in each operand, in the low halfword of<br />

the return value<br />

• the halved addition of the high halfwords in each operand, in the high halfword<br />

of the return value.<br />

Example:<br />

unsigned int add_halfwords_then halve(unsigned int val1, unsigned int val2)<br />

{<br />

unsigned int res;<br />

}<br />

res = __uhadd16(val1,val2); /* res[15:0] = (val1[15:0] + val2[15:0])

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

Saved successfully!

Ooh no, something went wrong!