From 5be106b86006e00c80bf846a172b2b69b40d10ef Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Mon, 18 Nov 2019 12:41:11 +0000 Subject: [PATCH] re PR tree-optimization/92558 (Miscompare of 554.roms_r with -Ofast -march=znver2 -flto since r278289) 2019-11-18 Richard Biener PR tree-optimization/92558 * tree-vect-loop.c (vect_create_epilog_for_reduction): When reducting the width of a reduction vector def update new_phis. * gcc.dg/vect/pr92558.c: New testcase. From-SVN: r278400 --- gcc/ChangeLog | 6 ++++++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.dg/vect/pr92558.c | 23 +++++++++++++++++++++++ gcc/tree-vect-loop.c | 1 + 4 files changed, 35 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/vect/pr92558.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 3d19783afd0..b2408021a0b 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2019-11-18 Richard Biener + + PR tree-optimization/92558 + * tree-vect-loop.c (vect_create_epilog_for_reduction): When + reducting the width of a reduction vector def update new_phis. + 2019-11-18 Szabolcs Nagy * configure.ac (gcc_cv_target_ldbl128): Set for powerpc*-*-linux-musl* diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 8773d5073e8..b6330cb57af 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2019-11-18 Richard Biener + + PR tree-optimization/92558 + * gcc.dg/vect/pr92558.c: New testcase. + 2019-11-18 Martin Liska PR ipa/92529 diff --git a/gcc/testsuite/gcc.dg/vect/pr92558.c b/gcc/testsuite/gcc.dg/vect/pr92558.c new file mode 100644 index 00000000000..1d24fa0f2f8 --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/pr92558.c @@ -0,0 +1,23 @@ +/* { dg-additional-options "-mavx2" { target avx2_runtime } } */ + +void __attribute__((noipa)) +foo (int * __restrict wsum, int * __restrict cff, int * __restrict weight) +{ + for (int i = 0; i < 16; ++i) + { + *wsum += weight[2*i+0]; + *cff += weight[2*i+1]; + } +} + +int main() +{ + int weight[32]; + for (int i = 0; i < 32; ++i) + weight[i] = i; + int wsum = 0, cff = 0; + foo (&wsum, &cff, weight); + if (wsum != 240 || cff != 256) + __builtin_abort (); + return 0; +} diff --git a/gcc/tree-vect-loop.c b/gcc/tree-vect-loop.c index 7a58dfc323a..02e6bfb9e5d 100644 --- a/gcc/tree-vect-loop.c +++ b/gcc/tree-vect-loop.c @@ -5198,6 +5198,7 @@ vect_create_epilog_for_reduction (stmt_vec_info stmt_info, new_temp = make_ssa_name (vectype1); epilog_stmt = gimple_build_assign (new_temp, code, dst1, dst2); gsi_insert_before (&exit_gsi, epilog_stmt, GSI_SAME_STMT); + new_phis[0] = epilog_stmt; } if (reduce_with_shift && !slp_reduc) -- 2.30.2