xref: /llvm-project/llvm/test/Analysis/CostModel/SystemZ/vectorinstrs.ll (revision 4178e33470763b406f614b646c8b01d24309e20b)
1; RUN: opt < %s -passes="print<cost-model>" 2>&1 -disable-output -mtriple=systemz-unknown -mcpu=z13 | FileCheck %s
2
3; CHECK: vecinstrs
4define void @vecinstrs() {
5
6  ;; Extract element is penalized somewhat with a cost of 2 for index 0.
7  extractelement <16 x i8> undef, i32 0
8  extractelement <16 x i8> undef, i32 1
9
10  extractelement <8 x i16> undef, i32 0
11  extractelement <8 x i16> undef, i32 1
12
13  extractelement <4 x i32> undef, i32 0
14  extractelement <4 x i32> undef, i32 1
15
16  extractelement <2 x i64> undef, i32 0
17  extractelement <2 x i64> undef, i32 1
18
19  extractelement <2 x double> undef, i32 0
20  extractelement <2 x double> undef, i32 1
21
22  ; Extraction of i1 means extract + test under mask before branch.
23  extractelement <2 x i1> undef, i32 0
24  extractelement <4 x i1> undef, i32 1
25  extractelement <8 x i1> undef, i32 2
26
27  ;; Insert element
28  insertelement <16 x i8> undef, i8 undef, i32 0
29  insertelement <8 x i16> undef, i16 undef, i32 0
30  insertelement <4 x i32> undef, i32 undef, i32 0
31
32  ; vlvgp will do two grs into a vector register: only add cost half of the time.
33  insertelement <2 x i64> undef, i64 undef, i32 0
34  insertelement <2 x i64> undef, i64 undef, i32 1
35
36  ret void
37
38; CHECK: Cost Model: Found an estimated cost of 2 for instruction:   %1 = extractelement <16 x i8> undef, i32 0
39; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %2 = extractelement <16 x i8> undef, i32 1
40; CHECK: Cost Model: Found an estimated cost of 2 for instruction:   %3 = extractelement <8 x i16> undef, i32 0
41; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %4 = extractelement <8 x i16> undef, i32 1
42; CHECK: Cost Model: Found an estimated cost of 2 for instruction:   %5 = extractelement <4 x i32> undef, i32 0
43; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %6 = extractelement <4 x i32> undef, i32 1
44; CHECK: Cost Model: Found an estimated cost of 2 for instruction:   %7 = extractelement <2 x i64> undef, i32 0
45; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %8 = extractelement <2 x i64> undef, i32 1
46; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %9 = extractelement <2 x double> undef, i32 0
47; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %10 = extractelement <2 x double> undef, i32 1
48; CHECK: Cost Model: Found an estimated cost of 3 for instruction:   %11 = extractelement <2 x i1> undef, i32 0
49; CHECK: Cost Model: Found an estimated cost of 2 for instruction:   %12 = extractelement <4 x i1> undef, i32 1
50; CHECK: Cost Model: Found an estimated cost of 2 for instruction:   %13 = extractelement <8 x i1> undef, i32 2
51; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %14 = insertelement <16 x i8> undef, i8 undef, i32 0
52; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %15 = insertelement <8 x i16> undef, i16 undef, i32 0
53; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %16 = insertelement <4 x i32> undef, i32 undef, i32 0
54; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %17 = insertelement <2 x i64> undef, i64 undef, i32 0
55; CHECK: Cost Model: Found an estimated cost of 0 for instruction:   %18 = insertelement <2 x i64> undef, i64 undef, i32 1
56}
57