fma.ll 1.4 KB

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