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