Hi,
Modern architectures provides wider and wider vector registers. This patch 
implements
common (in i386 arch) option to prefer vector register width for the vectorizer.
Currently, GCC has "-mprefer-avx128" and "-mprefer-avx256" options to limit 
maximum
vector register width in vectorizer. To avoid feature implementation of further 
options 
like "-mprefer-avx512", "-mprefer-avx1024", etc. I propose to implement 
the option "-mprefer-vector-width=[none|128|256|512]".

Also I propose to remove recently added -mprefer-avx256 option in favor
of -mprefer-vector-width=256 and consider also make -mprefer-avx128 as 
deprecated. 
Latter one is already there for few years, so It might be better to keep it as 
deprecated for some time.


2017-11-13  Sergey Shalnov  <sergey.shal...@intel.com>
gcc/
               * config/i386/i386-opts.h (enum prefer_vector_width): Added new 
enum
               for the new option -mprefer-vector-width=[none|128|256|512].
               * config/i386/i386.c (ix86_target_string): remove old style
               -mprefer-avx128 and -mprefer-avx256 options.
               (ix86_option_override_internal): Apply defaults for the
               -mprefer-vector-width=[128|256] option.
               * config/i386/i386.h (TARGET_PREFER_AVX128, 
TARGET_PREFER_AVX256):
               Implement macros to work with -mprefer-vector-width=.
               * config/i386/i386.opt: Implemented option
               -mprefer-vector-width=[none|128|256|512].
               * doc/invoke.texi: Documentation for
               -mprefer-vector-width=[none|128|256|512].

gcc/testsuite/
               * g++.dg/ext/pr57362.C (__attribute__): Apply new option syntax.
               * g++.dg/torture/pr81249.C: Ditto.
               * gcc.dg/torture/pr66076.c: Ditto.
               * gcc.target/i386/avx-cvt-3.c: Ditto.
               * gcc.target/i386/avx2-vpaddb-3.c: Ditto.
               * gcc.target/i386/avx2-vpaddd-3.c: Ditto.
               * gcc.target/i386/avx2-vpaddq-3.c: Ditto.
               * gcc.target/i386/avx2-vpaddw-3.c: Ditto.
               * gcc.target/i386/avx2-vpand-3.c: Ditto.
               * gcc.target/i386/avx2-vpmulld-3.c: Ditto.
               * gcc.target/i386/avx2-vpmullw-3.c: Ditto.
               * gcc.target/i386/avx2-vpsrad-3.c: Ditto.
               * gcc.target/i386/avx2-vpsraw-3.c: Ditto.
               * gcc.target/i386/avx2-vpsrld-3.c: Ditto.
               * gcc.target/i386/avx2-vpsrlw-3.c: Ditto.
               * gcc.target/i386/avx2-vpsubb-3.c: Ditto.
               * gcc.target/i386/avx2-vpsubd-3.c: Ditto.
               * gcc.target/i386/avx2-vpsubq-3.c: Ditto.
               * gcc.target/i386/avx2-vpsubw-3.c: Ditto.
               * gcc.target/i386/avx256-unaligned-load-1.c: Ditto.
               * gcc.target/i386/avx256-unaligned-load-2.c: Ditto.
               * gcc.target/i386/avx256-unaligned-load-4.c: Ditto.
               * gcc.target/i386/avx256-unaligned-store-1.c: Ditto.
               * gcc.target/i386/avx256-unaligned-store-2.c: Ditto.
               * gcc.target/i386/avx256-unaligned-store-4.c: Ditto.
               * gcc.target/i386/avx512f-constant-float-return.c: Ditto.
               * gcc.target/i386/avx512f-prefer.c: Ditto.
               * gcc.target/i386/pr82460-2.c: Ditto.
               * gfortran.dg/vect/fast-math-mgrid-resid.f: Ditto.

Sergey

Attachment: 0004-Refactoring-options-mprefer-avx-128-256-into-one-mpr.patch
Description: 0004-Refactoring-options-mprefer-avx-128-256-into-one-mpr.patch

Reply via email to