• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py
2; RUN: opt < %s -cost-model -analyze -mtriple=powerpc64-unknown-linux-gnu -mcpu=pwr7 -mattr=+vsx | FileCheck --check-prefix=CHECK-P7 %s
3; RUN: opt < %s -cost-model -analyze -mtriple=powerpc64le-unknown-linux-gnu -mcpu=pwr8 -mattr=+vsx | FileCheck --check-prefix=CHECK-P8LE %s
4; RUN: opt < %s -cost-model -analyze -mtriple=powerpc64-unknown-linux-gnu -mcpu=pwr9 -mattr=+vsx | FileCheck --check-prefix=CHECK-P9BE %s
5; RUN: opt < %s -cost-model -analyze -mtriple=powerpc64le-unknown-linux-gnu -mcpu=pwr9 -mattr=+vsx | FileCheck --check-prefix=CHECK-P9LE %s
6
7target datalayout = "E-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-f128:128:128-v128:128:128-n32:64"
8target triple = "powerpc64-unknown-linux-gnu"
9
10define i32 @insert(i32 %arg) {
11  ; CHECK: cost of 10 {{.*}} insertelement
12; CHECK-P7-LABEL: 'insert'
13; CHECK-P7-NEXT:  Cost Model: Found an estimated cost of 10 for instruction: %x = insertelement <4 x i32> undef, i32 %arg, i32 0
14; CHECK-P7-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i32 undef
15;
16; CHECK-P8LE-LABEL: 'insert'
17; CHECK-P8LE-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %x = insertelement <4 x i32> undef, i32 %arg, i32 0
18; CHECK-P8LE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i32 undef
19;
20; CHECK-P9BE-LABEL: 'insert'
21; CHECK-P9BE-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %x = insertelement <4 x i32> undef, i32 %arg, i32 0
22; CHECK-P9BE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i32 undef
23;
24; CHECK-P9LE-LABEL: 'insert'
25; CHECK-P9LE-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %x = insertelement <4 x i32> undef, i32 %arg, i32 0
26; CHECK-P9LE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i32 undef
27;
28  %x = insertelement <4 x i32> undef, i32 %arg, i32 0
29  ret i32 undef
30}
31
32define i32 @extract(<4 x i32> %arg) {
33  ; CHECK: cost of 3 {{.*}} extractelement
34; CHECK-P7-LABEL: 'extract'
35; CHECK-P7-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %x = extractelement <4 x i32> %arg, i32 0
36; CHECK-P7-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i32 %x
37;
38; CHECK-P8LE-LABEL: 'extract'
39; CHECK-P8LE-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %x = extractelement <4 x i32> %arg, i32 0
40; CHECK-P8LE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i32 %x
41;
42; CHECK-P9BE-LABEL: 'extract'
43; CHECK-P9BE-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %x = extractelement <4 x i32> %arg, i32 0
44; CHECK-P9BE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i32 %x
45;
46; CHECK-P9LE-LABEL: 'extract'
47; CHECK-P9LE-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %x = extractelement <4 x i32> %arg, i32 0
48; CHECK-P9LE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i32 %x
49;
50  %x = extractelement <4 x i32> %arg, i32 0
51  ret i32 %x
52}
53
54define void @test2xdouble(<2 x double> %arg1) {
55; CHECK-P7-LABEL: 'test2xdouble'
56; CHECK-P7-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %v1 = extractelement <2 x double> %arg1, i32 0
57; CHECK-P7-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v2 = extractelement <2 x double> %arg1, i32 1
58; CHECK-P7-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret void
59;
60; CHECK-P8LE-LABEL: 'test2xdouble'
61; CHECK-P8LE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v1 = extractelement <2 x double> %arg1, i32 0
62; CHECK-P8LE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %v2 = extractelement <2 x double> %arg1, i32 1
63; CHECK-P8LE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret void
64;
65; CHECK-P9BE-LABEL: 'test2xdouble'
66; CHECK-P9BE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %v1 = extractelement <2 x double> %arg1, i32 0
67; CHECK-P9BE-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %v2 = extractelement <2 x double> %arg1, i32 1
68; CHECK-P9BE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret void
69;
70; CHECK-P9LE-LABEL: 'test2xdouble'
71; CHECK-P9LE-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %v1 = extractelement <2 x double> %arg1, i32 0
72; CHECK-P9LE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %v2 = extractelement <2 x double> %arg1, i32 1
73; CHECK-P9LE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret void
74;
75  %v1 = extractelement <2 x double> %arg1, i32 0
76  %v2 = extractelement <2 x double> %arg1, i32 1
77  ret void
78}
79
80define void @test4xi32(<4 x i32> %v1, i32 %x1) {
81; CHECK-P7-LABEL: 'test4xi32'
82; CHECK-P7-NEXT:  Cost Model: Found an estimated cost of 10 for instruction: %v2 = insertelement <4 x i32> %v1, i32 %x1, i32 2
83; CHECK-P7-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret void
84;
85; CHECK-P8LE-LABEL: 'test4xi32'
86; CHECK-P8LE-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %v2 = insertelement <4 x i32> %v1, i32 %x1, i32 2
87; CHECK-P8LE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret void
88;
89; CHECK-P9BE-LABEL: 'test4xi32'
90; CHECK-P9BE-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %v2 = insertelement <4 x i32> %v1, i32 %x1, i32 2
91; CHECK-P9BE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret void
92;
93; CHECK-P9LE-LABEL: 'test4xi32'
94; CHECK-P9LE-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %v2 = insertelement <4 x i32> %v1, i32 %x1, i32 2
95; CHECK-P9LE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret void
96;
97  %v2 = insertelement <4 x i32> %v1, i32 %x1, i32 2
98  ret void
99}
100
101define void @vexti32(<4 x i32> %p1) {
102; CHECK-P7-LABEL: 'vexti32'
103; CHECK-P7-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %i1 = extractelement <4 x i32> %p1, i32 0
104; CHECK-P7-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %i2 = extractelement <4 x i32> %p1, i32 1
105; CHECK-P7-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %i3 = extractelement <4 x i32> %p1, i32 2
106; CHECK-P7-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %i4 = extractelement <4 x i32> %p1, i32 3
107; CHECK-P7-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret void
108;
109; CHECK-P8LE-LABEL: 'vexti32'
110; CHECK-P8LE-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %i1 = extractelement <4 x i32> %p1, i32 0
111; CHECK-P8LE-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %i2 = extractelement <4 x i32> %p1, i32 1
112; CHECK-P8LE-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %i3 = extractelement <4 x i32> %p1, i32 2
113; CHECK-P8LE-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %i4 = extractelement <4 x i32> %p1, i32 3
114; CHECK-P8LE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret void
115;
116; CHECK-P9BE-LABEL: 'vexti32'
117; CHECK-P9BE-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %i1 = extractelement <4 x i32> %p1, i32 0
118; CHECK-P9BE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %i2 = extractelement <4 x i32> %p1, i32 1
119; CHECK-P9BE-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %i3 = extractelement <4 x i32> %p1, i32 2
120; CHECK-P9BE-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %i4 = extractelement <4 x i32> %p1, i32 3
121; CHECK-P9BE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret void
122;
123; CHECK-P9LE-LABEL: 'vexti32'
124; CHECK-P9LE-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %i1 = extractelement <4 x i32> %p1, i32 0
125; CHECK-P9LE-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %i2 = extractelement <4 x i32> %p1, i32 1
126; CHECK-P9LE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %i3 = extractelement <4 x i32> %p1, i32 2
127; CHECK-P9LE-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %i4 = extractelement <4 x i32> %p1, i32 3
128; CHECK-P9LE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret void
129;
130  %i1 = extractelement <4 x i32> %p1, i32 0
131  %i2 = extractelement <4 x i32> %p1, i32 1
132  %i3 = extractelement <4 x i32> %p1, i32 2
133  %i4 = extractelement <4 x i32> %p1, i32 3
134  ret void
135}
136
137define void @vexti64(<2 x i64> %p1) {
138; CHECK-P7-LABEL: 'vexti64'
139; CHECK-P7-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %i1 = extractelement <2 x i64> %p1, i32 0
140; CHECK-P7-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %i2 = extractelement <2 x i64> %p1, i32 1
141; CHECK-P7-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret void
142;
143; CHECK-P8LE-LABEL: 'vexti64'
144; CHECK-P8LE-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %i1 = extractelement <2 x i64> %p1, i32 0
145; CHECK-P8LE-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %i2 = extractelement <2 x i64> %p1, i32 1
146; CHECK-P8LE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret void
147;
148; CHECK-P9BE-LABEL: 'vexti64'
149; CHECK-P9BE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %i1 = extractelement <2 x i64> %p1, i32 0
150; CHECK-P9BE-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %i2 = extractelement <2 x i64> %p1, i32 1
151; CHECK-P9BE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret void
152;
153; CHECK-P9LE-LABEL: 'vexti64'
154; CHECK-P9LE-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %i1 = extractelement <2 x i64> %p1, i32 0
155; CHECK-P9LE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %i2 = extractelement <2 x i64> %p1, i32 1
156; CHECK-P9LE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret void
157;
158  %i1 = extractelement <2 x i64> %p1, i32 0
159  %i2 = extractelement <2 x i64> %p1, i32 1
160  ret void
161}
162
163define void @vext(<8 x i16> %p1, <16 x i8> %p2) {
164; CHECK-P7-LABEL: 'vext'
165; CHECK-P7-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %i1 = extractelement <8 x i16> %p1, i32 0
166; CHECK-P7-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %i2 = extractelement <16 x i8> %p2, i32 0
167; CHECK-P7-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret void
168;
169; CHECK-P8LE-LABEL: 'vext'
170; CHECK-P8LE-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %i1 = extractelement <8 x i16> %p1, i32 0
171; CHECK-P8LE-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %i2 = extractelement <16 x i8> %p2, i32 0
172; CHECK-P8LE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret void
173;
174; CHECK-P9BE-LABEL: 'vext'
175; CHECK-P9BE-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %i1 = extractelement <8 x i16> %p1, i32 0
176; CHECK-P9BE-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %i2 = extractelement <16 x i8> %p2, i32 0
177; CHECK-P9BE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret void
178;
179; CHECK-P9LE-LABEL: 'vext'
180; CHECK-P9LE-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %i1 = extractelement <8 x i16> %p1, i32 0
181; CHECK-P9LE-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %i2 = extractelement <16 x i8> %p2, i32 0
182; CHECK-P9LE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret void
183;
184  %i1 = extractelement <8 x i16> %p1, i32 0
185  %i2 = extractelement <16 x i8> %p2, i32 0
186  ret void
187}
188