[llvm] [NVPTX] Lower -1/x to neg.f64(rcp.rn.f64) instead of fdiv (PR #98343)

Rajat Bajpai via llvm-commits llvm-commits at lists.llvm.org
Sat Jul 13 00:13:28 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))>;
----------------
rajatbajpai wrote:

I believe integers have better privileges than floats ;)

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


More information about the llvm-commits mailing list