[llvm] [GlobalISel] replace right identity X * -1.0 with fneg(x) (PR #80526)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 6 09:46:04 PST 2024


================
@@ -493,6 +493,13 @@ def right_identity_one_fp: GICombineRule<
   (apply (GIReplaceReg $dst, $x))
 >;
 
+def right_identity_neg_one_fp: GICombineRule<
+  (defs root:$dst),
+  (match (G_FMUL $dst, $x, $y):$root,
+    [{ return Helper.matchConstantFPOp(${y}, -1.0); }]),
----------------
arsenm wrote:

Not sure how much work adding float literals would be, but I assume that parsing them with APFloat would be an implementation detail of that. 

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


More information about the llvm-commits mailing list