[llvm] [GlobalISel] replace right identity X * -1.0 with fneg(x) (PR #80526)
Pierre van Houtryve via llvm-commits
llvm-commits at lists.llvm.org
Tue Feb 6 06:28:09 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); }]),
----------------
Pierre-vh wrote:
Unfortunately not, it's also been on my list but I'm not sure how to handle them well. TableGen doesn't have float literals. I can see a few options:
- Add float literals to tablegen
- Parse them from strings using APFloat
- Only allow hex/integer immediates and bitconvert to FP
What do you prefer?
https://github.com/llvm/llvm-project/pull/80526
More information about the llvm-commits
mailing list