[llvm] GlobalISel needs fdiv 1 / sqrt(x) to rsq combine (PR #78673)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Tue Jan 23 05:11:32 PST 2024
arsenm wrote:
> > 1. is the MIR I am trying to match against
> > `%sqrt:_(s16) = contract G_FSQRT %x`
> > ` %one:_(s16) = G_FCONSTANT half 1.0`
> > `%rsq:_(s16) = contract G_FDIV %one, %sqrt`
> > ?
>
> Slightly off-topic, but why do we need to match against 1.0? Wouldn't it be better to combine `y/sqrt(x)` into `y*rsq(x)` for all `y`, and then later optimize away the multiply if `y` happened to be 1.0?
We're missing folds for that, at least for f64 last I looked. It was on my todo list for math stuff but I never got around to it
https://github.com/llvm/llvm-project/pull/78673
More information about the llvm-commits
mailing list