SPRUIG8J January 2018 – March 2024
A constructed vector predicate value of type
__vpred
can be used in any intrinsic shown to accept this value
as an operand. Intrinsics that rely on vector predicate types are listed in
c7x_vpred.h
. Other operations on vector predicates—predicated
add, predicated subtract, predicated shift, and predicated store—can be performed.
Most operations can be made vector predicatable using the vector select
__select(vpred, ...)
intrinsic:
int16 ex_compare_and_select(int16 src1, int16 src2)
{
vpred condition = __cmp_gt_pred(src1, src2);
int16 result1 = src1 - src2; // if-clause
int16 result2 = src2 - src1; // else-clause
return __select(condition, result1, result2);
}