https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105075
Thomas Schwinge <tschwinge at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |rguenth at gcc dot gnu.org, | |tschwinge at gcc dot gnu.org Last reconfirmed| |2022-03-28 Ever confirmed|0 |1 Status|UNCONFIRMED |NEW --- Comment #4 from Thomas Schwinge <tschwinge at gcc dot gnu.org> --- (In reply to Tom de Vries from comment #0) > ptx has sad ((sum of absolute differences)) insn, which is currently not > modeled in the .md file. I also had noticed this, a while ago (but no opportunity to work on it properly). I had found GCC/RTL 'ssad', 'usad', and 'gcc/tree.def:SAD_EXPR', but not verified their applicability. (In reply to Tom de Vries from comment #2) > AFAIU, at gimple level support is limited to vectors, so that doesn't help > to generate the insn for the simple, scalar case. > > It would be nice if combine could generate it and we wouldn't have to use a > peephole, but AFAIU the pattern is too complex for that. > > I wonder if reformulating using a conditional could help there (ptx isa > describes semantics using "c + ((a<b) ? b-a : a-b)". Would that not be a case for a proper TREE-level representation, and 'gcc/match.pd' patterns to catch and transform any appearances to that, and then let each back end generate an ideal sequence of instructions (with a default to the expression you gave above)? > Also, I wonder if defining a stepping-stone intermediate pattern could help > combine.