This patch enables folding under -ffast-math flag sqrt(a) * sqrt(b) -> sqrt(a*b)
Note that we have a fast-math-flag specifically for reassociation now (as well as a FMF for approximation of math functions). I'm not sure what combination would be needed for this transform. It's independent of this patch, but something to think about.
What if sqrt(a) or sqrt(b) has another use besides the multiply? I don't think we want to do the transform in that case. Either way, please add a test for that kind of example.
You can use:
match(Op0, m_Intrinsic<Intrinsic::sqrt>( ...
to simplify this code.
|185–199 ↗||(On Diff #127243)|
Please use the script at utils/update_test_checks.py to auto-generate the checks for any tests you add. The checks will be more exact and have regex for the variable names, so they'll be more robust.
Just a few small bits here: