Home | History | Annotate | Download | only in ScalarRepl
      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 
      6 %0 = type { <2 x float>, float }
      7 %struct.PointC3 = type { %struct.array }
      8 %struct.Point_3 = type { %struct.PointC3 }
      9 %struct.array = type { [3 x float], [4 x i8] }
     10 
     11 ; CHECK: main
     12 ; CHECK-NOT: alloca
     13 ; CHECK: %[[A:[a-z0-9]*]] = and i128
     14 ; CHECK: %[[B:[a-z0-9]*]] = trunc i128 %[[A]] to i32
     15 
     16 define void @main() uwtable ssp {
     17 entry:
     18   %ref.tmp2 = alloca %0, align 16
     19   %tmpcast = bitcast %0* %ref.tmp2 to %struct.Point_3*
     20   %0 = getelementptr %0* %ref.tmp2, i64 0, i32 0
     21   store <2 x float> zeroinitializer, <2 x float>* %0, align 16
     22   %1 = getelementptr inbounds %struct.Point_3* %tmpcast, i64 0, i32 0
     23   %base.i.i.i = getelementptr inbounds %struct.PointC3* %1, i64 0, i32 0
     24   %arrayidx.i.i.i.i = getelementptr inbounds %struct.array* %base.i.i.i, i64 0, i32 0, i64 0
     25   %tmp5.i.i = load float* %arrayidx.i.i.i.i, align 4
     26   ret void
     27 }
     28 
     29 ; CHECK: test1
     30 ; CHECK-NOT: alloca
     31 ; CHECK: %[[A:[a-z0-9]*]] = and i128
     32 ; CHECK: %[[B:[a-z0-9]*]] = trunc i128 %[[A]] to i32
     33 
     34 define void @test1() uwtable ssp {
     35 entry:
     36   %ref.tmp2 = alloca {<2 x float>, float}, align 16
     37   %tmpcast = bitcast {<2 x float>, float}* %ref.tmp2 to float*
     38   %0 = getelementptr {<2 x float>, float}* %ref.tmp2, i64 0, i32 0
     39   store <2 x float> zeroinitializer, <2 x float>* %0, align 16
     40   %tmp5.i.i = load float* %tmpcast, align 4
     41   ret void
     42 }
     43 
     44 ; CHECK: test2
     45 ; CHECK-NOT: alloca
     46 ; CHECK: and i128
     47 ; CHECK: or i128
     48 ; CHECK: trunc i128
     49 ; CHECK-NOT: insertelement
     50 ; CHECK-NOT: extractelement
     51 
     52 define float @test2() uwtable ssp {
     53 entry:
     54   %ref.tmp2 = alloca {<2 x float>, float}, align 16
     55   %tmpcast = bitcast {<2 x float>, float}* %ref.tmp2 to float*
     56   %tmpcast2 = getelementptr {<2 x float>, float}* %ref.tmp2, i64 0, i32 1
     57   %0 = getelementptr {<2 x float>, float}* %ref.tmp2, i64 0, i32 0
     58   store <2 x float> zeroinitializer, <2 x float>* %0, align 16
     59   store float 1.0, float* %tmpcast2, align 4
     60   %r1 = load float* %tmpcast, align 4
     61   %r2 = load float* %tmpcast2, align 4
     62   %r = fadd float %r1, %r2
     63   ret float %r
     64 }
     65