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.89 __uhasx intrinsic<br />

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

compiler. It enables you to exchange the halfwords of the second operand, add the high<br />

halfwords and subtract the low halfwords, halving the results.<br />

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

Where:<br />

val1<br />

val2<br />

holds the first operand for the subtraction in the low halfword, and the<br />

first operand for the addition in the high halfword<br />

holds the second operand for the subtraction in the high halfword, and the<br />

second operand for the addition in the low halfword.<br />

The __uhasx intrinsic returns:<br />

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

halfword in the first operand<br />

• the halved addition of the high halfword in the first operand and the low halfword<br />

in the second operand.<br />

Example:<br />

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

{<br />

unsigned int res;<br />

}<br />

res = __uhasx(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!