On Wed, Feb 18, 2026 at 10:00:38AM +0100, Uros Bizjak wrote:
> BTW: Maybe IN_RANGE should be used more in this function? IMO,
> "!IN_RANGE (ipar[i], 2,3)" is easier to comprehend.

So like this?

Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?

2026-02-18  Jakub Jelinek  <[email protected]>

        * config/i386/i386.cc (avx_vpermilp_parallel): Use IN_RANGE
        macro.

--- gcc/config/i386/i386.cc.jj  2026-02-18 10:28:24.946476966 +0100
+++ gcc/config/i386/i386.cc     2026-02-18 17:50:35.081169983 +0100
@@ -20677,13 +20677,13 @@ avx_vpermilp_parallel (rtx par, machine_
         then fallthru.  */
       for (i = 4; i < 6; ++i)
        {
-         if (ipar[i] < 4 || ipar[i] >= 6)
+         if (!IN_RANGE (ipar[i], 4, 5))
            return 0;
          mask |= (ipar[i] - 4) << i;
        }
       for (i = 6; i < 8; ++i)
        {
-         if (ipar[i] < 6)
+         if (!IN_RANGE (ipar[i], 6, 7))
            return 0;
          mask |= (ipar[i] - 6) << i;
        }
@@ -20695,13 +20695,13 @@ avx_vpermilp_parallel (rtx par, machine_
          a 128-bit lane.  */
       for (i = 0; i < 2; ++i)
        {
-         if (ipar[i] >= 2)
+         if (!IN_RANGE (ipar[i], 0, 1))
            return 0;
          mask |= ipar[i] << i;
        }
       for (i = 2; i < 4; ++i)
        {
-         if (ipar[i] < 2 || ipar[i] >= 4)
+         if (!IN_RANGE (ipar[i], 2, 3))
            return 0;
          mask |= (ipar[i] - 2) << i;
        }


        Jakub

Reply via email to