Uros
Please, find the new patch attached.
Previously, I thought to change integer part of the " ix86_preferred_simd_mode" 
function in the same way 
as it done with floating point part. I haven't done it to disturb less code by 
the patch.
I completely agree with your proposal, currently the code looks better.

In case of  " ix86_autovectorize_vector_sizes ", I've done changes in the 
proposed way, but I keep 
algorithm the same as it was in mainline. Please note, the function can return 
"0" in original version.
I assume you just propose the "style of changes" in previous message.

If you like to change "ix86_autovectorize_vector_sizes" function 
algorithmically, I would propose to do 
this in separate patch.

Sergey

-----Original Message-----
From: Uros Bizjak [mailto:ubiz...@gmail.com] 
Sent: Monday, September 18, 2017 11:44 AM
To: Shalnov, Sergey <sergey.shal...@intel.com>
Cc: gcc-patches@gcc.gnu.org; kirill.yuk...@gmail.com; Koval, Julia 
<julia.ko...@intel.com>; Senkevich, Andrew <andrew.senkev...@intel.com>
Subject: Re: [PATCH, i386] Enable option -mprefer-avx256 added for Intel AVX512 
configuration

On Thu, Sep 14, 2017 at 2:10 PM, Shalnov, Sergey <sergey.shal...@intel.com> 
wrote:
> Hi,
> GCC has the option "mprefer-avx128" to use 128-bit AVX registers instead of 
> 256-bit AVX registers in the auto-vectorizer.
> This patch enables the command line option "mprefer-avx256" that reduces 
> 512-bit registers usage in "march=skylake-avx512" mode.
> This is the initial implementation of the option. Currently, 512-bit 
> registers might appears in some cases. I have a plan to continue fix the 
> cases where 512-bit registers are appear.
> Sergey
>
> 2017-09-14  Sergey Shalnov  sergey.shal...@intel.com
> * config/i386/i386.opt (mprefer-avx256): New flag.
> * config/i386/i386.c (ix86_preferred_simd_mode): Prefer 256-bit AVX modes 
> when the flag -mprefer-avx256 is on.

Please rewrite integer mode handling in ix86_preferred_simd_mode to some 
consistent form, like:

    case E_QImode:
      if (TARGET_AVX512BW && !TARGET_PREFER_AVX256)
    return V64QImode;
      else if (TARGET_AVX && !TARGET_PREFER_AVX128)
    return V32QImode;
      else
    return V16QImode;

...

and ix86_autovectorize_vector_sizes to some more readable form, like:

static unsigned int
ix86_autovectorize_vector_sizes (void)
{
  unsigned int bytesizes = 16;

  if (TARGET_AVX && !TARGET_PREFER_AVX128)
    bytesizes |= 32;
  if (TARGET_AVX512F && !TARGET_PREFER_AVX256)
    bytesizes |= 64;

  return bytesizes;
}

Uros.

Attachment: 0001-Option-mprefer-avx256-added-for-Intel-AVX512-configu.patch
Description: 0001-Option-mprefer-avx256-added-for-Intel-AVX512-configu.patch

Reply via email to