summaryrefslogtreecommitdiff
path: root/test/CodeGen/PTX
diff options
context:
space:
mode:
authorJustin Holewinski <justin.holewinski@gmail.com>2011-03-10 16:57:18 +0000
committerJustin Holewinski <justin.holewinski@gmail.com>2011-03-10 16:57:18 +0000
commitfca9efcbc4914603af1fd1cbf2a76a468a9ecf78 (patch)
tree0dfedf4743de907f559cbcdebf3b884c087da42d /test/CodeGen/PTX
parent7deb187736b09aa0805b7d9902f499e41feefccc (diff)
downloadllvm-fca9efcbc4914603af1fd1cbf2a76a468a9ecf78.tar.gz
llvm-fca9efcbc4914603af1fd1cbf2a76a468a9ecf78.tar.bz2
llvm-fca9efcbc4914603af1fd1cbf2a76a468a9ecf78.tar.xz
PTX: Add preliminary support for floating-point divide and multiply-and-add
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127410 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGen/PTX')
-rw-r--r--test/CodeGen/PTX/fdiv-sm10.ll15
-rw-r--r--test/CodeGen/PTX/fdiv-sm13.ll15
-rw-r--r--test/CodeGen/PTX/mad.ll17
3 files changed, 47 insertions, 0 deletions
diff --git a/test/CodeGen/PTX/fdiv-sm10.ll b/test/CodeGen/PTX/fdiv-sm10.ll
new file mode 100644
index 0000000000..42f615d0c8
--- /dev/null
+++ b/test/CodeGen/PTX/fdiv-sm10.ll
@@ -0,0 +1,15 @@
+; RUN: llc < %s -march=ptx -mattr=+sm10 | FileCheck %s
+
+define ptx_device float @t1_f32(float %x, float %y) {
+; CHECK: div.approx.f32 f0, f1, f2;
+; CHECK-NEXT: ret;
+ %a = fdiv float %x, %y
+ ret float %a
+}
+
+define ptx_device double @t1_f64(double %x, double %y) {
+; CHECK: div.f64 fd0, fd1, fd2;
+; CHECK-NEXT: ret;
+ %a = fdiv double %x, %y
+ ret double %a
+}
diff --git a/test/CodeGen/PTX/fdiv-sm13.ll b/test/CodeGen/PTX/fdiv-sm13.ll
new file mode 100644
index 0000000000..eb20f78763
--- /dev/null
+++ b/test/CodeGen/PTX/fdiv-sm13.ll
@@ -0,0 +1,15 @@
+; RUN: llc < %s -march=ptx -mattr=+sm13 | FileCheck %s
+
+define ptx_device float @t1_f32(float %x, float %y) {
+; CHECK: div.approx.f32 f0, f1, f2;
+; CHECK-NEXT: ret;
+ %a = fdiv float %x, %y
+ ret float %a
+}
+
+define ptx_device double @t1_f64(double %x, double %y) {
+; CHECK: div.rn.f64 fd0, fd1, fd2;
+; CHECK-NEXT: ret;
+ %a = fdiv double %x, %y
+ ret double %a
+}
diff --git a/test/CodeGen/PTX/mad.ll b/test/CodeGen/PTX/mad.ll
new file mode 100644
index 0000000000..56c77eb48e
--- /dev/null
+++ b/test/CodeGen/PTX/mad.ll
@@ -0,0 +1,17 @@
+; RUN: llc < %s -march=ptx | FileCheck %s
+
+define ptx_device float @t1_f32(float %x, float %y, float %z) {
+; CHECK: mad.rn.f32 f0, f1, f2, f3;
+; CHECK-NEXT: ret;
+ %a = fmul float %x, %y
+ %b = fadd float %a, %z
+ ret float %b
+}
+
+define ptx_device double @t1_f64(double %x, double %y, double %z) {
+; CHECK: mad.rn.f64 fd0, fd1, fd2, fd3;
+; CHECK-NEXT: ret;
+ %a = fmul double %x, %y
+ %b = fadd double %a, %z
+ ret double %b
+}