From 6c620b0744af235ceb1c07c214772895e0f73c15 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Wed, 5 Dec 2018 00:27:39 +0100 Subject: [PATCH] re PR tree-optimization/87320 (Last iteration of vectorized loop not executed when peeling for gaps) PR tree-optimization/87320 * gcc.dg/pr87320.c: New test. From-SVN: r266805 --- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.dg/pr87320.c | 28 ++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/pr87320.c diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 7aad09dae78..c1b1bc49e39 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2018-12-04 Jakub Jelinek + + PR tree-optimization/87320 + * gcc.dg/pr87320.c: New test. + 2018-12-04 Jeff Law * gcc.dg/strlenopt-58.c: Handle targets with 2 byte wchar_t. diff --git a/gcc/testsuite/gcc.dg/pr87320.c b/gcc/testsuite/gcc.dg/pr87320.c new file mode 100644 index 00000000000..38ece590aab --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr87320.c @@ -0,0 +1,28 @@ +/* PR tree-optimization/87320 */ +/* { dg-do run } */ +/* { dg-options "-O3" } */ +/* { dg-additional-options "-mavx" { target avx_runtime } } */ + +static void __attribute__ ((noinline)) +transpose_vector (unsigned long n) +{ + unsigned long data[2 * n]; + for (unsigned long i = 0; i < 2 * n; i++) + data[i] = 4 * i + 2; + + unsigned long transposed[n]; + for (unsigned long i = 0; i < n; i++) + transposed[i] = data[2 * i]; + + for (unsigned long i = 0; i < n; i++) + if (transposed[i] != 8 * i + 2) + __builtin_abort (); +} + +int +main () +{ + transpose_vector (4); + transpose_vector (120); + return 0; +} -- 2.30.2