arithmetic-fp-sm20.ll 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. ; RUN: llc < %s -march=nvptx -mcpu=sm_20 -fp-contract=fast | FileCheck %s
  2. ; RUN: llc < %s -march=nvptx64 -mcpu=sm_20 -fp-contract=fast | FileCheck %s
  3. ;; These tests should run for all targets
  4. ;;===-- Basic instruction selection tests ---------------------------------===;;
  5. ;;; f64
  6. define double @fadd_f64(double %a, double %b) {
  7. ; CHECK: add.f64 %fd{{[0-9]+}}, %fd{{[0-9]+}}, %fd{{[0-9]+}}
  8. ; CHECK: ret
  9. %ret = fadd double %a, %b
  10. ret double %ret
  11. }
  12. define double @fsub_f64(double %a, double %b) {
  13. ; CHECK: sub.f64 %fd{{[0-9]+}}, %fd{{[0-9]+}}, %fd{{[0-9]+}}
  14. ; CHECK: ret
  15. %ret = fsub double %a, %b
  16. ret double %ret
  17. }
  18. define double @fmul_f64(double %a, double %b) {
  19. ; CHECK: mul.f64 %fd{{[0-9]+}}, %fd{{[0-9]+}}, %fd{{[0-9]+}}
  20. ; CHECK: ret
  21. %ret = fmul double %a, %b
  22. ret double %ret
  23. }
  24. define double @fdiv_f64(double %a, double %b) {
  25. ; CHECK: div.rn.f64 %fd{{[0-9]+}}, %fd{{[0-9]+}}, %fd{{[0-9]+}}
  26. ; CHECK: ret
  27. %ret = fdiv double %a, %b
  28. ret double %ret
  29. }
  30. ;; PTX does not have a floating-point rem instruction
  31. ;;; f32
  32. define float @fadd_f32(float %a, float %b) {
  33. ; CHECK: add.f32 %f{{[0-9]+}}, %f{{[0-9]+}}, %f{{[0-9]+}}
  34. ; CHECK: ret
  35. %ret = fadd float %a, %b
  36. ret float %ret
  37. }
  38. define float @fsub_f32(float %a, float %b) {
  39. ; CHECK: sub.f32 %f{{[0-9]+}}, %f{{[0-9]+}}, %f{{[0-9]+}}
  40. ; CHECK: ret
  41. %ret = fsub float %a, %b
  42. ret float %ret
  43. }
  44. define float @fmul_f32(float %a, float %b) {
  45. ; CHECK: mul.f32 %f{{[0-9]+}}, %f{{[0-9]+}}, %f{{[0-9]+}}
  46. ; CHECK: ret
  47. %ret = fmul float %a, %b
  48. ret float %ret
  49. }
  50. define float @fdiv_f32(float %a, float %b) {
  51. ; CHECK: div.rn.f32 %f{{[0-9]+}}, %f{{[0-9]+}}, %f{{[0-9]+}}
  52. ; CHECK: ret
  53. %ret = fdiv float %a, %b
  54. ret float %ret
  55. }
  56. ;; PTX does not have a floating-point rem instruction