[llvm] [NVPTX] Lower -1/x to neg.f64(recp.rn.f64) instead of fdiv (PR #98343)
Rajat Bajpai via llvm-commits
llvm-commits at lists.llvm.org
Fri Jul 12 00:06:05 PDT 2024
================
@@ -0,0 +1,13 @@
+; RUN: llc < %s -march=nvptx64 | FileCheck %s
+; RUN: %if ptxas %{ llc < %s -march=nvptx64 | %ptxas-verify %}
+
+;; Check if fdiv -1, X lowers to fneg (rcp.rn X).
+
+; CHECK-LABEL: .func{{.*}}test1
+define double @test1(double %in) {
+; CHECK: rcp.rn.f64 [[RCP:%.*]], [[X:%.*]];
+; CHECK-NEXT: neg.f64 [[FNEG:%.*]], [[RCP]];
+ %div = fdiv double 1.000000e+00, %in
+ %neg = fsub double -0.000000e+00, %div
+ ret double %neg
+}
----------------
rajatbajpai wrote:
Fixed the comment and added two more scenarios in the latest commit. Thanks!
https://github.com/llvm/llvm-project/pull/98343
More information about the llvm-commits
mailing list