On 10/17/18, Marc Glisse <marc.gli...@inria.fr> wrote: > On Wed, 17 Oct 2018, H.J. Lu wrote: > >> We may simplify >> >> (subreg (vec_merge (vec_duplicate X) (vector) (const_int 1)) 0) >> >> to X when mode of X is the same as of mode of subreg. > > Hello, > > we already have code to simplify vec_select(vec_merge): > > /* If we select elements in a vec_merge that all come from the same > operand, select from that operand directly. */ > > It would make sense to me to make the subreg transform as similar to it as > possible, in particular you don't need to special case vec_duplicate, the > transformation would see that everything comes from the first vector, > produce (subreg (vec_duplicate X) 0), and let another transformation > optimize that.
What do you mean by another transformation? If simplify_subreg doesn't return X for (subreg (vec_merge (vec_duplicate X) (vector) (const_int ((1 << N) | M))) (N * sizeof (X))) no further transformation will be done. -- H.J.