Lines Matching full:exponent

273 template <int Exponent>
274 struct ImplSaturatingRoundingMultiplyByPOT<Exponent, v4i32, 1> {
276 static_assert(Exponent >= 0 && Exponent < 32, "");
277 if (Exponent < 5) {
278 for (int i = 0; i < Exponent; i++) {
283 // Saturate each signed 32-bit element to (32 - Exponent)
285 v4i32 res = __builtin_msa_sat_s_w(x, 31 - Exponent);
290 // will have Exponent trailing zero bits after the shift. Those
292 res = __builtin_msa_slli_w(res, Exponent);
301 template <int Exponent>
302 struct ImplSaturatingRoundingMultiplyByPOT<Exponent, v8i16, 1> {
304 static_assert(Exponent >= 0 && Exponent < 16, "");
305 if (Exponent < 5) {
306 for (int i = 0; i < Exponent; i++) {
311 // Saturate each signed 16-bit element to (16 - Exponent)
313 v8i16 res = __builtin_msa_sat_s_h(x, 15 - Exponent);
318 // will have Exponent trailing zero bits after the shift. Those
320 res = __builtin_msa_slli_h(res, Exponent);
329 template <int Exponent>
330 struct ImplSaturatingRoundingMultiplyByPOT<Exponent, v4i32, -1> {
332 static_assert(-31 <= Exponent && Exponent <= -1, "");
341 return __builtin_msa_srari_w(x, -Exponent);
345 template <int Exponent>
346 struct ImplSaturatingRoundingMultiplyByPOT<Exponent, v8i16, -1> {
348 static_assert(-15 <= Exponent && Exponent <= -1, "");
357 return __builtin_msa_srari_h(x, -Exponent);
362 inline v4i32 RoundingDivideByPOT(v4i32 x, int exponent) {
363 v4i32 e = __builtin_msa_fill_w(exponent);
366 // Reset them to 0 if exponent is 0.
369 // if exponent is non-zero.
379 inline v8i16 RoundingDivideByPOT(v8i16 x, int exponent) {
380 v8i16 e = __builtin_msa_fill_h(exponent);
383 // Reset them to 0 if exponent is 0.
386 // if exponent is non-zero.