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.59 __sel intrinsic<br />

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

compiler. It enables you to select bytes from the input parameters, whereby the bytes<br />

that are selected depend upon the results of previous SIMD instruction intrinsics. The<br />

results of previous SIMD instruction intrinsics are represented by the Greater than or<br />

Equal flags in the Application Program Status Register (APSR).<br />

The __sel intrinsic works equally well on both halfword and byte operand intrinsic<br />

results. This is because halfword operand operations set two (duplicate) GE bits per<br />

value. For example, the __sasx intrinsic.<br />

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

Where:<br />

val1<br />

val2<br />

holds four selectable bytes<br />

holds four selectable bytes.<br />

The __sel intrinsic selects bytes from the input parameters and returns them in the<br />

return value, res, according to the following criteria:<br />

if APSR.GE[0] == 1 then res[7:0] = val1[7:0] else res[7:0] = val2[7:0]<br />

if APSR.GE[1] == 1 then res[15:8] = val1[15:8] else res[15:8] = val2[15:8]<br />

if APSR.GE[2] == 1 then res[23:16] = val1[23:16] else res[23:16] = val2[23:16]<br />

if APSR.GE[3] == 1 then res[31;24] = val1[31:24] else res = val2[31:24]<br />

Example:<br />

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

{<br />

unsigned int res;<br />

}<br />

res = __sel(val1,val2);<br />

return res;<br />

unsigned int foo(unsigned int a, unsigned int b)<br />

{<br />

int res;<br />

int filtered_res;<br />

}<br />

res = __sasx(a,b); /* This intrinsic sets the GE flags */<br />

filtered_res = ge_filter(res); /* Filter the results of the __sasx */<br />

/* intrinsic. Some results are filtered */<br />

/* out based on the GE flags. */<br />

return filtered_res;<br />

4-134 Copyright © 2007-2010 <strong>ARM</strong>. All rights reserved. <strong>ARM</strong> DUI 0348C<br />

Non-Confidential,<br />

ID101213

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

Saved successfully!

Ooh no, something went wrong!