Research Article

Inastemp: A Novel Intrinsics-as-Template Library for Portable SIMD-Vectorization

Code 11

Inastemp static condition statements.
(1) // Considering InaVecBestType can contain 4 doubles
(2) InaVecBestType<double> a_value = ;
(3)
(4) // Return 10 where condition is true (a_value < 10) else return false
(5) InaVecBestType<double> res = InaVecBestType<double>::IfElse(a_value < 10, 10., 20.);
(6) // res =>
(7)
(8) // Return res    2 where condition is false (a_value == res) else return 0
(9) res += InaVecBestType<double>::IfFalse(a_value == res, res 2);
(10) // res => +
(11) // res =>
(12)
(13) // Return res where condition is true (res != 10) else return 0
(14) res = InaVecBestType<double>::IfTrue(res != 60, res);
(15) // res =>
(16)
(17) // Equivalent to: if(0 < a_value) a_value += 10;
(18) InaVecBestType<double>::MaskType a_is_positive_mask = 0 < a_value;
(19) a_value += InaVecBestType<double>::IfTrue(a_is_positive_mask, 10.0);
(20)
(21) // Equivalent to: if(a_value < another_value) a_value += another_value − 1
(22) a_value += InaVecBestType<double>::IfTrue(a_value < another_value, (another_value − 1.));