• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: opt < %s -scalarrepl -S | FileCheck %s
2target datalayout = "e-p:32:32:32-i1:8:32-i8:8:32-i16:16:32-i32:32:32-i64:32:32-f32:32:32-f64:32:32-v64:32:64-v128:32:128-a0:0:32-n32"
3target triple = "thumbv7-apple-darwin10"
4
5; CHECK: f
6; CHECK-NOT: alloca
7; CHECK: %[[A:[a-z0-9]*]] = and i128 undef, -16777216
8; CHECK: %[[B:[a-z0-9]*]] = bitcast i128 %[[A]] to <4 x float>
9; CHECK: %[[C:[a-z0-9]*]] = extractelement <4 x float> %[[B]], i32 0
10; CHECK: ret float %[[C]]
11
12define float @f() nounwind ssp {
13entry:
14  %a = alloca <4 x float>, align 16
15  %p = bitcast <4 x float>* %a to i8*
16  call void @llvm.memset.p0i8.i32(i8* %p, i8 0, i32 3, i32 16, i1 false)
17  %vec = load <4 x float>* %a, align 8
18  %val = extractelement <4 x float> %vec, i32 0
19  ret float %val
20}
21
22; CHECK: g
23; CHECK-NOT: alloca
24; CHECK: and i128
25
26define void @g() nounwind ssp {
27entry:
28  %a = alloca { <4 x float> }, align 16
29  %p = bitcast { <4 x float> }* %a to i8*
30  call void @llvm.memset.p0i8.i32(i8* %p, i8 0, i32 16, i32 16, i1 false)
31  %q = bitcast { <4 x float> }* %a to [2 x <2 x float>]*
32  %arrayidx = getelementptr inbounds [2 x <2 x float>]* %q, i32 0, i32 0
33  store <2 x float> undef, <2 x float>* %arrayidx, align 8
34  ret void
35}
36
37declare void @llvm.memset.p0i8.i32(i8* nocapture, i8, i32, i32, i1) nounwind
38