1*cee313d2SEric Christopher; RUN: opt -mtriple=x86_64-unknown-linux-gnu -load-store-vectorizer -mcpu haswell -S -o - %s | FileCheck --check-prefix=CHECK-HSW %s
2*cee313d2SEric Christopher; RUN: opt -mtriple=x86_64-unknown-linux-gnu -load-store-vectorizer -mcpu knl -S -o - %s | FileCheck --check-prefix=CHECK-KNL %s
3*cee313d2SEric Christopher; RUN: opt -mtriple=x86_64-unknown-linux-gnu -aa-pipeline=basic-aa -passes='function(load-store-vectorizer)' -mcpu haswell -S -o - %s | FileCheck --check-prefix=CHECK-HSW %s
4*cee313d2SEric Christopher; RUN: opt -mtriple=x86_64-unknown-linux-gnu -aa-pipeline=basic-aa -passes='function(load-store-vectorizer)' -mcpu knl -S -o - %s | FileCheck --check-prefix=CHECK-KNL %s
5*cee313d2SEric Christopher
6*cee313d2SEric Christopherdefine <8 x double> @loadwidth_insert_extract(double* %ptr) {
7*cee313d2SEric Christopher    %a = bitcast double* %ptr to <2 x double> *
8*cee313d2SEric Christopher    %b = getelementptr <2 x double>, <2 x double>* %a, i32 1
9*cee313d2SEric Christopher    %c = getelementptr <2 x double>, <2 x double>* %a, i32 2
10*cee313d2SEric Christopher    %d = getelementptr <2 x double>, <2 x double>* %a, i32 3
11*cee313d2SEric Christopher; CHECK-HSW: load <4 x double>
12*cee313d2SEric Christopher; CHECK-HSW: load <4 x double>
13*cee313d2SEric Christopher; CHECK-HSW-NOT: load
14*cee313d2SEric Christopher; CHECK-KNL: load <8 x double>
15*cee313d2SEric Christopher; CHECK-KNL-NOT: load
16*cee313d2SEric Christopher    %la = load <2 x double>, <2 x double> *%a
17*cee313d2SEric Christopher    %lb = load <2 x double>, <2 x double> *%b
18*cee313d2SEric Christopher    %lc = load <2 x double>, <2 x double> *%c
19*cee313d2SEric Christopher    %ld = load <2 x double>, <2 x double> *%d
20*cee313d2SEric Christopher    ; Scalarize everything - Explicitly not a shufflevector to test this code
21*cee313d2SEric Christopher    ; path in the LSV
22*cee313d2SEric Christopher    %v1 = extractelement <2 x double> %la, i32 0
23*cee313d2SEric Christopher    %v2 = extractelement <2 x double> %la, i32 1
24*cee313d2SEric Christopher    %v3 = extractelement <2 x double> %lb, i32 0
25*cee313d2SEric Christopher    %v4 = extractelement <2 x double> %lb, i32 1
26*cee313d2SEric Christopher    %v5 = extractelement <2 x double> %lc, i32 0
27*cee313d2SEric Christopher    %v6 = extractelement <2 x double> %lc, i32 1
28*cee313d2SEric Christopher    %v7 = extractelement <2 x double> %ld, i32 0
29*cee313d2SEric Christopher    %v8 = extractelement <2 x double> %ld, i32 1
30*cee313d2SEric Christopher    ; Make a vector again
31*cee313d2SEric Christopher    %i1 = insertelement <8 x double> undef, double %v1, i32 0
32*cee313d2SEric Christopher    %i2 = insertelement <8 x double> %i1, double %v2, i32 1
33*cee313d2SEric Christopher    %i3 = insertelement <8 x double> %i2, double %v3, i32 2
34*cee313d2SEric Christopher    %i4 = insertelement <8 x double> %i3, double %v4, i32 3
35*cee313d2SEric Christopher    %i5 = insertelement <8 x double> %i4, double %v5, i32 4
36*cee313d2SEric Christopher    %i6 = insertelement <8 x double> %i5, double %v6, i32 5
37*cee313d2SEric Christopher    %i7 = insertelement <8 x double> %i6, double %v7, i32 6
38*cee313d2SEric Christopher    %i8 = insertelement <8 x double> %i7, double %v8, i32 7
39*cee313d2SEric Christopher    ret <8 x double> %i8
40*cee313d2SEric Christopher}
41