1; RUN: opt < %s -basicaa -slp-vectorizer -slp-threshold=-100 -dce -S -mtriple=i386-apple-macosx10.8.0 -mcpu=corei7-avx | FileCheck %s
2
3; We purposely over-align f64 to 128bit here.
4target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:128:128-v64:64:64-v128:128:128-a0:0:64-f80:128:128-n8:16:32-S128"
5target triple = "i386-apple-macosx10.9.0"
6
7
8define void @test(double* %i1, double* %i2, double* %o) {
9; CHECK-LABEL: @test(
10;
11; Test that we correctly recognize the discontiguous memory in arrays where the
12; size is less than the alignment, and through various different GEP formations.
13
14entry:
15  %i1.0 = load double* %i1, align 16
16  %i1.gep1 = getelementptr double* %i1, i64 1
17  %i1.1 = load double* %i1.gep1, align 16
18; CHECK: load double*
19; CHECK: load double*
20; CHECK: insertelement <2 x double>
21; CHECK: insertelement <2 x double>
22  br i1 undef, label %then, label %end
23
24then:
25  %i2.gep0 = getelementptr inbounds double* %i2, i64 0
26  %i2.0 = load double* %i2.gep0, align 16
27  %i2.gep1 = getelementptr inbounds double* %i2, i64 1
28  %i2.1 = load double* %i2.gep1, align 16
29; CHECK: load double*
30; CHECK: load double*
31; CHECK: insertelement <2 x double>
32; CHECK: insertelement <2 x double>
33  br label %end
34
35end:
36  %phi0 = phi double [ %i1.0, %entry ], [ %i2.0, %then ]
37  %phi1 = phi double [ %i1.1, %entry ], [ %i2.1, %then ]
38; CHECK: phi <2 x double>
39; CHECK: extractelement <2 x double>
40; CHECK: extractelement <2 x double>
41  store double %phi0, double* %o, align 16
42  %o.gep1 = getelementptr inbounds double* %o, i64 1
43  store double %phi1, double* %o.gep1, align 16
44  ret void
45}
46