2
0

2011-06-08-VectorExtractValue.ll 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. ; RUN: opt < %s -S -scalarrepl | FileCheck %s
  2. ; RUN: opt < %s -S -scalarrepl-ssa | FileCheck %s
  3. 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"
  4. target triple = "x86_64-apple-macosx10.7.0"
  5. %0 = type { <2 x float>, float }
  6. %struct.PointC3 = type { %struct.array }
  7. %struct.Point_3 = type { %struct.PointC3 }
  8. %struct.array = type { [3 x float], [4 x i8] }
  9. ; CHECK: main
  10. ; CHECK-NOT: alloca
  11. ; CHECK: extractelement <2 x float> zeroinitializer, i32 0
  12. define void @main() uwtable ssp {
  13. entry:
  14. %ref.tmp2 = alloca %0, align 16
  15. %tmpcast = bitcast %0* %ref.tmp2 to %struct.Point_3*
  16. %0 = getelementptr %0, %0* %ref.tmp2, i64 0, i32 0
  17. store <2 x float> zeroinitializer, <2 x float>* %0, align 16
  18. %1 = getelementptr inbounds %struct.Point_3, %struct.Point_3* %tmpcast, i64 0, i32 0
  19. %base.i.i.i = getelementptr inbounds %struct.PointC3, %struct.PointC3* %1, i64 0, i32 0
  20. %arrayidx.i.i.i.i = getelementptr inbounds %struct.array, %struct.array* %base.i.i.i, i64 0, i32 0, i64 0
  21. %tmp5.i.i = load float, float* %arrayidx.i.i.i.i, align 4
  22. ret void
  23. }
  24. ; CHECK: test1
  25. ; CHECK-NOT: alloca
  26. ; CHECK: extractelement <2 x float> zeroinitializer, i32 0
  27. define void @test1() uwtable ssp {
  28. entry:
  29. %ref.tmp2 = alloca {<2 x float>, float}, align 16
  30. %tmpcast = bitcast {<2 x float>, float}* %ref.tmp2 to float*
  31. %0 = getelementptr {<2 x float>, float}, {<2 x float>, float}* %ref.tmp2, i64 0, i32 0
  32. store <2 x float> zeroinitializer, <2 x float>* %0, align 16
  33. %tmp5.i.i = load float, float* %tmpcast, align 4
  34. ret void
  35. }
  36. ; CHECK: test2
  37. ; CHECK-NOT: alloca
  38. ; CHECK: %[[A:[a-z0-9]*]] = extractelement <2 x float> zeroinitializer, i32 0
  39. ; CHECK: fadd float %[[A]], 1.000000e+00
  40. ; CHECK-NOT: insertelement
  41. ; CHECK-NOT: extractelement
  42. define float @test2() uwtable ssp {
  43. entry:
  44. %ref.tmp2 = alloca {<2 x float>, float}, align 16
  45. %tmpcast = bitcast {<2 x float>, float}* %ref.tmp2 to float*
  46. %tmpcast2 = getelementptr {<2 x float>, float}, {<2 x float>, float}* %ref.tmp2, i64 0, i32 1
  47. %0 = getelementptr {<2 x float>, float}, {<2 x float>, float}* %ref.tmp2, i64 0, i32 0
  48. store <2 x float> zeroinitializer, <2 x float>* %0, align 16
  49. store float 1.0, float* %tmpcast2, align 4
  50. %r1 = load float, float* %tmpcast, align 4
  51. %r2 = load float, float* %tmpcast2, align 4
  52. %r = fadd float %r1, %r2
  53. ret float %r
  54. }
  55. ; CHECK: test3
  56. ; CHECK: %[[A:[a-z0-9]*]] = extractelement <2 x float> <float 2.000000e+00, float 3.000000e+00>, i32 1
  57. ; CHECK: ret float %[[A]]
  58. define float @test3() {
  59. entry:
  60. %ai = alloca { <2 x float>, <2 x float> }, align 8
  61. store { <2 x float>, <2 x float> } {<2 x float> <float 0.0, float 1.0>, <2 x float> <float 2.0, float 3.0>}, { <2 x float>, <2 x float> }* %ai, align 8
  62. %tmpcast = bitcast { <2 x float>, <2 x float> }* %ai to [4 x float]*
  63. %arrayidx = getelementptr inbounds [4 x float], [4 x float]* %tmpcast, i64 0, i64 3
  64. %f = load float, float* %arrayidx, align 4
  65. ret float %f
  66. }