Home | History | Annotate | Download | only in NVPTX
      1 ; RUN: llc < %s -march=nvptx -mcpu=sm_20 -fp-contract=fast | FileCheck %s -check-prefix=CHECK
      2 ; RUN: llc < %s -march=nvptx -mcpu=sm_20 -fp-contract=fast -enable-unsafe-fp-math | FileCheck %s -check-prefix=CHECK -check-prefix=CHECK-UNSAFE
      3 
      4 define ptx_device float @t1_f32(float %x, float %y, float %z,
      5                                 float %u, float %v) {
      6 ; CHECK-UNSAFE: fma.rn.f32 %f{{[0-9]+}}, %f{{[0-9]+}}, %f{{[0-9]+}}, %f{{[0-9]+}};
      7 ; CHECK-UNSAFE: 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 = fmul float %u, %v
     11   %c = fadd float %a, %b
     12   %d = fadd float %c, %z
     13   ret float %d
     14 }
     15 
     16 define ptx_device double @t1_f64(double %x, double %y, double %z,
     17                                  double %u, double %v) {
     18 ; CHECK-UNSAFE: fma.rn.f64 %fd{{[0-9]+}}, %fd{{[0-9]+}}, %fd{{[0-9]+}}, %fd{{[0-9]+}};
     19 ; CHECK-UNSAFE: fma.rn.f64 %fd{{[0-9]+}}, %fd{{[0-9]+}}, %fd{{[0-9]+}}, %fd{{[0-9]+}};
     20 ; CHECK: ret;
     21   %a = fmul double %x, %y
     22   %b = fmul double %u, %v
     23   %c = fadd double %a, %b
     24   %d = fadd double %c, %z
     25   ret double %d
     26 }
     27 
     28 define double @two_choices(double %val1, double %val2) {
     29 ; CHECK-LABEL: two_choices(
     30 ; CHECK: mul.f64
     31 ; CHECK-NOT: mul.f64
     32 ; CHECK: fma.rn.f64
     33   %1 = fmul double %val1, %val2
     34   %2 = fmul double %1, %1
     35   %3 = fadd double %1, %2
     36 
     37   ret double %3
     38 }
     39 
     40