diff options
author | Richard Guenther <rguenther@suse.de> | 2012-08-10 13:35:34 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2012-08-10 13:35:34 +0000 |
commit | 09e4850d7e5ab207bf04c389c80ff9bc548f8298 (patch) | |
tree | 31eaec0e13000baa8f1cb7ab7d41cd89f9b560a4 /gcc | |
parent | 99cababb4b154f763a609127b498a9f0fa99b3f8 (diff) | |
download | gcc-09e4850d7e5ab207bf04c389c80ff9bc548f8298.zip gcc-09e4850d7e5ab207bf04c389c80ff9bc548f8298.tar.gz gcc-09e4850d7e5ab207bf04c389c80ff9bc548f8298.tar.bz2 |
re PR middle-end/54219 (__builtin_shuffle mask reversed)
2012-08-10 Richard Guenther <rguenther@suse.de>
PR middle-end/54219
* fold-const.c (fold_ternary_loc): Do not reverse the mask
when canonicalizing it when folding VEC_PERM_EXPR.
* gcc.dg/torture/vector-shuffle1.c: New testcase.
From-SVN: r190297
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/fold-const.c | 2 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/torture/vector-shuffle1.c | 20 |
4 files changed, 32 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 41e0db3..914742e 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2012-08-10 Richard Guenther <rguenther@suse.de> + + PR middle-end/54219 + * fold-const.c (fold_ternary_loc): Do not reverse the mask + when canonicalizing it when folding VEC_PERM_EXPR. + 2012-08-10 Bill Schmidt <wschmidt@linux.vnet.ibm.com> PR middle-end/54211 diff --git a/gcc/fold-const.c b/gcc/fold-const.c index 74fbb2a..5e14125 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -14189,7 +14189,7 @@ fold_ternary_loc (location_t loc, enum tree_code code, tree type, tree *tsel = XALLOCAVEC (tree, nelts); tree eltype = TREE_TYPE (TREE_TYPE (arg2)); for (i = 0; i < nelts; i++) - tsel[i] = build_int_cst (eltype, sel[nelts - i - 1]); + tsel[i] = build_int_cst (eltype, sel[i]); t = build_vector (TREE_TYPE (arg2), tsel); return build3_loc (loc, VEC_PERM_EXPR, type, op0, op1, t); } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 243f595..bc85735 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2012-08-10 Richard Guenther <rguenther@suse.de> + + PR middle-end/54219 + * gcc.dg/torture/vector-shuffle1.c: New testcase. + 2012-08-10 Bill Schmidt <wschmidt@linux.vnet.ibm.com> PR middle-end/54211 diff --git a/gcc/testsuite/gcc.dg/torture/vector-shuffle1.c b/gcc/testsuite/gcc.dg/torture/vector-shuffle1.c new file mode 100644 index 0000000..9fa4f21 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/vector-shuffle1.c @@ -0,0 +1,20 @@ +/* PR54219 */ +/* { dg-do run } */ + +extern void abort (void); + +typedef int v2si __attribute__((vector_size(2*sizeof(int)))); + +v2si f(v2si x) +{ + /* This requires canonicalization of the mask to { 1, 0 }. */ + return __builtin_shuffle(x,x, (v2si) { 5, 0 }); +} + +int main() +{ + v2si y = f((v2si) { 1, 2 }); + if (y[0] != 2 || y[1] != 1) + abort (); + return 0; +} |