From 264d951ae8c99ea72633487dc3404e8d2a4a02d8 Mon Sep 17 00:00:00 2001 From: Ilya Enkovich Date: Wed, 29 Jun 2016 12:26:40 +0000 Subject: [PATCH] re PR tree-optimization/71655 (GCC trunk ICE on westmere target) gcc/ PR tree-optimization/71655 * tree-vect-stmts.c (vectorizable_comparison): Swap definition types when swapping operands. gcc/testsuite/ PR tree-optimization/71655 * g++.dg/pr71655.C: New test. From-SVN: r237846 --- gcc/ChangeLog | 6 ++++++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/g++.dg/pr71655.C | 28 ++++++++++++++++++++++++++++ gcc/tree-vect-stmts.c | 2 ++ 4 files changed, 41 insertions(+) create mode 100644 gcc/testsuite/g++.dg/pr71655.C diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 1c63e41f515..3900362650a 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2016-06-29 Ilya Enkovich + + PR tree-optimization/71655 + * tree-vect-stmts.c (vectorizable_comparison): Swap definition + types when swapping operands. + 2016-06-29 Martin Liska PR middle-end/71585 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 6e132a25448..6801c5fb906 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2016-06-29 Ilya Enkovich + + PR tree-optimization/71655 + * g++.dg/pr71655.C: New test. + 2016-06-29 Martin Liska * gcc.dg/pr71585.c: New test. diff --git a/gcc/testsuite/g++.dg/pr71655.C b/gcc/testsuite/g++.dg/pr71655.C new file mode 100644 index 00000000000..8ed33711c36 --- /dev/null +++ b/gcc/testsuite/g++.dg/pr71655.C @@ -0,0 +1,28 @@ +// PR tree-optimization/71655 +// { dg-do compile } +// { dg-options "-O3 -std=c++11" } +// { dg-additional-options "-msse4" { target i?86-*-* x86_64-*-* } } + +#include +#include +extern int var_16, le_s5, le_s6, le_s9; +std::array, 4>, 24> v4; +extern std::array, 18> v15; + +void fn1() { + for (int k0 = 0;;) + for (int i1 = 0;;) + for (int j1 = 0; j1 < le_s9; j1 = j1 + 1) { + std::valarray> v15_; + for (; le_s5;) { + std::array, 48>, 18> v16; + for (int k2 = 0;; k2 = 1) + for (int l2 = 2; l2 < 6; l2 = l2 + 1) + for (int k3 = 0; le_s6;) + for (int i4 = 0; i4 < le_s9; i4 = i4 + 1) + *(i4 + (*v16.begin())[k3].begin()) = + (v15[k2][l2] || var_16) > + unsigned(i1 <= (*v4.begin()).at(k0).at(j1)); + } + } +} diff --git a/gcc/tree-vect-stmts.c b/gcc/tree-vect-stmts.c index 5c655029dd5..c41550d4a1b 100644 --- a/gcc/tree-vect-stmts.c +++ b/gcc/tree-vect-stmts.c @@ -7858,12 +7858,14 @@ vectorizable_comparison (gimple *stmt, gimple_stmt_iterator *gsi, bitop1 = BIT_NOT_EXPR; bitop2 = BIT_AND_EXPR; std::swap (rhs1, rhs2); + std::swap (dts[0], dts[1]); } else if (code == LE_EXPR) { bitop1 = BIT_NOT_EXPR; bitop2 = BIT_IOR_EXPR; std::swap (rhs1, rhs2); + std::swap (dts[0], dts[1]); } else { -- 2.30.2