From fca9efcbc4914603af1fd1cbf2a76a468a9ecf78 Mon Sep 17 00:00:00 2001 From: Justin Holewinski Date: Thu, 10 Mar 2011 16:57:18 +0000 Subject: 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 --- test/CodeGen/PTX/fdiv-sm10.ll | 15 +++++++++++++++ test/CodeGen/PTX/fdiv-sm13.ll | 15 +++++++++++++++ test/CodeGen/PTX/mad.ll | 17 +++++++++++++++++ 3 files changed, 47 insertions(+) create mode 100644 test/CodeGen/PTX/fdiv-sm10.ll create mode 100644 test/CodeGen/PTX/fdiv-sm13.ll create mode 100644 test/CodeGen/PTX/mad.ll (limited to 'test/CodeGen') diff --git a/test/CodeGen/PTX/fdiv-sm10.ll b/test/CodeGen/PTX/fdiv-sm10.ll new file mode 100644 index 0000000..42f615d --- /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 0000000..eb20f78 --- /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 0000000..56c77eb --- /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 +} -- cgit v1.1