xref: /llvm-project/llvm/test/Analysis/CostModel/X86/select-codesize.ll (revision 3edec9ba602c1ed5904e5bbcd8986dcd05fe3a83)
10de2c3d7SSimon Pilgrim; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py
2*3edec9baSSimon Pilgrim; RUN: opt < %s -passes="print<cost-model>" 2>&1 -disable-output -cost-kind=code-size -mtriple=x86_64-- -mattr=+sse2 | FileCheck %s -check-prefixes=SSE2
3*3edec9baSSimon Pilgrim; RUN: opt < %s -passes="print<cost-model>" 2>&1 -disable-output -cost-kind=code-size -mtriple=x86_64-- -mattr=+sse4.1 | FileCheck %s -check-prefixes=SSE4
4*3edec9baSSimon Pilgrim; RUN: opt < %s -passes="print<cost-model>" 2>&1 -disable-output -cost-kind=code-size -mtriple=x86_64-- -mattr=+avx | FileCheck %s -check-prefixes=AVX,AVX1
5*3edec9baSSimon Pilgrim; RUN: opt < %s -passes="print<cost-model>" 2>&1 -disable-output -cost-kind=code-size -mtriple=x86_64-- -mattr=+avx2 | FileCheck %s -check-prefixes=AVX,AVX2
6*3edec9baSSimon Pilgrim; RUN: opt < %s -passes="print<cost-model>" 2>&1 -disable-output -cost-kind=code-size -mtriple=x86_64-- -mattr=+avx512f,+avx512vl  | FileCheck %s -check-prefixes=AVX512,AVX512F
7*3edec9baSSimon Pilgrim; RUN: opt < %s -passes="print<cost-model>" 2>&1 -disable-output -cost-kind=code-size -mtriple=x86_64-- -mattr=+avx512bw,+avx512vl | FileCheck %s -check-prefixes=AVX512,AVX512BW
80de2c3d7SSimon Pilgrim;
9*3edec9baSSimon Pilgrim; RUN: opt < %s -passes="print<cost-model>" 2>&1 -disable-output -cost-kind=code-size -mtriple=x86_64-- -mcpu=slm | FileCheck %s --check-prefixes=SSE4
10*3edec9baSSimon Pilgrim; RUN: opt < %s -passes="print<cost-model>" 2>&1 -disable-output -cost-kind=code-size -mtriple=x86_64-- -mcpu=goldmont | FileCheck %s --check-prefixes=SSE4
11*3edec9baSSimon Pilgrim; RUN: opt < %s -passes="print<cost-model>" 2>&1 -disable-output -cost-kind=code-size -mtriple=x86_64-- -mcpu=btver2 | FileCheck %s --check-prefixes=AVX,AVX1
120de2c3d7SSimon Pilgrim
130de2c3d7SSimon Pilgrim; Verify the cost of vector select instructions.
140de2c3d7SSimon Pilgrim
150de2c3d7SSimon Pilgrimdefine i32 @test_select() {
16*3edec9baSSimon Pilgrim; SSE2-LABEL: 'test_select'
17*3edec9baSSimon Pilgrim; SSE2-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %I64 = select i1 undef, i64 undef, i64 undef
18*3edec9baSSimon Pilgrim; SSE2-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %V2I64 = select <2 x i1> undef, <2 x i64> undef, <2 x i64> undef
19*3edec9baSSimon Pilgrim; SSE2-NEXT:  Cost Model: Found an estimated cost of 6 for instruction: %V4I64 = select <4 x i1> undef, <4 x i64> undef, <4 x i64> undef
20*3edec9baSSimon Pilgrim; SSE2-NEXT:  Cost Model: Found an estimated cost of 12 for instruction: %V8I64 = select <8 x i1> undef, <8 x i64> undef, <8 x i64> undef
21*3edec9baSSimon Pilgrim; SSE2-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %I32 = select i1 undef, i32 undef, i32 undef
22*3edec9baSSimon Pilgrim; SSE2-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %V4I32 = select <4 x i1> undef, <4 x i32> undef, <4 x i32> undef
23*3edec9baSSimon Pilgrim; SSE2-NEXT:  Cost Model: Found an estimated cost of 6 for instruction: %V8I32 = select <8 x i1> undef, <8 x i32> undef, <8 x i32> undef
24*3edec9baSSimon Pilgrim; SSE2-NEXT:  Cost Model: Found an estimated cost of 12 for instruction: %V16I32 = select <16 x i1> undef, <16 x i32> undef, <16 x i32> undef
25*3edec9baSSimon Pilgrim; SSE2-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %I16 = select i1 undef, i16 undef, i16 undef
26*3edec9baSSimon Pilgrim; SSE2-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %V8I16 = select <8 x i1> undef, <8 x i16> undef, <8 x i16> undef
27*3edec9baSSimon Pilgrim; SSE2-NEXT:  Cost Model: Found an estimated cost of 6 for instruction: %V16I16 = select <16 x i1> undef, <16 x i16> undef, <16 x i16> undef
28*3edec9baSSimon Pilgrim; SSE2-NEXT:  Cost Model: Found an estimated cost of 12 for instruction: %V32I16 = select <32 x i1> undef, <32 x i16> undef, <32 x i16> undef
29*3edec9baSSimon Pilgrim; SSE2-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %I8 = select i1 undef, i8 undef, i8 undef
30*3edec9baSSimon Pilgrim; SSE2-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %V16I8 = select <16 x i1> undef, <16 x i8> undef, <16 x i8> undef
31*3edec9baSSimon Pilgrim; SSE2-NEXT:  Cost Model: Found an estimated cost of 6 for instruction: %V32I8 = select <32 x i1> undef, <32 x i8> undef, <32 x i8> undef
32*3edec9baSSimon Pilgrim; SSE2-NEXT:  Cost Model: Found an estimated cost of 12 for instruction: %V64I8 = select <64 x i1> undef, <64 x i8> undef, <64 x i8> undef
33*3edec9baSSimon Pilgrim; SSE2-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret i32 undef
34*3edec9baSSimon Pilgrim;
35*3edec9baSSimon Pilgrim; SSE4-LABEL: 'test_select'
36*3edec9baSSimon Pilgrim; SSE4-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %I64 = select i1 undef, i64 undef, i64 undef
37*3edec9baSSimon Pilgrim; SSE4-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V2I64 = select <2 x i1> undef, <2 x i64> undef, <2 x i64> undef
38*3edec9baSSimon Pilgrim; SSE4-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V4I64 = select <4 x i1> undef, <4 x i64> undef, <4 x i64> undef
39*3edec9baSSimon Pilgrim; SSE4-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %V8I64 = select <8 x i1> undef, <8 x i64> undef, <8 x i64> undef
40*3edec9baSSimon Pilgrim; SSE4-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %I32 = select i1 undef, i32 undef, i32 undef
41*3edec9baSSimon Pilgrim; SSE4-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V4I32 = select <4 x i1> undef, <4 x i32> undef, <4 x i32> undef
42*3edec9baSSimon Pilgrim; SSE4-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V8I32 = select <8 x i1> undef, <8 x i32> undef, <8 x i32> undef
43*3edec9baSSimon Pilgrim; SSE4-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %V16I32 = select <16 x i1> undef, <16 x i32> undef, <16 x i32> undef
44*3edec9baSSimon Pilgrim; SSE4-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %I16 = select i1 undef, i16 undef, i16 undef
45*3edec9baSSimon Pilgrim; SSE4-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V8I16 = select <8 x i1> undef, <8 x i16> undef, <8 x i16> undef
46*3edec9baSSimon Pilgrim; SSE4-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V16I16 = select <16 x i1> undef, <16 x i16> undef, <16 x i16> undef
47*3edec9baSSimon Pilgrim; SSE4-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %V32I16 = select <32 x i1> undef, <32 x i16> undef, <32 x i16> undef
48*3edec9baSSimon Pilgrim; SSE4-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %I8 = select i1 undef, i8 undef, i8 undef
49*3edec9baSSimon Pilgrim; SSE4-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V16I8 = select <16 x i1> undef, <16 x i8> undef, <16 x i8> undef
50*3edec9baSSimon Pilgrim; SSE4-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V32I8 = select <32 x i1> undef, <32 x i8> undef, <32 x i8> undef
51*3edec9baSSimon Pilgrim; SSE4-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %V64I8 = select <64 x i1> undef, <64 x i8> undef, <64 x i8> undef
52*3edec9baSSimon Pilgrim; SSE4-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret i32 undef
53*3edec9baSSimon Pilgrim;
54*3edec9baSSimon Pilgrim; AVX1-LABEL: 'test_select'
55*3edec9baSSimon Pilgrim; AVX1-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %I64 = select i1 undef, i64 undef, i64 undef
56*3edec9baSSimon Pilgrim; AVX1-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V2I64 = select <2 x i1> undef, <2 x i64> undef, <2 x i64> undef
57*3edec9baSSimon Pilgrim; AVX1-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V4I64 = select <4 x i1> undef, <4 x i64> undef, <4 x i64> undef
58*3edec9baSSimon Pilgrim; AVX1-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V8I64 = select <8 x i1> undef, <8 x i64> undef, <8 x i64> undef
59*3edec9baSSimon Pilgrim; AVX1-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %I32 = select i1 undef, i32 undef, i32 undef
60*3edec9baSSimon Pilgrim; AVX1-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V4I32 = select <4 x i1> undef, <4 x i32> undef, <4 x i32> undef
61*3edec9baSSimon Pilgrim; AVX1-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V8I32 = select <8 x i1> undef, <8 x i32> undef, <8 x i32> undef
62*3edec9baSSimon Pilgrim; AVX1-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V16I32 = select <16 x i1> undef, <16 x i32> undef, <16 x i32> undef
63*3edec9baSSimon Pilgrim; AVX1-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %I16 = select i1 undef, i16 undef, i16 undef
64*3edec9baSSimon Pilgrim; AVX1-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V8I16 = select <8 x i1> undef, <8 x i16> undef, <8 x i16> undef
65*3edec9baSSimon Pilgrim; AVX1-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %V16I16 = select <16 x i1> undef, <16 x i16> undef, <16 x i16> undef
66*3edec9baSSimon Pilgrim; AVX1-NEXT:  Cost Model: Found an estimated cost of 6 for instruction: %V32I16 = select <32 x i1> undef, <32 x i16> undef, <32 x i16> undef
67*3edec9baSSimon Pilgrim; AVX1-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %I8 = select i1 undef, i8 undef, i8 undef
68*3edec9baSSimon Pilgrim; AVX1-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V16I8 = select <16 x i1> undef, <16 x i8> undef, <16 x i8> undef
69*3edec9baSSimon Pilgrim; AVX1-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %V32I8 = select <32 x i1> undef, <32 x i8> undef, <32 x i8> undef
70*3edec9baSSimon Pilgrim; AVX1-NEXT:  Cost Model: Found an estimated cost of 6 for instruction: %V64I8 = select <64 x i1> undef, <64 x i8> undef, <64 x i8> undef
71*3edec9baSSimon Pilgrim; AVX1-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret i32 undef
72*3edec9baSSimon Pilgrim;
73*3edec9baSSimon Pilgrim; AVX2-LABEL: 'test_select'
74*3edec9baSSimon Pilgrim; AVX2-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %I64 = select i1 undef, i64 undef, i64 undef
75*3edec9baSSimon Pilgrim; AVX2-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V2I64 = select <2 x i1> undef, <2 x i64> undef, <2 x i64> undef
76*3edec9baSSimon Pilgrim; AVX2-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V4I64 = select <4 x i1> undef, <4 x i64> undef, <4 x i64> undef
77*3edec9baSSimon Pilgrim; AVX2-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V8I64 = select <8 x i1> undef, <8 x i64> undef, <8 x i64> undef
78*3edec9baSSimon Pilgrim; AVX2-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %I32 = select i1 undef, i32 undef, i32 undef
79*3edec9baSSimon Pilgrim; AVX2-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V4I32 = select <4 x i1> undef, <4 x i32> undef, <4 x i32> undef
80*3edec9baSSimon Pilgrim; AVX2-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V8I32 = select <8 x i1> undef, <8 x i32> undef, <8 x i32> undef
81*3edec9baSSimon Pilgrim; AVX2-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V16I32 = select <16 x i1> undef, <16 x i32> undef, <16 x i32> undef
82*3edec9baSSimon Pilgrim; AVX2-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %I16 = select i1 undef, i16 undef, i16 undef
83*3edec9baSSimon Pilgrim; AVX2-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V8I16 = select <8 x i1> undef, <8 x i16> undef, <8 x i16> undef
84*3edec9baSSimon Pilgrim; AVX2-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V16I16 = select <16 x i1> undef, <16 x i16> undef, <16 x i16> undef
85*3edec9baSSimon Pilgrim; AVX2-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V32I16 = select <32 x i1> undef, <32 x i16> undef, <32 x i16> undef
86*3edec9baSSimon Pilgrim; AVX2-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %I8 = select i1 undef, i8 undef, i8 undef
87*3edec9baSSimon Pilgrim; AVX2-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V16I8 = select <16 x i1> undef, <16 x i8> undef, <16 x i8> undef
88*3edec9baSSimon Pilgrim; AVX2-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V32I8 = select <32 x i1> undef, <32 x i8> undef, <32 x i8> undef
89*3edec9baSSimon Pilgrim; AVX2-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V64I8 = select <64 x i1> undef, <64 x i8> undef, <64 x i8> undef
90*3edec9baSSimon Pilgrim; AVX2-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret i32 undef
91*3edec9baSSimon Pilgrim;
92*3edec9baSSimon Pilgrim; AVX512F-LABEL: 'test_select'
93*3edec9baSSimon Pilgrim; AVX512F-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %I64 = select i1 undef, i64 undef, i64 undef
94*3edec9baSSimon Pilgrim; AVX512F-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V2I64 = select <2 x i1> undef, <2 x i64> undef, <2 x i64> undef
95*3edec9baSSimon Pilgrim; AVX512F-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V4I64 = select <4 x i1> undef, <4 x i64> undef, <4 x i64> undef
96*3edec9baSSimon Pilgrim; AVX512F-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V8I64 = select <8 x i1> undef, <8 x i64> undef, <8 x i64> undef
97*3edec9baSSimon Pilgrim; AVX512F-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %I32 = select i1 undef, i32 undef, i32 undef
98*3edec9baSSimon Pilgrim; AVX512F-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V4I32 = select <4 x i1> undef, <4 x i32> undef, <4 x i32> undef
99*3edec9baSSimon Pilgrim; AVX512F-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V8I32 = select <8 x i1> undef, <8 x i32> undef, <8 x i32> undef
100*3edec9baSSimon Pilgrim; AVX512F-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V16I32 = select <16 x i1> undef, <16 x i32> undef, <16 x i32> undef
101*3edec9baSSimon Pilgrim; AVX512F-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %I16 = select i1 undef, i16 undef, i16 undef
102*3edec9baSSimon Pilgrim; AVX512F-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V8I16 = select <8 x i1> undef, <8 x i16> undef, <8 x i16> undef
103*3edec9baSSimon Pilgrim; AVX512F-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V16I16 = select <16 x i1> undef, <16 x i16> undef, <16 x i16> undef
104*3edec9baSSimon Pilgrim; AVX512F-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %V32I16 = select <32 x i1> undef, <32 x i16> undef, <32 x i16> undef
105*3edec9baSSimon Pilgrim; AVX512F-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %I8 = select i1 undef, i8 undef, i8 undef
106*3edec9baSSimon Pilgrim; AVX512F-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V16I8 = select <16 x i1> undef, <16 x i8> undef, <16 x i8> undef
107*3edec9baSSimon Pilgrim; AVX512F-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V32I8 = select <32 x i1> undef, <32 x i8> undef, <32 x i8> undef
108*3edec9baSSimon Pilgrim; AVX512F-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %V64I8 = select <64 x i1> undef, <64 x i8> undef, <64 x i8> undef
109*3edec9baSSimon Pilgrim; AVX512F-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret i32 undef
110*3edec9baSSimon Pilgrim;
111*3edec9baSSimon Pilgrim; AVX512BW-LABEL: 'test_select'
112*3edec9baSSimon Pilgrim; AVX512BW-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %I64 = select i1 undef, i64 undef, i64 undef
113*3edec9baSSimon Pilgrim; AVX512BW-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V2I64 = select <2 x i1> undef, <2 x i64> undef, <2 x i64> undef
114*3edec9baSSimon Pilgrim; AVX512BW-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V4I64 = select <4 x i1> undef, <4 x i64> undef, <4 x i64> undef
115*3edec9baSSimon Pilgrim; AVX512BW-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V8I64 = select <8 x i1> undef, <8 x i64> undef, <8 x i64> undef
116*3edec9baSSimon Pilgrim; AVX512BW-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %I32 = select i1 undef, i32 undef, i32 undef
117*3edec9baSSimon Pilgrim; AVX512BW-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V4I32 = select <4 x i1> undef, <4 x i32> undef, <4 x i32> undef
118*3edec9baSSimon Pilgrim; AVX512BW-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V8I32 = select <8 x i1> undef, <8 x i32> undef, <8 x i32> undef
119*3edec9baSSimon Pilgrim; AVX512BW-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V16I32 = select <16 x i1> undef, <16 x i32> undef, <16 x i32> undef
120*3edec9baSSimon Pilgrim; AVX512BW-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %I16 = select i1 undef, i16 undef, i16 undef
121*3edec9baSSimon Pilgrim; AVX512BW-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V8I16 = select <8 x i1> undef, <8 x i16> undef, <8 x i16> undef
122*3edec9baSSimon Pilgrim; AVX512BW-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V16I16 = select <16 x i1> undef, <16 x i16> undef, <16 x i16> undef
123*3edec9baSSimon Pilgrim; AVX512BW-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V32I16 = select <32 x i1> undef, <32 x i16> undef, <32 x i16> undef
124*3edec9baSSimon Pilgrim; AVX512BW-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %I8 = select i1 undef, i8 undef, i8 undef
125*3edec9baSSimon Pilgrim; AVX512BW-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V16I8 = select <16 x i1> undef, <16 x i8> undef, <16 x i8> undef
126*3edec9baSSimon Pilgrim; AVX512BW-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V32I8 = select <32 x i1> undef, <32 x i8> undef, <32 x i8> undef
127*3edec9baSSimon Pilgrim; AVX512BW-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V64I8 = select <64 x i1> undef, <64 x i8> undef, <64 x i8> undef
128*3edec9baSSimon Pilgrim; AVX512BW-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret i32 undef
1290de2c3d7SSimon Pilgrim;
1300de2c3d7SSimon Pilgrim  %I64 = select i1 undef, i64 undef, i64 undef
1310de2c3d7SSimon Pilgrim  %V2I64 = select <2 x i1> undef, <2 x i64> undef, <2 x i64> undef
1320de2c3d7SSimon Pilgrim  %V4I64 = select <4 x i1> undef, <4 x i64> undef, <4 x i64> undef
1330de2c3d7SSimon Pilgrim  %V8I64 = select <8 x i1> undef, <8 x i64> undef, <8 x i64> undef
1340de2c3d7SSimon Pilgrim
1350de2c3d7SSimon Pilgrim  %I32 = select i1 undef, i32 undef, i32 undef
1360de2c3d7SSimon Pilgrim  %V4I32 = select <4 x i1> undef, <4 x i32> undef, <4 x i32> undef
1370de2c3d7SSimon Pilgrim  %V8I32 = select <8 x i1> undef, <8 x i32> undef, <8 x i32> undef
1380de2c3d7SSimon Pilgrim  %V16I32 = select <16 x i1> undef, <16 x i32> undef, <16 x i32> undef
1390de2c3d7SSimon Pilgrim
1400de2c3d7SSimon Pilgrim  %I16 = select i1 undef, i16 undef, i16 undef
1410de2c3d7SSimon Pilgrim  %V8I16 = select <8 x i1> undef, <8 x i16> undef, <8 x i16> undef
1420de2c3d7SSimon Pilgrim  %V16I16 = select <16 x i1> undef, <16 x i16> undef, <16 x i16> undef
1430de2c3d7SSimon Pilgrim  %V32I16 = select <32 x i1> undef, <32 x i16> undef, <32 x i16> undef
1440de2c3d7SSimon Pilgrim
1450de2c3d7SSimon Pilgrim  %I8 = select i1 undef, i8 undef, i8 undef
1460de2c3d7SSimon Pilgrim  %V16I8 = select <16 x i1> undef, <16 x i8> undef, <16 x i8> undef
1470de2c3d7SSimon Pilgrim  %V32I8 = select <32 x i1> undef, <32 x i8> undef, <32 x i8> undef
1480de2c3d7SSimon Pilgrim  %V64I8 = select <64 x i1> undef, <64 x i8> undef, <64 x i8> undef
1490de2c3d7SSimon Pilgrim
1500de2c3d7SSimon Pilgrim  ret i32 undef
1510de2c3d7SSimon Pilgrim}
1520de2c3d7SSimon Pilgrim
1530de2c3d7SSimon Pilgrimdefine i32 @test_select_fp() {
154*3edec9baSSimon Pilgrim; SSE2-LABEL: 'test_select_fp'
155*3edec9baSSimon Pilgrim; SSE2-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %F64 = select i1 undef, double undef, double undef
156*3edec9baSSimon Pilgrim; SSE2-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %V2F64 = select <2 x i1> undef, <2 x double> undef, <2 x double> undef
157*3edec9baSSimon Pilgrim; SSE2-NEXT:  Cost Model: Found an estimated cost of 6 for instruction: %V4F64 = select <4 x i1> undef, <4 x double> undef, <4 x double> undef
158*3edec9baSSimon Pilgrim; SSE2-NEXT:  Cost Model: Found an estimated cost of 12 for instruction: %V8F64 = select <8 x i1> undef, <8 x double> undef, <8 x double> undef
159*3edec9baSSimon Pilgrim; SSE2-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %F32 = select i1 undef, float undef, float undef
160*3edec9baSSimon Pilgrim; SSE2-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %V4F32 = select <4 x i1> undef, <4 x float> undef, <4 x float> undef
161*3edec9baSSimon Pilgrim; SSE2-NEXT:  Cost Model: Found an estimated cost of 6 for instruction: %V8F32 = select <8 x i1> undef, <8 x float> undef, <8 x float> undef
162*3edec9baSSimon Pilgrim; SSE2-NEXT:  Cost Model: Found an estimated cost of 12 for instruction: %V16F32 = select <16 x i1> undef, <16 x float> undef, <16 x float> undef
163*3edec9baSSimon Pilgrim; SSE2-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret i32 undef
164*3edec9baSSimon Pilgrim;
165*3edec9baSSimon Pilgrim; SSE4-LABEL: 'test_select_fp'
166*3edec9baSSimon Pilgrim; SSE4-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %F64 = select i1 undef, double undef, double undef
167*3edec9baSSimon Pilgrim; SSE4-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V2F64 = select <2 x i1> undef, <2 x double> undef, <2 x double> undef
168*3edec9baSSimon Pilgrim; SSE4-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V4F64 = select <4 x i1> undef, <4 x double> undef, <4 x double> undef
169*3edec9baSSimon Pilgrim; SSE4-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %V8F64 = select <8 x i1> undef, <8 x double> undef, <8 x double> undef
170*3edec9baSSimon Pilgrim; SSE4-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %F32 = select i1 undef, float undef, float undef
171*3edec9baSSimon Pilgrim; SSE4-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V4F32 = select <4 x i1> undef, <4 x float> undef, <4 x float> undef
172*3edec9baSSimon Pilgrim; SSE4-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V8F32 = select <8 x i1> undef, <8 x float> undef, <8 x float> undef
173*3edec9baSSimon Pilgrim; SSE4-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %V16F32 = select <16 x i1> undef, <16 x float> undef, <16 x float> undef
174*3edec9baSSimon Pilgrim; SSE4-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret i32 undef
175*3edec9baSSimon Pilgrim;
176*3edec9baSSimon Pilgrim; AVX-LABEL: 'test_select_fp'
177*3edec9baSSimon Pilgrim; AVX-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %F64 = select i1 undef, double undef, double undef
178*3edec9baSSimon Pilgrim; AVX-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V2F64 = select <2 x i1> undef, <2 x double> undef, <2 x double> undef
179*3edec9baSSimon Pilgrim; AVX-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V4F64 = select <4 x i1> undef, <4 x double> undef, <4 x double> undef
180*3edec9baSSimon Pilgrim; AVX-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V8F64 = select <8 x i1> undef, <8 x double> undef, <8 x double> undef
181*3edec9baSSimon Pilgrim; AVX-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %F32 = select i1 undef, float undef, float undef
182*3edec9baSSimon Pilgrim; AVX-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V4F32 = select <4 x i1> undef, <4 x float> undef, <4 x float> undef
183*3edec9baSSimon Pilgrim; AVX-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V8F32 = select <8 x i1> undef, <8 x float> undef, <8 x float> undef
184*3edec9baSSimon Pilgrim; AVX-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V16F32 = select <16 x i1> undef, <16 x float> undef, <16 x float> undef
185*3edec9baSSimon Pilgrim; AVX-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret i32 undef
186*3edec9baSSimon Pilgrim;
187*3edec9baSSimon Pilgrim; AVX512-LABEL: 'test_select_fp'
188*3edec9baSSimon Pilgrim; AVX512-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %F64 = select i1 undef, double undef, double undef
189*3edec9baSSimon Pilgrim; AVX512-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V2F64 = select <2 x i1> undef, <2 x double> undef, <2 x double> undef
190*3edec9baSSimon Pilgrim; AVX512-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V4F64 = select <4 x i1> undef, <4 x double> undef, <4 x double> undef
191*3edec9baSSimon Pilgrim; AVX512-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V8F64 = select <8 x i1> undef, <8 x double> undef, <8 x double> undef
192*3edec9baSSimon Pilgrim; AVX512-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %F32 = select i1 undef, float undef, float undef
193*3edec9baSSimon Pilgrim; AVX512-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V4F32 = select <4 x i1> undef, <4 x float> undef, <4 x float> undef
194*3edec9baSSimon Pilgrim; AVX512-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V8F32 = select <8 x i1> undef, <8 x float> undef, <8 x float> undef
195*3edec9baSSimon Pilgrim; AVX512-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V16F32 = select <16 x i1> undef, <16 x float> undef, <16 x float> undef
196*3edec9baSSimon Pilgrim; AVX512-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret i32 undef
1970de2c3d7SSimon Pilgrim;
1980de2c3d7SSimon Pilgrim  %F64 = select i1 undef, double undef, double undef
1990de2c3d7SSimon Pilgrim  %V2F64 = select <2 x i1> undef, <2 x double> undef, <2 x double> undef
2000de2c3d7SSimon Pilgrim  %V4F64 = select <4 x i1> undef, <4 x double> undef, <4 x double> undef
2010de2c3d7SSimon Pilgrim  %V8F64 = select <8 x i1> undef, <8 x double> undef, <8 x double> undef
2020de2c3d7SSimon Pilgrim
2030de2c3d7SSimon Pilgrim  %F32 = select i1 undef, float undef, float undef
2040de2c3d7SSimon Pilgrim  %V4F32 = select <4 x i1> undef, <4 x float> undef, <4 x float> undef
2050de2c3d7SSimon Pilgrim  %V8F32 = select <8 x i1> undef, <8 x float> undef, <8 x float> undef
2060de2c3d7SSimon Pilgrim  %V16F32 = select <16 x i1> undef, <16 x float> undef, <16 x float> undef
2070de2c3d7SSimon Pilgrim
2080de2c3d7SSimon Pilgrim  ret i32 undef
2090de2c3d7SSimon Pilgrim}
2100de2c3d7SSimon Pilgrim
2110de2c3d7SSimon Pilgrim; Immediate blend instructions for <2 x double> and <4 x float> added at SSE41.
2120de2c3d7SSimon Pilgrim; Integers of the same size should also use those instructions.
2130de2c3d7SSimon Pilgrim
2140de2c3d7SSimon Pilgrimdefine <2 x i64> @test_2i64(<2 x i64> %a, <2 x i64> %b) {
215*3edec9baSSimon Pilgrim; SSE2-LABEL: 'test_2i64'
216*3edec9baSSimon Pilgrim; SSE2-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %sel = select <2 x i1> <i1 true, i1 false>, <2 x i64> %a, <2 x i64> %b
217*3edec9baSSimon Pilgrim; SSE2-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <2 x i64> %sel
218*3edec9baSSimon Pilgrim;
219*3edec9baSSimon Pilgrim; SSE4-LABEL: 'test_2i64'
220*3edec9baSSimon Pilgrim; SSE4-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %sel = select <2 x i1> <i1 true, i1 false>, <2 x i64> %a, <2 x i64> %b
221*3edec9baSSimon Pilgrim; SSE4-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <2 x i64> %sel
222*3edec9baSSimon Pilgrim;
223*3edec9baSSimon Pilgrim; AVX-LABEL: 'test_2i64'
224*3edec9baSSimon Pilgrim; AVX-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %sel = select <2 x i1> <i1 true, i1 false>, <2 x i64> %a, <2 x i64> %b
225*3edec9baSSimon Pilgrim; AVX-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <2 x i64> %sel
226*3edec9baSSimon Pilgrim;
227*3edec9baSSimon Pilgrim; AVX512-LABEL: 'test_2i64'
228*3edec9baSSimon Pilgrim; AVX512-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %sel = select <2 x i1> <i1 true, i1 false>, <2 x i64> %a, <2 x i64> %b
229*3edec9baSSimon Pilgrim; AVX512-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <2 x i64> %sel
2300de2c3d7SSimon Pilgrim;
2310de2c3d7SSimon Pilgrim  %sel = select <2 x i1> <i1 true, i1 false>, <2 x i64> %a, <2 x i64> %b
2320de2c3d7SSimon Pilgrim  ret <2 x i64> %sel
2330de2c3d7SSimon Pilgrim}
2340de2c3d7SSimon Pilgrim
2350de2c3d7SSimon Pilgrimdefine <2 x double> @test_2double(<2 x double> %a, <2 x double> %b) {
236*3edec9baSSimon Pilgrim; SSE2-LABEL: 'test_2double'
237*3edec9baSSimon Pilgrim; SSE2-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %sel = select <2 x i1> <i1 true, i1 false>, <2 x double> %a, <2 x double> %b
238*3edec9baSSimon Pilgrim; SSE2-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <2 x double> %sel
239*3edec9baSSimon Pilgrim;
240*3edec9baSSimon Pilgrim; SSE4-LABEL: 'test_2double'
241*3edec9baSSimon Pilgrim; SSE4-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %sel = select <2 x i1> <i1 true, i1 false>, <2 x double> %a, <2 x double> %b
242*3edec9baSSimon Pilgrim; SSE4-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <2 x double> %sel
243*3edec9baSSimon Pilgrim;
244*3edec9baSSimon Pilgrim; AVX-LABEL: 'test_2double'
245*3edec9baSSimon Pilgrim; AVX-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %sel = select <2 x i1> <i1 true, i1 false>, <2 x double> %a, <2 x double> %b
246*3edec9baSSimon Pilgrim; AVX-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <2 x double> %sel
247*3edec9baSSimon Pilgrim;
248*3edec9baSSimon Pilgrim; AVX512-LABEL: 'test_2double'
249*3edec9baSSimon Pilgrim; AVX512-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %sel = select <2 x i1> <i1 true, i1 false>, <2 x double> %a, <2 x double> %b
250*3edec9baSSimon Pilgrim; AVX512-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <2 x double> %sel
2510de2c3d7SSimon Pilgrim;
2520de2c3d7SSimon Pilgrim  %sel = select <2 x i1> <i1 true, i1 false>, <2 x double> %a, <2 x double> %b
2530de2c3d7SSimon Pilgrim  ret <2 x double> %sel
2540de2c3d7SSimon Pilgrim}
2550de2c3d7SSimon Pilgrim
2560de2c3d7SSimon Pilgrimdefine <4 x i32> @test_4i32(<4 x i32> %a, <4 x i32> %b) {
257*3edec9baSSimon Pilgrim; SSE2-LABEL: 'test_4i32'
258*3edec9baSSimon Pilgrim; SSE2-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %sel = select <4 x i1> <i1 true, i1 false, i1 true, i1 false>, <4 x i32> %a, <4 x i32> %b
259*3edec9baSSimon Pilgrim; SSE2-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <4 x i32> %sel
260*3edec9baSSimon Pilgrim;
261*3edec9baSSimon Pilgrim; SSE4-LABEL: 'test_4i32'
262*3edec9baSSimon Pilgrim; SSE4-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %sel = select <4 x i1> <i1 true, i1 false, i1 true, i1 false>, <4 x i32> %a, <4 x i32> %b
263*3edec9baSSimon Pilgrim; SSE4-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <4 x i32> %sel
264*3edec9baSSimon Pilgrim;
265*3edec9baSSimon Pilgrim; AVX-LABEL: 'test_4i32'
266*3edec9baSSimon Pilgrim; AVX-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %sel = select <4 x i1> <i1 true, i1 false, i1 true, i1 false>, <4 x i32> %a, <4 x i32> %b
267*3edec9baSSimon Pilgrim; AVX-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <4 x i32> %sel
268*3edec9baSSimon Pilgrim;
269*3edec9baSSimon Pilgrim; AVX512-LABEL: 'test_4i32'
270*3edec9baSSimon Pilgrim; AVX512-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %sel = select <4 x i1> <i1 true, i1 false, i1 true, i1 false>, <4 x i32> %a, <4 x i32> %b
271*3edec9baSSimon Pilgrim; AVX512-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <4 x i32> %sel
2720de2c3d7SSimon Pilgrim;
2730de2c3d7SSimon Pilgrim  %sel = select <4 x i1> <i1 true, i1 false, i1 true, i1 false>, <4 x i32> %a, <4 x i32> %b
2740de2c3d7SSimon Pilgrim  ret <4 x i32> %sel
2750de2c3d7SSimon Pilgrim}
2760de2c3d7SSimon Pilgrim
2770de2c3d7SSimon Pilgrimdefine <4 x float> @test_4float(<4 x float> %a, <4 x float> %b) {
278*3edec9baSSimon Pilgrim; SSE2-LABEL: 'test_4float'
279*3edec9baSSimon Pilgrim; SSE2-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %sel = select <4 x i1> <i1 true, i1 false, i1 true, i1 true>, <4 x float> %a, <4 x float> %b
280*3edec9baSSimon Pilgrim; SSE2-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <4 x float> %sel
281*3edec9baSSimon Pilgrim;
282*3edec9baSSimon Pilgrim; SSE4-LABEL: 'test_4float'
283*3edec9baSSimon Pilgrim; SSE4-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %sel = select <4 x i1> <i1 true, i1 false, i1 true, i1 true>, <4 x float> %a, <4 x float> %b
284*3edec9baSSimon Pilgrim; SSE4-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <4 x float> %sel
285*3edec9baSSimon Pilgrim;
286*3edec9baSSimon Pilgrim; AVX-LABEL: 'test_4float'
287*3edec9baSSimon Pilgrim; AVX-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %sel = select <4 x i1> <i1 true, i1 false, i1 true, i1 true>, <4 x float> %a, <4 x float> %b
288*3edec9baSSimon Pilgrim; AVX-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <4 x float> %sel
289*3edec9baSSimon Pilgrim;
290*3edec9baSSimon Pilgrim; AVX512-LABEL: 'test_4float'
291*3edec9baSSimon Pilgrim; AVX512-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %sel = select <4 x i1> <i1 true, i1 false, i1 true, i1 true>, <4 x float> %a, <4 x float> %b
292*3edec9baSSimon Pilgrim; AVX512-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <4 x float> %sel
2930de2c3d7SSimon Pilgrim;
2940de2c3d7SSimon Pilgrim  %sel = select <4 x i1> <i1 true, i1 false, i1 true, i1 true>, <4 x float> %a, <4 x float> %b
2950de2c3d7SSimon Pilgrim  ret <4 x float> %sel
2960de2c3d7SSimon Pilgrim}
2970de2c3d7SSimon Pilgrim
2980de2c3d7SSimon Pilgrimdefine <16 x i8> @test_16i8(<16 x i8> %a, <16 x i8> %b) {
299*3edec9baSSimon Pilgrim; SSE2-LABEL: 'test_16i8'
300*3edec9baSSimon Pilgrim; SSE2-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %sel = select <16 x i1> <i1 true, i1 false, i1 true, i1 true, i1 true, i1 false, i1 true, i1 true, i1 true, i1 false, i1 true, i1 true, i1 true, i1 false, i1 true, i1 true>, <16 x i8> %a, <16 x i8> %b
301*3edec9baSSimon Pilgrim; SSE2-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <16 x i8> %sel
302*3edec9baSSimon Pilgrim;
303*3edec9baSSimon Pilgrim; SSE4-LABEL: 'test_16i8'
304*3edec9baSSimon Pilgrim; SSE4-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %sel = select <16 x i1> <i1 true, i1 false, i1 true, i1 true, i1 true, i1 false, i1 true, i1 true, i1 true, i1 false, i1 true, i1 true, i1 true, i1 false, i1 true, i1 true>, <16 x i8> %a, <16 x i8> %b
305*3edec9baSSimon Pilgrim; SSE4-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <16 x i8> %sel
306*3edec9baSSimon Pilgrim;
307*3edec9baSSimon Pilgrim; AVX-LABEL: 'test_16i8'
308*3edec9baSSimon Pilgrim; AVX-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %sel = select <16 x i1> <i1 true, i1 false, i1 true, i1 true, i1 true, i1 false, i1 true, i1 true, i1 true, i1 false, i1 true, i1 true, i1 true, i1 false, i1 true, i1 true>, <16 x i8> %a, <16 x i8> %b
309*3edec9baSSimon Pilgrim; AVX-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <16 x i8> %sel
310*3edec9baSSimon Pilgrim;
311*3edec9baSSimon Pilgrim; AVX512-LABEL: 'test_16i8'
312*3edec9baSSimon Pilgrim; AVX512-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %sel = select <16 x i1> <i1 true, i1 false, i1 true, i1 true, i1 true, i1 false, i1 true, i1 true, i1 true, i1 false, i1 true, i1 true, i1 true, i1 false, i1 true, i1 true>, <16 x i8> %a, <16 x i8> %b
313*3edec9baSSimon Pilgrim; AVX512-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <16 x i8> %sel
3140de2c3d7SSimon Pilgrim;
3150de2c3d7SSimon Pilgrim  %sel = select <16 x i1> <i1 true, i1 false, i1 true, i1 true, i1 true, i1 false, i1 true, i1 true, i1 true, i1 false, i1 true, i1 true, i1 true, i1 false, i1 true, i1 true>, <16 x i8> %a, <16 x i8> %b
3160de2c3d7SSimon Pilgrim  ret <16 x i8> %sel
3170de2c3d7SSimon Pilgrim}
3180de2c3d7SSimon Pilgrim
3190de2c3d7SSimon Pilgrim; Immediate blend instructions for <4 x double> and <8 x float> added at AVX.
3200de2c3d7SSimon Pilgrim; Integers of the same size should also use those instructions.
3210de2c3d7SSimon Pilgrim
3220de2c3d7SSimon Pilgrimdefine <4 x i64> @test_4i64(<4 x i64> %a, <4 x i64> %b) {
323*3edec9baSSimon Pilgrim; SSE2-LABEL: 'test_4i64'
324*3edec9baSSimon Pilgrim; SSE2-NEXT:  Cost Model: Found an estimated cost of 6 for instruction: %sel = select <4 x i1> <i1 true, i1 false, i1 false, i1 true>, <4 x i64> %a, <4 x i64> %b
325*3edec9baSSimon Pilgrim; SSE2-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <4 x i64> %sel
326*3edec9baSSimon Pilgrim;
327*3edec9baSSimon Pilgrim; SSE4-LABEL: 'test_4i64'
328*3edec9baSSimon Pilgrim; SSE4-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %sel = select <4 x i1> <i1 true, i1 false, i1 false, i1 true>, <4 x i64> %a, <4 x i64> %b
329*3edec9baSSimon Pilgrim; SSE4-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <4 x i64> %sel
330*3edec9baSSimon Pilgrim;
331*3edec9baSSimon Pilgrim; AVX-LABEL: 'test_4i64'
332*3edec9baSSimon Pilgrim; AVX-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %sel = select <4 x i1> <i1 true, i1 false, i1 false, i1 true>, <4 x i64> %a, <4 x i64> %b
333*3edec9baSSimon Pilgrim; AVX-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <4 x i64> %sel
334*3edec9baSSimon Pilgrim;
335*3edec9baSSimon Pilgrim; AVX512-LABEL: 'test_4i64'
336*3edec9baSSimon Pilgrim; AVX512-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %sel = select <4 x i1> <i1 true, i1 false, i1 false, i1 true>, <4 x i64> %a, <4 x i64> %b
337*3edec9baSSimon Pilgrim; AVX512-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <4 x i64> %sel
3380de2c3d7SSimon Pilgrim;
3390de2c3d7SSimon Pilgrim  %sel = select <4 x i1> <i1 true, i1 false, i1 false, i1 true>, <4 x i64> %a, <4 x i64> %b
3400de2c3d7SSimon Pilgrim  ret <4 x i64> %sel
3410de2c3d7SSimon Pilgrim}
3420de2c3d7SSimon Pilgrim
3430de2c3d7SSimon Pilgrimdefine <4 x double> @test_4double(<4 x double> %a, <4 x double> %b) {
344*3edec9baSSimon Pilgrim; SSE2-LABEL: 'test_4double'
345*3edec9baSSimon Pilgrim; SSE2-NEXT:  Cost Model: Found an estimated cost of 6 for instruction: %sel = select <4 x i1> <i1 true, i1 false, i1 true, i1 false>, <4 x double> %a, <4 x double> %b
346*3edec9baSSimon Pilgrim; SSE2-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <4 x double> %sel
347*3edec9baSSimon Pilgrim;
348*3edec9baSSimon Pilgrim; SSE4-LABEL: 'test_4double'
349*3edec9baSSimon Pilgrim; SSE4-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %sel = select <4 x i1> <i1 true, i1 false, i1 true, i1 false>, <4 x double> %a, <4 x double> %b
350*3edec9baSSimon Pilgrim; SSE4-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <4 x double> %sel
351*3edec9baSSimon Pilgrim;
352*3edec9baSSimon Pilgrim; AVX-LABEL: 'test_4double'
353*3edec9baSSimon Pilgrim; AVX-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %sel = select <4 x i1> <i1 true, i1 false, i1 true, i1 false>, <4 x double> %a, <4 x double> %b
354*3edec9baSSimon Pilgrim; AVX-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <4 x double> %sel
355*3edec9baSSimon Pilgrim;
356*3edec9baSSimon Pilgrim; AVX512-LABEL: 'test_4double'
357*3edec9baSSimon Pilgrim; AVX512-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %sel = select <4 x i1> <i1 true, i1 false, i1 true, i1 false>, <4 x double> %a, <4 x double> %b
358*3edec9baSSimon Pilgrim; AVX512-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <4 x double> %sel
3590de2c3d7SSimon Pilgrim;
3600de2c3d7SSimon Pilgrim  %sel = select <4 x i1> <i1 true, i1 false, i1 true, i1 false>, <4 x double> %a, <4 x double> %b
3610de2c3d7SSimon Pilgrim  ret <4 x double> %sel
3620de2c3d7SSimon Pilgrim}
3630de2c3d7SSimon Pilgrim
3640de2c3d7SSimon Pilgrimdefine <8 x i32> @test_8i32(<8 x i32> %a, <8 x i32> %b) {
365*3edec9baSSimon Pilgrim; SSE2-LABEL: 'test_8i32'
366*3edec9baSSimon Pilgrim; SSE2-NEXT:  Cost Model: Found an estimated cost of 6 for instruction: %sel = select <8 x i1> <i1 true, i1 false, i1 true, i1 true, i1 true, i1 false, i1 true, i1 false>, <8 x i32> %a, <8 x i32> %b
367*3edec9baSSimon Pilgrim; SSE2-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <8 x i32> %sel
368*3edec9baSSimon Pilgrim;
369*3edec9baSSimon Pilgrim; SSE4-LABEL: 'test_8i32'
370*3edec9baSSimon Pilgrim; SSE4-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %sel = select <8 x i1> <i1 true, i1 false, i1 true, i1 true, i1 true, i1 false, i1 true, i1 false>, <8 x i32> %a, <8 x i32> %b
371*3edec9baSSimon Pilgrim; SSE4-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <8 x i32> %sel
372*3edec9baSSimon Pilgrim;
373*3edec9baSSimon Pilgrim; AVX-LABEL: 'test_8i32'
374*3edec9baSSimon Pilgrim; AVX-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %sel = select <8 x i1> <i1 true, i1 false, i1 true, i1 true, i1 true, i1 false, i1 true, i1 false>, <8 x i32> %a, <8 x i32> %b
375*3edec9baSSimon Pilgrim; AVX-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <8 x i32> %sel
376*3edec9baSSimon Pilgrim;
377*3edec9baSSimon Pilgrim; AVX512-LABEL: 'test_8i32'
378*3edec9baSSimon Pilgrim; AVX512-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %sel = select <8 x i1> <i1 true, i1 false, i1 true, i1 true, i1 true, i1 false, i1 true, i1 false>, <8 x i32> %a, <8 x i32> %b
379*3edec9baSSimon Pilgrim; AVX512-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <8 x i32> %sel
3800de2c3d7SSimon Pilgrim;
3810de2c3d7SSimon Pilgrim  %sel = select <8 x i1> <i1 true, i1 false, i1 true, i1 true, i1 true, i1 false, i1 true, i1 false>, <8 x i32> %a, <8 x i32> %b
3820de2c3d7SSimon Pilgrim  ret <8 x i32> %sel
3830de2c3d7SSimon Pilgrim}
3840de2c3d7SSimon Pilgrim
3850de2c3d7SSimon Pilgrimdefine <8 x float> @test_8float(<8 x float> %a, <8 x float> %b) {
386*3edec9baSSimon Pilgrim; SSE2-LABEL: 'test_8float'
387*3edec9baSSimon Pilgrim; SSE2-NEXT:  Cost Model: Found an estimated cost of 6 for instruction: %sel = select <8 x i1> <i1 true, i1 false, i1 false, i1 false, i1 true, i1 false, i1 false, i1 false>, <8 x float> %a, <8 x float> %b
388*3edec9baSSimon Pilgrim; SSE2-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <8 x float> %sel
389*3edec9baSSimon Pilgrim;
390*3edec9baSSimon Pilgrim; SSE4-LABEL: 'test_8float'
391*3edec9baSSimon Pilgrim; SSE4-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %sel = select <8 x i1> <i1 true, i1 false, i1 false, i1 false, i1 true, i1 false, i1 false, i1 false>, <8 x float> %a, <8 x float> %b
392*3edec9baSSimon Pilgrim; SSE4-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <8 x float> %sel
393*3edec9baSSimon Pilgrim;
394*3edec9baSSimon Pilgrim; AVX-LABEL: 'test_8float'
395*3edec9baSSimon Pilgrim; AVX-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %sel = select <8 x i1> <i1 true, i1 false, i1 false, i1 false, i1 true, i1 false, i1 false, i1 false>, <8 x float> %a, <8 x float> %b
396*3edec9baSSimon Pilgrim; AVX-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <8 x float> %sel
397*3edec9baSSimon Pilgrim;
398*3edec9baSSimon Pilgrim; AVX512-LABEL: 'test_8float'
399*3edec9baSSimon Pilgrim; AVX512-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %sel = select <8 x i1> <i1 true, i1 false, i1 false, i1 false, i1 true, i1 false, i1 false, i1 false>, <8 x float> %a, <8 x float> %b
400*3edec9baSSimon Pilgrim; AVX512-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <8 x float> %sel
4010de2c3d7SSimon Pilgrim;
4020de2c3d7SSimon Pilgrim  %sel = select <8 x i1> <i1 true, i1 false, i1 false, i1 false, i1 true, i1 false, i1 false, i1 false>, <8 x float> %a, <8 x float> %b
4030de2c3d7SSimon Pilgrim  ret <8 x float> %sel
4040de2c3d7SSimon Pilgrim}
4050de2c3d7SSimon Pilgrim
4060de2c3d7SSimon Pilgrimdefine <16 x i16> @test_16i16(<16 x i16> %a, <16 x i16> %b) {
407*3edec9baSSimon Pilgrim; SSE2-LABEL: 'test_16i16'
408*3edec9baSSimon Pilgrim; SSE2-NEXT:  Cost Model: Found an estimated cost of 6 for instruction: %sel = select <16 x i1> <i1 true, i1 false, i1 false, i1 false, i1 true, i1 false, i1 false, i1 false, i1 true, i1 false, i1 false, i1 false, i1 true, i1 false, i1 false, i1 false>, <16 x i16> %a, <16 x i16> %b
409*3edec9baSSimon Pilgrim; SSE2-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <16 x i16> %sel
410*3edec9baSSimon Pilgrim;
411*3edec9baSSimon Pilgrim; SSE4-LABEL: 'test_16i16'
412*3edec9baSSimon Pilgrim; SSE4-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %sel = select <16 x i1> <i1 true, i1 false, i1 false, i1 false, i1 true, i1 false, i1 false, i1 false, i1 true, i1 false, i1 false, i1 false, i1 true, i1 false, i1 false, i1 false>, <16 x i16> %a, <16 x i16> %b
413*3edec9baSSimon Pilgrim; SSE4-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <16 x i16> %sel
414*3edec9baSSimon Pilgrim;
415*3edec9baSSimon Pilgrim; AVX1-LABEL: 'test_16i16'
416*3edec9baSSimon Pilgrim; AVX1-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %sel = select <16 x i1> <i1 true, i1 false, i1 false, i1 false, i1 true, i1 false, i1 false, i1 false, i1 true, i1 false, i1 false, i1 false, i1 true, i1 false, i1 false, i1 false>, <16 x i16> %a, <16 x i16> %b
417*3edec9baSSimon Pilgrim; AVX1-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <16 x i16> %sel
418*3edec9baSSimon Pilgrim;
419*3edec9baSSimon Pilgrim; AVX2-LABEL: 'test_16i16'
420*3edec9baSSimon Pilgrim; AVX2-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %sel = select <16 x i1> <i1 true, i1 false, i1 false, i1 false, i1 true, i1 false, i1 false, i1 false, i1 true, i1 false, i1 false, i1 false, i1 true, i1 false, i1 false, i1 false>, <16 x i16> %a, <16 x i16> %b
421*3edec9baSSimon Pilgrim; AVX2-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <16 x i16> %sel
422*3edec9baSSimon Pilgrim;
423*3edec9baSSimon Pilgrim; AVX512-LABEL: 'test_16i16'
424*3edec9baSSimon Pilgrim; AVX512-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %sel = select <16 x i1> <i1 true, i1 false, i1 false, i1 false, i1 true, i1 false, i1 false, i1 false, i1 true, i1 false, i1 false, i1 false, i1 true, i1 false, i1 false, i1 false>, <16 x i16> %a, <16 x i16> %b
425*3edec9baSSimon Pilgrim; AVX512-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <16 x i16> %sel
4260de2c3d7SSimon Pilgrim;
4270de2c3d7SSimon Pilgrim  %sel = select <16 x i1> <i1 true, i1 false, i1 false, i1 false, i1 true, i1 false, i1 false, i1 false, i1 true, i1 false, i1 false, i1 false, i1 true, i1 false, i1 false, i1 false>, <16 x i16> %a, <16 x i16> %b
4280de2c3d7SSimon Pilgrim  ret <16 x i16> %sel
4290de2c3d7SSimon Pilgrim}
4300de2c3d7SSimon Pilgrim
4310de2c3d7SSimon Pilgrimdefine <32 x i8> @test_32i8(<32 x i8> %a, <32 x i8> %b) {
432*3edec9baSSimon Pilgrim; SSE2-LABEL: 'test_32i8'
433*3edec9baSSimon Pilgrim; SSE2-NEXT:  Cost Model: Found an estimated cost of 6 for instruction: %sel = select <32 x i1> <i1 true, i1 false, i1 true, i1 true, i1 true, i1 false, i1 true, i1 true, i1 true, i1 false, i1 true, i1 true, i1 true, i1 false, i1 true, i1 true, i1 true, i1 false, i1 true, i1 true, i1 true, i1 false, i1 true, i1 true, i1 true, i1 false, i1 true, i1 true, i1 true, i1 false, i1 true, i1 true>, <32 x i8> %a, <32 x i8> %b
434*3edec9baSSimon Pilgrim; SSE2-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <32 x i8> %sel
435*3edec9baSSimon Pilgrim;
436*3edec9baSSimon Pilgrim; SSE4-LABEL: 'test_32i8'
437*3edec9baSSimon Pilgrim; SSE4-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %sel = select <32 x i1> <i1 true, i1 false, i1 true, i1 true, i1 true, i1 false, i1 true, i1 true, i1 true, i1 false, i1 true, i1 true, i1 true, i1 false, i1 true, i1 true, i1 true, i1 false, i1 true, i1 true, i1 true, i1 false, i1 true, i1 true, i1 true, i1 false, i1 true, i1 true, i1 true, i1 false, i1 true, i1 true>, <32 x i8> %a, <32 x i8> %b
438*3edec9baSSimon Pilgrim; SSE4-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <32 x i8> %sel
439*3edec9baSSimon Pilgrim;
440*3edec9baSSimon Pilgrim; AVX1-LABEL: 'test_32i8'
441*3edec9baSSimon Pilgrim; AVX1-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %sel = select <32 x i1> <i1 true, i1 false, i1 true, i1 true, i1 true, i1 false, i1 true, i1 true, i1 true, i1 false, i1 true, i1 true, i1 true, i1 false, i1 true, i1 true, i1 true, i1 false, i1 true, i1 true, i1 true, i1 false, i1 true, i1 true, i1 true, i1 false, i1 true, i1 true, i1 true, i1 false, i1 true, i1 true>, <32 x i8> %a, <32 x i8> %b
442*3edec9baSSimon Pilgrim; AVX1-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <32 x i8> %sel
443*3edec9baSSimon Pilgrim;
444*3edec9baSSimon Pilgrim; AVX2-LABEL: 'test_32i8'
445*3edec9baSSimon Pilgrim; AVX2-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %sel = select <32 x i1> <i1 true, i1 false, i1 true, i1 true, i1 true, i1 false, i1 true, i1 true, i1 true, i1 false, i1 true, i1 true, i1 true, i1 false, i1 true, i1 true, i1 true, i1 false, i1 true, i1 true, i1 true, i1 false, i1 true, i1 true, i1 true, i1 false, i1 true, i1 true, i1 true, i1 false, i1 true, i1 true>, <32 x i8> %a, <32 x i8> %b
446*3edec9baSSimon Pilgrim; AVX2-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <32 x i8> %sel
447*3edec9baSSimon Pilgrim;
448*3edec9baSSimon Pilgrim; AVX512-LABEL: 'test_32i8'
449*3edec9baSSimon Pilgrim; AVX512-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %sel = select <32 x i1> <i1 true, i1 false, i1 true, i1 true, i1 true, i1 false, i1 true, i1 true, i1 true, i1 false, i1 true, i1 true, i1 true, i1 false, i1 true, i1 true, i1 true, i1 false, i1 true, i1 true, i1 true, i1 false, i1 true, i1 true, i1 true, i1 false, i1 true, i1 true, i1 true, i1 false, i1 true, i1 true>, <32 x i8> %a, <32 x i8> %b
450*3edec9baSSimon Pilgrim; AVX512-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <32 x i8> %sel
4510de2c3d7SSimon Pilgrim;
4520de2c3d7SSimon Pilgrim  %sel = select <32 x i1> <i1 true, i1 false, i1 true, i1 true, i1 true, i1 false, i1 true, i1 true, i1 true, i1 false, i1 true, i1 true, i1 true, i1 false, i1 true, i1 true, i1 true, i1 false, i1 true, i1 true, i1 true, i1 false, i1 true, i1 true, i1 true, i1 false, i1 true, i1 true, i1 true, i1 false, i1 true, i1 true>, <32 x i8> %a, <32 x i8> %b
4530de2c3d7SSimon Pilgrim  ret <32 x i8> %sel
4540de2c3d7SSimon Pilgrim}
4550de2c3d7SSimon Pilgrim
456