On Thu, Jun 03, 2021 at 11:03:43AM +0000, Liu, Hongtao wrote: > >A very typical example is how UMIN is optimised: > > > > case UMIN: > > if (trueop1 == CONST0_RTX (mode) && ! side_effects_p (op0)) > > return op1; > > if (rtx_equal_p (trueop0, trueop1) && ! side_effects_p (op0)) > > return op0; > > tem = simplify_associative_operation (code, mode, op0, op1); > > if (tem) > > return tem; > > break; > > > >(the stuff using "tem"). > > > >Hongtao, can we do something similar here? Does that work well? Please try > >it out :-) > > 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.
simplify-rtx is used by combine. When you do and+not+splat for example my suggestion should kick in. Try it out, don't just dismiss it? > 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. But you need to do this *before* it is split. That is the whole point. > Consider andnot is existed for many backends, I think a canonicalization is > needed here. Please do note that that is not as easy as yoou may think: you need to make sure nothing ever creates non-canonical code. > 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))? I don't understand what this means? Segher