From: Richard Biener Date: Mon, 25 May 2020 09:14:03 +0000 (+0200) Subject: tree-optimization/95297 - handle scalar shift arg for SLP invariant vectype X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=d31694544d2d805151899ab0a0bc654767035ad6;p=gcc.git tree-optimization/95297 - handle scalar shift arg for SLP invariant vectype This skips invariant vector type setting for a scalar shift argument. 2020-05-25 Richard Biener PR tree-optimization/95297 * tree-vect-stmts.c (vectorizable_shift): For scalar_shift_arg skip updating operand 1 vector type. * g++.dg/vect/pr95297.cc: New testcase. * g++.dg/vect/pr95290.cc: Likewise. --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 8a089279e1b..38ca3ef863b 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2020-05-25 Richard Biener + + PR tree-optimization/95297 + * tree-vect-stmts.c (vectorizable_shift): For scalar_shift_arg + skip updating operand 1 vector type. + 2020-05-25 Richard Biener PR tree-optimization/95284 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index db94bd05bc3..2ac873c4291 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2020-05-25 Richard Biener + + PR tree-optimization/95297 + * g++.dg/vect/pr95297.cc: New testcase. + * g++.dg/vect/pr95290.cc: Likewise. + 2020-05-25 Richard Biener PR tree-optimization/95284 diff --git a/gcc/testsuite/g++.dg/vect/pr95290.cc b/gcc/testsuite/g++.dg/vect/pr95290.cc new file mode 100644 index 00000000000..150bbf72103 --- /dev/null +++ b/gcc/testsuite/g++.dg/vect/pr95290.cc @@ -0,0 +1,25 @@ +// { dg-do compile } + +typedef short a; +enum b {}; +typedef struct { + a c; +} d; +typedef struct { + a e, f; +} g; +typedef struct { + g h; +} i; +typedef struct { + d j; + int k; +} l; +class m +{ + i imgdata; + void n(); + l o; +}; +void m::n() try { imgdata.h.e = imgdata.h.f = o.j.c >> o.j.c; } catch (b) { +} diff --git a/gcc/testsuite/g++.dg/vect/pr95297.cc b/gcc/testsuite/g++.dg/vect/pr95297.cc new file mode 100644 index 00000000000..6ffc92e5fd0 --- /dev/null +++ b/gcc/testsuite/g++.dg/vect/pr95297.cc @@ -0,0 +1,22 @@ +// { dg-do compile } +// { dg-additional-options "-O3 -fvect-cost-model=dynamic" } + +extern bool var_10; +extern int var_16; +extern short var_17; +extern long var_18; +extern int arr_3[][13]; + +int min(const int &a, const int &b) +{ + return a < b ? a : b; +} + +void test() { + for (short a = 0; a < 010; a++) + for (char b = 0; b < 012; b++) + arr_3[a][b] = min(-var_10, 0) + 2147483647 >> var_10; + var_16 = (bool)4; + var_17 = 0; + var_18 = -1594153176; +} diff --git a/gcc/tree-vect-stmts.c b/gcc/tree-vect-stmts.c index e7822c44951..c3254926e22 100644 --- a/gcc/tree-vect-stmts.c +++ b/gcc/tree-vect-stmts.c @@ -5774,7 +5774,8 @@ vectorizable_shift (vec_info *vinfo, { if (slp_node && (!vect_maybe_update_slp_op_vectype (slp_op0, vectype) - || !vect_maybe_update_slp_op_vectype (slp_op1, op1_vectype))) + || (!scalar_shift_arg + && !vect_maybe_update_slp_op_vectype (slp_op1, op1_vectype)))) { if (dump_enabled_p ()) dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,