On Tue, 2 Jul 2024, Jennifer Schmitz wrote: > This patch adds a pattern in match.pd folding x/sqrt(x) to sqrt(x) for > -funsafe-math-optimizations. Test cases were added for double, float, and > long double. > > The patch was bootstrapped and regtested on aarch64-linux-gnu, no regression. > Ok for mainline?
You put that into /* Fold comparisons against built-in math functions. */ but it fits more the group of simplifications around /* Simplification of math builtins. These rules must all be optimizations as well as IL simplifications. If there is a possibility that the new form could be a pessimization, the rule should go in the canonicalization ... where we already have sqrt related foldings. Please put it there. Otherwise this looks OK. Richard. > Signed-off-by: Jennifer Schmitz <jschm...@nvidia.com> > > gcc/ > > * match.pd: Fold x/sqrt(x) to sqrt(x). > > gcc/testsuite/ > > * gcc.dg/tree-ssa/sqrt_div.c: New test. > -- Richard Biener <rguent...@suse.de> SUSE Software Solutions Germany GmbH, Frankenstrasse 146, 90461 Nuernberg, Germany; GF: Ivo Totev, Andrew McDonald, Werner Knoblich; (HRB 36809, AG Nuernberg)