[llvm] [NVPTX] Lower -1/x to neg.f64(rcp.rn.f64) instead of fdiv (PR #98343)
Artem Belevich via llvm-commits
llvm-commits at lists.llvm.org
Fri Jul 12 10:12:09 PDT 2024
================
@@ -1225,6 +1235,10 @@ def FDIV64ri :
"div.rn.f64 \t$dst, $a, $b;",
[(set Float64Regs:$dst, (fdiv Float64Regs:$a, fpimm:$b))]>;
+// fdiv -1.0, X => fneg (rcp.rn X)
+def : Pat<(fdiv DoubleConstNeg1:$a, Float64Regs:$b),
+ (FNEGf64 (FDIV641r (NegDoubleConst node:$a), Float64Regs:$b))>;
----------------
Artem-B wrote:
Bummer. We certainly can do it for integers. E.g https://github.com/llvm/llvm-project/blob/19a9f22c17c3e46f49095c71e6922b4a1deae567/llvm/lib/Target/AArch64/AArch64InstrInfo.td#L2148
https://github.com/llvm/llvm-project/pull/98343
More information about the llvm-commits
mailing list