On Thu, Jun 03, 2021 at 11:03:43AM +0000, Liu, Hongtao via Gcc-patches wrote: > In simplify_rtx, no simplication occurs, there is just the difference between > (vec_duplicate (not REG)) and (not (vec_duplicate (REG)). So here tem will > only be 0. > Basically we don't know it's a simplication until combine successfully split > the > 3->2 instructions (not + broadcast + and to andnot + broadcast), but it's > pretty awkward > to do this in combine. > > Consider andnot is existed for many backends, I think a canonicalization is > needed here. > Maybe we can add insn canonicalization for transforming (and (vect_duplicate > (not A)) B) to > (and (not (duplicate (not A)) B) instead of (vec_duplicate (not A)) to (not > (vec_duplicate A))?
For the (not (vec_duplicate)) vs. (vec_duplicate (not)) it isn't clear which one is generally a win on major targets, so I'd say it is better to add a combine splitter to swap it in backends that want that. Jakub