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

Nick Anderson via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 19 22:55:49 PST 2024


================
@@ -33,6 +33,11 @@ def rcp_sqrt_to_rsq : GICombineRule<
          [{ return matchRcpSqrtToRsq(*${rcp}, ${matchinfo}); }]),
   (apply [{ Helper.applyBuildFn(*${rcp}, ${matchinfo}); }])>;
 
+def fdiv_1_by_sqrt_to_rsq : GICombineRule<
+  (defs root:$root, build_fn_matchinfo:$matchinfo),
+  (match (wip_match_opcode G_FSQRT, G_FDIV):$root,
+         [{ return matchFDivSqrt(*${root}, ${matchinfo}); }]),
----------------
nickleus27 wrote:

Thank you for your review. I am using this example, and I am making some progress now. However, one error I am getting that I do not understand is `('G_FCONSTANT') is unreachable from the pattern root!`. Any ideas why I would be getting this error? I am not seeing why this pattern would not be reachable.

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


More information about the llvm-commits mailing list