From 32151c3f1b8b394b16b3d396a781e65426dd8f45 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Fri, 15 Dec 2017 18:51:36 +0100 Subject: [PATCH] re PR tree-optimization/80631 (Compiling with -O3 -mavx2 gives wrong code) PR tree-optimization/80631 * gcc.target/i386/avx2-pr80631.c: New test. From-SVN: r255701 --- gcc/testsuite/ChangeLog | 3 +++ gcc/testsuite/gcc.target/i386/avx2-pr80631.c | 23 ++++++++++++++++++++ 2 files changed, 26 insertions(+) create mode 100644 gcc/testsuite/gcc.target/i386/avx2-pr80631.c diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 9ab04282c4e..3d037b53d9d 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,8 @@ 2017-12-15 Jakub Jelinek + PR tree-optimization/80631 + * gcc.target/i386/avx2-pr80631.c: New test. + * g++.dg/plugin/attribute_plugin.c (user_attr): Swap affects_type_identity and handler fields, add NULL for exclude. diff --git a/gcc/testsuite/gcc.target/i386/avx2-pr80631.c b/gcc/testsuite/gcc.target/i386/avx2-pr80631.c new file mode 100644 index 00000000000..5af1b0feb2c --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/avx2-pr80631.c @@ -0,0 +1,23 @@ +/* PR tree-optimization/80631 */ +/* { dg-do run } */ +/* { dg-options "-O2 -ftree-vectorize -mavx2 -fno-vect-cost-model" } */ +/* { dg-require-effective-target avx2 } */ + +#include "avx2-check.h" + +#define N 8 + +static void +avx2_test (void) +{ + int v[N], k; + for(k = 0; k < N; k++) + v[k] = k; + v[0] = 77; + int found_index = -1; + for (k = 0; k < N; k++) + if (v[k] == 77) + found_index = k; + if (found_index != 0) + abort (); +} -- 2.30.2