Hi, Thanks again for your review and useful comments.
>> I see. But I can't really help without a testcase that I can use to have a >> look >> (same for the above issue with the segfaults). The following testcase does not generate "x" as needed. ==================== double t (double x) { x = sqrt (x) * sqrt (x); return x; } ==================== All of the following operation results in segfault with:- aarch64-thunder-elf-gcc simlify-2.c -O2 -funsafe-math-optimizations =============================================== #include <math.h> double t (double x, double y, double z) { x = cbrt (x) * cbrt (y); x = exp10 (x) * exp10 (y); x = pow10 (x) * pow10 (y); x = x / cbrt (x/y) x = x / exp10 (y); x = x / pow10 (y); return x; } float t (float x, float y, float z) { x = sqrtf (x) * sqrtf (y); x = expf (x) * expf (y); x = powf (x, y) * powf (x, z); x = x / expf (y); return x; } long double t1 (long double x, long double y, long double z) { x = sqrtl (x) * sqrtl (y); x = expl (x) * expl (y); x = powl (x, y) * powl (x, z); x = x / expl (y); return x; } =============================================== /* Simplify sqrt(x) * sqrt(y) -> sqrt(x*y). */ (simplify (mult (SQRT:s @0) (SQRT:s @1)) (SQRT (mult @0 @1))) /* Simplify pow(x,y) * pow(x,z) -> pow(x,y+z). */ (simplify (mult (POW:s @0 @1) (POW:s @0 @2)) (POW @0 (plus @1 @2))) /* Simplify expN(x) * expN(y) -> expN(x+y). */ (simplify (mult (EXP:s @0) (EXP:s @1)) (EXP (plus @0 @1))) /* Simplify x / expN(y) into x*expN(-y). */ (simplify (rdiv @0 (EXP @1)) (mult @0 (EXP (negate @1)))) =============================================== >> A quick "fix" to avoid this ICE would disable the pattern for >> -ferrno-math. Disabled the pattern for -ferrno-math. >> If you open a bugreport with the pattern and a testcase I'm going to have a closer look. https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67285 Thanks for the detailed explanation of ":s". Please let me know whether the working patch can be committed? If its okay and with your approval, I would like to move some more patterns using "match and simplify". Thanks, Naveen