]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
[i386] Fix type in ix86_move_max setup
authorRichard Biener <rguenther@suse.de>
Thu, 30 Oct 2025 12:30:21 +0000 (13:30 +0100)
committerRichard Biener <rguenth@gcc.gnu.org>
Thu, 30 Oct 2025 13:26:27 +0000 (14:26 +0100)
There's a typo in the way we compute opts->x_ix86_move_max:

  if (opts_set->x_ix86_move_max == PVW_NONE)
    {
      /* Set the maximum number of bits can be moved from memory to
         memory efficiently.  */
      if (opts_set->x_prefer_vector_width_type != PVW_NONE)
        opts->x_ix86_move_max = opts->x_prefer_vector_width_type;
      else if (ix86_tune_features[X86_TUNE_AVX512_MOVE_BY_PIECES])
        opts->x_ix86_move_max = PVW_AVX512;
      else if (ix86_tune_features[X86_TUNE_AVX256_MOVE_BY_PIECES])
        opts->x_ix86_move_max = PVW_AVX256;
      else
        {
          opts->x_ix86_move_max = opts->x_prefer_vector_width_type;
 /* */    if (opts_set->x_ix86_move_max == PVW_NONE)
            {
              if (TARGET_AVX512F_P (opts->x_ix86_isa_flags))
                opts->x_ix86_move_max = PVW_AVX512;
              /* Align with vectorizer to avoid potential STLF issue.  */
              else if (TARGET_AVX_P (opts->x_ix86_isa_flags))
                opts->x_ix86_move_max = PVW_AVX256;
              else
                opts->x_ix86_move_max = PVW_AVX128;
            }
        }
    }

as written the /* */ condition is redundant with the outermost one.
But intended is (IMO) that the earlier set opts->x_prefer_vector_width_type
via X86_TUNE_{AVX128,AVX256}_OPTIMAL takes precedence over the ISA
based setup that follows.  So instead of checking opts_set we want
to check whether the previous assignment left us with still PVW_NONE.
The issue makes us ignore X86_TUNE_AVX128_OPTIMAL/X86_TUNE_AVX256_OPTIMAL
when determining opts->x_ix86_move_max.

* config/i386/i386-options.cc (ix86_option_override_internal):
Fix check during opts->x_ix86_move_max initialization.

gcc/config/i386/i386-options.cc

index dadcf7664c632456a44cb524fbbb8bb20d08e976..ba598a817f304e1048b251b6a30e1940f8df0156 100644 (file)
@@ -2917,7 +2917,7 @@ ix86_option_override_internal (bool main_args_p,
       else
        {
          opts->x_ix86_move_max = opts->x_prefer_vector_width_type;
-         if (opts_set->x_ix86_move_max == PVW_NONE)
+         if (opts->x_ix86_move_max == PVW_NONE)
            {
              if (TARGET_AVX512F_P (opts->x_ix86_isa_flags))
                opts->x_ix86_move_max = PVW_AVX512;