xref: /llvm-project/llvm/test/Analysis/CostModel/AMDGPU/insertelement.ll (revision 4178e33470763b406f614b646c8b01d24309e20b)
1; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py
2; RUN: opt -passes="print<cost-model>" 2>&1 -disable-output -mtriple=amdgcn-unknown-amdhsa %s | FileCheck -check-prefixes=ALL,CI %s
3; RUN: opt -passes="print<cost-model>" 2>&1 -disable-output -mtriple=amdgcn-unknown-amdhsa -mcpu=fiji %s | FileCheck -check-prefixes=ALL,GFX89 %s
4; RUN: opt -passes="print<cost-model>" 2>&1 -disable-output -mtriple=amdgcn-unknown-amdhsa -mcpu=gfx900 %s | FileCheck -check-prefixes=ALL,GFX89 %s
5; RUN: opt -passes="print<cost-model>" -cost-kind=code-size 2>&1 -disable-output -mtriple=amdgcn-unknown-amdhsa %s | FileCheck -check-prefixes=ALL-SIZE,CI-SIZE %s
6; RUN: opt -passes="print<cost-model>" -cost-kind=code-size 2>&1 -disable-output -mtriple=amdgcn-unknown-amdhsa -mcpu=fiji %s | FileCheck -check-prefixes=ALL-SIZE,GFX89-SIZE %s
7; RUN: opt -passes="print<cost-model>" -cost-kind=code-size 2>&1 -disable-output -mtriple=amdgcn-unknown-amdhsa -mcpu=gfx900 %s | FileCheck -check-prefixes=ALL-SIZE,GFX89-SIZE %s
8; END.
9
10define amdgpu_kernel void @insertelement_i8(i32 %arg) {
11; ALL-LABEL: 'insertelement_i8'
12; ALL-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v2i8_0 = insertelement <2 x i8> undef, i8 42, i32 0
13; ALL-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v3i8_0 = insertelement <3 x i8> undef, i8 42, i32 0
14; ALL-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v4i8_0 = insertelement <4 x i8> undef, i8 42, i32 0
15; ALL-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v5i8_0 = insertelement <5 x i8> undef, i8 42, i32 0
16; ALL-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v2i8_1 = insertelement <2 x i8> undef, i8 42, i32 1
17; ALL-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v3i8_1 = insertelement <3 x i8> undef, i8 42, i32 1
18; ALL-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v4i8_1 = insertelement <4 x i8> undef, i8 42, i32 1
19; ALL-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v5i8_1 = insertelement <5 x i8> undef, i8 42, i32 1
20; ALL-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v2i8_a = insertelement <2 x i8> undef, i8 42, i32 %arg
21; ALL-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v3i8_a = insertelement <3 x i8> undef, i8 42, i32 %arg
22; ALL-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v4i8_a = insertelement <4 x i8> undef, i8 42, i32 %arg
23; ALL-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v5i8_a = insertelement <5 x i8> undef, i8 42, i32 %arg
24; ALL-NEXT:  Cost Model: Found an estimated cost of 10 for instruction: ret void
25;
26; ALL-SIZE-LABEL: 'insertelement_i8'
27; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v2i8_0 = insertelement <2 x i8> undef, i8 42, i32 0
28; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v3i8_0 = insertelement <3 x i8> undef, i8 42, i32 0
29; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v4i8_0 = insertelement <4 x i8> undef, i8 42, i32 0
30; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v5i8_0 = insertelement <5 x i8> undef, i8 42, i32 0
31; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v2i8_1 = insertelement <2 x i8> undef, i8 42, i32 1
32; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v3i8_1 = insertelement <3 x i8> undef, i8 42, i32 1
33; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v4i8_1 = insertelement <4 x i8> undef, i8 42, i32 1
34; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v5i8_1 = insertelement <5 x i8> undef, i8 42, i32 1
35; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v2i8_a = insertelement <2 x i8> undef, i8 42, i32 %arg
36; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v3i8_a = insertelement <3 x i8> undef, i8 42, i32 %arg
37; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v4i8_a = insertelement <4 x i8> undef, i8 42, i32 %arg
38; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v5i8_a = insertelement <5 x i8> undef, i8 42, i32 %arg
39; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret void
40;
41  %v2i8_0 = insertelement <2 x i8> undef, i8 42, i32 0
42  %v3i8_0 = insertelement <3 x i8> undef, i8 42, i32 0
43  %v4i8_0 = insertelement <4 x i8> undef, i8 42, i32 0
44  %v5i8_0 = insertelement <5 x i8> undef, i8 42, i32 0
45  %v2i8_1 = insertelement <2 x i8> undef, i8 42, i32 1
46  %v3i8_1 = insertelement <3 x i8> undef, i8 42, i32 1
47  %v4i8_1 = insertelement <4 x i8> undef, i8 42, i32 1
48  %v5i8_1 = insertelement <5 x i8> undef, i8 42, i32 1
49  %v2i8_a = insertelement <2 x i8> undef, i8 42, i32 %arg
50  %v3i8_a = insertelement <3 x i8> undef, i8 42, i32 %arg
51  %v4i8_a = insertelement <4 x i8> undef, i8 42, i32 %arg
52  %v5i8_a = insertelement <5 x i8> undef, i8 42, i32 %arg
53  ret void
54}
55
56define amdgpu_kernel void @insertelement_i16(i32 %arg) {
57; CI-LABEL: 'insertelement_i16'
58; CI-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v2i16_0 = insertelement <2 x i16> undef, i16 42, i32 0
59; CI-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v3i16_0 = insertelement <3 x i16> undef, i16 42, i32 0
60; CI-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v4i16_0 = insertelement <4 x i16> undef, i16 42, i32 0
61; CI-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v5i16_0 = insertelement <5 x i16> undef, i16 42, i32 0
62; CI-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v2i16_1 = insertelement <2 x i16> undef, i16 42, i32 1
63; CI-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v3i16_1 = insertelement <3 x i16> undef, i16 42, i32 1
64; CI-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v4i16_1 = insertelement <4 x i16> undef, i16 42, i32 1
65; CI-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v5i16_1 = insertelement <5 x i16> undef, i16 42, i32 1
66; CI-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v2i16_a = insertelement <2 x i16> undef, i16 42, i32 %arg
67; CI-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v3i16_a = insertelement <3 x i16> undef, i16 42, i32 %arg
68; CI-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v4i16_a = insertelement <4 x i16> undef, i16 42, i32 %arg
69; CI-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v5i16_a = insertelement <5 x i16> undef, i16 42, i32 %arg
70; CI-NEXT:  Cost Model: Found an estimated cost of 10 for instruction: ret void
71;
72; GFX89-LABEL: 'insertelement_i16'
73; GFX89-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %v2i16_0 = insertelement <2 x i16> undef, i16 42, i32 0
74; GFX89-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %v3i16_0 = insertelement <3 x i16> undef, i16 42, i32 0
75; GFX89-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %v4i16_0 = insertelement <4 x i16> undef, i16 42, i32 0
76; GFX89-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %v5i16_0 = insertelement <5 x i16> undef, i16 42, i32 0
77; GFX89-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v2i16_1 = insertelement <2 x i16> undef, i16 42, i32 1
78; GFX89-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v3i16_1 = insertelement <3 x i16> undef, i16 42, i32 1
79; GFX89-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v4i16_1 = insertelement <4 x i16> undef, i16 42, i32 1
80; GFX89-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v5i16_1 = insertelement <5 x i16> undef, i16 42, i32 1
81; GFX89-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v2i16_a = insertelement <2 x i16> undef, i16 42, i32 %arg
82; GFX89-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v3i16_a = insertelement <3 x i16> undef, i16 42, i32 %arg
83; GFX89-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v4i16_a = insertelement <4 x i16> undef, i16 42, i32 %arg
84; GFX89-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v5i16_a = insertelement <5 x i16> undef, i16 42, i32 %arg
85; GFX89-NEXT:  Cost Model: Found an estimated cost of 10 for instruction: ret void
86;
87; CI-SIZE-LABEL: 'insertelement_i16'
88; CI-SIZE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v2i16_0 = insertelement <2 x i16> undef, i16 42, i32 0
89; CI-SIZE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v3i16_0 = insertelement <3 x i16> undef, i16 42, i32 0
90; CI-SIZE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v4i16_0 = insertelement <4 x i16> undef, i16 42, i32 0
91; CI-SIZE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v5i16_0 = insertelement <5 x i16> undef, i16 42, i32 0
92; CI-SIZE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v2i16_1 = insertelement <2 x i16> undef, i16 42, i32 1
93; CI-SIZE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v3i16_1 = insertelement <3 x i16> undef, i16 42, i32 1
94; CI-SIZE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v4i16_1 = insertelement <4 x i16> undef, i16 42, i32 1
95; CI-SIZE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v5i16_1 = insertelement <5 x i16> undef, i16 42, i32 1
96; CI-SIZE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v2i16_a = insertelement <2 x i16> undef, i16 42, i32 %arg
97; CI-SIZE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v3i16_a = insertelement <3 x i16> undef, i16 42, i32 %arg
98; CI-SIZE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v4i16_a = insertelement <4 x i16> undef, i16 42, i32 %arg
99; CI-SIZE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v5i16_a = insertelement <5 x i16> undef, i16 42, i32 %arg
100; CI-SIZE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret void
101;
102; GFX89-SIZE-LABEL: 'insertelement_i16'
103; GFX89-SIZE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %v2i16_0 = insertelement <2 x i16> undef, i16 42, i32 0
104; GFX89-SIZE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %v3i16_0 = insertelement <3 x i16> undef, i16 42, i32 0
105; GFX89-SIZE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %v4i16_0 = insertelement <4 x i16> undef, i16 42, i32 0
106; GFX89-SIZE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %v5i16_0 = insertelement <5 x i16> undef, i16 42, i32 0
107; GFX89-SIZE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v2i16_1 = insertelement <2 x i16> undef, i16 42, i32 1
108; GFX89-SIZE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v3i16_1 = insertelement <3 x i16> undef, i16 42, i32 1
109; GFX89-SIZE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v4i16_1 = insertelement <4 x i16> undef, i16 42, i32 1
110; GFX89-SIZE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v5i16_1 = insertelement <5 x i16> undef, i16 42, i32 1
111; GFX89-SIZE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v2i16_a = insertelement <2 x i16> undef, i16 42, i32 %arg
112; GFX89-SIZE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v3i16_a = insertelement <3 x i16> undef, i16 42, i32 %arg
113; GFX89-SIZE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v4i16_a = insertelement <4 x i16> undef, i16 42, i32 %arg
114; GFX89-SIZE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v5i16_a = insertelement <5 x i16> undef, i16 42, i32 %arg
115; GFX89-SIZE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret void
116;
117  %v2i16_0 = insertelement <2 x i16> undef, i16 42, i32 0
118  %v3i16_0 = insertelement <3 x i16> undef, i16 42, i32 0
119  %v4i16_0 = insertelement <4 x i16> undef, i16 42, i32 0
120  %v5i16_0 = insertelement <5 x i16> undef, i16 42, i32 0
121  %v2i16_1 = insertelement <2 x i16> undef, i16 42, i32 1
122  %v3i16_1 = insertelement <3 x i16> undef, i16 42, i32 1
123  %v4i16_1 = insertelement <4 x i16> undef, i16 42, i32 1
124  %v5i16_1 = insertelement <5 x i16> undef, i16 42, i32 1
125  %v2i16_a = insertelement <2 x i16> undef, i16 42, i32 %arg
126  %v3i16_a = insertelement <3 x i16> undef, i16 42, i32 %arg
127  %v4i16_a = insertelement <4 x i16> undef, i16 42, i32 %arg
128  %v5i16_a = insertelement <5 x i16> undef, i16 42, i32 %arg
129  ret void
130}
131
132define amdgpu_kernel void @insertelement_i32(i32 %arg) {
133; ALL-LABEL: 'insertelement_i32'
134; ALL-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %v2i32_0 = insertelement <2 x i32> undef, i32 42, i32 0
135; ALL-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %v3i32_0 = insertelement <3 x i32> undef, i32 42, i32 0
136; ALL-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %v4i32_0 = insertelement <4 x i32> undef, i32 42, i32 0
137; ALL-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %v5i32_0 = insertelement <5 x i32> undef, i32 42, i32 0
138; ALL-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %v2i32_1 = insertelement <2 x i32> undef, i32 42, i32 1
139; ALL-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %v3i32_1 = insertelement <3 x i32> undef, i32 42, i32 1
140; ALL-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %v4i32_1 = insertelement <4 x i32> undef, i32 42, i32 1
141; ALL-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %v5i32_1 = insertelement <5 x i32> undef, i32 42, i32 1
142; ALL-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %v2i32_a = insertelement <2 x i32> undef, i32 42, i32 %arg
143; ALL-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %v3i32_a = insertelement <3 x i32> undef, i32 42, i32 %arg
144; ALL-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %v4i32_a = insertelement <4 x i32> undef, i32 42, i32 %arg
145; ALL-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %v5i32_a = insertelement <5 x i32> undef, i32 42, i32 %arg
146; ALL-NEXT:  Cost Model: Found an estimated cost of 10 for instruction: ret void
147;
148; ALL-SIZE-LABEL: 'insertelement_i32'
149; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %v2i32_0 = insertelement <2 x i32> undef, i32 42, i32 0
150; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %v3i32_0 = insertelement <3 x i32> undef, i32 42, i32 0
151; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %v4i32_0 = insertelement <4 x i32> undef, i32 42, i32 0
152; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %v5i32_0 = insertelement <5 x i32> undef, i32 42, i32 0
153; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %v2i32_1 = insertelement <2 x i32> undef, i32 42, i32 1
154; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %v3i32_1 = insertelement <3 x i32> undef, i32 42, i32 1
155; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %v4i32_1 = insertelement <4 x i32> undef, i32 42, i32 1
156; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %v5i32_1 = insertelement <5 x i32> undef, i32 42, i32 1
157; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %v2i32_a = insertelement <2 x i32> undef, i32 42, i32 %arg
158; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %v3i32_a = insertelement <3 x i32> undef, i32 42, i32 %arg
159; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %v4i32_a = insertelement <4 x i32> undef, i32 42, i32 %arg
160; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %v5i32_a = insertelement <5 x i32> undef, i32 42, i32 %arg
161; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret void
162;
163  %v2i32_0 = insertelement <2 x i32> undef, i32 42, i32 0
164  %v3i32_0 = insertelement <3 x i32> undef, i32 42, i32 0
165  %v4i32_0 = insertelement <4 x i32> undef, i32 42, i32 0
166  %v5i32_0 = insertelement <5 x i32> undef, i32 42, i32 0
167  %v2i32_1 = insertelement <2 x i32> undef, i32 42, i32 1
168  %v3i32_1 = insertelement <3 x i32> undef, i32 42, i32 1
169  %v4i32_1 = insertelement <4 x i32> undef, i32 42, i32 1
170  %v5i32_1 = insertelement <5 x i32> undef, i32 42, i32 1
171  %v2i32_a = insertelement <2 x i32> undef, i32 42, i32 %arg
172  %v3i32_a = insertelement <3 x i32> undef, i32 42, i32 %arg
173  %v4i32_a = insertelement <4 x i32> undef, i32 42, i32 %arg
174  %v5i32_a = insertelement <5 x i32> undef, i32 42, i32 %arg
175  ret void
176}
177
178define amdgpu_kernel void @insertelement_i64(i32 %arg) {
179; ALL-LABEL: 'insertelement_i64'
180; ALL-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %v2i64_0 = insertelement <2 x i64> undef, i64 42, i32 0
181; ALL-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %v3i64_0 = insertelement <3 x i64> undef, i64 42, i32 0
182; ALL-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %v4i64_0 = insertelement <4 x i64> undef, i64 42, i32 0
183; ALL-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %v5i64_0 = insertelement <5 x i64> undef, i64 42, i32 0
184; ALL-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %v2i64_1 = insertelement <2 x i64> undef, i64 42, i32 1
185; ALL-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %v3i64_1 = insertelement <3 x i64> undef, i64 42, i32 1
186; ALL-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %v4i64_1 = insertelement <4 x i64> undef, i64 42, i32 1
187; ALL-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %v5i64_1 = insertelement <5 x i64> undef, i64 42, i32 1
188; ALL-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %v2i64_a = insertelement <2 x i64> undef, i64 42, i32 %arg
189; ALL-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %v3i64_a = insertelement <3 x i64> undef, i64 42, i32 %arg
190; ALL-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %v4i64_a = insertelement <4 x i64> undef, i64 42, i32 %arg
191; ALL-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %v5i64_a = insertelement <5 x i64> undef, i64 42, i32 %arg
192; ALL-NEXT:  Cost Model: Found an estimated cost of 10 for instruction: ret void
193;
194; ALL-SIZE-LABEL: 'insertelement_i64'
195; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %v2i64_0 = insertelement <2 x i64> undef, i64 42, i32 0
196; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %v3i64_0 = insertelement <3 x i64> undef, i64 42, i32 0
197; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %v4i64_0 = insertelement <4 x i64> undef, i64 42, i32 0
198; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %v5i64_0 = insertelement <5 x i64> undef, i64 42, i32 0
199; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %v2i64_1 = insertelement <2 x i64> undef, i64 42, i32 1
200; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %v3i64_1 = insertelement <3 x i64> undef, i64 42, i32 1
201; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %v4i64_1 = insertelement <4 x i64> undef, i64 42, i32 1
202; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %v5i64_1 = insertelement <5 x i64> undef, i64 42, i32 1
203; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %v2i64_a = insertelement <2 x i64> undef, i64 42, i32 %arg
204; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %v3i64_a = insertelement <3 x i64> undef, i64 42, i32 %arg
205; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %v4i64_a = insertelement <4 x i64> undef, i64 42, i32 %arg
206; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %v5i64_a = insertelement <5 x i64> undef, i64 42, i32 %arg
207; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret void
208;
209  %v2i64_0 = insertelement <2 x i64> undef, i64 42, i32 0
210  %v3i64_0 = insertelement <3 x i64> undef, i64 42, i32 0
211  %v4i64_0 = insertelement <4 x i64> undef, i64 42, i32 0
212  %v5i64_0 = insertelement <5 x i64> undef, i64 42, i32 0
213  %v2i64_1 = insertelement <2 x i64> undef, i64 42, i32 1
214  %v3i64_1 = insertelement <3 x i64> undef, i64 42, i32 1
215  %v4i64_1 = insertelement <4 x i64> undef, i64 42, i32 1
216  %v5i64_1 = insertelement <5 x i64> undef, i64 42, i32 1
217  %v2i64_a = insertelement <2 x i64> undef, i64 42, i32 %arg
218  %v3i64_a = insertelement <3 x i64> undef, i64 42, i32 %arg
219  %v4i64_a = insertelement <4 x i64> undef, i64 42, i32 %arg
220  %v5i64_a = insertelement <5 x i64> undef, i64 42, i32 %arg
221  ret void
222}
223
224define i32 @insert_double_poison(i32 %arg) {
225; ALL-LABEL: 'insert_double_poison'
226; ALL-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %v2f64_a = insertelement <2 x double> poison, double undef, i32 %arg
227; ALL-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %v2f64_0 = insertelement <2 x double> poison, double undef, i32 0
228; ALL-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %v2f64_1 = insertelement <2 x double> poison, double undef, i32 1
229; ALL-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %v4f64_a = insertelement <4 x double> poison, double undef, i32 %arg
230; ALL-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %v4f64_0 = insertelement <4 x double> poison, double undef, i32 0
231; ALL-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %v4f64_3 = insertelement <4 x double> poison, double undef, i32 3
232; ALL-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %v8f64_a = insertelement <8 x double> poison, double undef, i32 %arg
233; ALL-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %v8f64_0 = insertelement <8 x double> poison, double undef, i32 0
234; ALL-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %v8f64_3 = insertelement <8 x double> poison, double undef, i32 3
235; ALL-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %v8f64_4 = insertelement <8 x double> poison, double undef, i32 4
236; ALL-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %v8f64_7 = insertelement <8 x double> poison, double undef, i32 7
237; ALL-NEXT:  Cost Model: Found an estimated cost of 10 for instruction: ret i32 undef
238;
239; ALL-SIZE-LABEL: 'insert_double_poison'
240; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %v2f64_a = insertelement <2 x double> poison, double undef, i32 %arg
241; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %v2f64_0 = insertelement <2 x double> poison, double undef, i32 0
242; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %v2f64_1 = insertelement <2 x double> poison, double undef, i32 1
243; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %v4f64_a = insertelement <4 x double> poison, double undef, i32 %arg
244; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %v4f64_0 = insertelement <4 x double> poison, double undef, i32 0
245; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %v4f64_3 = insertelement <4 x double> poison, double undef, i32 3
246; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %v8f64_a = insertelement <8 x double> poison, double undef, i32 %arg
247; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %v8f64_0 = insertelement <8 x double> poison, double undef, i32 0
248; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %v8f64_3 = insertelement <8 x double> poison, double undef, i32 3
249; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %v8f64_4 = insertelement <8 x double> poison, double undef, i32 4
250; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %v8f64_7 = insertelement <8 x double> poison, double undef, i32 7
251; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret i32 undef
252;
253  %v2f64_a = insertelement <2 x double> poison, double undef, i32 %arg
254  %v2f64_0 = insertelement <2 x double> poison, double undef, i32 0
255  %v2f64_1 = insertelement <2 x double> poison, double undef, i32 1
256
257  %v4f64_a = insertelement <4 x double> poison, double undef, i32 %arg
258  %v4f64_0 = insertelement <4 x double> poison, double undef, i32 0
259  %v4f64_3 = insertelement <4 x double> poison, double undef, i32 3
260
261  %v8f64_a = insertelement <8 x double> poison, double undef, i32 %arg
262  %v8f64_0 = insertelement <8 x double> poison, double undef, i32 0
263  %v8f64_3 = insertelement <8 x double> poison, double undef, i32 3
264  %v8f64_4 = insertelement <8 x double> poison, double undef, i32 4
265  %v8f64_7 = insertelement <8 x double> poison, double undef, i32 7
266
267  ret i32 undef
268}
269
270define i32 @insert_float_poison(i32 %arg) {
271; ALL-LABEL: 'insert_float_poison'
272; ALL-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %v2f32_a = insertelement <2 x float> poison, float undef, i32 %arg
273; ALL-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %v2f32_0 = insertelement <2 x float> poison, float undef, i32 0
274; ALL-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %v2f32_1 = insertelement <2 x float> poison, float undef, i32 1
275; ALL-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %v4f32_a = insertelement <4 x float> poison, float undef, i32 %arg
276; ALL-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %v4f32_0 = insertelement <4 x float> poison, float undef, i32 0
277; ALL-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %v4f32_3 = insertelement <4 x float> poison, float undef, i32 3
278; ALL-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %v8f32_a = insertelement <8 x float> poison, float undef, i32 %arg
279; ALL-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %v8f32_0 = insertelement <8 x float> poison, float undef, i32 0
280; ALL-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %v8f32_3 = insertelement <8 x float> poison, float undef, i32 3
281; ALL-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %v8f32_4 = insertelement <8 x float> poison, float undef, i32 4
282; ALL-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %v8f32_7 = insertelement <8 x float> poison, float undef, i32 7
283; ALL-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %v16f32_a = insertelement <16 x float> poison, float undef, i32 %arg
284; ALL-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %v16f32_0 = insertelement <16 x float> poison, float undef, i32 0
285; ALL-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %v16f32_3 = insertelement <16 x float> poison, float undef, i32 3
286; ALL-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %v16f32_8 = insertelement <16 x float> poison, float undef, i32 8
287; ALL-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %v16f32_15 = insertelement <16 x float> poison, float undef, i32 15
288; ALL-NEXT:  Cost Model: Found an estimated cost of 10 for instruction: ret i32 undef
289;
290; ALL-SIZE-LABEL: 'insert_float_poison'
291; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %v2f32_a = insertelement <2 x float> poison, float undef, i32 %arg
292; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %v2f32_0 = insertelement <2 x float> poison, float undef, i32 0
293; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %v2f32_1 = insertelement <2 x float> poison, float undef, i32 1
294; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %v4f32_a = insertelement <4 x float> poison, float undef, i32 %arg
295; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %v4f32_0 = insertelement <4 x float> poison, float undef, i32 0
296; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %v4f32_3 = insertelement <4 x float> poison, float undef, i32 3
297; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %v8f32_a = insertelement <8 x float> poison, float undef, i32 %arg
298; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %v8f32_0 = insertelement <8 x float> poison, float undef, i32 0
299; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %v8f32_3 = insertelement <8 x float> poison, float undef, i32 3
300; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %v8f32_4 = insertelement <8 x float> poison, float undef, i32 4
301; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %v8f32_7 = insertelement <8 x float> poison, float undef, i32 7
302; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %v16f32_a = insertelement <16 x float> poison, float undef, i32 %arg
303; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %v16f32_0 = insertelement <16 x float> poison, float undef, i32 0
304; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %v16f32_3 = insertelement <16 x float> poison, float undef, i32 3
305; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %v16f32_8 = insertelement <16 x float> poison, float undef, i32 8
306; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %v16f32_15 = insertelement <16 x float> poison, float undef, i32 15
307; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret i32 undef
308;
309  %v2f32_a = insertelement <2 x float> poison, float undef, i32 %arg
310  %v2f32_0 = insertelement <2 x float> poison, float undef, i32 0
311  %v2f32_1 = insertelement <2 x float> poison, float undef, i32 1
312
313  %v4f32_a = insertelement <4 x float> poison, float undef, i32 %arg
314  %v4f32_0 = insertelement <4 x float> poison, float undef, i32 0
315  %v4f32_3 = insertelement <4 x float> poison, float undef, i32 3
316
317  %v8f32_a = insertelement <8 x float> poison, float undef, i32 %arg
318  %v8f32_0 = insertelement <8 x float> poison, float undef, i32 0
319  %v8f32_3 = insertelement <8 x float> poison, float undef, i32 3
320  %v8f32_4 = insertelement <8 x float> poison, float undef, i32 4
321  %v8f32_7 = insertelement <8 x float> poison, float undef, i32 7
322
323  %v16f32_a  = insertelement <16 x float> poison, float undef, i32 %arg
324  %v16f32_0  = insertelement <16 x float> poison, float undef, i32 0
325  %v16f32_3  = insertelement <16 x float> poison, float undef, i32 3
326  %v16f32_8  = insertelement <16 x float> poison, float undef, i32 8
327  %v16f32_15 = insertelement <16 x float> poison, float undef, i32 15
328
329  ret i32 undef
330}
331
332define i32 @insert_i64_poison(i32 %arg) {
333; ALL-LABEL: 'insert_i64_poison'
334; ALL-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %v2i64_a = insertelement <2 x i64> poison, i64 undef, i32 %arg
335; ALL-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %v2i64_0 = insertelement <2 x i64> poison, i64 undef, i32 0
336; ALL-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %v2i64_1 = insertelement <2 x i64> poison, i64 undef, i32 1
337; ALL-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %v4i64_a = insertelement <4 x i64> poison, i64 undef, i32 %arg
338; ALL-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %v4i64_0 = insertelement <4 x i64> poison, i64 undef, i32 0
339; ALL-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %v4i64_3 = insertelement <4 x i64> poison, i64 undef, i32 3
340; ALL-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %v8i64_a = insertelement <8 x i64> poison, i64 undef, i32 %arg
341; ALL-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %v8i64_0 = insertelement <8 x i64> poison, i64 undef, i32 0
342; ALL-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %v8i64_3 = insertelement <8 x i64> poison, i64 undef, i32 3
343; ALL-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %v8i64_4 = insertelement <8 x i64> poison, i64 undef, i32 4
344; ALL-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %v8i64_7 = insertelement <8 x i64> poison, i64 undef, i32 7
345; ALL-NEXT:  Cost Model: Found an estimated cost of 10 for instruction: ret i32 undef
346;
347; ALL-SIZE-LABEL: 'insert_i64_poison'
348; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %v2i64_a = insertelement <2 x i64> poison, i64 undef, i32 %arg
349; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %v2i64_0 = insertelement <2 x i64> poison, i64 undef, i32 0
350; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %v2i64_1 = insertelement <2 x i64> poison, i64 undef, i32 1
351; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %v4i64_a = insertelement <4 x i64> poison, i64 undef, i32 %arg
352; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %v4i64_0 = insertelement <4 x i64> poison, i64 undef, i32 0
353; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %v4i64_3 = insertelement <4 x i64> poison, i64 undef, i32 3
354; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %v8i64_a = insertelement <8 x i64> poison, i64 undef, i32 %arg
355; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %v8i64_0 = insertelement <8 x i64> poison, i64 undef, i32 0
356; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %v8i64_3 = insertelement <8 x i64> poison, i64 undef, i32 3
357; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %v8i64_4 = insertelement <8 x i64> poison, i64 undef, i32 4
358; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %v8i64_7 = insertelement <8 x i64> poison, i64 undef, i32 7
359; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret i32 undef
360;
361  %v2i64_a = insertelement <2 x i64> poison, i64 undef, i32 %arg
362  %v2i64_0 = insertelement <2 x i64> poison, i64 undef, i32 0
363  %v2i64_1 = insertelement <2 x i64> poison, i64 undef, i32 1
364
365  %v4i64_a = insertelement <4 x i64> poison, i64 undef, i32 %arg
366  %v4i64_0 = insertelement <4 x i64> poison, i64 undef, i32 0
367  %v4i64_3 = insertelement <4 x i64> poison, i64 undef, i32 3
368
369  %v8i64_a = insertelement <8 x i64> poison, i64 undef, i32 %arg
370  %v8i64_0 = insertelement <8 x i64> poison, i64 undef, i32 0
371  %v8i64_3 = insertelement <8 x i64> poison, i64 undef, i32 3
372  %v8i64_4 = insertelement <8 x i64> poison, i64 undef, i32 4
373  %v8i64_7 = insertelement <8 x i64> poison, i64 undef, i32 7
374
375  ret i32 undef
376}
377
378define i32 @insert_i32_poison(i32 %arg) {
379; ALL-LABEL: 'insert_i32_poison'
380; ALL-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %v2i32_a = insertelement <2 x i32> poison, i32 undef, i32 %arg
381; ALL-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %v2i32_0 = insertelement <2 x i32> poison, i32 undef, i32 0
382; ALL-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %v2i32_1 = insertelement <2 x i32> poison, i32 undef, i32 1
383; ALL-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %v4i32_a = insertelement <4 x i32> poison, i32 undef, i32 %arg
384; ALL-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %v4i32_0 = insertelement <4 x i32> poison, i32 undef, i32 0
385; ALL-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %v4i32_3 = insertelement <4 x i32> poison, i32 undef, i32 3
386; ALL-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %v8i32_a = insertelement <8 x i32> poison, i32 undef, i32 %arg
387; ALL-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %v8i32_0 = insertelement <8 x i32> poison, i32 undef, i32 0
388; ALL-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %v8i32_3 = insertelement <8 x i32> poison, i32 undef, i32 3
389; ALL-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %v8i32_4 = insertelement <8 x i32> poison, i32 undef, i32 4
390; ALL-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %v8i32_7 = insertelement <8 x i32> poison, i32 undef, i32 7
391; ALL-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %v16i32_a = insertelement <16 x i32> poison, i32 undef, i32 %arg
392; ALL-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %v16i32_0 = insertelement <16 x i32> poison, i32 undef, i32 0
393; ALL-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %v16i32_3 = insertelement <16 x i32> poison, i32 undef, i32 3
394; ALL-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %v16i32_8 = insertelement <16 x i32> poison, i32 undef, i32 8
395; ALL-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %v16i32_15 = insertelement <16 x i32> poison, i32 undef, i32 15
396; ALL-NEXT:  Cost Model: Found an estimated cost of 10 for instruction: ret i32 undef
397;
398; ALL-SIZE-LABEL: 'insert_i32_poison'
399; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %v2i32_a = insertelement <2 x i32> poison, i32 undef, i32 %arg
400; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %v2i32_0 = insertelement <2 x i32> poison, i32 undef, i32 0
401; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %v2i32_1 = insertelement <2 x i32> poison, i32 undef, i32 1
402; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %v4i32_a = insertelement <4 x i32> poison, i32 undef, i32 %arg
403; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %v4i32_0 = insertelement <4 x i32> poison, i32 undef, i32 0
404; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %v4i32_3 = insertelement <4 x i32> poison, i32 undef, i32 3
405; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %v8i32_a = insertelement <8 x i32> poison, i32 undef, i32 %arg
406; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %v8i32_0 = insertelement <8 x i32> poison, i32 undef, i32 0
407; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %v8i32_3 = insertelement <8 x i32> poison, i32 undef, i32 3
408; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %v8i32_4 = insertelement <8 x i32> poison, i32 undef, i32 4
409; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %v8i32_7 = insertelement <8 x i32> poison, i32 undef, i32 7
410; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %v16i32_a = insertelement <16 x i32> poison, i32 undef, i32 %arg
411; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %v16i32_0 = insertelement <16 x i32> poison, i32 undef, i32 0
412; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %v16i32_3 = insertelement <16 x i32> poison, i32 undef, i32 3
413; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %v16i32_8 = insertelement <16 x i32> poison, i32 undef, i32 8
414; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %v16i32_15 = insertelement <16 x i32> poison, i32 undef, i32 15
415; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret i32 undef
416;
417  %v2i32_a = insertelement <2 x i32> poison, i32 undef, i32 %arg
418  %v2i32_0 = insertelement <2 x i32> poison, i32 undef, i32 0
419  %v2i32_1 = insertelement <2 x i32> poison, i32 undef, i32 1
420
421  %v4i32_a = insertelement <4 x i32> poison, i32 undef, i32 %arg
422  %v4i32_0 = insertelement <4 x i32> poison, i32 undef, i32 0
423  %v4i32_3 = insertelement <4 x i32> poison, i32 undef, i32 3
424
425  %v8i32_a = insertelement <8 x i32> poison, i32 undef, i32 %arg
426  %v8i32_0 = insertelement <8 x i32> poison, i32 undef, i32 0
427  %v8i32_3 = insertelement <8 x i32> poison, i32 undef, i32 3
428  %v8i32_4 = insertelement <8 x i32> poison, i32 undef, i32 4
429  %v8i32_7 = insertelement <8 x i32> poison, i32 undef, i32 7
430
431  %v16i32_a  = insertelement <16 x i32> poison, i32 undef, i32 %arg
432  %v16i32_0  = insertelement <16 x i32> poison, i32 undef, i32 0
433  %v16i32_3  = insertelement <16 x i32> poison, i32 undef, i32 3
434  %v16i32_8  = insertelement <16 x i32> poison, i32 undef, i32 8
435  %v16i32_15 = insertelement <16 x i32> poison, i32 undef, i32 15
436
437  ret i32 undef
438}
439
440define i32 @insert_i16_poison(i32 %arg) {
441; CI-LABEL: 'insert_i16_poison'
442; CI-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v2i16_a = insertelement <2 x i16> poison, i16 undef, i32 %arg
443; CI-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v2i16_0 = insertelement <2 x i16> poison, i16 undef, i32 0
444; CI-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v2i16_1 = insertelement <2 x i16> poison, i16 undef, i32 1
445; CI-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v4i16_a = insertelement <4 x i16> poison, i16 undef, i32 %arg
446; CI-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v4i16_0 = insertelement <4 x i16> poison, i16 undef, i32 0
447; CI-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v4i16_3 = insertelement <4 x i16> poison, i16 undef, i32 3
448; CI-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v8i16_a = insertelement <8 x i16> poison, i16 undef, i32 %arg
449; CI-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v8i16_0 = insertelement <8 x i16> poison, i16 undef, i32 0
450; CI-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v8i16_7 = insertelement <8 x i16> poison, i16 undef, i32 7
451; CI-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v16i16_a = insertelement <16 x i16> poison, i16 undef, i32 %arg
452; CI-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v16i16_0 = insertelement <16 x i16> poison, i16 undef, i32 0
453; CI-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v16i16_7 = insertelement <16 x i16> poison, i16 undef, i32 7
454; CI-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v16i16_8 = insertelement <16 x i16> poison, i16 undef, i32 8
455; CI-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v16i16_15 = insertelement <16 x i16> poison, i16 undef, i32 15
456; CI-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v32i16_a = insertelement <32 x i16> poison, i16 undef, i32 %arg
457; CI-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v32i16_0 = insertelement <32 x i16> poison, i16 undef, i32 0
458; CI-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v32i16_7 = insertelement <32 x i16> poison, i16 undef, i32 7
459; CI-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v32i16_8 = insertelement <32 x i16> poison, i16 undef, i32 8
460; CI-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v32i16_15 = insertelement <32 x i16> poison, i16 undef, i32 15
461; CI-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v32i16_16 = insertelement <32 x i16> poison, i16 undef, i32 16
462; CI-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v32i16_24 = insertelement <32 x i16> poison, i16 undef, i32 24
463; CI-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v32i16_31 = insertelement <32 x i16> poison, i16 undef, i32 31
464; CI-NEXT:  Cost Model: Found an estimated cost of 10 for instruction: ret i32 undef
465;
466; GFX89-LABEL: 'insert_i16_poison'
467; GFX89-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v2i16_a = insertelement <2 x i16> poison, i16 undef, i32 %arg
468; GFX89-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %v2i16_0 = insertelement <2 x i16> poison, i16 undef, i32 0
469; GFX89-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v2i16_1 = insertelement <2 x i16> poison, i16 undef, i32 1
470; GFX89-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v4i16_a = insertelement <4 x i16> poison, i16 undef, i32 %arg
471; GFX89-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %v4i16_0 = insertelement <4 x i16> poison, i16 undef, i32 0
472; GFX89-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v4i16_3 = insertelement <4 x i16> poison, i16 undef, i32 3
473; GFX89-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v8i16_a = insertelement <8 x i16> poison, i16 undef, i32 %arg
474; GFX89-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %v8i16_0 = insertelement <8 x i16> poison, i16 undef, i32 0
475; GFX89-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v8i16_7 = insertelement <8 x i16> poison, i16 undef, i32 7
476; GFX89-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v16i16_a = insertelement <16 x i16> poison, i16 undef, i32 %arg
477; GFX89-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %v16i16_0 = insertelement <16 x i16> poison, i16 undef, i32 0
478; GFX89-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v16i16_7 = insertelement <16 x i16> poison, i16 undef, i32 7
479; GFX89-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v16i16_8 = insertelement <16 x i16> poison, i16 undef, i32 8
480; GFX89-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v16i16_15 = insertelement <16 x i16> poison, i16 undef, i32 15
481; GFX89-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v32i16_a = insertelement <32 x i16> poison, i16 undef, i32 %arg
482; GFX89-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %v32i16_0 = insertelement <32 x i16> poison, i16 undef, i32 0
483; GFX89-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v32i16_7 = insertelement <32 x i16> poison, i16 undef, i32 7
484; GFX89-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v32i16_8 = insertelement <32 x i16> poison, i16 undef, i32 8
485; GFX89-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v32i16_15 = insertelement <32 x i16> poison, i16 undef, i32 15
486; GFX89-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v32i16_16 = insertelement <32 x i16> poison, i16 undef, i32 16
487; GFX89-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v32i16_24 = insertelement <32 x i16> poison, i16 undef, i32 24
488; GFX89-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v32i16_31 = insertelement <32 x i16> poison, i16 undef, i32 31
489; GFX89-NEXT:  Cost Model: Found an estimated cost of 10 for instruction: ret i32 undef
490;
491; CI-SIZE-LABEL: 'insert_i16_poison'
492; CI-SIZE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v2i16_a = insertelement <2 x i16> poison, i16 undef, i32 %arg
493; CI-SIZE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v2i16_0 = insertelement <2 x i16> poison, i16 undef, i32 0
494; CI-SIZE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v2i16_1 = insertelement <2 x i16> poison, i16 undef, i32 1
495; CI-SIZE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v4i16_a = insertelement <4 x i16> poison, i16 undef, i32 %arg
496; CI-SIZE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v4i16_0 = insertelement <4 x i16> poison, i16 undef, i32 0
497; CI-SIZE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v4i16_3 = insertelement <4 x i16> poison, i16 undef, i32 3
498; CI-SIZE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v8i16_a = insertelement <8 x i16> poison, i16 undef, i32 %arg
499; CI-SIZE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v8i16_0 = insertelement <8 x i16> poison, i16 undef, i32 0
500; CI-SIZE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v8i16_7 = insertelement <8 x i16> poison, i16 undef, i32 7
501; CI-SIZE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v16i16_a = insertelement <16 x i16> poison, i16 undef, i32 %arg
502; CI-SIZE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v16i16_0 = insertelement <16 x i16> poison, i16 undef, i32 0
503; CI-SIZE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v16i16_7 = insertelement <16 x i16> poison, i16 undef, i32 7
504; CI-SIZE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v16i16_8 = insertelement <16 x i16> poison, i16 undef, i32 8
505; CI-SIZE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v16i16_15 = insertelement <16 x i16> poison, i16 undef, i32 15
506; CI-SIZE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v32i16_a = insertelement <32 x i16> poison, i16 undef, i32 %arg
507; CI-SIZE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v32i16_0 = insertelement <32 x i16> poison, i16 undef, i32 0
508; CI-SIZE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v32i16_7 = insertelement <32 x i16> poison, i16 undef, i32 7
509; CI-SIZE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v32i16_8 = insertelement <32 x i16> poison, i16 undef, i32 8
510; CI-SIZE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v32i16_15 = insertelement <32 x i16> poison, i16 undef, i32 15
511; CI-SIZE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v32i16_16 = insertelement <32 x i16> poison, i16 undef, i32 16
512; CI-SIZE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v32i16_24 = insertelement <32 x i16> poison, i16 undef, i32 24
513; CI-SIZE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v32i16_31 = insertelement <32 x i16> poison, i16 undef, i32 31
514; CI-SIZE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret i32 undef
515;
516; GFX89-SIZE-LABEL: 'insert_i16_poison'
517; GFX89-SIZE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v2i16_a = insertelement <2 x i16> poison, i16 undef, i32 %arg
518; GFX89-SIZE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %v2i16_0 = insertelement <2 x i16> poison, i16 undef, i32 0
519; GFX89-SIZE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v2i16_1 = insertelement <2 x i16> poison, i16 undef, i32 1
520; GFX89-SIZE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v4i16_a = insertelement <4 x i16> poison, i16 undef, i32 %arg
521; GFX89-SIZE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %v4i16_0 = insertelement <4 x i16> poison, i16 undef, i32 0
522; GFX89-SIZE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v4i16_3 = insertelement <4 x i16> poison, i16 undef, i32 3
523; GFX89-SIZE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v8i16_a = insertelement <8 x i16> poison, i16 undef, i32 %arg
524; GFX89-SIZE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %v8i16_0 = insertelement <8 x i16> poison, i16 undef, i32 0
525; GFX89-SIZE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v8i16_7 = insertelement <8 x i16> poison, i16 undef, i32 7
526; GFX89-SIZE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v16i16_a = insertelement <16 x i16> poison, i16 undef, i32 %arg
527; GFX89-SIZE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %v16i16_0 = insertelement <16 x i16> poison, i16 undef, i32 0
528; GFX89-SIZE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v16i16_7 = insertelement <16 x i16> poison, i16 undef, i32 7
529; GFX89-SIZE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v16i16_8 = insertelement <16 x i16> poison, i16 undef, i32 8
530; GFX89-SIZE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v16i16_15 = insertelement <16 x i16> poison, i16 undef, i32 15
531; GFX89-SIZE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v32i16_a = insertelement <32 x i16> poison, i16 undef, i32 %arg
532; GFX89-SIZE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %v32i16_0 = insertelement <32 x i16> poison, i16 undef, i32 0
533; GFX89-SIZE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v32i16_7 = insertelement <32 x i16> poison, i16 undef, i32 7
534; GFX89-SIZE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v32i16_8 = insertelement <32 x i16> poison, i16 undef, i32 8
535; GFX89-SIZE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v32i16_15 = insertelement <32 x i16> poison, i16 undef, i32 15
536; GFX89-SIZE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v32i16_16 = insertelement <32 x i16> poison, i16 undef, i32 16
537; GFX89-SIZE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v32i16_24 = insertelement <32 x i16> poison, i16 undef, i32 24
538; GFX89-SIZE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v32i16_31 = insertelement <32 x i16> poison, i16 undef, i32 31
539; GFX89-SIZE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret i32 undef
540;
541  %v2i16_a = insertelement <2 x i16> poison, i16 undef, i32 %arg
542  %v2i16_0 = insertelement <2 x i16> poison, i16 undef, i32 0
543  %v2i16_1 = insertelement <2 x i16> poison, i16 undef, i32 1
544
545  %v4i16_a = insertelement <4 x i16> poison, i16 undef, i32 %arg
546  %v4i16_0 = insertelement <4 x i16> poison, i16 undef, i32 0
547  %v4i16_3 = insertelement <4 x i16> poison, i16 undef, i32 3
548
549  %v8i16_a = insertelement <8 x i16> poison, i16 undef, i32 %arg
550  %v8i16_0 = insertelement <8 x i16> poison, i16 undef, i32 0
551  %v8i16_7 = insertelement <8 x i16> poison, i16 undef, i32 7
552
553  %v16i16_a  = insertelement <16 x i16> poison, i16 undef, i32 %arg
554  %v16i16_0  = insertelement <16 x i16> poison, i16 undef, i32 0
555  %v16i16_7  = insertelement <16 x i16> poison, i16 undef, i32 7
556  %v16i16_8  = insertelement <16 x i16> poison, i16 undef, i32 8
557  %v16i16_15 = insertelement <16 x i16> poison, i16 undef, i32 15
558
559  %v32i16_a  = insertelement <32 x i16> poison, i16 undef, i32 %arg
560  %v32i16_0  = insertelement <32 x i16> poison, i16 undef, i32 0
561  %v32i16_7  = insertelement <32 x i16> poison, i16 undef, i32 7
562  %v32i16_8  = insertelement <32 x i16> poison, i16 undef, i32 8
563  %v32i16_15 = insertelement <32 x i16> poison, i16 undef, i32 15
564  %v32i16_16 = insertelement <32 x i16> poison, i16 undef, i32 16
565  %v32i16_24 = insertelement <32 x i16> poison, i16 undef, i32 24
566  %v32i16_31 = insertelement <32 x i16> poison, i16 undef, i32 31
567
568  ret i32 undef
569}
570
571define i32 @insert_i8_poison(i32 %arg) {
572; ALL-LABEL: 'insert_i8_poison'
573; ALL-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v2i8_a = insertelement <2 x i8> poison, i8 undef, i32 %arg
574; ALL-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v2i8_0 = insertelement <2 x i8> poison, i8 undef, i32 0
575; ALL-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v2i8_3 = insertelement <2 x i8> poison, i8 undef, i32 1
576; ALL-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v4i8_a = insertelement <4 x i8> poison, i8 undef, i32 %arg
577; ALL-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v4i8_0 = insertelement <4 x i8> poison, i8 undef, i32 0
578; ALL-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v4i8_3 = insertelement <4 x i8> poison, i8 undef, i32 3
579; ALL-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v8i8_a = insertelement <8 x i8> poison, i8 undef, i32 %arg
580; ALL-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v8i8_0 = insertelement <8 x i8> poison, i8 undef, i32 0
581; ALL-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v8i8_7 = insertelement <8 x i8> poison, i8 undef, i32 7
582; ALL-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v16i8_a = insertelement <16 x i8> poison, i8 undef, i32 %arg
583; ALL-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v16i8_0 = insertelement <16 x i8> poison, i8 undef, i32 0
584; ALL-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v16i8_8 = insertelement <16 x i8> poison, i8 undef, i32 8
585; ALL-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v16i8_15 = insertelement <16 x i8> poison, i8 undef, i32 15
586; ALL-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v32i8_a = insertelement <32 x i8> poison, i8 undef, i32 %arg
587; ALL-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v32i8_0 = insertelement <32 x i8> poison, i8 undef, i32 0
588; ALL-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v32i8_7 = insertelement <32 x i8> poison, i8 undef, i32 7
589; ALL-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v32i8_8 = insertelement <32 x i8> poison, i8 undef, i32 8
590; ALL-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v32i8_15 = insertelement <32 x i8> poison, i8 undef, i32 15
591; ALL-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v32i8_24 = insertelement <32 x i8> poison, i8 undef, i32 24
592; ALL-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v32i8_31 = insertelement <32 x i8> poison, i8 undef, i32 31
593; ALL-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v64i8_a = insertelement <64 x i8> poison, i8 undef, i32 %arg
594; ALL-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v64i8_0 = insertelement <64 x i8> poison, i8 undef, i32 0
595; ALL-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v64i8_7 = insertelement <64 x i8> poison, i8 undef, i32 7
596; ALL-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v64i8_8 = insertelement <64 x i8> poison, i8 undef, i32 8
597; ALL-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v64i8_15 = insertelement <64 x i8> poison, i8 undef, i32 15
598; ALL-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v64i8_24 = insertelement <64 x i8> poison, i8 undef, i32 24
599; ALL-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v64i8_31 = insertelement <64 x i8> poison, i8 undef, i32 31
600; ALL-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v64i8_32 = insertelement <64 x i8> poison, i8 undef, i32 32
601; ALL-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v64i8_48 = insertelement <64 x i8> poison, i8 undef, i32 48
602; ALL-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v64i8_63 = insertelement <64 x i8> poison, i8 undef, i32 63
603; ALL-NEXT:  Cost Model: Found an estimated cost of 10 for instruction: ret i32 undef
604;
605; ALL-SIZE-LABEL: 'insert_i8_poison'
606; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v2i8_a = insertelement <2 x i8> poison, i8 undef, i32 %arg
607; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v2i8_0 = insertelement <2 x i8> poison, i8 undef, i32 0
608; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v2i8_3 = insertelement <2 x i8> poison, i8 undef, i32 1
609; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v4i8_a = insertelement <4 x i8> poison, i8 undef, i32 %arg
610; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v4i8_0 = insertelement <4 x i8> poison, i8 undef, i32 0
611; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v4i8_3 = insertelement <4 x i8> poison, i8 undef, i32 3
612; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v8i8_a = insertelement <8 x i8> poison, i8 undef, i32 %arg
613; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v8i8_0 = insertelement <8 x i8> poison, i8 undef, i32 0
614; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v8i8_7 = insertelement <8 x i8> poison, i8 undef, i32 7
615; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v16i8_a = insertelement <16 x i8> poison, i8 undef, i32 %arg
616; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v16i8_0 = insertelement <16 x i8> poison, i8 undef, i32 0
617; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v16i8_8 = insertelement <16 x i8> poison, i8 undef, i32 8
618; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v16i8_15 = insertelement <16 x i8> poison, i8 undef, i32 15
619; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v32i8_a = insertelement <32 x i8> poison, i8 undef, i32 %arg
620; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v32i8_0 = insertelement <32 x i8> poison, i8 undef, i32 0
621; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v32i8_7 = insertelement <32 x i8> poison, i8 undef, i32 7
622; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v32i8_8 = insertelement <32 x i8> poison, i8 undef, i32 8
623; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v32i8_15 = insertelement <32 x i8> poison, i8 undef, i32 15
624; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v32i8_24 = insertelement <32 x i8> poison, i8 undef, i32 24
625; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v32i8_31 = insertelement <32 x i8> poison, i8 undef, i32 31
626; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v64i8_a = insertelement <64 x i8> poison, i8 undef, i32 %arg
627; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v64i8_0 = insertelement <64 x i8> poison, i8 undef, i32 0
628; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v64i8_7 = insertelement <64 x i8> poison, i8 undef, i32 7
629; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v64i8_8 = insertelement <64 x i8> poison, i8 undef, i32 8
630; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v64i8_15 = insertelement <64 x i8> poison, i8 undef, i32 15
631; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v64i8_24 = insertelement <64 x i8> poison, i8 undef, i32 24
632; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v64i8_31 = insertelement <64 x i8> poison, i8 undef, i32 31
633; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v64i8_32 = insertelement <64 x i8> poison, i8 undef, i32 32
634; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v64i8_48 = insertelement <64 x i8> poison, i8 undef, i32 48
635; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v64i8_63 = insertelement <64 x i8> poison, i8 undef, i32 63
636; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret i32 undef
637;
638  %v2i8_a   = insertelement <2 x i8> poison, i8 undef, i32 %arg
639  %v2i8_0   = insertelement <2 x i8> poison, i8 undef, i32 0
640  %v2i8_3   = insertelement <2 x i8> poison, i8 undef, i32 1
641
642  %v4i8_a   = insertelement <4 x i8> poison, i8 undef, i32 %arg
643  %v4i8_0   = insertelement <4 x i8> poison, i8 undef, i32 0
644  %v4i8_3   = insertelement <4 x i8> poison, i8 undef, i32 3
645
646  %v8i8_a   = insertelement <8 x i8> poison, i8 undef, i32 %arg
647  %v8i8_0   = insertelement <8 x i8> poison, i8 undef, i32 0
648  %v8i8_7   = insertelement <8 x i8> poison, i8 undef, i32 7
649
650  %v16i8_a  = insertelement <16 x i8> poison, i8 undef, i32 %arg
651  %v16i8_0  = insertelement <16 x i8> poison, i8 undef, i32 0
652  %v16i8_8  = insertelement <16 x i8> poison, i8 undef, i32 8
653  %v16i8_15 = insertelement <16 x i8> poison, i8 undef, i32 15
654
655  %v32i8_a  = insertelement <32 x i8> poison, i8 undef, i32 %arg
656  %v32i8_0  = insertelement <32 x i8> poison, i8 undef, i32 0
657  %v32i8_7  = insertelement <32 x i8> poison, i8 undef, i32 7
658  %v32i8_8  = insertelement <32 x i8> poison, i8 undef, i32 8
659  %v32i8_15 = insertelement <32 x i8> poison, i8 undef, i32 15
660  %v32i8_24 = insertelement <32 x i8> poison, i8 undef, i32 24
661  %v32i8_31 = insertelement <32 x i8> poison, i8 undef, i32 31
662
663  %v64i8_a  = insertelement <64 x i8> poison, i8 undef, i32 %arg
664  %v64i8_0  = insertelement <64 x i8> poison, i8 undef, i32 0
665  %v64i8_7  = insertelement <64 x i8> poison, i8 undef, i32 7
666  %v64i8_8  = insertelement <64 x i8> poison, i8 undef, i32 8
667  %v64i8_15 = insertelement <64 x i8> poison, i8 undef, i32 15
668  %v64i8_24 = insertelement <64 x i8> poison, i8 undef, i32 24
669  %v64i8_31 = insertelement <64 x i8> poison, i8 undef, i32 31
670  %v64i8_32 = insertelement <64 x i8> poison, i8 undef, i32 32
671  %v64i8_48 = insertelement <64 x i8> poison, i8 undef, i32 48
672  %v64i8_63 = insertelement <64 x i8> poison, i8 undef, i32 63
673
674  ret i32 undef
675}
676
677define i32 @insert_i1_poison(i32 %arg) {
678; ALL-LABEL: 'insert_i1_poison'
679; ALL-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v2i1_a = insertelement <2 x i1> poison, i1 undef, i32 %arg
680; ALL-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v2i1_0 = insertelement <2 x i1> poison, i1 undef, i32 0
681; ALL-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v2i1_1 = insertelement <2 x i1> poison, i1 undef, i32 1
682; ALL-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v4i1_a = insertelement <4 x i1> poison, i1 undef, i32 %arg
683; ALL-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v4i1_0 = insertelement <4 x i1> poison, i1 undef, i32 0
684; ALL-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v4i1_2 = insertelement <4 x i1> poison, i1 undef, i32 2
685; ALL-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v8i1_a = insertelement <8 x i1> poison, i1 undef, i32 %arg
686; ALL-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v8i1_0 = insertelement <8 x i1> poison, i1 undef, i32 0
687; ALL-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v8i1_4 = insertelement <8 x i1> poison, i1 undef, i32 4
688; ALL-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v16i1_a = insertelement <16 x i1> poison, i1 undef, i32 %arg
689; ALL-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v16i1_0 = insertelement <16 x i1> poison, i1 undef, i32 0
690; ALL-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v16i1_8 = insertelement <16 x i1> poison, i1 undef, i32 8
691; ALL-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v16i1_15 = insertelement <16 x i1> poison, i1 undef, i32 15
692; ALL-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v32i1_a = insertelement <32 x i1> poison, i1 undef, i32 %arg
693; ALL-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v32i1_0 = insertelement <32 x i1> poison, i1 undef, i32 0
694; ALL-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v32i1_7 = insertelement <32 x i1> poison, i1 undef, i32 7
695; ALL-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v32i1_8 = insertelement <32 x i1> poison, i1 undef, i32 8
696; ALL-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v32i1_15 = insertelement <32 x i1> poison, i1 undef, i32 15
697; ALL-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v32i1_24 = insertelement <32 x i1> poison, i1 undef, i32 24
698; ALL-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v32i1_31 = insertelement <32 x i1> poison, i1 undef, i32 31
699; ALL-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v64i1_a = insertelement <64 x i1> poison, i1 undef, i32 %arg
700; ALL-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v64i1_0 = insertelement <64 x i1> poison, i1 undef, i32 0
701; ALL-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v64i1_7 = insertelement <64 x i1> poison, i1 undef, i32 7
702; ALL-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v64i1_8 = insertelement <64 x i1> poison, i1 undef, i32 8
703; ALL-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v64i1_15 = insertelement <64 x i1> poison, i1 undef, i32 15
704; ALL-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v64i1_24 = insertelement <64 x i1> poison, i1 undef, i32 24
705; ALL-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v64i1_31 = insertelement <64 x i1> poison, i1 undef, i32 31
706; ALL-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v64i1_32 = insertelement <64 x i1> poison, i1 undef, i32 32
707; ALL-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v64i1_48 = insertelement <64 x i1> poison, i1 undef, i32 48
708; ALL-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v64i1_63 = insertelement <64 x i1> poison, i1 undef, i32 63
709; ALL-NEXT:  Cost Model: Found an estimated cost of 10 for instruction: ret i32 undef
710;
711; ALL-SIZE-LABEL: 'insert_i1_poison'
712; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v2i1_a = insertelement <2 x i1> poison, i1 undef, i32 %arg
713; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v2i1_0 = insertelement <2 x i1> poison, i1 undef, i32 0
714; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v2i1_1 = insertelement <2 x i1> poison, i1 undef, i32 1
715; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v4i1_a = insertelement <4 x i1> poison, i1 undef, i32 %arg
716; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v4i1_0 = insertelement <4 x i1> poison, i1 undef, i32 0
717; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v4i1_2 = insertelement <4 x i1> poison, i1 undef, i32 2
718; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v8i1_a = insertelement <8 x i1> poison, i1 undef, i32 %arg
719; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v8i1_0 = insertelement <8 x i1> poison, i1 undef, i32 0
720; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v8i1_4 = insertelement <8 x i1> poison, i1 undef, i32 4
721; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v16i1_a = insertelement <16 x i1> poison, i1 undef, i32 %arg
722; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v16i1_0 = insertelement <16 x i1> poison, i1 undef, i32 0
723; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v16i1_8 = insertelement <16 x i1> poison, i1 undef, i32 8
724; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v16i1_15 = insertelement <16 x i1> poison, i1 undef, i32 15
725; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v32i1_a = insertelement <32 x i1> poison, i1 undef, i32 %arg
726; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v32i1_0 = insertelement <32 x i1> poison, i1 undef, i32 0
727; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v32i1_7 = insertelement <32 x i1> poison, i1 undef, i32 7
728; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v32i1_8 = insertelement <32 x i1> poison, i1 undef, i32 8
729; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v32i1_15 = insertelement <32 x i1> poison, i1 undef, i32 15
730; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v32i1_24 = insertelement <32 x i1> poison, i1 undef, i32 24
731; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v32i1_31 = insertelement <32 x i1> poison, i1 undef, i32 31
732; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v64i1_a = insertelement <64 x i1> poison, i1 undef, i32 %arg
733; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v64i1_0 = insertelement <64 x i1> poison, i1 undef, i32 0
734; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v64i1_7 = insertelement <64 x i1> poison, i1 undef, i32 7
735; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v64i1_8 = insertelement <64 x i1> poison, i1 undef, i32 8
736; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v64i1_15 = insertelement <64 x i1> poison, i1 undef, i32 15
737; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v64i1_24 = insertelement <64 x i1> poison, i1 undef, i32 24
738; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v64i1_31 = insertelement <64 x i1> poison, i1 undef, i32 31
739; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v64i1_32 = insertelement <64 x i1> poison, i1 undef, i32 32
740; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v64i1_48 = insertelement <64 x i1> poison, i1 undef, i32 48
741; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v64i1_63 = insertelement <64 x i1> poison, i1 undef, i32 63
742; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret i32 undef
743;
744  %v2i1_a  = insertelement <2 x i1> poison, i1 undef, i32 %arg
745  %v2i1_0  = insertelement <2 x i1> poison, i1 undef, i32 0
746  %v2i1_1  = insertelement <2 x i1> poison, i1 undef, i32 1
747
748  %v4i1_a  = insertelement <4 x i1> poison, i1 undef, i32 %arg
749  %v4i1_0  = insertelement <4 x i1> poison, i1 undef, i32 0
750  %v4i1_2  = insertelement <4 x i1> poison, i1 undef, i32 2
751
752  %v8i1_a  = insertelement <8 x i1> poison, i1 undef, i32 %arg
753  %v8i1_0  = insertelement <8 x i1> poison, i1 undef, i32 0
754  %v8i1_4  = insertelement <8 x i1> poison, i1 undef, i32 4
755
756  %v16i1_a  = insertelement <16 x i1> poison, i1 undef, i32 %arg
757  %v16i1_0  = insertelement <16 x i1> poison, i1 undef, i32 0
758  %v16i1_8  = insertelement <16 x i1> poison, i1 undef, i32 8
759  %v16i1_15 = insertelement <16 x i1> poison, i1 undef, i32 15
760
761  %v32i1_a  = insertelement <32 x i1> poison, i1 undef, i32 %arg
762  %v32i1_0  = insertelement <32 x i1> poison, i1 undef, i32 0
763  %v32i1_7  = insertelement <32 x i1> poison, i1 undef, i32 7
764  %v32i1_8  = insertelement <32 x i1> poison, i1 undef, i32 8
765  %v32i1_15 = insertelement <32 x i1> poison, i1 undef, i32 15
766  %v32i1_24 = insertelement <32 x i1> poison, i1 undef, i32 24
767  %v32i1_31 = insertelement <32 x i1> poison, i1 undef, i32 31
768
769  %v64i1_a  = insertelement <64 x i1> poison, i1 undef, i32 %arg
770  %v64i1_0  = insertelement <64 x i1> poison, i1 undef, i32 0
771  %v64i1_7  = insertelement <64 x i1> poison, i1 undef, i32 7
772  %v64i1_8  = insertelement <64 x i1> poison, i1 undef, i32 8
773  %v64i1_15 = insertelement <64 x i1> poison, i1 undef, i32 15
774  %v64i1_24 = insertelement <64 x i1> poison, i1 undef, i32 24
775  %v64i1_31 = insertelement <64 x i1> poison, i1 undef, i32 31
776  %v64i1_32 = insertelement <64 x i1> poison, i1 undef, i32 32
777  %v64i1_48 = insertelement <64 x i1> poison, i1 undef, i32 48
778  %v64i1_63 = insertelement <64 x i1> poison, i1 undef, i32 63
779
780  ret i32 undef
781}
782