Hi! This backport didn't apply cleanly, because 4.8 doesn't have build_all_ones_cst function.
So, either we can apply something like the patch below (bootstrapped/regtested with the other backports), or as another alternative I see backport the addition of build_minus_one_cst and build_all_ones_cst functions (probably without adding any new uses of those functions, just define in tree.c and declare in tree.h) and then apply the r208507 change as is. What do you prefer? 2014-04-10 Jakub Jelinek <ja...@redhat.com> Backport from mainline 2014-03-12 Jakub Jelinek <ja...@redhat.com> Marc Glisse <marc.gli...@inria.fr> PR tree-optimization/60502 * tree-ssa-reassoc.c (eliminate_not_pairs): Handle VECTOR_TYPE. * gcc.c-torture/compile/pr60502.c: New test. --- gcc/tree-ssa-reassoc.c (revision 208506) +++ gcc/tree-ssa-reassoc.c (revision 208507) @@ -785,8 +785,15 @@ eliminate_not_pairs (enum tree_code opco if (opcode == BIT_AND_EXPR) oe->op = build_zero_cst (TREE_TYPE (oe->op)); else if (opcode == BIT_IOR_EXPR) - oe->op = build_low_bits_mask (TREE_TYPE (oe->op), - TYPE_PRECISION (TREE_TYPE (oe->op))); + { + tree type = TREE_TYPE (oe->op); + tree itype = type; + if (TREE_CODE (type) == VECTOR_TYPE) + itype = TREE_TYPE (type); + oe->op = build_low_bits_mask (itype, TYPE_PRECISION (itype)); + if (TREE_CODE (type) == VECTOR_TYPE) + oe->op = build_vector_from_val (type, oe->op); + } reassociate_stats.ops_eliminated += ops->length () - 1; ops->truncate (0); --- gcc/testsuite/gcc.c-torture/compile/pr60502.c (revision 0) +++ gcc/testsuite/gcc.c-torture/compile/pr60502.c (revision 208507) @@ -0,0 +1,18 @@ +/* PR tree-optimization/60502 */ + +typedef signed char v16i8 __attribute__ ((vector_size (16))); +typedef unsigned char v16u8 __attribute__ ((vector_size (16))); + +void +foo (v16i8 *x) +{ + v16i8 m1 = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }; + *x |= *x ^ m1; +} + +void +bar (v16u8 *x) +{ + v16u8 m1 = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }; + *x |= *x ^ m1; +} Jakub