Marc Glisse <marc.gli...@inria.fr> writes: > +/* (c ? a : b) op (c ? d : e) --> c ? (a op d) : (b op e) */ > + (simplify > + (op (vec_cond:s @0 @1 @2) (vec_cond:s @0 @3 @4)) > + (with > + { > + tree rhs1, rhs2 = NULL; > + rhs1 = fold_binary (op, type, @1, @3); > + if (rhs1 && is_gimple_val (rhs1)) > + rhs2 = fold_binary (op, type, @2, @4); > + } > + (if (rhs2 && is_gimple_val (rhs2)) > + (vec_cond @0 { rhs1; } { rhs2; }))))) > +#endif
This one looks dangerous for potentially-trapping ops. > +/* (v ? w : 0) ? a : b is just (v & w) ? a : b */ > +(simplify > + (vec_cond (vec_cond:s @0 @3 integer_zerop) @1 @2) > + (vec_cond (bit_and @0 @3) @1 @2)) Does something check automatically that @0 and @3 have compatible types? Same question for the later folds. Thanks, Richard