double-float-shrink-2.ll 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. ; RUN: opt < %s -instcombine -S -mtriple "i386-pc-linux" | FileCheck -check-prefix=DO-SIMPLIFY %s
  2. ; RUN: opt < %s -instcombine -S -mtriple "i386-pc-win32" | FileCheck -check-prefix=DONT-SIMPLIFY %s
  3. ; RUN: opt < %s -instcombine -S -mtriple "x86_64-pc-win32" | FileCheck -check-prefix=C89-SIMPLIFY %s
  4. ; RUN: opt < %s -instcombine -S -mtriple "i386-pc-mingw32" | FileCheck -check-prefix=DO-SIMPLIFY %s
  5. ; RUN: opt < %s -instcombine -S -mtriple "x86_64-pc-mingw32" | FileCheck -check-prefix=DO-SIMPLIFY %s
  6. ; RUN: opt < %s -instcombine -S -mtriple "sparc-sun-solaris" | FileCheck -check-prefix=DO-SIMPLIFY %s
  7. ; DO-SIMPLIFY: call float @floorf(
  8. ; DO-SIMPLIFY: call float @ceilf(
  9. ; DO-SIMPLIFY: call float @roundf(
  10. ; DO-SIMPLIFY: call float @nearbyintf(
  11. ; DO-SIMPLIFY: call float @truncf(
  12. ; DO-SIMPLIFY: call float @fabsf(
  13. ; C89-SIMPLIFY: call float @floorf(
  14. ; C89-SIMPLIFY: call float @ceilf(
  15. ; C89-SIMPLIFY: call double @round(
  16. ; C89-SIMPLIFY: call double @nearbyint(
  17. ; DONT-SIMPLIFY: call double @floor(
  18. ; DONT-SIMPLIFY: call double @ceil(
  19. ; DONT-SIMPLIFY: call double @round(
  20. ; DONT-SIMPLIFY: call double @nearbyint(
  21. ; DONT-SIMPLIFY: call double @trunc(
  22. ; DONT-SIMPLIFY: call double @fabs(
  23. declare double @floor(double)
  24. declare double @ceil(double)
  25. declare double @round(double)
  26. declare double @nearbyint(double)
  27. declare double @trunc(double)
  28. declare double @fabs(double)
  29. define float @test_floor(float %C) {
  30. %D = fpext float %C to double
  31. ; --> floorf
  32. %E = call double @floor(double %D)
  33. %F = fptrunc double %E to float
  34. ret float %F
  35. }
  36. define float @test_ceil(float %C) {
  37. %D = fpext float %C to double
  38. ; --> ceilf
  39. %E = call double @ceil(double %D)
  40. %F = fptrunc double %E to float
  41. ret float %F
  42. }
  43. define float @test_round(float %C) {
  44. %D = fpext float %C to double
  45. ; --> roundf
  46. %E = call double @round(double %D)
  47. %F = fptrunc double %E to float
  48. ret float %F
  49. }
  50. define float @test_nearbyint(float %C) {
  51. %D = fpext float %C to double
  52. ; --> nearbyintf
  53. %E = call double @nearbyint(double %D)
  54. %F = fptrunc double %E to float
  55. ret float %F
  56. }
  57. define float @test_trunc(float %C) {
  58. %D = fpext float %C to double
  59. ; --> truncf
  60. %E = call double @trunc(double %D)
  61. %F = fptrunc double %E to float
  62. ret float %F
  63. }
  64. define float @test_fabs(float %C) {
  65. %D = fpext float %C to double
  66. ; --> fabsf
  67. %E = call double @fabs(double %D)
  68. %F = fptrunc double %E to float
  69. ret float %F
  70. }