cpp-new-array.ll 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. ; RUN: opt < %s -loop-vectorize -force-vector-interleave=1 -force-vector-width=4 -dce -instcombine -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. target triple = "x86_64-apple-macosx10.8.0"
  4. ;CHECK-LABEL: @cpp_new_arrays(
  5. ;CHECK: sext i32
  6. ;CHECK: load <4 x float>
  7. ;CHECK: fadd <4 x float>
  8. ;CHECK: ret i32
  9. define i32 @cpp_new_arrays() uwtable ssp {
  10. entry:
  11. %call = call noalias i8* @_Znwm(i64 4)
  12. %0 = bitcast i8* %call to float*
  13. store float 1.000000e+03, float* %0, align 4
  14. %call1 = call noalias i8* @_Znwm(i64 4)
  15. %1 = bitcast i8* %call1 to float*
  16. store float 1.000000e+03, float* %1, align 4
  17. %call3 = call noalias i8* @_Znwm(i64 4)
  18. %2 = bitcast i8* %call3 to float*
  19. store float 1.000000e+03, float* %2, align 4
  20. br label %for.body
  21. for.body: ; preds = %entry, %for.body
  22. %i.01 = phi i32 [ 0, %entry ], [ %inc, %for.body ]
  23. %idxprom = sext i32 %i.01 to i64
  24. %arrayidx = getelementptr inbounds float, float* %0, i64 %idxprom
  25. %3 = load float, float* %arrayidx, align 4
  26. %idxprom5 = sext i32 %i.01 to i64
  27. %arrayidx6 = getelementptr inbounds float, float* %1, i64 %idxprom5
  28. %4 = load float, float* %arrayidx6, align 4
  29. %add = fadd float %3, %4
  30. %idxprom7 = sext i32 %i.01 to i64
  31. %arrayidx8 = getelementptr inbounds float, float* %2, i64 %idxprom7
  32. store float %add, float* %arrayidx8, align 4
  33. %inc = add nsw i32 %i.01, 1
  34. %cmp = icmp slt i32 %inc, 1000
  35. br i1 %cmp, label %for.body, label %for.end
  36. for.end: ; preds = %for.body
  37. %5 = load float, float* %2, align 4
  38. %conv10 = fptosi float %5 to i32
  39. ret i32 %conv10
  40. }
  41. declare noalias i8* @_Znwm(i64)