[Bug target/92448] Confusing using of TARGET_PREFER_AVX128

2019-11-17 Thread crazylht at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92448

Hongtao.liu  changed:

   What|Removed |Added

 Status|UNCONFIRMED |RESOLVED
 Resolution|--- |FIXED

--- Comment #4 from Hongtao.liu  ---
Fixed in gcc10.

[Bug target/92448] Confusing using of TARGET_PREFER_AVX128

2019-11-17 Thread liuhongt at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92448

--- Comment #3 from liuhongt at gcc dot gnu.org ---
Author: liuhongt
Date: Mon Nov 18 02:22:55 2019
New Revision: 278385

URL: https://gcc.gnu.org/viewcvs?rev=278385=gcc=rev
Log:
Split X86_TUNE_AVX128_OPTIMAL into X86_TUNE_AVX256_SPLIT_REGS
and X86_TUNE_AVX128_OPTIMAL.

Changelog
gcc/
PR target/92448
* config/i386/i386-expand.c (ix86_expand_set_or_cpymem):
Replace TARGET_AVX128_OPTIMAL with TARGET_AVX256_SPLIT_REGS.
* config/i386/i386-option.c (ix86_vec_cost): Ditto.
(ix86_reassociation_width): Ditto.
* config/i386/i386-options.c (ix86_option_override_internal):
Replace TARGET_AVX128_OPTIAML with
ix86_tune_features[X86_TUNE_AVX128_OPTIMAL]
* config/i386/i386.h (TARGET_AVX256_SPLIT_REGS): New macro.
(TARGET_AVX128_OPTIMAL): Deleted.
* config/i386/x86-tune.def (X86_TUNE_AVX256_SPLIT_REGS): New
DEF_TUNE.


Modified:
trunk/gcc/ChangeLog
trunk/gcc/config/i386/i386-expand.c
trunk/gcc/config/i386/i386-options.c
trunk/gcc/config/i386/i386.c
trunk/gcc/config/i386/i386.h
trunk/gcc/config/i386/x86-tune.def

[Bug target/92448] Confusing using of TARGET_PREFER_AVX128

2019-11-11 Thread rguenther at suse dot de
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92448

--- Comment #2 from rguenther at suse dot de  ---
On November 11, 2019 10:20:10 AM GMT+01:00, crazylht at gmail dot com
 wrote:
>https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92448
>
>--- Comment #1 from Hongtao.liu  ---
>Also with TARGET_AVX128_OPTIMAL plus -mprefer-vector-width=256, 256-bit
>vectorization may be not generated since TARGET_AVX128_OPTIMAL will
>change
>vec_cost.
>
>
>/* Return cost of vector operation in MODE given that scalar version
>has
>   COST.  */
>
>static int
>ix86_vec_cost (machine_mode mode, int cost)
>{
>  if (!VECTOR_MODE_P (mode))
>return cost;
>
>  if (GET_MODE_BITSIZE (mode) == 128
>  && TARGET_SSE_SPLIT_REGS)
>return cost * 2;
>  if (GET_MODE_BITSIZE (mode) > 128
>  && TARGET_AVX128_OPTIMAL)
>return cost * GET_MODE_BITSIZE (mode) / 128;
>  return cost;
>}
>-

But this is because 128 optimal really means 256 bit ops are split into two 128
bit ones. The tuning is possibly poorly named. 

Richard.

[Bug target/92448] Confusing using of TARGET_PREFER_AVX128

2019-11-11 Thread crazylht at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92448

--- Comment #1 from Hongtao.liu  ---
Also with TARGET_AVX128_OPTIMAL plus -mprefer-vector-width=256, 256-bit
vectorization may be not generated since TARGET_AVX128_OPTIMAL will change
vec_cost.


/* Return cost of vector operation in MODE given that scalar version has
   COST.  */

static int
ix86_vec_cost (machine_mode mode, int cost)
{
  if (!VECTOR_MODE_P (mode))
return cost;

  if (GET_MODE_BITSIZE (mode) == 128
  && TARGET_SSE_SPLIT_REGS)
return cost * 2;
  if (GET_MODE_BITSIZE (mode) > 128
  && TARGET_AVX128_OPTIMAL)
return cost * GET_MODE_BITSIZE (mode) / 128;
  return cost;
}
-