aboutsummaryrefslogtreecommitdiff
path: root/gcc/fold-const.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2011-11-22 17:57:33 +0100
committerJakub Jelinek <jakub@gcc.gnu.org>2011-11-22 17:57:33 +0100
commit32ef15bd33b765435ed5b2634c67b09d71026576 (patch)
treeb74222af83d6549fcb439b71ed4a893990c161b9 /gcc/fold-const.c
parent3945f48ca7b437e7da227aca004b7e6c069ccf7f (diff)
downloadgcc-32ef15bd33b765435ed5b2634c67b09d71026576.zip
gcc-32ef15bd33b765435ed5b2634c67b09d71026576.tar.gz
gcc-32ef15bd33b765435ed5b2634c67b09d71026576.tar.bz2
re PR tree-optimization/51074 (No constant folding performed for VEC_PERM_EXPR, VEC_INTERLEAVE*EXPR, VEC_EXTRACT*EXPR)
PR tree-optimization/51074 * fold-const.c (fold_binary_loc): Fix up VEC_INTERLEAVE_*_EXPR handling for BYTES_BIG_ENDIAN. * optabs.c (can_vec_perm_for_code_p): Likewise. * gcc.dg/vect/pr51074.c: New test. From-SVN: r181627
Diffstat (limited to 'gcc/fold-const.c')
-rw-r--r--gcc/fold-const.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index e590377..8f31a5fd 100644
--- a/gcc/fold-const.c
+++ b/gcc/fold-const.c
@@ -13483,10 +13483,12 @@ fold_binary_loc (location_t loc,
sel[i] = i * 2 + 1;
break;
case VEC_INTERLEAVE_HIGH_EXPR:
- sel[i] = (i + nelts) / 2 + ((i & 1) ? nelts : 0);
+ sel[i] = (i + (BYTES_BIG_ENDIAN ? 0 : nelts)) / 2
+ + ((i & 1) ? nelts : 0);
break;
case VEC_INTERLEAVE_LOW_EXPR:
- sel[i] = i / 2 + ((i & 1) ? nelts : 0);
+ sel[i] = (i + (BYTES_BIG_ENDIAN ? nelts : 0)) / 2
+ + ((i & 1) ? nelts : 0);
break;
default:
gcc_unreachable ();