diff options
author | Jakub Jelinek <jakub@redhat.com> | 2013-05-17 10:52:36 +0200 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2013-05-17 10:52:36 +0200 |
commit | de935390a6084fa00ebdf03a7a47d14ba236adc8 (patch) | |
tree | d2632e159794f93aae304f45f522d8282c3b9a00 | |
parent | 21dfed9e383a3b63a30316f3d4fbefffb7921429 (diff) | |
download | gcc-de935390a6084fa00ebdf03a7a47d14ba236adc8.zip gcc-de935390a6084fa00ebdf03a7a47d14ba236adc8.tar.gz gcc-de935390a6084fa00ebdf03a7a47d14ba236adc8.tar.bz2 |
re PR tree-optimization/57051 (Optimization regression in 4.8.0 from 4.7.2)
PR tree-optimization/57051
* fold-const.c (const_binop) <case VEC_LSHIFT_EXPR,
case VEC_RSHIFT_EXPR>: Fix BYTES_BIG_ENDIAN handling.
From-SVN: r199004
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/fold-const.c | 6 |
2 files changed, 11 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 4612d9f..782f08e 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2013-05-17 Jakub Jelinek <jakub@redhat.com> + + PR tree-optimization/57051 + * fold-const.c (const_binop) <case VEC_LSHIFT_EXPR, + case VEC_RSHIFT_EXPR>: Fix BYTES_BIG_ENDIAN handling. + 2013-05-16 Jakub Jelinek <jakub@redhat.com> * omp-low.c (extract_omp_for_data): For collapsed loops, diff --git a/gcc/fold-const.c b/gcc/fold-const.c index a2e9632..5e34863 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -1388,7 +1388,11 @@ const_binop (enum tree_code code, tree arg1, tree arg2) if (shiftc >= outerc || (shiftc % innerc) != 0) return NULL_TREE; int offset = shiftc / innerc; - if (code == VEC_LSHIFT_EXPR) + /* The direction of VEC_[LR]SHIFT_EXPR is endian dependent. + For reductions, compiler emits VEC_RSHIFT_EXPR always, + for !BYTES_BIG_ENDIAN picks first vector element, but + for BYTES_BIG_ENDIAN last element from the vector. */ + if ((code == VEC_RSHIFT_EXPR) ^ (!BYTES_BIG_ENDIAN)) offset = -offset; tree zero = build_zero_cst (TREE_TYPE (type)); for (i = 0; i < count; i++) |