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.62 __shasx intrinsic<br />

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

compiler. It enables you to exchange the two halfwords of one operand, perform one<br />

signed 16-bit integer addition and one signed 16-bit subtraction, and halve the results.<br />

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

Where:<br />

val1<br />

val2<br />

holds the first halfword operands<br />

holds the second halfword operands.<br />

The __shasx intrinsic returns:<br />

• the halved subtraction of the high halfword in the second operand from the low<br />

halfword in the first operand, in the low halfword of the return value<br />

• the halved subtraction of the low halfword in the second operand from the high<br />

halfword in the first operand, in the high halfword of the return value.<br />

Example:<br />

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

{<br />

unsigned int res;<br />

}<br />

res = __shasx(val1,val2); /* res[15:0] = (val1[15:0] - val2[31:16])

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

Saved successfully!

Ooh no, something went wrong!