1; RUN: llc < %s -march=nvptx -mcpu=sm_20 -fp-contract=fast | FileCheck %s
2
3declare float @dummy_f32(float, float) #0
4declare double @dummy_f64(double, double) #0
5
6define ptx_device float @t1_f32(float %x, float %y, float %z) {
7; CHECK: fma.rn.f32 %f{{[0-9]+}}, %f{{[0-9]+}}, %f{{[0-9]+}}, %f{{[0-9]+}};
8; CHECK: ret;
9  %a = fmul float %x, %y
10  %b = fadd float %a, %z
11  ret float %b
12}
13
14define ptx_device float @t2_f32(float %x, float %y, float %z, float %w) {
15; CHECK: fma.rn.f32 %f{{[0-9]+}}, %f{{[0-9]+}}, %f{{[0-9]+}}, %f{{[0-9]+}};
16; CHECK: fma.rn.f32 %f{{[0-9]+}}, %f{{[0-9]+}}, %f{{[0-9]+}}, %f{{[0-9]+}};
17; CHECK: ret;
18  %a = fmul float %x, %y
19  %b = fadd float %a, %z
20  %c = fadd float %a, %w
21  %d = call float @dummy_f32(float %b, float %c)
22  ret float %d
23}
24
25define ptx_device double @t1_f64(double %x, double %y, double %z) {
26; CHECK: fma.rn.f64 %fd{{[0-9]+}}, %fd{{[0-9]+}}, %fd{{[0-9]+}}, %fd{{[0-9]+}};
27; CHECK: ret;
28  %a = fmul double %x, %y
29  %b = fadd double %a, %z
30  ret double %b
31}
32
33define ptx_device double @t2_f64(double %x, double %y, double %z, double %w) {
34; CHECK: fma.rn.f64 %fd{{[0-9]+}}, %fd{{[0-9]+}}, %fd{{[0-9]+}}, %fd{{[0-9]+}};
35; CHECK: fma.rn.f64 %fd{{[0-9]+}}, %fd{{[0-9]+}}, %fd{{[0-9]+}}, %fd{{[0-9]+}};
36; CHECK: ret;
37  %a = fmul double %x, %y
38  %b = fadd double %a, %z
39  %c = fadd double %a, %w
40  %d = call double @dummy_f64(double %b, double %c)
41  ret double %d
42}
43