e73ad256a1c408fe06f40a630ed5eafc13e6fc01
[oota-llvm.git] / test / CodeGen / PTX / llvm-intrinsic.ll
1 ; RUN: llc < %s -march=ptx32 -mattr=+ptx20 | FileCheck %s
2
3 define ptx_device float @test_sqrt_f32(float %x) {
4 entry:
5 ; CHECK: sqrt.rn.f32 %ret{{[0-9]+}}, %f{{[0-9]+}};
6 ; CHECK: ret;
7   %y = call float @llvm.sqrt.f32(float %x)
8   ret float %y
9 }
10
11 define ptx_device double @test_sqrt_f64(double %x) {
12 entry:
13 ; CHECK: sqrt.rn.f64 %ret{{[0-9]+}}, %fd{{[0-9]+}};
14 ; CHECK: ret;
15   %y = call double @llvm.sqrt.f64(double %x)
16   ret double %y
17 }
18
19 define ptx_device float @test_sin_f32(float %x) {
20 entry:
21 ; CHECK: sin.approx.f32 %ret{{[0-9]+}}, %f{{[0-9]+}};
22 ; CHECK: ret;
23   %y = call float @llvm.sin.f32(float %x)
24   ret float %y
25 }
26
27 define ptx_device double @test_sin_f64(double %x) {
28 entry:
29 ; CHECK: sin.approx.f64 %ret{{[0-9]+}}, %fd{{[0-9]+}};
30 ; CHECK: ret;
31   %y = call double @llvm.sin.f64(double %x)
32   ret double %y
33 }
34
35 define ptx_device float @test_cos_f32(float %x) {
36 entry:
37 ; CHECK: cos.approx.f32 %ret{{[0-9]+}}, %f{{[0-9]+}};
38 ; CHECK: ret;
39   %y = call float @llvm.cos.f32(float %x)
40   ret float %y
41 }
42
43 define ptx_device double @test_cos_f64(double %x) {
44 entry:
45 ; CHECK: cos.approx.f64 %ret{{[0-9]+}}, %fd{{[0-9]+}};
46 ; CHECK: ret;
47   %y = call double @llvm.cos.f64(double %x)
48   ret double %y
49 }
50
51 declare float  @llvm.sqrt.f32(float)
52 declare double @llvm.sqrt.f64(double)
53 declare float  @llvm.sin.f32(float)
54 declare double @llvm.sin.f64(double)
55 declare float  @llvm.cos.f32(float)
56 declare double @llvm.cos.f64(double)