On Sun, Nov 02, 2014 at 11:08:57AM +0100, Marc Glisse wrote: > @@ -14189,47 +14190,47 @@ fold_ternary_loc (location_t loc, enum t > return fold_build2_loc (loc, PLUS_EXPR, type, > const_binop (MULT_EXPR, arg0, arg1), arg2); > if (integer_zerop (arg2)) > return fold_build2_loc (loc, MULT_EXPR, type, arg0, arg1); > > return fold_fma (loc, type, arg0, arg1, arg2); > > case VEC_PERM_EXPR: > if (TREE_CODE (arg2) == VECTOR_CST) > { > - unsigned int nelts = TYPE_VECTOR_SUBPARTS (type), i, mask; > + unsigned int nelts = TYPE_VECTOR_SUBPARTS (type), i, mask, mask2; > unsigned char *sel = XALLOCAVEC (unsigned char, nelts); > + unsigned char *sel2 = XALLOCAVEC (unsigned char, nelts);
Can't you just XALLOCAVEC 2 * nelts and set sel2 = sel + nelts; ? > bool need_mask_canon = false; > + bool need_mask_canon2 = false; > bool all_in_vec0 = true; > bool all_in_vec1 = true; > bool maybe_identity = true; > bool single_arg = (op0 == op1); > bool changed = false; > > mask = single_arg ? (nelts - 1) : (2 * nelts - 1); > + mask2 = 2 * nelts - 1; Perhaps mask2 = 2 * nelts - 1; first and use mask2 in mask = ? Otherwise LGTM. Jakub