xref: /llvm-project/llvm/test/Analysis/CostModel/PowerPC/insert_extract.ll (revision 8d1046ae49fdf7585f70cfbb35bcfc46725d9b29)
1; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py
2; RUN: opt < %s -passes="print<cost-model>" 2>&1 -disable-output -mtriple=powerpc64-unknown-linux-gnu -mcpu=pwr7 -mattr=+vsx | FileCheck --check-prefix=CHECK-P7 %s
3; RUN: opt < %s -passes="print<cost-model>" 2>&1 -disable-output -mtriple=powerpc64le-unknown-linux-gnu -mcpu=pwr8 -mattr=+vsx | FileCheck --check-prefix=CHECK-P8LE %s
4; RUN: opt < %s -passes="print<cost-model>" 2>&1 -disable-output -mtriple=powerpc64-unknown-linux-gnu -mcpu=pwr9 -mattr=+vsx | FileCheck --check-prefix=CHECK-P9BE %s
5; RUN: opt < %s -passes="print<cost-model>" 2>&1 -disable-output -mtriple=powerpc64le-unknown-linux-gnu -mcpu=pwr9 -mattr=+vsx | FileCheck --check-prefix=CHECK-P9LE %s
6; RUN: opt < %s -passes="print<cost-model>" 2>&1 -disable-output -mtriple=powerpc64le-unknown-linux-gnu -mcpu=pwr10 -mattr=+vsx | FileCheck --check-prefix=CHECK-P10 %s
7
8target 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"
9target triple = "powerpc64-unknown-linux-gnu"
10
11define i32 @insert(i32 %arg) {
12  ; CHECK: cost of 10 {{.*}} insertelement
13; CHECK-P7-LABEL: 'insert'
14; CHECK-P7-NEXT:  Cost Model: Found an estimated cost of 10 for instruction: %x = insertelement <4 x i32> undef, i32 %arg, i32 0
15; CHECK-P7-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i32 undef
16;
17; CHECK-P8LE-LABEL: 'insert'
18; CHECK-P8LE-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %x = insertelement <4 x i32> undef, i32 %arg, i32 0
19; CHECK-P8LE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i32 undef
20;
21; CHECK-P9BE-LABEL: 'insert'
22; CHECK-P9BE-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %x = insertelement <4 x i32> undef, i32 %arg, i32 0
23; CHECK-P9BE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i32 undef
24;
25; CHECK-P9LE-LABEL: 'insert'
26; CHECK-P9LE-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %x = insertelement <4 x i32> undef, i32 %arg, i32 0
27; CHECK-P9LE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i32 undef
28;
29; CHECK-P10-LABEL: 'insert'
30; CHECK-P10-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %x = insertelement <4 x i32> undef, i32 %arg, i32 0
31; CHECK-P10-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i32 undef
32;
33  %x = insertelement <4 x i32> undef, i32 %arg, i32 0
34  ret i32 undef
35}
36
37define i32 @extract(<4 x i32> %arg) {
38  ; CHECK: cost of 3 {{.*}} extractelement
39; CHECK-P7-LABEL: 'extract'
40; CHECK-P7-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %x = extractelement <4 x i32> %arg, i32 0
41; CHECK-P7-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i32 %x
42;
43; CHECK-P8LE-LABEL: 'extract'
44; CHECK-P8LE-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %x = extractelement <4 x i32> %arg, i32 0
45; CHECK-P8LE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i32 %x
46;
47; CHECK-P9BE-LABEL: 'extract'
48; CHECK-P9BE-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %x = extractelement <4 x i32> %arg, i32 0
49; CHECK-P9BE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i32 %x
50;
51; CHECK-P9LE-LABEL: 'extract'
52; CHECK-P9LE-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %x = extractelement <4 x i32> %arg, i32 0
53; CHECK-P9LE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i32 %x
54;
55; CHECK-P10-LABEL: 'extract'
56; CHECK-P10-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %x = extractelement <4 x i32> %arg, i32 0
57; CHECK-P10-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i32 %x
58;
59  %x = extractelement <4 x i32> %arg, i32 0
60  ret i32 %x
61}
62
63define void @test2xdouble(<2 x double> %arg1) {
64; CHECK-P7-LABEL: 'test2xdouble'
65; CHECK-P7-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %v1 = extractelement <2 x double> %arg1, i32 0
66; CHECK-P7-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v2 = extractelement <2 x double> %arg1, i32 1
67; CHECK-P7-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret void
68;
69; CHECK-P8LE-LABEL: 'test2xdouble'
70; CHECK-P8LE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v1 = extractelement <2 x double> %arg1, i32 0
71; CHECK-P8LE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %v2 = extractelement <2 x double> %arg1, i32 1
72; CHECK-P8LE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret void
73;
74; CHECK-P9BE-LABEL: 'test2xdouble'
75; CHECK-P9BE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %v1 = extractelement <2 x double> %arg1, i32 0
76; CHECK-P9BE-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %v2 = extractelement <2 x double> %arg1, i32 1
77; CHECK-P9BE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret void
78;
79; CHECK-P9LE-LABEL: 'test2xdouble'
80; CHECK-P9LE-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %v1 = extractelement <2 x double> %arg1, i32 0
81; CHECK-P9LE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %v2 = extractelement <2 x double> %arg1, i32 1
82; CHECK-P9LE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret void
83;
84; CHECK-P10-LABEL: 'test2xdouble'
85; CHECK-P10-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v1 = extractelement <2 x double> %arg1, i32 0
86; CHECK-P10-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %v2 = extractelement <2 x double> %arg1, i32 1
87; CHECK-P10-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret void
88;
89  %v1 = extractelement <2 x double> %arg1, i32 0
90  %v2 = extractelement <2 x double> %arg1, i32 1
91  ret void
92}
93
94define void @test4xi32(<4 x i32> %v1, i32 %x1) {
95; CHECK-P7-LABEL: 'test4xi32'
96; CHECK-P7-NEXT:  Cost Model: Found an estimated cost of 10 for instruction: %v2 = insertelement <4 x i32> %v1, i32 %x1, i32 2
97; CHECK-P7-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret void
98;
99; CHECK-P8LE-LABEL: 'test4xi32'
100; CHECK-P8LE-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %v2 = insertelement <4 x i32> %v1, i32 %x1, i32 2
101; CHECK-P8LE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret void
102;
103; CHECK-P9BE-LABEL: 'test4xi32'
104; CHECK-P9BE-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %v2 = insertelement <4 x i32> %v1, i32 %x1, i32 2
105; CHECK-P9BE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret void
106;
107; CHECK-P9LE-LABEL: 'test4xi32'
108; CHECK-P9LE-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %v2 = insertelement <4 x i32> %v1, i32 %x1, i32 2
109; CHECK-P9LE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret void
110;
111; CHECK-P10-LABEL: 'test4xi32'
112; CHECK-P10-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v2 = insertelement <4 x i32> %v1, i32 %x1, i32 2
113; CHECK-P10-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret void
114;
115  %v2 = insertelement <4 x i32> %v1, i32 %x1, i32 2
116  ret void
117}
118
119define void @vexti32(<4 x i32> %p1) {
120; CHECK-P7-LABEL: 'vexti32'
121; CHECK-P7-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %i1 = extractelement <4 x i32> %p1, i32 0
122; CHECK-P7-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %i2 = extractelement <4 x i32> %p1, i32 1
123; CHECK-P7-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %i3 = extractelement <4 x i32> %p1, i32 2
124; CHECK-P7-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %i4 = extractelement <4 x i32> %p1, i32 3
125; CHECK-P7-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret void
126;
127; CHECK-P8LE-LABEL: 'vexti32'
128; CHECK-P8LE-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %i1 = extractelement <4 x i32> %p1, i32 0
129; CHECK-P8LE-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %i2 = extractelement <4 x i32> %p1, i32 1
130; CHECK-P8LE-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %i3 = extractelement <4 x i32> %p1, i32 2
131; CHECK-P8LE-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %i4 = extractelement <4 x i32> %p1, i32 3
132; CHECK-P8LE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret void
133;
134; CHECK-P9BE-LABEL: 'vexti32'
135; CHECK-P9BE-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %i1 = extractelement <4 x i32> %p1, i32 0
136; CHECK-P9BE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %i2 = extractelement <4 x i32> %p1, i32 1
137; CHECK-P9BE-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %i3 = extractelement <4 x i32> %p1, i32 2
138; CHECK-P9BE-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %i4 = extractelement <4 x i32> %p1, i32 3
139; CHECK-P9BE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret void
140;
141; CHECK-P9LE-LABEL: 'vexti32'
142; CHECK-P9LE-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %i1 = extractelement <4 x i32> %p1, i32 0
143; CHECK-P9LE-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %i2 = extractelement <4 x i32> %p1, i32 1
144; CHECK-P9LE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %i3 = extractelement <4 x i32> %p1, i32 2
145; CHECK-P9LE-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %i4 = extractelement <4 x i32> %p1, i32 3
146; CHECK-P9LE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret void
147;
148; CHECK-P10-LABEL: 'vexti32'
149; CHECK-P10-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %i1 = extractelement <4 x i32> %p1, i32 0
150; CHECK-P10-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %i2 = extractelement <4 x i32> %p1, i32 1
151; CHECK-P10-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %i3 = extractelement <4 x i32> %p1, i32 2
152; CHECK-P10-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %i4 = extractelement <4 x i32> %p1, i32 3
153; CHECK-P10-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret void
154;
155  %i1 = extractelement <4 x i32> %p1, i32 0
156  %i2 = extractelement <4 x i32> %p1, i32 1
157  %i3 = extractelement <4 x i32> %p1, i32 2
158  %i4 = extractelement <4 x i32> %p1, i32 3
159  ret void
160}
161
162define void @vexti64(<2 x i64> %p1) {
163; CHECK-P7-LABEL: 'vexti64'
164; CHECK-P7-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %i1 = extractelement <2 x i64> %p1, i32 0
165; CHECK-P7-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %i2 = extractelement <2 x i64> %p1, i32 1
166; CHECK-P7-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret void
167;
168; CHECK-P8LE-LABEL: 'vexti64'
169; CHECK-P8LE-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %i1 = extractelement <2 x i64> %p1, i32 0
170; CHECK-P8LE-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %i2 = extractelement <2 x i64> %p1, i32 1
171; CHECK-P8LE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret void
172;
173; CHECK-P9BE-LABEL: 'vexti64'
174; CHECK-P9BE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %i1 = extractelement <2 x i64> %p1, i32 0
175; CHECK-P9BE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %i2 = extractelement <2 x i64> %p1, i32 1
176; CHECK-P9BE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret void
177;
178; CHECK-P9LE-LABEL: 'vexti64'
179; CHECK-P9LE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %i1 = extractelement <2 x i64> %p1, i32 0
180; CHECK-P9LE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %i2 = extractelement <2 x i64> %p1, i32 1
181; CHECK-P9LE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret void
182;
183; CHECK-P10-LABEL: 'vexti64'
184; CHECK-P10-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %i1 = extractelement <2 x i64> %p1, i32 0
185; CHECK-P10-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %i2 = extractelement <2 x i64> %p1, i32 1
186; CHECK-P10-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret void
187;
188  %i1 = extractelement <2 x i64> %p1, i32 0
189  %i2 = extractelement <2 x i64> %p1, i32 1
190  ret void
191}
192
193define void @vext(<8 x i16> %p1, <16 x i8> %p2) {
194; CHECK-P7-LABEL: 'vext'
195; CHECK-P7-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %i1 = extractelement <8 x i16> %p1, i32 0
196; CHECK-P7-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %i2 = extractelement <16 x i8> %p2, i32 0
197; CHECK-P7-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret void
198;
199; CHECK-P8LE-LABEL: 'vext'
200; CHECK-P8LE-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %i1 = extractelement <8 x i16> %p1, i32 0
201; CHECK-P8LE-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %i2 = extractelement <16 x i8> %p2, i32 0
202; CHECK-P8LE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret void
203;
204; CHECK-P9BE-LABEL: 'vext'
205; CHECK-P9BE-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %i1 = extractelement <8 x i16> %p1, i32 0
206; CHECK-P9BE-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %i2 = extractelement <16 x i8> %p2, i32 0
207; CHECK-P9BE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret void
208;
209; CHECK-P9LE-LABEL: 'vext'
210; CHECK-P9LE-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %i1 = extractelement <8 x i16> %p1, i32 0
211; CHECK-P9LE-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %i2 = extractelement <16 x i8> %p2, i32 0
212; CHECK-P9LE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret void
213;
214; CHECK-P10-LABEL: 'vext'
215; CHECK-P10-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %i1 = extractelement <8 x i16> %p1, i32 0
216; CHECK-P10-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %i2 = extractelement <16 x i8> %p2, i32 0
217; CHECK-P10-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret void
218;
219  %i1 = extractelement <8 x i16> %p1, i32 0
220  %i2 = extractelement <16 x i8> %p2, i32 0
221  ret void
222}
223
224define <2 x i64> @insert_i64_x(<2 x i64> %dest, i64 %arg, i32 %idx) {
225; CHECK-P7-LABEL: 'insert_i64_x'
226; CHECK-P7-NEXT:  Cost Model: Found an estimated cost of 10 for instruction: %x = insertelement <2 x i64> %dest, i64 %arg, i32 %idx
227; CHECK-P7-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <2 x i64> %x
228;
229; CHECK-P8LE-LABEL: 'insert_i64_x'
230; CHECK-P8LE-NEXT:  Cost Model: Found an estimated cost of 10 for instruction: %x = insertelement <2 x i64> %dest, i64 %arg, i32 %idx
231; CHECK-P8LE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <2 x i64> %x
232;
233; CHECK-P9BE-LABEL: 'insert_i64_x'
234; CHECK-P9BE-NEXT:  Cost Model: Found an estimated cost of 10 for instruction: %x = insertelement <2 x i64> %dest, i64 %arg, i32 %idx
235; CHECK-P9BE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <2 x i64> %x
236;
237; CHECK-P9LE-LABEL: 'insert_i64_x'
238; CHECK-P9LE-NEXT:  Cost Model: Found an estimated cost of 10 for instruction: %x = insertelement <2 x i64> %dest, i64 %arg, i32 %idx
239; CHECK-P9LE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <2 x i64> %x
240;
241; CHECK-P10-LABEL: 'insert_i64_x'
242; CHECK-P10-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %x = insertelement <2 x i64> %dest, i64 %arg, i32 %idx
243; CHECK-P10-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <2 x i64> %x
244;
245  %x = insertelement <2 x i64> %dest, i64 %arg, i32 %idx
246  ret <2 x i64> %x
247}
248
249define <4 x i32> @insert_i32_x(<4 x i32> %dest, i32 %arg, i32 %idx) {
250; CHECK-P7-LABEL: 'insert_i32_x'
251; CHECK-P7-NEXT:  Cost Model: Found an estimated cost of 10 for instruction: %x = insertelement <4 x i32> %dest, i32 %arg, i32 %idx
252; CHECK-P7-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <4 x i32> %x
253;
254; CHECK-P8LE-LABEL: 'insert_i32_x'
255; CHECK-P8LE-NEXT:  Cost Model: Found an estimated cost of 10 for instruction: %x = insertelement <4 x i32> %dest, i32 %arg, i32 %idx
256; CHECK-P8LE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <4 x i32> %x
257;
258; CHECK-P9BE-LABEL: 'insert_i32_x'
259; CHECK-P9BE-NEXT:  Cost Model: Found an estimated cost of 11 for instruction: %x = insertelement <4 x i32> %dest, i32 %arg, i32 %idx
260; CHECK-P9BE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <4 x i32> %x
261;
262; CHECK-P9LE-LABEL: 'insert_i32_x'
263; CHECK-P9LE-NEXT:  Cost Model: Found an estimated cost of 11 for instruction: %x = insertelement <4 x i32> %dest, i32 %arg, i32 %idx
264; CHECK-P9LE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <4 x i32> %x
265;
266; CHECK-P10-LABEL: 'insert_i32_x'
267; CHECK-P10-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %x = insertelement <4 x i32> %dest, i32 %arg, i32 %idx
268; CHECK-P10-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <4 x i32> %x
269;
270  %x = insertelement <4 x i32> %dest, i32 %arg, i32 %idx
271  ret <4 x i32> %x
272}
273
274define  <8 x i16> @insert_i16_x(<8 x i16> %dest, i16 %arg, i32 %idx) {
275; CHECK-P7-LABEL: 'insert_i16_x'
276; CHECK-P7-NEXT:  Cost Model: Found an estimated cost of 10 for instruction: %x = insertelement <8 x i16> %dest, i16 %arg, i32 %idx
277; CHECK-P7-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <8 x i16> %x
278;
279; CHECK-P8LE-LABEL: 'insert_i16_x'
280; CHECK-P8LE-NEXT:  Cost Model: Found an estimated cost of 10 for instruction: %x = insertelement <8 x i16> %dest, i16 %arg, i32 %idx
281; CHECK-P8LE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <8 x i16> %x
282;
283; CHECK-P9BE-LABEL: 'insert_i16_x'
284; CHECK-P9BE-NEXT:  Cost Model: Found an estimated cost of 11 for instruction: %x = insertelement <8 x i16> %dest, i16 %arg, i32 %idx
285; CHECK-P9BE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <8 x i16> %x
286;
287; CHECK-P9LE-LABEL: 'insert_i16_x'
288; CHECK-P9LE-NEXT:  Cost Model: Found an estimated cost of 11 for instruction: %x = insertelement <8 x i16> %dest, i16 %arg, i32 %idx
289; CHECK-P9LE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <8 x i16> %x
290;
291; CHECK-P10-LABEL: 'insert_i16_x'
292; CHECK-P10-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %x = insertelement <8 x i16> %dest, i16 %arg, i32 %idx
293; CHECK-P10-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <8 x i16> %x
294;
295  %x = insertelement <8 x i16> %dest, i16 %arg, i32 %idx
296  ret <8 x i16> %x
297}
298
299define  <16 x i8> @insert_i8_x(<16 x i8> %dest, i8 %arg, i32 %idx) {
300; CHECK-P7-LABEL: 'insert_i8_x'
301; CHECK-P7-NEXT:  Cost Model: Found an estimated cost of 10 for instruction: %x = insertelement <16 x i8> %dest, i8 %arg, i32 %idx
302; CHECK-P7-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <16 x i8> %x
303;
304; CHECK-P8LE-LABEL: 'insert_i8_x'
305; CHECK-P8LE-NEXT:  Cost Model: Found an estimated cost of 10 for instruction: %x = insertelement <16 x i8> %dest, i8 %arg, i32 %idx
306; CHECK-P8LE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <16 x i8> %x
307;
308; CHECK-P9BE-LABEL: 'insert_i8_x'
309; CHECK-P9BE-NEXT:  Cost Model: Found an estimated cost of 11 for instruction: %x = insertelement <16 x i8> %dest, i8 %arg, i32 %idx
310; CHECK-P9BE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <16 x i8> %x
311;
312; CHECK-P9LE-LABEL: 'insert_i8_x'
313; CHECK-P9LE-NEXT:  Cost Model: Found an estimated cost of 11 for instruction: %x = insertelement <16 x i8> %dest, i8 %arg, i32 %idx
314; CHECK-P9LE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <16 x i8> %x
315;
316; CHECK-P10-LABEL: 'insert_i8_x'
317; CHECK-P10-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %x = insertelement <16 x i8> %dest, i8 %arg, i32 %idx
318; CHECK-P10-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <16 x i8> %x
319;
320  %x = insertelement <16 x i8> %dest, i8 %arg, i32 %idx
321  ret <16 x i8> %x
322}
323
324define i64 @extract_i64_x(<2 x i64> %arg, i32 %idx) {
325; CHECK-P7-LABEL: 'extract_i64_x'
326; CHECK-P7-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %x = extractelement <2 x i64> %arg, i32 %idx
327; CHECK-P7-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i64 %x
328;
329; CHECK-P8LE-LABEL: 'extract_i64_x'
330; CHECK-P8LE-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %x = extractelement <2 x i64> %arg, i32 %idx
331; CHECK-P8LE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i64 %x
332;
333; CHECK-P9BE-LABEL: 'extract_i64_x'
334; CHECK-P9BE-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %x = extractelement <2 x i64> %arg, i32 %idx
335; CHECK-P9BE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i64 %x
336;
337; CHECK-P9LE-LABEL: 'extract_i64_x'
338; CHECK-P9LE-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %x = extractelement <2 x i64> %arg, i32 %idx
339; CHECK-P9LE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i64 %x
340;
341; CHECK-P10-LABEL: 'extract_i64_x'
342; CHECK-P10-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %x = extractelement <2 x i64> %arg, i32 %idx
343; CHECK-P10-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i64 %x
344;
345  %x = extractelement <2 x i64> %arg, i32 %idx
346  ret i64 %x
347}
348
349define i32 @extract_i32_x(<4 x i32> %arg, i32 %idx) {
350; CHECK-P7-LABEL: 'extract_i32_x'
351; CHECK-P7-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %x = extractelement <4 x i32> %arg, i32 %idx
352; CHECK-P7-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i32 %x
353;
354; CHECK-P8LE-LABEL: 'extract_i32_x'
355; CHECK-P8LE-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %x = extractelement <4 x i32> %arg, i32 %idx
356; CHECK-P8LE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i32 %x
357;
358; CHECK-P9BE-LABEL: 'extract_i32_x'
359; CHECK-P9BE-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %x = extractelement <4 x i32> %arg, i32 %idx
360; CHECK-P9BE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i32 %x
361;
362; CHECK-P9LE-LABEL: 'extract_i32_x'
363; CHECK-P9LE-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %x = extractelement <4 x i32> %arg, i32 %idx
364; CHECK-P9LE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i32 %x
365;
366; CHECK-P10-LABEL: 'extract_i32_x'
367; CHECK-P10-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %x = extractelement <4 x i32> %arg, i32 %idx
368; CHECK-P10-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i32 %x
369;
370  %x = extractelement <4 x i32> %arg, i32 %idx
371  ret i32 %x
372}
373
374define i16 @extract_i16_x(<8 x i16> %arg, i32 %idx) {
375; CHECK-P7-LABEL: 'extract_i16_x'
376; CHECK-P7-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %x = extractelement <8 x i16> %arg, i32 %idx
377; CHECK-P7-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i16 %x
378;
379; CHECK-P8LE-LABEL: 'extract_i16_x'
380; CHECK-P8LE-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %x = extractelement <8 x i16> %arg, i32 %idx
381; CHECK-P8LE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i16 %x
382;
383; CHECK-P9BE-LABEL: 'extract_i16_x'
384; CHECK-P9BE-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %x = extractelement <8 x i16> %arg, i32 %idx
385; CHECK-P9BE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i16 %x
386;
387; CHECK-P9LE-LABEL: 'extract_i16_x'
388; CHECK-P9LE-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %x = extractelement <8 x i16> %arg, i32 %idx
389; CHECK-P9LE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i16 %x
390;
391; CHECK-P10-LABEL: 'extract_i16_x'
392; CHECK-P10-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %x = extractelement <8 x i16> %arg, i32 %idx
393; CHECK-P10-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i16 %x
394;
395  %x = extractelement <8 x i16> %arg, i32 %idx
396  ret i16 %x
397}
398
399define i8 @extract_i8_x(<16 x i8> %arg, i32 %idx) {
400; CHECK-P7-LABEL: 'extract_i8_x'
401; CHECK-P7-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %x = extractelement <16 x i8> %arg, i32 %idx
402; CHECK-P7-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i8 %x
403;
404; CHECK-P8LE-LABEL: 'extract_i8_x'
405; CHECK-P8LE-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %x = extractelement <16 x i8> %arg, i32 %idx
406; CHECK-P8LE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i8 %x
407;
408; CHECK-P9BE-LABEL: 'extract_i8_x'
409; CHECK-P9BE-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %x = extractelement <16 x i8> %arg, i32 %idx
410; CHECK-P9BE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i8 %x
411;
412; CHECK-P9LE-LABEL: 'extract_i8_x'
413; CHECK-P9LE-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %x = extractelement <16 x i8> %arg, i32 %idx
414; CHECK-P9LE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i8 %x
415;
416; CHECK-P10-LABEL: 'extract_i8_x'
417; CHECK-P10-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %x = extractelement <16 x i8> %arg, i32 %idx
418; CHECK-P10-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i8 %x
419;
420  %x = extractelement <16 x i8> %arg, i32 %idx
421  ret i8 %x
422}
423