On Thu, Sep 14, 2017 at 2:10 PM, Shalnov, Sergey
<[email protected]> 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 [email protected]
> * 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.