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

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

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

Compiler-specific Features<br />

4.7.88 __uhadd8 intrinsic<br />

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

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

results.<br />

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

Where:<br />

val1<br />

val2<br />

holds the first four 8-bit summands<br />

holds the second four 8-bit summands.<br />

The __uhadd8 intrinsic returns:<br />

• the halved addition of the first bytes in each operand, in the first byte of the return<br />

value<br />

• the halved addition of the second bytes in each operand, in the second byte of the<br />

return value<br />

• the halved addition of the third bytes in each operand, in the third byte of the<br />

return value<br />

• the halved addition of the fourth bytes in each operand, in the fourth byte of the<br />

return value.<br />

Example:<br />

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

{<br />

unsigned int res;<br />

}<br />

res = __uhadd8(val1,val2); /* res[7:0] = (val1[7:0] + val2[7:0])

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

Saved successfully!

Ooh no, something went wrong!