xref: /llvm-project/llvm/test/Analysis/CostModel/X86/cast.ll (revision ed412494988411fc1aae2f1014c4ecad56d8085f)
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=x86_64-apple-macosx10.8.0 -mattr=+sse2 | FileCheck %s --check-prefixes=SSE,SSE2
3; RUN: opt < %s  -passes="print<cost-model>" 2>&1 -disable-output -mtriple=x86_64-apple-macosx10.8.0 -mattr=+sse4.1 | FileCheck %s --check-prefixes=SSE,SSE41
4; RUN: opt < %s  -passes="print<cost-model>" 2>&1 -disable-output -mtriple=x86_64-apple-macosx10.8.0 -mattr=+avx | FileCheck %s --check-prefixes=AVX,AVX1
5; RUN: opt < %s  -passes="print<cost-model>" 2>&1 -disable-output -mtriple=x86_64-apple-macosx10.8.0 -mattr=+avx2 | FileCheck %s --check-prefixes=AVX,AVX2
6; RUN: opt < %s  -passes="print<cost-model>" 2>&1 -disable-output -mtriple=x86_64-apple-macosx10.8.0 -mattr=+avx512f | FileCheck %s --check-prefixes=AVX512,AVX512F
7; RUN: opt < %s  -passes="print<cost-model>" 2>&1 -disable-output -mtriple=x86_64-apple-macosx10.8.0 -mattr=+avx512bw | FileCheck %s --check-prefixes=AVX512,AVX512BW
8; RUN: opt < %s  -passes="print<cost-model>" 2>&1 -disable-output -mtriple=x86_64-apple-macosx10.8.0 -mattr=+avx512dq | FileCheck %s --check-prefixes=AVX512,AVX512DQ
9
10define i32 @add(i32 %arg) {
11; SSE2-LABEL: 'add'
12; SSE2-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %A = zext <4 x i1> undef to <4 x i32>
13; SSE2-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %B = sext <4 x i1> undef to <4 x i32>
14; SSE2-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %C = trunc <4 x i32> undef to <4 x i1>
15; SSE2-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %D = zext <8 x i1> undef to <8 x i32>
16; SSE2-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %E = sext <8 x i1> undef to <8 x i32>
17; SSE2-NEXT:  Cost Model: Found an estimated cost of 6 for instruction: %F = trunc <8 x i32> undef to <8 x i1>
18; SSE2-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %G = zext i1 undef to i32
19; SSE2-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %H = trunc i32 undef to i1
20; SSE2-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i32 undef
21;
22; SSE41-LABEL: 'add'
23; SSE41-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %A = zext <4 x i1> undef to <4 x i32>
24; SSE41-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %B = sext <4 x i1> undef to <4 x i32>
25; SSE41-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %C = trunc <4 x i32> undef to <4 x i1>
26; SSE41-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %D = zext <8 x i1> undef to <8 x i32>
27; SSE41-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %E = sext <8 x i1> undef to <8 x i32>
28; SSE41-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %F = trunc <8 x i32> undef to <8 x i1>
29; SSE41-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %G = zext i1 undef to i32
30; SSE41-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %H = trunc i32 undef to i1
31; SSE41-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i32 undef
32;
33; AVX1-LABEL: 'add'
34; AVX1-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %A = zext <4 x i1> undef to <4 x i32>
35; AVX1-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %B = sext <4 x i1> undef to <4 x i32>
36; AVX1-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %C = trunc <4 x i32> undef to <4 x i1>
37; AVX1-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %D = zext <8 x i1> undef to <8 x i32>
38; AVX1-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %E = sext <8 x i1> undef to <8 x i32>
39; AVX1-NEXT:  Cost Model: Found an estimated cost of 5 for instruction: %F = trunc <8 x i32> undef to <8 x i1>
40; AVX1-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %G = zext i1 undef to i32
41; AVX1-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %H = trunc i32 undef to i1
42; AVX1-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i32 undef
43;
44; AVX2-LABEL: 'add'
45; AVX2-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %A = zext <4 x i1> undef to <4 x i32>
46; AVX2-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %B = sext <4 x i1> undef to <4 x i32>
47; AVX2-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %C = trunc <4 x i32> undef to <4 x i1>
48; AVX2-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %D = zext <8 x i1> undef to <8 x i32>
49; AVX2-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %E = sext <8 x i1> undef to <8 x i32>
50; AVX2-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %F = trunc <8 x i32> undef to <8 x i1>
51; AVX2-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %G = zext i1 undef to i32
52; AVX2-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %H = trunc i32 undef to i1
53; AVX2-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i32 undef
54;
55; AVX512-LABEL: 'add'
56; AVX512-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %A = zext <4 x i1> undef to <4 x i32>
57; AVX512-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %B = sext <4 x i1> undef to <4 x i32>
58; AVX512-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %C = trunc <4 x i32> undef to <4 x i1>
59; AVX512-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %D = zext <8 x i1> undef to <8 x i32>
60; AVX512-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %E = sext <8 x i1> undef to <8 x i32>
61; AVX512-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %F = trunc <8 x i32> undef to <8 x i1>
62; AVX512-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %G = zext i1 undef to i32
63; AVX512-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %H = trunc i32 undef to i1
64; AVX512-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i32 undef
65;
66  ; -- Same size registeres --
67  %A = zext <4 x i1> undef to <4 x i32>
68  %B = sext <4 x i1> undef to <4 x i32>
69  %C = trunc <4 x i32> undef to <4 x i1>
70
71  ; -- Different size registers --
72  %D = zext <8 x i1> undef to <8 x i32>
73  %E = sext <8 x i1> undef to <8 x i32>
74  %F = trunc <8 x i32> undef to <8 x i1>
75
76  ; -- scalars --
77  %G = zext i1 undef to i32
78  %H = trunc i32 undef to i1
79
80  ret i32 undef
81}
82
83define i32 @zext_sext(<8 x i1> %in) {
84; SSE2-LABEL: 'zext_sext'
85; SSE2-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %Z = zext <8 x i1> %in to <8 x i32>
86; SSE2-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %S = sext <8 x i1> %in to <8 x i32>
87; SSE2-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %A1 = zext <16 x i8> undef to <16 x i16>
88; SSE2-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %A2 = sext <16 x i8> undef to <16 x i16>
89; SSE2-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %A = sext <8 x i16> undef to <8 x i32>
90; SSE2-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %B = zext <8 x i16> undef to <8 x i32>
91; SSE2-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %C = sext <4 x i32> undef to <4 x i64>
92; SSE2-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %C.v8i8.z = zext <8 x i8> undef to <8 x i32>
93; SSE2-NEXT:  Cost Model: Found an estimated cost of 6 for instruction: %C.v8i8.s = sext <8 x i8> undef to <8 x i32>
94; SSE2-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %C.v4i16.z = zext <4 x i16> undef to <4 x i64>
95; SSE2-NEXT:  Cost Model: Found an estimated cost of 6 for instruction: %C.v4i16.s = sext <4 x i16> undef to <4 x i64>
96; SSE2-NEXT:  Cost Model: Found an estimated cost of 8 for instruction: %C.v4i8.z = zext <4 x i8> undef to <4 x i64>
97; SSE2-NEXT:  Cost Model: Found an estimated cost of 8 for instruction: %C.v4i8.s = sext <4 x i8> undef to <4 x i64>
98; SSE2-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %D = zext <4 x i32> undef to <4 x i64>
99; SSE2-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %D1 = zext <8 x i32> undef to <8 x i64>
100; SSE2-NEXT:  Cost Model: Found an estimated cost of 8 for instruction: %D2 = sext <8 x i32> undef to <8 x i64>
101; SSE2-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %D3 = zext <16 x i16> undef to <16 x i32>
102; SSE2-NEXT:  Cost Model: Found an estimated cost of 8 for instruction: %D4 = zext <16 x i8> undef to <16 x i32>
103; SSE2-NEXT:  Cost Model: Found an estimated cost of 8 for instruction: %D5 = zext <16 x i1> undef to <16 x i32>
104; SSE2-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %E = trunc <4 x i64> undef to <4 x i32>
105; SSE2-NEXT:  Cost Model: Found an estimated cost of 5 for instruction: %F = trunc <8 x i32> undef to <8 x i16>
106; SSE2-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %F1 = trunc <16 x i16> undef to <16 x i8>
107; SSE2-NEXT:  Cost Model: Found an estimated cost of 6 for instruction: %F2 = trunc <8 x i32> undef to <8 x i8>
108; SSE2-NEXT:  Cost Model: Found an estimated cost of 8 for instruction: %F3 = trunc <4 x i64> undef to <4 x i8>
109; SSE2-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %G = trunc <8 x i64> undef to <8 x i32>
110; SSE2-NEXT:  Cost Model: Found an estimated cost of 10 for instruction: %G1 = trunc <16 x i32> undef to <16 x i16>
111; SSE2-NEXT:  Cost Model: Found an estimated cost of 7 for instruction: %G2 = trunc <16 x i32> undef to <16 x i8>
112; SSE2-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i32 undef
113;
114; SSE41-LABEL: 'zext_sext'
115; SSE41-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %Z = zext <8 x i1> %in to <8 x i32>
116; SSE41-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %S = sext <8 x i1> %in to <8 x i32>
117; SSE41-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %A1 = zext <16 x i8> undef to <16 x i16>
118; SSE41-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %A2 = sext <16 x i8> undef to <16 x i16>
119; SSE41-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %A = sext <8 x i16> undef to <8 x i32>
120; SSE41-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %B = zext <8 x i16> undef to <8 x i32>
121; SSE41-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %C = sext <4 x i32> undef to <4 x i64>
122; SSE41-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %C.v8i8.z = zext <8 x i8> undef to <8 x i32>
123; SSE41-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %C.v8i8.s = sext <8 x i8> undef to <8 x i32>
124; SSE41-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %C.v4i16.z = zext <4 x i16> undef to <4 x i64>
125; SSE41-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %C.v4i16.s = sext <4 x i16> undef to <4 x i64>
126; SSE41-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %C.v4i8.z = zext <4 x i8> undef to <4 x i64>
127; SSE41-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %C.v4i8.s = sext <4 x i8> undef to <4 x i64>
128; SSE41-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %D = zext <4 x i32> undef to <4 x i64>
129; SSE41-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %D1 = zext <8 x i32> undef to <8 x i64>
130; SSE41-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %D2 = sext <8 x i32> undef to <8 x i64>
131; SSE41-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %D3 = zext <16 x i16> undef to <16 x i32>
132; SSE41-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %D4 = zext <16 x i8> undef to <16 x i32>
133; SSE41-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %D5 = zext <16 x i1> undef to <16 x i32>
134; SSE41-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %E = trunc <4 x i64> undef to <4 x i32>
135; SSE41-NEXT:  Cost Model: Found an estimated cost of 5 for instruction: %F = trunc <8 x i32> undef to <8 x i16>
136; SSE41-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %F1 = trunc <16 x i16> undef to <16 x i8>
137; SSE41-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %F2 = trunc <8 x i32> undef to <8 x i8>
138; SSE41-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %F3 = trunc <4 x i64> undef to <4 x i8>
139; SSE41-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %G = trunc <8 x i64> undef to <8 x i32>
140; SSE41-NEXT:  Cost Model: Found an estimated cost of 10 for instruction: %G1 = trunc <16 x i32> undef to <16 x i16>
141; SSE41-NEXT:  Cost Model: Found an estimated cost of 7 for instruction: %G2 = trunc <16 x i32> undef to <16 x i8>
142; SSE41-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i32 undef
143;
144; AVX1-LABEL: 'zext_sext'
145; AVX1-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %Z = zext <8 x i1> %in to <8 x i32>
146; AVX1-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %S = sext <8 x i1> %in to <8 x i32>
147; AVX1-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %A1 = zext <16 x i8> undef to <16 x i16>
148; AVX1-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %A2 = sext <16 x i8> undef to <16 x i16>
149; AVX1-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %A = sext <8 x i16> undef to <8 x i32>
150; AVX1-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %B = zext <8 x i16> undef to <8 x i32>
151; AVX1-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %C = sext <4 x i32> undef to <4 x i64>
152; AVX1-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %C.v8i8.z = zext <8 x i8> undef to <8 x i32>
153; AVX1-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %C.v8i8.s = sext <8 x i8> undef to <8 x i32>
154; AVX1-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %C.v4i16.z = zext <4 x i16> undef to <4 x i64>
155; AVX1-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %C.v4i16.s = sext <4 x i16> undef to <4 x i64>
156; AVX1-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %C.v4i8.z = zext <4 x i8> undef to <4 x i64>
157; AVX1-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %C.v4i8.s = sext <4 x i8> undef to <4 x i64>
158; AVX1-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %D = zext <4 x i32> undef to <4 x i64>
159; AVX1-NEXT:  Cost Model: Found an estimated cost of 7 for instruction: %D1 = zext <8 x i32> undef to <8 x i64>
160; AVX1-NEXT:  Cost Model: Found an estimated cost of 7 for instruction: %D2 = sext <8 x i32> undef to <8 x i64>
161; AVX1-NEXT:  Cost Model: Found an estimated cost of 7 for instruction: %D3 = zext <16 x i16> undef to <16 x i32>
162; AVX1-NEXT:  Cost Model: Found an estimated cost of 6 for instruction: %D4 = zext <16 x i8> undef to <16 x i32>
163; AVX1-NEXT:  Cost Model: Found an estimated cost of 6 for instruction: %D5 = zext <16 x i1> undef to <16 x i32>
164; AVX1-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %E = trunc <4 x i64> undef to <4 x i32>
165; AVX1-NEXT:  Cost Model: Found an estimated cost of 5 for instruction: %F = trunc <8 x i32> undef to <8 x i16>
166; AVX1-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %F1 = trunc <16 x i16> undef to <16 x i8>
167; AVX1-NEXT:  Cost Model: Found an estimated cost of 5 for instruction: %F2 = trunc <8 x i32> undef to <8 x i8>
168; AVX1-NEXT:  Cost Model: Found an estimated cost of 5 for instruction: %F3 = trunc <4 x i64> undef to <4 x i8>
169; AVX1-NEXT:  Cost Model: Found an estimated cost of 5 for instruction: %G = trunc <8 x i64> undef to <8 x i32>
170; AVX1-NEXT:  Cost Model: Found an estimated cost of 6 for instruction: %G1 = trunc <16 x i32> undef to <16 x i16>
171; AVX1-NEXT:  Cost Model: Found an estimated cost of 6 for instruction: %G2 = trunc <16 x i32> undef to <16 x i8>
172; AVX1-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i32 undef
173;
174; AVX2-LABEL: 'zext_sext'
175; AVX2-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %Z = zext <8 x i1> %in to <8 x i32>
176; AVX2-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %S = sext <8 x i1> %in to <8 x i32>
177; AVX2-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %A1 = zext <16 x i8> undef to <16 x i16>
178; AVX2-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %A2 = sext <16 x i8> undef to <16 x i16>
179; AVX2-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %A = sext <8 x i16> undef to <8 x i32>
180; AVX2-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %B = zext <8 x i16> undef to <8 x i32>
181; AVX2-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %C = sext <4 x i32> undef to <4 x i64>
182; AVX2-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %C.v8i8.z = zext <8 x i8> undef to <8 x i32>
183; AVX2-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %C.v8i8.s = sext <8 x i8> undef to <8 x i32>
184; AVX2-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %C.v4i16.z = zext <4 x i16> undef to <4 x i64>
185; AVX2-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %C.v4i16.s = sext <4 x i16> undef to <4 x i64>
186; AVX2-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %C.v4i8.z = zext <4 x i8> undef to <4 x i64>
187; AVX2-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %C.v4i8.s = sext <4 x i8> undef to <4 x i64>
188; AVX2-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %D = zext <4 x i32> undef to <4 x i64>
189; AVX2-NEXT:  Cost Model: Found an estimated cost of 5 for instruction: %D1 = zext <8 x i32> undef to <8 x i64>
190; AVX2-NEXT:  Cost Model: Found an estimated cost of 5 for instruction: %D2 = sext <8 x i32> undef to <8 x i64>
191; AVX2-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %D3 = zext <16 x i16> undef to <16 x i32>
192; AVX2-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %D4 = zext <16 x i8> undef to <16 x i32>
193; AVX2-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %D5 = zext <16 x i1> undef to <16 x i32>
194; AVX2-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %E = trunc <4 x i64> undef to <4 x i32>
195; AVX2-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %F = trunc <8 x i32> undef to <8 x i16>
196; AVX2-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %F1 = trunc <16 x i16> undef to <16 x i8>
197; AVX2-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %F2 = trunc <8 x i32> undef to <8 x i8>
198; AVX2-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %F3 = trunc <4 x i64> undef to <4 x i8>
199; AVX2-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %G = trunc <8 x i64> undef to <8 x i32>
200; AVX2-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %G1 = trunc <16 x i32> undef to <16 x i16>
201; AVX2-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %G2 = trunc <16 x i32> undef to <16 x i8>
202; AVX2-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i32 undef
203;
204; AVX512F-LABEL: 'zext_sext'
205; AVX512F-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %Z = zext <8 x i1> %in to <8 x i32>
206; AVX512F-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %S = sext <8 x i1> %in to <8 x i32>
207; AVX512F-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %A1 = zext <16 x i8> undef to <16 x i16>
208; AVX512F-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %A2 = sext <16 x i8> undef to <16 x i16>
209; AVX512F-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %A = sext <8 x i16> undef to <8 x i32>
210; AVX512F-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %B = zext <8 x i16> undef to <8 x i32>
211; AVX512F-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %C = sext <4 x i32> undef to <4 x i64>
212; AVX512F-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %C.v8i8.z = zext <8 x i8> undef to <8 x i32>
213; AVX512F-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %C.v8i8.s = sext <8 x i8> undef to <8 x i32>
214; AVX512F-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %C.v4i16.z = zext <4 x i16> undef to <4 x i64>
215; AVX512F-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %C.v4i16.s = sext <4 x i16> undef to <4 x i64>
216; AVX512F-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %C.v4i8.z = zext <4 x i8> undef to <4 x i64>
217; AVX512F-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %C.v4i8.s = sext <4 x i8> undef to <4 x i64>
218; AVX512F-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %D = zext <4 x i32> undef to <4 x i64>
219; AVX512F-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %D1 = zext <8 x i32> undef to <8 x i64>
220; AVX512F-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %D2 = sext <8 x i32> undef to <8 x i64>
221; AVX512F-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %D3 = zext <16 x i16> undef to <16 x i32>
222; AVX512F-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %D4 = zext <16 x i8> undef to <16 x i32>
223; AVX512F-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %D5 = zext <16 x i1> undef to <16 x i32>
224; AVX512F-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %E = trunc <4 x i64> undef to <4 x i32>
225; AVX512F-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %F = trunc <8 x i32> undef to <8 x i16>
226; AVX512F-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %F1 = trunc <16 x i16> undef to <16 x i8>
227; AVX512F-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %F2 = trunc <8 x i32> undef to <8 x i8>
228; AVX512F-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %F3 = trunc <4 x i64> undef to <4 x i8>
229; AVX512F-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %G = trunc <8 x i64> undef to <8 x i32>
230; AVX512F-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %G1 = trunc <16 x i32> undef to <16 x i16>
231; AVX512F-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %G2 = trunc <16 x i32> undef to <16 x i8>
232; AVX512F-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i32 undef
233;
234; AVX512BW-LABEL: 'zext_sext'
235; AVX512BW-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %Z = zext <8 x i1> %in to <8 x i32>
236; AVX512BW-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %S = sext <8 x i1> %in to <8 x i32>
237; AVX512BW-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %A1 = zext <16 x i8> undef to <16 x i16>
238; AVX512BW-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %A2 = sext <16 x i8> undef to <16 x i16>
239; AVX512BW-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %A = sext <8 x i16> undef to <8 x i32>
240; AVX512BW-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %B = zext <8 x i16> undef to <8 x i32>
241; AVX512BW-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %C = sext <4 x i32> undef to <4 x i64>
242; AVX512BW-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %C.v8i8.z = zext <8 x i8> undef to <8 x i32>
243; AVX512BW-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %C.v8i8.s = sext <8 x i8> undef to <8 x i32>
244; AVX512BW-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %C.v4i16.z = zext <4 x i16> undef to <4 x i64>
245; AVX512BW-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %C.v4i16.s = sext <4 x i16> undef to <4 x i64>
246; AVX512BW-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %C.v4i8.z = zext <4 x i8> undef to <4 x i64>
247; AVX512BW-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %C.v4i8.s = sext <4 x i8> undef to <4 x i64>
248; AVX512BW-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %D = zext <4 x i32> undef to <4 x i64>
249; AVX512BW-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %D1 = zext <8 x i32> undef to <8 x i64>
250; AVX512BW-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %D2 = sext <8 x i32> undef to <8 x i64>
251; AVX512BW-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %D3 = zext <16 x i16> undef to <16 x i32>
252; AVX512BW-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %D4 = zext <16 x i8> undef to <16 x i32>
253; AVX512BW-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %D5 = zext <16 x i1> undef to <16 x i32>
254; AVX512BW-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %E = trunc <4 x i64> undef to <4 x i32>
255; AVX512BW-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %F = trunc <8 x i32> undef to <8 x i16>
256; AVX512BW-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %F1 = trunc <16 x i16> undef to <16 x i8>
257; AVX512BW-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %F2 = trunc <8 x i32> undef to <8 x i8>
258; AVX512BW-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %F3 = trunc <4 x i64> undef to <4 x i8>
259; AVX512BW-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %G = trunc <8 x i64> undef to <8 x i32>
260; AVX512BW-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %G1 = trunc <16 x i32> undef to <16 x i16>
261; AVX512BW-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %G2 = trunc <16 x i32> undef to <16 x i8>
262; AVX512BW-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i32 undef
263;
264; AVX512DQ-LABEL: 'zext_sext'
265; AVX512DQ-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %Z = zext <8 x i1> %in to <8 x i32>
266; AVX512DQ-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %S = sext <8 x i1> %in to <8 x i32>
267; AVX512DQ-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %A1 = zext <16 x i8> undef to <16 x i16>
268; AVX512DQ-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %A2 = sext <16 x i8> undef to <16 x i16>
269; AVX512DQ-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %A = sext <8 x i16> undef to <8 x i32>
270; AVX512DQ-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %B = zext <8 x i16> undef to <8 x i32>
271; AVX512DQ-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %C = sext <4 x i32> undef to <4 x i64>
272; AVX512DQ-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %C.v8i8.z = zext <8 x i8> undef to <8 x i32>
273; AVX512DQ-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %C.v8i8.s = sext <8 x i8> undef to <8 x i32>
274; AVX512DQ-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %C.v4i16.z = zext <4 x i16> undef to <4 x i64>
275; AVX512DQ-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %C.v4i16.s = sext <4 x i16> undef to <4 x i64>
276; AVX512DQ-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %C.v4i8.z = zext <4 x i8> undef to <4 x i64>
277; AVX512DQ-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %C.v4i8.s = sext <4 x i8> undef to <4 x i64>
278; AVX512DQ-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %D = zext <4 x i32> undef to <4 x i64>
279; AVX512DQ-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %D1 = zext <8 x i32> undef to <8 x i64>
280; AVX512DQ-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %D2 = sext <8 x i32> undef to <8 x i64>
281; AVX512DQ-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %D3 = zext <16 x i16> undef to <16 x i32>
282; AVX512DQ-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %D4 = zext <16 x i8> undef to <16 x i32>
283; AVX512DQ-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %D5 = zext <16 x i1> undef to <16 x i32>
284; AVX512DQ-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %E = trunc <4 x i64> undef to <4 x i32>
285; AVX512DQ-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %F = trunc <8 x i32> undef to <8 x i16>
286; AVX512DQ-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %F1 = trunc <16 x i16> undef to <16 x i8>
287; AVX512DQ-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %F2 = trunc <8 x i32> undef to <8 x i8>
288; AVX512DQ-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %F3 = trunc <4 x i64> undef to <4 x i8>
289; AVX512DQ-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %G = trunc <8 x i64> undef to <8 x i32>
290; AVX512DQ-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %G1 = trunc <16 x i32> undef to <16 x i16>
291; AVX512DQ-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %G2 = trunc <16 x i32> undef to <16 x i8>
292; AVX512DQ-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i32 undef
293;
294  %Z = zext <8 x i1> %in to <8 x i32>
295  %S = sext <8 x i1> %in to <8 x i32>
296
297  %A1 = zext <16 x i8> undef to <16 x i16>
298  %A2 = sext <16 x i8> undef to <16 x i16>
299  %A = sext <8 x i16> undef to <8 x i32>
300  %B = zext <8 x i16> undef to <8 x i32>
301  %C = sext <4 x i32> undef to <4 x i64>
302
303  %C.v8i8.z = zext <8 x i8> undef to <8 x i32>
304  %C.v8i8.s = sext <8 x i8> undef to <8 x i32>
305  %C.v4i16.z = zext <4 x i16> undef to <4 x i64>
306  %C.v4i16.s = sext <4 x i16> undef to <4 x i64>
307
308  %C.v4i8.z = zext <4 x i8> undef to <4 x i64>
309  %C.v4i8.s = sext <4 x i8> undef to <4 x i64>
310
311  %D = zext <4 x i32> undef to <4 x i64>
312
313  %D1 = zext <8 x i32> undef to <8 x i64>
314
315  %D2 = sext <8 x i32> undef to <8 x i64>
316
317  %D3 = zext <16 x i16> undef to <16 x i32>
318  %D4 = zext <16 x i8> undef to <16 x i32>
319  %D5 = zext <16 x i1> undef to <16 x i32>
320
321  %E = trunc <4 x i64> undef to <4 x i32>
322  %F = trunc <8 x i32> undef to <8 x i16>
323  %F1 = trunc <16 x i16> undef to <16 x i8>
324  %F2 = trunc <8 x i32> undef to <8 x i8>
325  %F3 = trunc <4 x i64> undef to <4 x i8>
326
327  %G = trunc <8 x i64> undef to <8 x i32>
328  %G1 = trunc <16 x i32> undef to <16 x i16>
329  %G2 = trunc <16 x i32> undef to <16 x i8>
330  ret i32 undef
331}
332
333define i32 @masks8(<8 x i1> %in) {
334; SSE2-LABEL: 'masks8'
335; SSE2-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %Z = zext <8 x i1> %in to <8 x i32>
336; SSE2-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %S = sext <8 x i1> %in to <8 x i32>
337; SSE2-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i32 undef
338;
339; SSE41-LABEL: 'masks8'
340; SSE41-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %Z = zext <8 x i1> %in to <8 x i32>
341; SSE41-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %S = sext <8 x i1> %in to <8 x i32>
342; SSE41-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i32 undef
343;
344; AVX1-LABEL: 'masks8'
345; AVX1-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %Z = zext <8 x i1> %in to <8 x i32>
346; AVX1-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %S = sext <8 x i1> %in to <8 x i32>
347; AVX1-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i32 undef
348;
349; AVX2-LABEL: 'masks8'
350; AVX2-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %Z = zext <8 x i1> %in to <8 x i32>
351; AVX2-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %S = sext <8 x i1> %in to <8 x i32>
352; AVX2-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i32 undef
353;
354; AVX512-LABEL: 'masks8'
355; AVX512-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %Z = zext <8 x i1> %in to <8 x i32>
356; AVX512-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %S = sext <8 x i1> %in to <8 x i32>
357; AVX512-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i32 undef
358;
359  %Z = zext <8 x i1> %in to <8 x i32>
360  %S = sext <8 x i1> %in to <8 x i32>
361  ret i32 undef
362}
363
364define i32 @masks4(<4 x i1> %in) {
365; SSE2-LABEL: 'masks4'
366; SSE2-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %Z = zext <4 x i1> %in to <4 x i64>
367; SSE2-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %S = sext <4 x i1> %in to <4 x i64>
368; SSE2-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i32 undef
369;
370; SSE41-LABEL: 'masks4'
371; SSE41-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %Z = zext <4 x i1> %in to <4 x i64>
372; SSE41-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %S = sext <4 x i1> %in to <4 x i64>
373; SSE41-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i32 undef
374;
375; AVX1-LABEL: 'masks4'
376; AVX1-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %Z = zext <4 x i1> %in to <4 x i64>
377; AVX1-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %S = sext <4 x i1> %in to <4 x i64>
378; AVX1-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i32 undef
379;
380; AVX2-LABEL: 'masks4'
381; AVX2-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %Z = zext <4 x i1> %in to <4 x i64>
382; AVX2-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %S = sext <4 x i1> %in to <4 x i64>
383; AVX2-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i32 undef
384;
385; AVX512-LABEL: 'masks4'
386; AVX512-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %Z = zext <4 x i1> %in to <4 x i64>
387; AVX512-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %S = sext <4 x i1> %in to <4 x i64>
388; AVX512-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i32 undef
389;
390  %Z = zext <4 x i1> %in to <4 x i64>
391  %S = sext <4 x i1> %in to <4 x i64>
392  ret i32 undef
393}
394
395define void @sitofp4(<4 x i1> %a, <4 x i8> %b, <4 x i16> %c, <4 x i32> %d) {
396; SSE2-LABEL: 'sitofp4'
397; SSE2-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %A1 = sitofp <4 x i1> %a to <4 x float>
398; SSE2-NEXT:  Cost Model: Found an estimated cost of 8 for instruction: %A2 = sitofp <4 x i1> %a to <4 x double>
399; SSE2-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %B1 = sitofp <4 x i8> %b to <4 x float>
400; SSE2-NEXT:  Cost Model: Found an estimated cost of 8 for instruction: %B2 = sitofp <4 x i8> %b to <4 x double>
401; SSE2-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %C1 = sitofp <4 x i16> %c to <4 x float>
402; SSE2-NEXT:  Cost Model: Found an estimated cost of 8 for instruction: %C2 = sitofp <4 x i16> %c to <4 x double>
403; SSE2-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %D1 = sitofp <4 x i32> %d to <4 x float>
404; SSE2-NEXT:  Cost Model: Found an estimated cost of 8 for instruction: %D2 = sitofp <4 x i32> %d to <4 x double>
405; SSE2-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret void
406;
407; SSE41-LABEL: 'sitofp4'
408; SSE41-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %A1 = sitofp <4 x i1> %a to <4 x float>
409; SSE41-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %A2 = sitofp <4 x i1> %a to <4 x double>
410; SSE41-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %B1 = sitofp <4 x i8> %b to <4 x float>
411; SSE41-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %B2 = sitofp <4 x i8> %b to <4 x double>
412; SSE41-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %C1 = sitofp <4 x i16> %c to <4 x float>
413; SSE41-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %C2 = sitofp <4 x i16> %c to <4 x double>
414; SSE41-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %D1 = sitofp <4 x i32> %d to <4 x float>
415; SSE41-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %D2 = sitofp <4 x i32> %d to <4 x double>
416; SSE41-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret void
417;
418; AVX1-LABEL: 'sitofp4'
419; AVX1-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %A1 = sitofp <4 x i1> %a to <4 x float>
420; AVX1-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %A2 = sitofp <4 x i1> %a to <4 x double>
421; AVX1-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %B1 = sitofp <4 x i8> %b to <4 x float>
422; AVX1-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %B2 = sitofp <4 x i8> %b to <4 x double>
423; AVX1-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %C1 = sitofp <4 x i16> %c to <4 x float>
424; AVX1-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %C2 = sitofp <4 x i16> %c to <4 x double>
425; AVX1-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %D1 = sitofp <4 x i32> %d to <4 x float>
426; AVX1-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %D2 = sitofp <4 x i32> %d to <4 x double>
427; AVX1-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret void
428;
429; AVX2-LABEL: 'sitofp4'
430; AVX2-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %A1 = sitofp <4 x i1> %a to <4 x float>
431; AVX2-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %A2 = sitofp <4 x i1> %a to <4 x double>
432; AVX2-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %B1 = sitofp <4 x i8> %b to <4 x float>
433; AVX2-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %B2 = sitofp <4 x i8> %b to <4 x double>
434; AVX2-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %C1 = sitofp <4 x i16> %c to <4 x float>
435; AVX2-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %C2 = sitofp <4 x i16> %c to <4 x double>
436; AVX2-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %D1 = sitofp <4 x i32> %d to <4 x float>
437; AVX2-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %D2 = sitofp <4 x i32> %d to <4 x double>
438; AVX2-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret void
439;
440; AVX512-LABEL: 'sitofp4'
441; AVX512-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %A1 = sitofp <4 x i1> %a to <4 x float>
442; AVX512-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %A2 = sitofp <4 x i1> %a to <4 x double>
443; AVX512-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %B1 = sitofp <4 x i8> %b to <4 x float>
444; AVX512-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %B2 = sitofp <4 x i8> %b to <4 x double>
445; AVX512-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %C1 = sitofp <4 x i16> %c to <4 x float>
446; AVX512-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %C2 = sitofp <4 x i16> %c to <4 x double>
447; AVX512-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %D1 = sitofp <4 x i32> %d to <4 x float>
448; AVX512-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %D2 = sitofp <4 x i32> %d to <4 x double>
449; AVX512-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret void
450;
451  %A1 = sitofp <4 x i1> %a to <4 x float>
452  %A2 = sitofp <4 x i1> %a to <4 x double>
453  %B1 = sitofp <4 x i8> %b to <4 x float>
454  %B2 = sitofp <4 x i8> %b to <4 x double>
455  %C1 = sitofp <4 x i16> %c to <4 x float>
456  %C2 = sitofp <4 x i16> %c to <4 x double>
457  %D1 = sitofp <4 x i32> %d to <4 x float>
458  %D2 = sitofp <4 x i32> %d to <4 x double>
459  ret void
460}
461
462define void @sitofp8(<8 x i1> %a, <8 x i8> %b, <8 x i16> %c, <8 x i32> %d) {
463; SSE2-LABEL: 'sitofp8'
464; SSE2-NEXT:  Cost Model: Found an estimated cost of 6 for instruction: %A1 = sitofp <8 x i1> %a to <8 x float>
465; SSE2-NEXT:  Cost Model: Found an estimated cost of 6 for instruction: %B1 = sitofp <8 x i8> %b to <8 x float>
466; SSE2-NEXT:  Cost Model: Found an estimated cost of 6 for instruction: %C1 = sitofp <8 x i16> %c to <8 x float>
467; SSE2-NEXT:  Cost Model: Found an estimated cost of 6 for instruction: %D1 = sitofp <8 x i32> %d to <8 x float>
468; SSE2-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret void
469;
470; SSE41-LABEL: 'sitofp8'
471; SSE41-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %A1 = sitofp <8 x i1> %a to <8 x float>
472; SSE41-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %B1 = sitofp <8 x i8> %b to <8 x float>
473; SSE41-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %C1 = sitofp <8 x i16> %c to <8 x float>
474; SSE41-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %D1 = sitofp <8 x i32> %d to <8 x float>
475; SSE41-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret void
476;
477; AVX1-LABEL: 'sitofp8'
478; AVX1-NEXT:  Cost Model: Found an estimated cost of 8 for instruction: %A1 = sitofp <8 x i1> %a to <8 x float>
479; AVX1-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %B1 = sitofp <8 x i8> %b to <8 x float>
480; AVX1-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %C1 = sitofp <8 x i16> %c to <8 x float>
481; AVX1-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %D1 = sitofp <8 x i32> %d to <8 x float>
482; AVX1-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret void
483;
484; AVX2-LABEL: 'sitofp8'
485; AVX2-NEXT:  Cost Model: Found an estimated cost of 8 for instruction: %A1 = sitofp <8 x i1> %a to <8 x float>
486; AVX2-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %B1 = sitofp <8 x i8> %b to <8 x float>
487; AVX2-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %C1 = sitofp <8 x i16> %c to <8 x float>
488; AVX2-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %D1 = sitofp <8 x i32> %d to <8 x float>
489; AVX2-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret void
490;
491; AVX512-LABEL: 'sitofp8'
492; AVX512-NEXT:  Cost Model: Found an estimated cost of 8 for instruction: %A1 = sitofp <8 x i1> %a to <8 x float>
493; AVX512-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %B1 = sitofp <8 x i8> %b to <8 x float>
494; AVX512-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %C1 = sitofp <8 x i16> %c to <8 x float>
495; AVX512-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %D1 = sitofp <8 x i32> %d to <8 x float>
496; AVX512-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret void
497;
498  %A1 = sitofp <8 x i1> %a to <8 x float>
499  %B1 = sitofp <8 x i8> %b to <8 x float>
500  %C1 = sitofp <8 x i16> %c to <8 x float>
501  %D1 = sitofp <8 x i32> %d to <8 x float>
502  ret void
503}
504
505define void @uitofp4(<4 x i1> %a, <4 x i8> %b, <4 x i16> %c, <4 x i32> %d) {
506; SSE2-LABEL: 'uitofp4'
507; SSE2-NEXT:  Cost Model: Found an estimated cost of 5 for instruction: %A1 = uitofp <4 x i1> %a to <4 x float>
508; SSE2-NEXT:  Cost Model: Found an estimated cost of 14 for instruction: %A2 = uitofp <4 x i1> %a to <4 x double>
509; SSE2-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %B1 = uitofp <4 x i8> %b to <4 x float>
510; SSE2-NEXT:  Cost Model: Found an estimated cost of 8 for instruction: %B2 = uitofp <4 x i8> %b to <4 x double>
511; SSE2-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %C1 = uitofp <4 x i16> %c to <4 x float>
512; SSE2-NEXT:  Cost Model: Found an estimated cost of 8 for instruction: %C2 = uitofp <4 x i16> %c to <4 x double>
513; SSE2-NEXT:  Cost Model: Found an estimated cost of 5 for instruction: %D1 = uitofp <4 x i32> %d to <4 x float>
514; SSE2-NEXT:  Cost Model: Found an estimated cost of 14 for instruction: %D2 = uitofp <4 x i32> %d to <4 x double>
515; SSE2-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret void
516;
517; SSE41-LABEL: 'uitofp4'
518; SSE41-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %A1 = uitofp <4 x i1> %a to <4 x float>
519; SSE41-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %A2 = uitofp <4 x i1> %a to <4 x double>
520; SSE41-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %B1 = uitofp <4 x i8> %b to <4 x float>
521; SSE41-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %B2 = uitofp <4 x i8> %b to <4 x double>
522; SSE41-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %C1 = uitofp <4 x i16> %c to <4 x float>
523; SSE41-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %C2 = uitofp <4 x i16> %c to <4 x double>
524; SSE41-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %D1 = uitofp <4 x i32> %d to <4 x float>
525; SSE41-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %D2 = uitofp <4 x i32> %d to <4 x double>
526; SSE41-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret void
527;
528; AVX1-LABEL: 'uitofp4'
529; AVX1-NEXT:  Cost Model: Found an estimated cost of 7 for instruction: %A1 = uitofp <4 x i1> %a to <4 x float>
530; AVX1-NEXT:  Cost Model: Found an estimated cost of 7 for instruction: %A2 = uitofp <4 x i1> %a to <4 x double>
531; AVX1-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %B1 = uitofp <4 x i8> %b to <4 x float>
532; AVX1-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %B2 = uitofp <4 x i8> %b to <4 x double>
533; AVX1-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %C1 = uitofp <4 x i16> %c to <4 x float>
534; AVX1-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %C2 = uitofp <4 x i16> %c to <4 x double>
535; AVX1-NEXT:  Cost Model: Found an estimated cost of 5 for instruction: %D1 = uitofp <4 x i32> %d to <4 x float>
536; AVX1-NEXT:  Cost Model: Found an estimated cost of 6 for instruction: %D2 = uitofp <4 x i32> %d to <4 x double>
537; AVX1-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret void
538;
539; AVX2-LABEL: 'uitofp4'
540; AVX2-NEXT:  Cost Model: Found an estimated cost of 7 for instruction: %A1 = uitofp <4 x i1> %a to <4 x float>
541; AVX2-NEXT:  Cost Model: Found an estimated cost of 7 for instruction: %A2 = uitofp <4 x i1> %a to <4 x double>
542; AVX2-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %B1 = uitofp <4 x i8> %b to <4 x float>
543; AVX2-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %B2 = uitofp <4 x i8> %b to <4 x double>
544; AVX2-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %C1 = uitofp <4 x i16> %c to <4 x float>
545; AVX2-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %C2 = uitofp <4 x i16> %c to <4 x double>
546; AVX2-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %D1 = uitofp <4 x i32> %d to <4 x float>
547; AVX2-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %D2 = uitofp <4 x i32> %d to <4 x double>
548; AVX2-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret void
549;
550; AVX512-LABEL: 'uitofp4'
551; AVX512-NEXT:  Cost Model: Found an estimated cost of 7 for instruction: %A1 = uitofp <4 x i1> %a to <4 x float>
552; AVX512-NEXT:  Cost Model: Found an estimated cost of 7 for instruction: %A2 = uitofp <4 x i1> %a to <4 x double>
553; AVX512-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %B1 = uitofp <4 x i8> %b to <4 x float>
554; AVX512-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %B2 = uitofp <4 x i8> %b to <4 x double>
555; AVX512-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %C1 = uitofp <4 x i16> %c to <4 x float>
556; AVX512-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %C2 = uitofp <4 x i16> %c to <4 x double>
557; AVX512-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %D1 = uitofp <4 x i32> %d to <4 x float>
558; AVX512-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %D2 = uitofp <4 x i32> %d to <4 x double>
559; AVX512-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret void
560;
561  %A1 = uitofp <4 x i1> %a to <4 x float>
562  %A2 = uitofp <4 x i1> %a to <4 x double>
563  %B1 = uitofp <4 x i8> %b to <4 x float>
564  %B2 = uitofp <4 x i8> %b to <4 x double>
565  %C1 = uitofp <4 x i16> %c to <4 x float>
566  %C2 = uitofp <4 x i16> %c to <4 x double>
567  %D1 = uitofp <4 x i32> %d to <4 x float>
568  %D2 = uitofp <4 x i32> %d to <4 x double>
569  ret void
570}
571
572define void @uitofp8(<8 x i1> %a, <8 x i8> %b, <8 x i16> %c, <8 x i32> %d) {
573; SSE2-LABEL: 'uitofp8'
574; SSE2-NEXT:  Cost Model: Found an estimated cost of 8 for instruction: %A1 = uitofp <8 x i1> %a to <8 x float>
575; SSE2-NEXT:  Cost Model: Found an estimated cost of 8 for instruction: %B1 = uitofp <8 x i8> %b to <8 x float>
576; SSE2-NEXT:  Cost Model: Found an estimated cost of 8 for instruction: %C1 = uitofp <8 x i16> %c to <8 x float>
577; SSE2-NEXT:  Cost Model: Found an estimated cost of 10 for instruction: %D1 = uitofp <8 x i32> %d to <8 x float>
578; SSE2-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret void
579;
580; SSE41-LABEL: 'uitofp8'
581; SSE41-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %A1 = uitofp <8 x i1> %a to <8 x float>
582; SSE41-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %B1 = uitofp <8 x i8> %b to <8 x float>
583; SSE41-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %C1 = uitofp <8 x i16> %c to <8 x float>
584; SSE41-NEXT:  Cost Model: Found an estimated cost of 6 for instruction: %D1 = uitofp <8 x i32> %d to <8 x float>
585; SSE41-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret void
586;
587; AVX1-LABEL: 'uitofp8'
588; AVX1-NEXT:  Cost Model: Found an estimated cost of 6 for instruction: %A1 = uitofp <8 x i1> %a to <8 x float>
589; AVX1-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %B1 = uitofp <8 x i8> %b to <8 x float>
590; AVX1-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %C1 = uitofp <8 x i16> %c to <8 x float>
591; AVX1-NEXT:  Cost Model: Found an estimated cost of 8 for instruction: %D1 = uitofp <8 x i32> %d to <8 x float>
592; AVX1-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret void
593;
594; AVX2-LABEL: 'uitofp8'
595; AVX2-NEXT:  Cost Model: Found an estimated cost of 6 for instruction: %A1 = uitofp <8 x i1> %a to <8 x float>
596; AVX2-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %B1 = uitofp <8 x i8> %b to <8 x float>
597; AVX2-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %C1 = uitofp <8 x i16> %c to <8 x float>
598; AVX2-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %D1 = uitofp <8 x i32> %d to <8 x float>
599; AVX2-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret void
600;
601; AVX512-LABEL: 'uitofp8'
602; AVX512-NEXT:  Cost Model: Found an estimated cost of 6 for instruction: %A1 = uitofp <8 x i1> %a to <8 x float>
603; AVX512-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %B1 = uitofp <8 x i8> %b to <8 x float>
604; AVX512-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %C1 = uitofp <8 x i16> %c to <8 x float>
605; AVX512-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %D1 = uitofp <8 x i32> %d to <8 x float>
606; AVX512-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret void
607;
608  %A1 = uitofp <8 x i1> %a to <8 x float>
609  %B1 = uitofp <8 x i8> %b to <8 x float>
610  %C1 = uitofp <8 x i16> %c to <8 x float>
611  %D1 = uitofp <8 x i32> %d to <8 x float>
612  ret void
613}
614
615define void @fp_conv(<8 x float> %a, <16 x float>%b, <4 x float> %c) {
616; SSE-LABEL: 'fp_conv'
617; SSE-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %A1 = fpext <4 x float> %c to <4 x double>
618; SSE-NEXT:  Cost Model: Found an estimated cost of 6 for instruction: %A2 = fpext <8 x float> %a to <8 x double>
619; SSE-NEXT:  Cost Model: Found an estimated cost of 12 for instruction: %A3 = fpext <16 x float> %b to <16 x double>
620; SSE-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %A4 = fptrunc <4 x double> undef to <4 x float>
621; SSE-NEXT:  Cost Model: Found an estimated cost of 6 for instruction: %A5 = fptrunc <8 x double> undef to <8 x float>
622; SSE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret void
623;
624; AVX-LABEL: 'fp_conv'
625; AVX-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %A1 = fpext <4 x float> %c to <4 x double>
626; AVX-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %A2 = fpext <8 x float> %a to <8 x double>
627; AVX-NEXT:  Cost Model: Found an estimated cost of 6 for instruction: %A3 = fpext <16 x float> %b to <16 x double>
628; AVX-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %A4 = fptrunc <4 x double> undef to <4 x float>
629; AVX-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %A5 = fptrunc <8 x double> undef to <8 x float>
630; AVX-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret void
631;
632; AVX512-LABEL: 'fp_conv'
633; AVX512-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %A1 = fpext <4 x float> %c to <4 x double>
634; AVX512-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %A2 = fpext <8 x float> %a to <8 x double>
635; AVX512-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %A3 = fpext <16 x float> %b to <16 x double>
636; AVX512-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %A4 = fptrunc <4 x double> undef to <4 x float>
637; AVX512-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %A5 = fptrunc <8 x double> undef to <8 x float>
638; AVX512-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret void
639;
640  %A1 = fpext <4 x float> %c to <4 x double>
641  %A2 = fpext <8 x float> %a to <8 x double>
642  %A3 = fpext <16 x float> %b to <16 x double>
643  %A4 = fptrunc <4 x double> undef to <4 x float>
644  %A5 = fptrunc <8 x double> undef to <8 x float>
645  ret void
646}
647