[llvm] GlobalISel needs fdiv 1 / sqrt(x) to rsq combine (PR #78673)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Sat Feb 3 21:26:57 PST 2024


================
@@ -33,6 +33,11 @@ def rcp_sqrt_to_rsq : GICombineRule<
          [{ return matchRcpSqrtToRsq(*${rcp}, ${matchinfo}); }]),
   (apply [{ Helper.applyBuildFn(*${rcp}, ${matchinfo}); }])>;
 
+def fdiv_by_sqrt_to_rsq : GICombineRule<
+  (defs root:$root),
+  (match (G_FSQRT $sqrt, $x, (MIFlags FmContract)),
+         (G_FDIV $dst, $y, $sqrt, (MIFlags FmContract)):$root),
----------------
arsenm wrote:

Needs more flags. Without the denormal correction code, this isn't more precise. Also switches to dropping denormals and 1ulp. You can refer to the dag version for the exact conditions 

https://github.com/llvm/llvm-project/pull/78673


More information about the llvm-commits mailing list