fold-sqrt-sqrtf.ll 583 B

1234567891011121314151617
  1. ; RUN: opt -instcombine -S -disable-simplify-libcalls < %s | FileCheck %s
  2. ; rdar://10466410
  3. ; Instcombine tries to fold (fptrunc (sqrt (fpext x))) -> (sqrtf x), but this
  4. ; shouldn't fold when sqrtf isn't available.
  5. define float @foo(float %f) uwtable ssp {
  6. entry:
  7. ; CHECK: %conv = fpext float %f to double
  8. ; CHECK: %call = tail call double @sqrt(double %conv)
  9. ; CHECK: %conv1 = fptrunc double %call to float
  10. %conv = fpext float %f to double
  11. %call = tail call double @sqrt(double %conv)
  12. %conv1 = fptrunc double %call to float
  13. ret float %conv1
  14. }
  15. declare double @sqrt(double)