https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70841
--- Comment #6 from rguenther at suse dot de <rguenther at suse dot de> --- On Tue, 18 Jun 2019, glisse at gcc dot gnu.org wrote: > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70841 > > --- Comment #5 from Marc Glisse <glisse at gcc dot gnu.org> --- > (In reply to Christophe Lyon from comment #4) > > Can this be achieved in match.pd? > > A simple case like x*y/x could be done in match.pd (assuming we want to > simplify it to just y under some conditions). To handle more generally > x*a*b*c*d*e/x, you really need reassoc. And probably needs similar treatment as minus which we rewrite to plus negate op. Thus, y / x needs to be handled as y * (1 / x) for this to work and this also shows the truncation/rounding issue more clearly that is involved with doing this. In the end not too difficult I think but whether it's generally applicable to -Ofast needs to be evaluated (we generally desire all of SPEC CPU to still verify with -Ofast).