funcall.ll 1.2 KB

1234567891011121314151617181920212223242526272829303132
  1. ; RUN: opt -S -loop-vectorize -force-vector-width=2 -force-vector-interleave=1 < %s | FileCheck %s
  2. target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
  3. ; Make sure we can vectorize loops with functions to math library functions.
  4. ; They might read the rounding mode but we are only vectorizing loops that
  5. ; contain a limited set of function calls and none of them sets the rounding
  6. ; mode, so vectorizing them is safe.
  7. ; CHECK-LABEL: @test(
  8. ; CHECK: <2 x double>
  9. define void @test(double* %d, double %t) {
  10. entry:
  11. br label %for.body
  12. for.body:
  13. %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ]
  14. %arrayidx = getelementptr inbounds double, double* %d, i64 %indvars.iv
  15. %0 = load double, double* %arrayidx, align 8
  16. %1 = tail call double @llvm.pow.f64(double %0, double %t)
  17. store double %1, double* %arrayidx, align 8
  18. %indvars.iv.next = add i64 %indvars.iv, 1
  19. %lftr.wideiv = trunc i64 %indvars.iv.next to i32
  20. %exitcond = icmp ne i32 %lftr.wideiv, 128
  21. br i1 %exitcond, label %for.body, label %for.end
  22. for.end:
  23. ret void
  24. }
  25. declare double @llvm.pow.f64(double, double)