Jakub Jelinek b95f529df4 i386: Fix up avx_vpermilp_parallel [PR124138]
r16-3677 extended avx_vpermilp_parallel so that it handles also V8DImode
(among others) and broke this testcase.
For V8DFmode the bug existed there already since r0-127405 which extended
avx_vpermilp_parallel to handle V8DFmode.
For V16SImode/V16SFmode I think the code is correct, in that case it can
for V4SImode/V4SFmode choose any permutation it wants and the
V8S{I,F}mode and V16S{I,F}mode cases before FALLTHRU verify the upper lanes
match those lower ones.
For V[48]D[IF]mode the function uses different checking, where it checks
each pair of ipar separately:
    case E_V8DFmode:
    case E_V8DImode:
      /* In the 512-bit DFmode case, we can only move elements within
         a 128-bit lane.  First fill the second part of the mask,
         then fallthru.  */
      for (i = 4; i < 6; ++i)
        {
          if (ipar[i] < 4 || ipar[i] >= 6)
            return 0;
          mask |= (ipar[i] - 4) << i;
        }
      for (i = 6; i < 8; ++i)
        {
          if (ipar[i] < 6)
            return 0;
          mask |= (ipar[i] - 6) << i;
        }
      /* FALLTHRU */

    case E_V4DFmode:
    case E_V4DImode:
      /* In the 256-bit DFmode case, we can only move elements within
         a 128-bit lane.  */
      for (i = 0; i < 2; ++i)
        {
          if (ipar[i] >= 2)
            return 0;
          mask |= ipar[i] << i;
        }
      for (i = 2; i < 4; ++i)
        {
          if (ipar[i] < 2)
            return 0;
          mask |= (ipar[i] - 2) << i;
        }
      break;
so that it directly computes corresponding mask bit.
Earlier in the function it verified ipar[i] wasn't above
nelts (nor negative), so just checking if (ipar[i] >= 2) is ok, it can't
be negative, and just checking if (ipar[i] < 6) is also fine, because
it can never be 8 or above (because nelts is 8 in that case).
Though, the if (ipar[i] < 2) case check used to be correct only when
nelts could be only 4, when it can be 8 too, it will as in the following
testcase happily accept values in the [4, 7] range which shouldn't be
accepted (it can only handle [2, 3]).

Fixed thusly.

2026-02-17  Jakub Jelinek  <jakub@redhat.com>

	PR target/124138
	* config/i386/i386.cc (avx_vpermilp_parallel): Verify
	ipar[2] and ipar[3] aren't larger than 3.

	* gcc.dg/pr124138.c: New test.
	* gcc.target/i386/avx512f-pr124138-1.c: New test.
	* gcc.target/i386/avx512f-pr124138-2.c: New test.
2026-02-18 10:28:34 +01:00
2026-02-05 00:16:28 +00:00
2026-02-06 00:16:39 +00:00
2026-02-16 00:16:25 +00:00
2026-02-06 00:16:39 +00:00
2026-02-07 00:16:36 +00:00
2026-02-15 00:16:25 +00:00
2026-02-13 00:16:32 +00:00
2026-02-13 00:16:32 +00:00
2026-02-13 00:16:32 +00:00
2026-02-06 00:16:39 +00:00
2026-02-18 00:16:35 +00:00
2026-02-06 00:16:39 +00:00

This directory contains the GNU Compiler Collection (GCC).

The GNU Compiler Collection is free software.  See the files whose
names start with COPYING for copying permission.  The manuals, and
some of the runtime libraries, are under different terms; see the
individual source files for details.

The directory INSTALL contains copies of the installation information
as HTML and plain text.  The source of this information is
gcc/doc/install.texi.  The installation information includes details
of what is included in the GCC sources and what files GCC installs.

See the file gcc/doc/gcc.texi (together with other files that it
includes) for usage and porting information.  An online readable
version of the manual is in the files gcc/doc/gcc.info*.

See http://gcc.gnu.org/bugs/ for how to report bugs usefully.

Copyright years on GCC source files may be listed using range
notation, e.g., 1987-2012, indicating that every year in the range,
inclusive, is a copyrightable year that could otherwise be listed
individually.
Description
No description provided
Readme 4.2 GiB
Languages
C++ 30.7%
C 30.2%
Ada 14.4%
D 6.1%
Go 5.7%
Other 12.4%