3da83f9502f8303e3948c5e1f15e120bdf4e5318
[oota-llvm.git] / test / Transforms / SLPVectorizer / X86 / phi_overalignedtype.ll
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. 
4 target 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"
5 target triple = "i386-apple-macosx10.9.0"
6
7
8 define 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
14 entry:
15   %i1.0 = load double* %i1, align 16
16   %i1.gep1 = getelementptr double, 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
24 then:
25   %i2.gep0 = getelementptr inbounds double, double* %i2, i64 0
26   %i2.0 = load double* %i2.gep0, align 16
27   %i2.gep1 = getelementptr inbounds double, 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
35 end:
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, double* %o, i64 1
43   store double %phi1, double* %o.gep1, align 16
44   ret void
45 }