fpmath.ll 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. ; RUN: opt -gvn -S < %s | FileCheck %s
  2. define double @test1(double %x, double %y) {
  3. ; CHECK: @test1(double %x, double %y)
  4. ; CHECK: %add1 = fadd double %x, %y
  5. ; CHECK-NOT: fpmath
  6. ; CHECK: %foo = fadd double %add1, %add1
  7. %add1 = fadd double %x, %y, !fpmath !0
  8. %add2 = fadd double %x, %y
  9. %foo = fadd double %add1, %add2
  10. ret double %foo
  11. }
  12. define double @test2(double %x, double %y) {
  13. ; CHECK: @test2(double %x, double %y)
  14. ; CHECK: %add1 = fadd double %x, %y, !fpmath !0
  15. ; CHECK: %foo = fadd double %add1, %add1
  16. %add1 = fadd double %x, %y, !fpmath !0
  17. %add2 = fadd double %x, %y, !fpmath !0
  18. %foo = fadd double %add1, %add2
  19. ret double %foo
  20. }
  21. define double @test3(double %x, double %y) {
  22. ; CHECK: @test3(double %x, double %y)
  23. ; CHECK: %add1 = fadd double %x, %y, !fpmath !1
  24. ; CHECK: %foo = fadd double %add1, %add1
  25. %add1 = fadd double %x, %y, !fpmath !1
  26. %add2 = fadd double %x, %y, !fpmath !0
  27. %foo = fadd double %add1, %add2
  28. ret double %foo
  29. }
  30. define double @test4(double %x, double %y) {
  31. ; CHECK: @test4(double %x, double %y)
  32. ; CHECK: %add1 = fadd double %x, %y, !fpmath !1
  33. ; CHECK: %foo = fadd double %add1, %add1
  34. %add1 = fadd double %x, %y, !fpmath !0
  35. %add2 = fadd double %x, %y, !fpmath !1
  36. %foo = fadd double %add1, %add2
  37. ret double %foo
  38. }
  39. !0 = !{ float 5.0 }
  40. !1 = !{ float 2.5 }