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.65 __shsub8 intrinsic<br />

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

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

results.<br />

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

Where:<br />

val1<br />

val2<br />

holds the first four operands<br />

holds the second four operands.<br />

The __shsub8 intrinsic returns:<br />

• the halved subtraction of the first byte in the second operand from the first byte in<br />

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

• the halved subtraction of the second byte in the second operand from the second<br />

byte in the first operand, in the second byte of the return value<br />

• the halved subtraction of the third byte in the second operand from the third byte<br />

in the first operand, in the third byte of the return value<br />

• the halved subtraction of the fourth byte in the second operand from the fourth<br />

byte in the first operand, in the fourth byte of the return value<br />

Example:<br />

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

{<br />

unsigned int res;<br />

}<br />

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