xref: /llvm-project/llvm/test/Analysis/CostModel/X86/select.ll (revision 1ad18b5968124abcd67e0210b8c508bbae74407e)
13482523dSSimon Pilgrim; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py
2*1ad18b59SSimon Pilgrim; RUN: opt < %s -passes="print<cost-model>" 2>&1 -disable-output -mtriple=x86_64-- -mattr=+sse2 | FileCheck %s -check-prefixes=SSE
3*1ad18b59SSimon Pilgrim; RUN: opt < %s -passes="print<cost-model>" 2>&1 -disable-output -mtriple=x86_64-- -mattr=+sse4.1 | FileCheck %s -check-prefixes=SSE
4*1ad18b59SSimon Pilgrim; RUN: opt < %s -passes="print<cost-model>" 2>&1 -disable-output -mtriple=x86_64-- -mattr=+avx | FileCheck %s -check-prefixes=AVX,AVX1
5*1ad18b59SSimon Pilgrim; RUN: opt < %s -passes="print<cost-model>" 2>&1 -disable-output -mtriple=x86_64-- -mattr=+avx2 | FileCheck %s -check-prefixes=AVX,AVX2
6*1ad18b59SSimon Pilgrim; RUN: opt < %s -passes="print<cost-model>" 2>&1 -disable-output -mtriple=x86_64-- -mattr=+avx512f,+avx512vl  | FileCheck %s -check-prefixes=AVX512,AVX512F
7*1ad18b59SSimon Pilgrim; RUN: opt < %s -passes="print<cost-model>" 2>&1 -disable-output -mtriple=x86_64-- -mattr=+avx512bw,+avx512vl | FileCheck %s -check-prefixes=AVX512,AVX512BW
85c7b9753SSimon Pilgrim;
9*1ad18b59SSimon Pilgrim; RUN: opt < %s -passes="print<cost-model>" 2>&1 -disable-output -mtriple=x86_64-- -mcpu=slm | FileCheck %s --check-prefixes=SLM
10*1ad18b59SSimon Pilgrim; RUN: opt < %s -passes="print<cost-model>" 2>&1 -disable-output -mtriple=x86_64-- -mcpu=goldmont | FileCheck %s --check-prefixes=SSE
11*1ad18b59SSimon Pilgrim; RUN: opt < %s -passes="print<cost-model>" 2>&1 -disable-output -mtriple=x86_64-- -mcpu=btver2 | FileCheck %s --check-prefixes=AVX,AVX1
123482523dSSimon Pilgrim
133482523dSSimon Pilgrim; Verify the cost of vector select instructions.
143482523dSSimon Pilgrim
153482523dSSimon Pilgrimdefine i32 @test_select() {
163482523dSSimon Pilgrim; SSE-LABEL: 'test_select'
173482523dSSimon Pilgrim; SSE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %I64 = select i1 undef, i64 undef, i64 undef
183482523dSSimon Pilgrim; SSE-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V2I64 = select <2 x i1> undef, <2 x i64> undef, <2 x i64> undef
193482523dSSimon Pilgrim; SSE-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %V4I64 = select <4 x i1> undef, <4 x i64> undef, <4 x i64> undef
203482523dSSimon Pilgrim; SSE-NEXT:  Cost Model: Found an estimated cost of 8 for instruction: %V8I64 = select <8 x i1> undef, <8 x i64> undef, <8 x i64> undef
213482523dSSimon Pilgrim; SSE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %I32 = select i1 undef, i32 undef, i32 undef
223482523dSSimon Pilgrim; SSE-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V4I32 = select <4 x i1> undef, <4 x i32> undef, <4 x i32> undef
233482523dSSimon Pilgrim; SSE-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %V8I32 = select <8 x i1> undef, <8 x i32> undef, <8 x i32> undef
243482523dSSimon Pilgrim; SSE-NEXT:  Cost Model: Found an estimated cost of 8 for instruction: %V16I32 = select <16 x i1> undef, <16 x i32> undef, <16 x i32> undef
253482523dSSimon Pilgrim; SSE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %I16 = select i1 undef, i16 undef, i16 undef
263482523dSSimon Pilgrim; SSE-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V8I16 = select <8 x i1> undef, <8 x i16> undef, <8 x i16> undef
273482523dSSimon Pilgrim; SSE-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %V16I16 = select <16 x i1> undef, <16 x i16> undef, <16 x i16> undef
283482523dSSimon Pilgrim; SSE-NEXT:  Cost Model: Found an estimated cost of 8 for instruction: %V32I16 = select <32 x i1> undef, <32 x i16> undef, <32 x i16> undef
293482523dSSimon Pilgrim; SSE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %I8 = select i1 undef, i8 undef, i8 undef
303482523dSSimon Pilgrim; SSE-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V16I8 = select <16 x i1> undef, <16 x i8> undef, <16 x i8> undef
313482523dSSimon Pilgrim; SSE-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %V32I8 = select <32 x i1> undef, <32 x i8> undef, <32 x i8> undef
323482523dSSimon Pilgrim; SSE-NEXT:  Cost Model: Found an estimated cost of 8 for instruction: %V64I8 = select <64 x i1> undef, <64 x i8> undef, <64 x i8> undef
333482523dSSimon Pilgrim; SSE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i32 undef
343482523dSSimon Pilgrim;
353482523dSSimon Pilgrim; AVX1-LABEL: 'test_select'
363482523dSSimon Pilgrim; AVX1-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %I64 = select i1 undef, i64 undef, i64 undef
373482523dSSimon Pilgrim; AVX1-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V2I64 = select <2 x i1> undef, <2 x i64> undef, <2 x i64> undef
383482523dSSimon Pilgrim; AVX1-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %V4I64 = select <4 x i1> undef, <4 x i64> undef, <4 x i64> undef
393482523dSSimon Pilgrim; AVX1-NEXT:  Cost Model: Found an estimated cost of 6 for instruction: %V8I64 = select <8 x i1> undef, <8 x i64> undef, <8 x i64> undef
403482523dSSimon Pilgrim; AVX1-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %I32 = select i1 undef, i32 undef, i32 undef
413482523dSSimon Pilgrim; AVX1-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V4I32 = select <4 x i1> undef, <4 x i32> undef, <4 x i32> undef
423482523dSSimon Pilgrim; AVX1-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %V8I32 = select <8 x i1> undef, <8 x i32> undef, <8 x i32> undef
433482523dSSimon Pilgrim; AVX1-NEXT:  Cost Model: Found an estimated cost of 6 for instruction: %V16I32 = select <16 x i1> undef, <16 x i32> undef, <16 x i32> undef
443482523dSSimon Pilgrim; AVX1-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %I16 = select i1 undef, i16 undef, i16 undef
453482523dSSimon Pilgrim; AVX1-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V8I16 = select <8 x i1> undef, <8 x i16> undef, <8 x i16> undef
463482523dSSimon 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
473482523dSSimon 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
483482523dSSimon Pilgrim; AVX1-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %I8 = select i1 undef, i8 undef, i8 undef
493482523dSSimon Pilgrim; AVX1-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V16I8 = select <16 x i1> undef, <16 x i8> undef, <16 x i8> undef
503482523dSSimon 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
513482523dSSimon 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
523482523dSSimon Pilgrim; AVX1-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i32 undef
533482523dSSimon Pilgrim;
543482523dSSimon Pilgrim; AVX2-LABEL: 'test_select'
553482523dSSimon Pilgrim; AVX2-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %I64 = select i1 undef, i64 undef, i64 undef
563482523dSSimon Pilgrim; AVX2-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V2I64 = select <2 x i1> undef, <2 x i64> undef, <2 x i64> undef
573482523dSSimon Pilgrim; AVX2-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
583482523dSSimon Pilgrim; AVX2-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
593482523dSSimon Pilgrim; AVX2-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %I32 = select i1 undef, i32 undef, i32 undef
603482523dSSimon Pilgrim; AVX2-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V4I32 = select <4 x i1> undef, <4 x i32> undef, <4 x i32> undef
613482523dSSimon Pilgrim; AVX2-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
623482523dSSimon Pilgrim; AVX2-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
633482523dSSimon Pilgrim; AVX2-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %I16 = select i1 undef, i16 undef, i16 undef
643482523dSSimon Pilgrim; AVX2-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V8I16 = select <8 x i1> undef, <8 x i16> undef, <8 x i16> undef
653482523dSSimon Pilgrim; AVX2-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
663482523dSSimon Pilgrim; AVX2-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
673482523dSSimon Pilgrim; AVX2-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %I8 = select i1 undef, i8 undef, i8 undef
683482523dSSimon Pilgrim; AVX2-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V16I8 = select <16 x i1> undef, <16 x i8> undef, <16 x i8> undef
693482523dSSimon Pilgrim; AVX2-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
703482523dSSimon Pilgrim; AVX2-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
713482523dSSimon Pilgrim; AVX2-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i32 undef
723482523dSSimon Pilgrim;
733482523dSSimon Pilgrim; AVX512F-LABEL: 'test_select'
743482523dSSimon Pilgrim; AVX512F-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %I64 = select i1 undef, i64 undef, i64 undef
753482523dSSimon 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
763482523dSSimon 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
773482523dSSimon 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
783482523dSSimon Pilgrim; AVX512F-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %I32 = select i1 undef, i32 undef, i32 undef
793482523dSSimon 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
803482523dSSimon 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
813482523dSSimon 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
823482523dSSimon Pilgrim; AVX512F-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %I16 = select i1 undef, i16 undef, i16 undef
833482523dSSimon 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
843482523dSSimon 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
853482523dSSimon Pilgrim; AVX512F-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
863482523dSSimon Pilgrim; AVX512F-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %I8 = select i1 undef, i8 undef, i8 undef
873482523dSSimon 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
883482523dSSimon 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
893482523dSSimon Pilgrim; AVX512F-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
903482523dSSimon Pilgrim; AVX512F-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i32 undef
913482523dSSimon Pilgrim;
923482523dSSimon Pilgrim; AVX512BW-LABEL: 'test_select'
933482523dSSimon Pilgrim; AVX512BW-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %I64 = select i1 undef, i64 undef, i64 undef
943482523dSSimon 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
953482523dSSimon 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
963482523dSSimon 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
973482523dSSimon Pilgrim; AVX512BW-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %I32 = select i1 undef, i32 undef, i32 undef
983482523dSSimon 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
993482523dSSimon 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
1003482523dSSimon 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
1013482523dSSimon Pilgrim; AVX512BW-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %I16 = select i1 undef, i16 undef, i16 undef
1023482523dSSimon 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
1033482523dSSimon 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
1043482523dSSimon 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
1053482523dSSimon Pilgrim; AVX512BW-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %I8 = select i1 undef, i8 undef, i8 undef
1063482523dSSimon 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
1073482523dSSimon 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
1083482523dSSimon 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
1093482523dSSimon Pilgrim; AVX512BW-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i32 undef
1103482523dSSimon Pilgrim;
1115c7b9753SSimon Pilgrim; SLM-LABEL: 'test_select'
1125c7b9753SSimon Pilgrim; SLM-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %I64 = select i1 undef, i64 undef, i64 undef
1135c7b9753SSimon Pilgrim; SLM-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %V2I64 = select <2 x i1> undef, <2 x i64> undef, <2 x i64> undef
1145c7b9753SSimon Pilgrim; SLM-NEXT:  Cost Model: Found an estimated cost of 8 for instruction: %V4I64 = select <4 x i1> undef, <4 x i64> undef, <4 x i64> undef
1155c7b9753SSimon Pilgrim; SLM-NEXT:  Cost Model: Found an estimated cost of 16 for instruction: %V8I64 = select <8 x i1> undef, <8 x i64> undef, <8 x i64> undef
1165c7b9753SSimon Pilgrim; SLM-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %I32 = select i1 undef, i32 undef, i32 undef
1175c7b9753SSimon Pilgrim; SLM-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V4I32 = select <4 x i1> undef, <4 x i32> undef, <4 x i32> undef
1185c7b9753SSimon Pilgrim; SLM-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %V8I32 = select <8 x i1> undef, <8 x i32> undef, <8 x i32> undef
1195c7b9753SSimon Pilgrim; SLM-NEXT:  Cost Model: Found an estimated cost of 8 for instruction: %V16I32 = select <16 x i1> undef, <16 x i32> undef, <16 x i32> undef
1205c7b9753SSimon Pilgrim; SLM-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %I16 = select i1 undef, i16 undef, i16 undef
1215c7b9753SSimon Pilgrim; SLM-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %V8I16 = select <8 x i1> undef, <8 x i16> undef, <8 x i16> undef
1225c7b9753SSimon Pilgrim; SLM-NEXT:  Cost Model: Found an estimated cost of 8 for instruction: %V16I16 = select <16 x i1> undef, <16 x i16> undef, <16 x i16> undef
1235c7b9753SSimon Pilgrim; SLM-NEXT:  Cost Model: Found an estimated cost of 16 for instruction: %V32I16 = select <32 x i1> undef, <32 x i16> undef, <32 x i16> undef
1245c7b9753SSimon Pilgrim; SLM-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %I8 = select i1 undef, i8 undef, i8 undef
1255c7b9753SSimon Pilgrim; SLM-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %V16I8 = select <16 x i1> undef, <16 x i8> undef, <16 x i8> undef
1265c7b9753SSimon Pilgrim; SLM-NEXT:  Cost Model: Found an estimated cost of 8 for instruction: %V32I8 = select <32 x i1> undef, <32 x i8> undef, <32 x i8> undef
1275c7b9753SSimon Pilgrim; SLM-NEXT:  Cost Model: Found an estimated cost of 16 for instruction: %V64I8 = select <64 x i1> undef, <64 x i8> undef, <64 x i8> undef
1285c7b9753SSimon Pilgrim; SLM-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i32 undef
1295c7b9753SSimon Pilgrim;
1303482523dSSimon Pilgrim  %I64 = select i1 undef, i64 undef, i64 undef
1313482523dSSimon Pilgrim  %V2I64 = select <2 x i1> undef, <2 x i64> undef, <2 x i64> undef
1323482523dSSimon Pilgrim  %V4I64 = select <4 x i1> undef, <4 x i64> undef, <4 x i64> undef
1333482523dSSimon Pilgrim  %V8I64 = select <8 x i1> undef, <8 x i64> undef, <8 x i64> undef
1343482523dSSimon Pilgrim
1353482523dSSimon Pilgrim  %I32 = select i1 undef, i32 undef, i32 undef
1363482523dSSimon Pilgrim  %V4I32 = select <4 x i1> undef, <4 x i32> undef, <4 x i32> undef
1373482523dSSimon Pilgrim  %V8I32 = select <8 x i1> undef, <8 x i32> undef, <8 x i32> undef
1383482523dSSimon Pilgrim  %V16I32 = select <16 x i1> undef, <16 x i32> undef, <16 x i32> undef
1393482523dSSimon Pilgrim
1403482523dSSimon Pilgrim  %I16 = select i1 undef, i16 undef, i16 undef
1413482523dSSimon Pilgrim  %V8I16 = select <8 x i1> undef, <8 x i16> undef, <8 x i16> undef
1423482523dSSimon Pilgrim  %V16I16 = select <16 x i1> undef, <16 x i16> undef, <16 x i16> undef
1433482523dSSimon Pilgrim  %V32I16 = select <32 x i1> undef, <32 x i16> undef, <32 x i16> undef
1443482523dSSimon Pilgrim
1453482523dSSimon Pilgrim  %I8 = select i1 undef, i8 undef, i8 undef
1463482523dSSimon Pilgrim  %V16I8 = select <16 x i1> undef, <16 x i8> undef, <16 x i8> undef
1473482523dSSimon Pilgrim  %V32I8 = select <32 x i1> undef, <32 x i8> undef, <32 x i8> undef
1483482523dSSimon Pilgrim  %V64I8 = select <64 x i1> undef, <64 x i8> undef, <64 x i8> undef
1493482523dSSimon Pilgrim
1503482523dSSimon Pilgrim  ret i32 undef
1513482523dSSimon Pilgrim}
1523482523dSSimon Pilgrim
1533482523dSSimon Pilgrimdefine i32 @test_select_fp() {
1543482523dSSimon Pilgrim; SSE-LABEL: 'test_select_fp'
1553482523dSSimon Pilgrim; SSE-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %F64 = select i1 undef, double undef, double undef
1563482523dSSimon Pilgrim; SSE-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V2F64 = select <2 x i1> undef, <2 x double> undef, <2 x double> undef
1573482523dSSimon Pilgrim; SSE-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %V4F64 = select <4 x i1> undef, <4 x double> undef, <4 x double> undef
1583482523dSSimon Pilgrim; SSE-NEXT:  Cost Model: Found an estimated cost of 8 for instruction: %V8F64 = select <8 x i1> undef, <8 x double> undef, <8 x double> undef
1593482523dSSimon Pilgrim; SSE-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %F32 = select i1 undef, float undef, float undef
1603482523dSSimon Pilgrim; SSE-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V4F32 = select <4 x i1> undef, <4 x float> undef, <4 x float> undef
1613482523dSSimon Pilgrim; SSE-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %V8F32 = select <8 x i1> undef, <8 x float> undef, <8 x float> undef
1623482523dSSimon Pilgrim; SSE-NEXT:  Cost Model: Found an estimated cost of 8 for instruction: %V16F32 = select <16 x i1> undef, <16 x float> undef, <16 x float> undef
1633482523dSSimon Pilgrim; SSE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i32 undef
1643482523dSSimon Pilgrim;
1653482523dSSimon Pilgrim; AVX1-LABEL: 'test_select_fp'
1663482523dSSimon Pilgrim; AVX1-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %F64 = select i1 undef, double undef, double undef
1673482523dSSimon Pilgrim; AVX1-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V2F64 = select <2 x i1> undef, <2 x double> undef, <2 x double> undef
1683482523dSSimon Pilgrim; AVX1-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %V4F64 = select <4 x i1> undef, <4 x double> undef, <4 x double> undef
1693482523dSSimon Pilgrim; AVX1-NEXT:  Cost Model: Found an estimated cost of 6 for instruction: %V8F64 = select <8 x i1> undef, <8 x double> undef, <8 x double> undef
1703482523dSSimon Pilgrim; AVX1-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %F32 = select i1 undef, float undef, float undef
1713482523dSSimon Pilgrim; AVX1-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V4F32 = select <4 x i1> undef, <4 x float> undef, <4 x float> undef
1723482523dSSimon Pilgrim; AVX1-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %V8F32 = select <8 x i1> undef, <8 x float> undef, <8 x float> undef
1733482523dSSimon Pilgrim; AVX1-NEXT:  Cost Model: Found an estimated cost of 6 for instruction: %V16F32 = select <16 x i1> undef, <16 x float> undef, <16 x float> undef
1743482523dSSimon Pilgrim; AVX1-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i32 undef
1753482523dSSimon Pilgrim;
1763482523dSSimon Pilgrim; AVX2-LABEL: 'test_select_fp'
1773482523dSSimon Pilgrim; AVX2-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %F64 = select i1 undef, double undef, double undef
1783482523dSSimon Pilgrim; AVX2-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V2F64 = select <2 x i1> undef, <2 x double> undef, <2 x double> undef
1793482523dSSimon Pilgrim; AVX2-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
1803482523dSSimon Pilgrim; AVX2-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
1813482523dSSimon Pilgrim; AVX2-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %F32 = select i1 undef, float undef, float undef
1823482523dSSimon Pilgrim; AVX2-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V4F32 = select <4 x i1> undef, <4 x float> undef, <4 x float> undef
1833482523dSSimon Pilgrim; AVX2-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
1843482523dSSimon Pilgrim; AVX2-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
1853482523dSSimon Pilgrim; AVX2-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i32 undef
1863482523dSSimon Pilgrim;
1873482523dSSimon Pilgrim; AVX512-LABEL: 'test_select_fp'
1883482523dSSimon Pilgrim; AVX512-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %F64 = select i1 undef, double undef, double undef
1893482523dSSimon 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
1903482523dSSimon 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
1913482523dSSimon 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
1923482523dSSimon Pilgrim; AVX512-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %F32 = select i1 undef, float undef, float undef
1933482523dSSimon 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
1943482523dSSimon 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
1953482523dSSimon 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
1963482523dSSimon Pilgrim; AVX512-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i32 undef
1973482523dSSimon Pilgrim;
1985c7b9753SSimon Pilgrim; SLM-LABEL: 'test_select_fp'
1995c7b9753SSimon Pilgrim; SLM-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %F64 = select i1 undef, double undef, double undef
2005c7b9753SSimon Pilgrim; SLM-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %V2F64 = select <2 x i1> undef, <2 x double> undef, <2 x double> undef
2015c7b9753SSimon Pilgrim; SLM-NEXT:  Cost Model: Found an estimated cost of 8 for instruction: %V4F64 = select <4 x i1> undef, <4 x double> undef, <4 x double> undef
2025c7b9753SSimon Pilgrim; SLM-NEXT:  Cost Model: Found an estimated cost of 16 for instruction: %V8F64 = select <8 x i1> undef, <8 x double> undef, <8 x double> undef
2035c7b9753SSimon Pilgrim; SLM-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %F32 = select i1 undef, float undef, float undef
2045c7b9753SSimon Pilgrim; SLM-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %V4F32 = select <4 x i1> undef, <4 x float> undef, <4 x float> undef
2055c7b9753SSimon Pilgrim; SLM-NEXT:  Cost Model: Found an estimated cost of 8 for instruction: %V8F32 = select <8 x i1> undef, <8 x float> undef, <8 x float> undef
2065c7b9753SSimon Pilgrim; SLM-NEXT:  Cost Model: Found an estimated cost of 16 for instruction: %V16F32 = select <16 x i1> undef, <16 x float> undef, <16 x float> undef
2075c7b9753SSimon Pilgrim; SLM-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i32 undef
2085c7b9753SSimon Pilgrim;
2093482523dSSimon Pilgrim  %F64 = select i1 undef, double undef, double undef
2103482523dSSimon Pilgrim  %V2F64 = select <2 x i1> undef, <2 x double> undef, <2 x double> undef
2113482523dSSimon Pilgrim  %V4F64 = select <4 x i1> undef, <4 x double> undef, <4 x double> undef
2123482523dSSimon Pilgrim  %V8F64 = select <8 x i1> undef, <8 x double> undef, <8 x double> undef
2133482523dSSimon Pilgrim
2143482523dSSimon Pilgrim  %F32 = select i1 undef, float undef, float undef
2153482523dSSimon Pilgrim  %V4F32 = select <4 x i1> undef, <4 x float> undef, <4 x float> undef
2163482523dSSimon Pilgrim  %V8F32 = select <8 x i1> undef, <8 x float> undef, <8 x float> undef
2173482523dSSimon Pilgrim  %V16F32 = select <16 x i1> undef, <16 x float> undef, <16 x float> undef
2183482523dSSimon Pilgrim
2193482523dSSimon Pilgrim  ret i32 undef
2203482523dSSimon Pilgrim}
2213482523dSSimon Pilgrim
2223482523dSSimon Pilgrim; Immediate blend instructions for <2 x double> and <4 x float> added at SSE41.
2233482523dSSimon Pilgrim; Integers of the same size should also use those instructions.
2243482523dSSimon Pilgrim
2253482523dSSimon Pilgrimdefine <2 x i64> @test_2i64(<2 x i64> %a, <2 x i64> %b) {
2263482523dSSimon Pilgrim; SSE-LABEL: 'test_2i64'
2273482523dSSimon Pilgrim; SSE-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %sel = select <2 x i1> <i1 true, i1 false>, <2 x i64> %a, <2 x i64> %b
2283482523dSSimon Pilgrim; SSE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <2 x i64> %sel
2293482523dSSimon Pilgrim;
2303482523dSSimon Pilgrim; AVX-LABEL: 'test_2i64'
2313482523dSSimon Pilgrim; AVX-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %sel = select <2 x i1> <i1 true, i1 false>, <2 x i64> %a, <2 x i64> %b
2323482523dSSimon Pilgrim; AVX-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <2 x i64> %sel
2333482523dSSimon Pilgrim;
2343482523dSSimon Pilgrim; AVX512-LABEL: 'test_2i64'
2353482523dSSimon 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
2363482523dSSimon Pilgrim; AVX512-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <2 x i64> %sel
2373482523dSSimon Pilgrim;
2385c7b9753SSimon Pilgrim; SLM-LABEL: 'test_2i64'
2395c7b9753SSimon Pilgrim; SLM-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %sel = select <2 x i1> <i1 true, i1 false>, <2 x i64> %a, <2 x i64> %b
2405c7b9753SSimon Pilgrim; SLM-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <2 x i64> %sel
2415c7b9753SSimon Pilgrim;
2423482523dSSimon Pilgrim  %sel = select <2 x i1> <i1 true, i1 false>, <2 x i64> %a, <2 x i64> %b
2433482523dSSimon Pilgrim  ret <2 x i64> %sel
2443482523dSSimon Pilgrim}
2453482523dSSimon Pilgrim
2463482523dSSimon Pilgrimdefine <2 x double> @test_2double(<2 x double> %a, <2 x double> %b) {
2473482523dSSimon Pilgrim; SSE-LABEL: 'test_2double'
2483482523dSSimon Pilgrim; SSE-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %sel = select <2 x i1> <i1 true, i1 false>, <2 x double> %a, <2 x double> %b
2493482523dSSimon Pilgrim; SSE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <2 x double> %sel
2503482523dSSimon Pilgrim;
2513482523dSSimon Pilgrim; AVX-LABEL: 'test_2double'
2523482523dSSimon Pilgrim; AVX-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %sel = select <2 x i1> <i1 true, i1 false>, <2 x double> %a, <2 x double> %b
2533482523dSSimon Pilgrim; AVX-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <2 x double> %sel
2543482523dSSimon Pilgrim;
2553482523dSSimon Pilgrim; AVX512-LABEL: 'test_2double'
2563482523dSSimon 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
2573482523dSSimon Pilgrim; AVX512-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <2 x double> %sel
2583482523dSSimon Pilgrim;
2595c7b9753SSimon Pilgrim; SLM-LABEL: 'test_2double'
2605c7b9753SSimon Pilgrim; SLM-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %sel = select <2 x i1> <i1 true, i1 false>, <2 x double> %a, <2 x double> %b
2615c7b9753SSimon Pilgrim; SLM-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <2 x double> %sel
2625c7b9753SSimon Pilgrim;
2633482523dSSimon Pilgrim  %sel = select <2 x i1> <i1 true, i1 false>, <2 x double> %a, <2 x double> %b
2643482523dSSimon Pilgrim  ret <2 x double> %sel
2653482523dSSimon Pilgrim}
2663482523dSSimon Pilgrim
2673482523dSSimon Pilgrimdefine <4 x i32> @test_4i32(<4 x i32> %a, <4 x i32> %b) {
2683482523dSSimon Pilgrim; SSE-LABEL: 'test_4i32'
2693482523dSSimon Pilgrim; SSE-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 i32> %a, <4 x i32> %b
2703482523dSSimon Pilgrim; SSE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <4 x i32> %sel
2713482523dSSimon Pilgrim;
2723482523dSSimon Pilgrim; AVX-LABEL: 'test_4i32'
2733482523dSSimon Pilgrim; AVX-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 i32> %a, <4 x i32> %b
2743482523dSSimon Pilgrim; AVX-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <4 x i32> %sel
2753482523dSSimon Pilgrim;
2763482523dSSimon Pilgrim; AVX512-LABEL: 'test_4i32'
2773482523dSSimon 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
2783482523dSSimon Pilgrim; AVX512-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <4 x i32> %sel
2793482523dSSimon Pilgrim;
2805c7b9753SSimon Pilgrim; SLM-LABEL: 'test_4i32'
2815c7b9753SSimon Pilgrim; SLM-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 i32> %a, <4 x i32> %b
2825c7b9753SSimon Pilgrim; SLM-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <4 x i32> %sel
2835c7b9753SSimon Pilgrim;
2843482523dSSimon Pilgrim  %sel = select <4 x i1> <i1 true, i1 false, i1 true, i1 false>, <4 x i32> %a, <4 x i32> %b
2853482523dSSimon Pilgrim  ret <4 x i32> %sel
2863482523dSSimon Pilgrim}
2873482523dSSimon Pilgrim
2883482523dSSimon Pilgrimdefine <4 x float> @test_4float(<4 x float> %a, <4 x float> %b) {
2893482523dSSimon Pilgrim; SSE-LABEL: 'test_4float'
2903482523dSSimon Pilgrim; SSE-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %sel = select <4 x i1> <i1 true, i1 false, i1 true, i1 true>, <4 x float> %a, <4 x float> %b
2913482523dSSimon Pilgrim; SSE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <4 x float> %sel
2923482523dSSimon Pilgrim;
2933482523dSSimon Pilgrim; AVX-LABEL: 'test_4float'
2943482523dSSimon Pilgrim; AVX-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %sel = select <4 x i1> <i1 true, i1 false, i1 true, i1 true>, <4 x float> %a, <4 x float> %b
2953482523dSSimon Pilgrim; AVX-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <4 x float> %sel
2963482523dSSimon Pilgrim;
2973482523dSSimon Pilgrim; AVX512-LABEL: 'test_4float'
2983482523dSSimon 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
2993482523dSSimon Pilgrim; AVX512-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <4 x float> %sel
3003482523dSSimon Pilgrim;
3015c7b9753SSimon Pilgrim; SLM-LABEL: 'test_4float'
3025c7b9753SSimon Pilgrim; SLM-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %sel = select <4 x i1> <i1 true, i1 false, i1 true, i1 true>, <4 x float> %a, <4 x float> %b
3035c7b9753SSimon Pilgrim; SLM-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <4 x float> %sel
3045c7b9753SSimon Pilgrim;
3053482523dSSimon Pilgrim  %sel = select <4 x i1> <i1 true, i1 false, i1 true, i1 true>, <4 x float> %a, <4 x float> %b
3063482523dSSimon Pilgrim  ret <4 x float> %sel
3073482523dSSimon Pilgrim}
3083482523dSSimon Pilgrim
3093482523dSSimon Pilgrimdefine <16 x i8> @test_16i8(<16 x i8> %a, <16 x i8> %b) {
3103482523dSSimon Pilgrim; SSE-LABEL: 'test_16i8'
3113482523dSSimon Pilgrim; SSE-NEXT:  Cost Model: Found an estimated cost of 2 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
3123482523dSSimon Pilgrim; SSE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <16 x i8> %sel
3133482523dSSimon Pilgrim;
3143482523dSSimon Pilgrim; AVX-LABEL: 'test_16i8'
3153482523dSSimon Pilgrim; AVX-NEXT:  Cost Model: Found an estimated cost of 2 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
3163482523dSSimon Pilgrim; AVX-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <16 x i8> %sel
3173482523dSSimon Pilgrim;
3183482523dSSimon Pilgrim; AVX512-LABEL: 'test_16i8'
3193482523dSSimon 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
3203482523dSSimon Pilgrim; AVX512-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <16 x i8> %sel
3213482523dSSimon Pilgrim;
3225c7b9753SSimon Pilgrim; SLM-LABEL: 'test_16i8'
3235c7b9753SSimon Pilgrim; SLM-NEXT:  Cost Model: Found an estimated cost of 4 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
3245c7b9753SSimon Pilgrim; SLM-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <16 x i8> %sel
3255c7b9753SSimon Pilgrim;
3263482523dSSimon 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
3273482523dSSimon Pilgrim  ret <16 x i8> %sel
3283482523dSSimon Pilgrim}
3293482523dSSimon Pilgrim
3303482523dSSimon Pilgrim; Immediate blend instructions for <4 x double> and <8 x float> added at AVX.
3313482523dSSimon Pilgrim; Integers of the same size should also use those instructions.
3323482523dSSimon Pilgrim
3333482523dSSimon Pilgrimdefine <4 x i64> @test_4i64(<4 x i64> %a, <4 x i64> %b) {
3343482523dSSimon Pilgrim; SSE-LABEL: 'test_4i64'
3353482523dSSimon Pilgrim; SSE-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %sel = select <4 x i1> <i1 true, i1 false, i1 false, i1 true>, <4 x i64> %a, <4 x i64> %b
3363482523dSSimon Pilgrim; SSE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <4 x i64> %sel
3373482523dSSimon Pilgrim;
3383482523dSSimon Pilgrim; AVX1-LABEL: 'test_4i64'
3393482523dSSimon Pilgrim; AVX1-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %sel = select <4 x i1> <i1 true, i1 false, i1 false, i1 true>, <4 x i64> %a, <4 x i64> %b
3403482523dSSimon Pilgrim; AVX1-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <4 x i64> %sel
3413482523dSSimon Pilgrim;
3423482523dSSimon Pilgrim; AVX2-LABEL: 'test_4i64'
3433482523dSSimon Pilgrim; AVX2-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
3443482523dSSimon Pilgrim; AVX2-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <4 x i64> %sel
3453482523dSSimon Pilgrim;
3463482523dSSimon Pilgrim; AVX512-LABEL: 'test_4i64'
3473482523dSSimon 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
3483482523dSSimon Pilgrim; AVX512-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <4 x i64> %sel
3493482523dSSimon Pilgrim;
3505c7b9753SSimon Pilgrim; SLM-LABEL: 'test_4i64'
3515c7b9753SSimon Pilgrim; SLM-NEXT:  Cost Model: Found an estimated cost of 8 for instruction: %sel = select <4 x i1> <i1 true, i1 false, i1 false, i1 true>, <4 x i64> %a, <4 x i64> %b
3525c7b9753SSimon Pilgrim; SLM-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <4 x i64> %sel
3535c7b9753SSimon Pilgrim;
3543482523dSSimon Pilgrim  %sel = select <4 x i1> <i1 true, i1 false, i1 false, i1 true>, <4 x i64> %a, <4 x i64> %b
3553482523dSSimon Pilgrim  ret <4 x i64> %sel
3563482523dSSimon Pilgrim}
3573482523dSSimon Pilgrim
3583482523dSSimon Pilgrimdefine <4 x double> @test_4double(<4 x double> %a, <4 x double> %b) {
3593482523dSSimon Pilgrim; SSE-LABEL: 'test_4double'
3603482523dSSimon Pilgrim; SSE-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %sel = select <4 x i1> <i1 true, i1 false, i1 true, i1 false>, <4 x double> %a, <4 x double> %b
3613482523dSSimon Pilgrim; SSE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <4 x double> %sel
3623482523dSSimon Pilgrim;
3633482523dSSimon Pilgrim; AVX1-LABEL: 'test_4double'
3643482523dSSimon Pilgrim; AVX1-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 double> %a, <4 x double> %b
3653482523dSSimon Pilgrim; AVX1-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <4 x double> %sel
3663482523dSSimon Pilgrim;
3673482523dSSimon Pilgrim; AVX2-LABEL: 'test_4double'
3683482523dSSimon Pilgrim; AVX2-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
3693482523dSSimon Pilgrim; AVX2-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <4 x double> %sel
3703482523dSSimon Pilgrim;
3713482523dSSimon Pilgrim; AVX512-LABEL: 'test_4double'
3723482523dSSimon 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
3733482523dSSimon Pilgrim; AVX512-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <4 x double> %sel
3743482523dSSimon Pilgrim;
3755c7b9753SSimon Pilgrim; SLM-LABEL: 'test_4double'
3765c7b9753SSimon Pilgrim; SLM-NEXT:  Cost Model: Found an estimated cost of 8 for instruction: %sel = select <4 x i1> <i1 true, i1 false, i1 true, i1 false>, <4 x double> %a, <4 x double> %b
3775c7b9753SSimon Pilgrim; SLM-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <4 x double> %sel
3785c7b9753SSimon Pilgrim;
3793482523dSSimon Pilgrim  %sel = select <4 x i1> <i1 true, i1 false, i1 true, i1 false>, <4 x double> %a, <4 x double> %b
3803482523dSSimon Pilgrim  ret <4 x double> %sel
3813482523dSSimon Pilgrim}
3823482523dSSimon Pilgrim
3833482523dSSimon Pilgrimdefine <8 x i32> @test_8i32(<8 x i32> %a, <8 x i32> %b) {
3843482523dSSimon Pilgrim; SSE-LABEL: 'test_8i32'
3853482523dSSimon Pilgrim; SSE-NEXT:  Cost Model: Found an estimated cost of 4 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
3863482523dSSimon Pilgrim; SSE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <8 x i32> %sel
3873482523dSSimon Pilgrim;
3883482523dSSimon Pilgrim; AVX1-LABEL: 'test_8i32'
3893482523dSSimon Pilgrim; AVX1-NEXT:  Cost Model: Found an estimated cost of 3 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
3903482523dSSimon Pilgrim; AVX1-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <8 x i32> %sel
3913482523dSSimon Pilgrim;
3923482523dSSimon Pilgrim; AVX2-LABEL: 'test_8i32'
3933482523dSSimon Pilgrim; AVX2-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
3943482523dSSimon Pilgrim; AVX2-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <8 x i32> %sel
3953482523dSSimon Pilgrim;
3963482523dSSimon Pilgrim; AVX512-LABEL: 'test_8i32'
3973482523dSSimon 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
3983482523dSSimon Pilgrim; AVX512-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <8 x i32> %sel
3993482523dSSimon Pilgrim;
4005c7b9753SSimon Pilgrim; SLM-LABEL: 'test_8i32'
4015c7b9753SSimon Pilgrim; SLM-NEXT:  Cost Model: Found an estimated cost of 4 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
4025c7b9753SSimon Pilgrim; SLM-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <8 x i32> %sel
4035c7b9753SSimon Pilgrim;
4043482523dSSimon 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
4053482523dSSimon Pilgrim  ret <8 x i32> %sel
4063482523dSSimon Pilgrim}
4073482523dSSimon Pilgrim
4083482523dSSimon Pilgrimdefine <8 x float> @test_8float(<8 x float> %a, <8 x float> %b) {
4093482523dSSimon Pilgrim; SSE-LABEL: 'test_8float'
4103482523dSSimon Pilgrim; SSE-NEXT:  Cost Model: Found an estimated cost of 4 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
4113482523dSSimon Pilgrim; SSE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <8 x float> %sel
4123482523dSSimon Pilgrim;
4133482523dSSimon Pilgrim; AVX1-LABEL: 'test_8float'
4143482523dSSimon Pilgrim; AVX1-NEXT:  Cost Model: Found an estimated cost of 3 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
4153482523dSSimon Pilgrim; AVX1-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <8 x float> %sel
4163482523dSSimon Pilgrim;
4173482523dSSimon Pilgrim; AVX2-LABEL: 'test_8float'
4183482523dSSimon Pilgrim; AVX2-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
4193482523dSSimon Pilgrim; AVX2-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <8 x float> %sel
4203482523dSSimon Pilgrim;
4213482523dSSimon Pilgrim; AVX512-LABEL: 'test_8float'
4223482523dSSimon 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
4233482523dSSimon Pilgrim; AVX512-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <8 x float> %sel
4243482523dSSimon Pilgrim;
4255c7b9753SSimon Pilgrim; SLM-LABEL: 'test_8float'
4265c7b9753SSimon Pilgrim; SLM-NEXT:  Cost Model: Found an estimated cost of 8 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
4275c7b9753SSimon Pilgrim; SLM-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <8 x float> %sel
4285c7b9753SSimon Pilgrim;
4293482523dSSimon 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
4303482523dSSimon Pilgrim  ret <8 x float> %sel
4313482523dSSimon Pilgrim}
4323482523dSSimon Pilgrim
4333482523dSSimon Pilgrimdefine <16 x i16> @test_16i16(<16 x i16> %a, <16 x i16> %b) {
4343482523dSSimon Pilgrim; SSE-LABEL: 'test_16i16'
4353482523dSSimon Pilgrim; SSE-NEXT:  Cost Model: Found an estimated cost of 4 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
4363482523dSSimon Pilgrim; SSE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <16 x i16> %sel
4373482523dSSimon Pilgrim;
4383482523dSSimon Pilgrim; AVX1-LABEL: 'test_16i16'
4393482523dSSimon 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
4403482523dSSimon Pilgrim; AVX1-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <16 x i16> %sel
4413482523dSSimon Pilgrim;
4423482523dSSimon Pilgrim; AVX2-LABEL: 'test_16i16'
4433482523dSSimon Pilgrim; AVX2-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
4443482523dSSimon Pilgrim; AVX2-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <16 x i16> %sel
4453482523dSSimon Pilgrim;
4463482523dSSimon Pilgrim; AVX512-LABEL: 'test_16i16'
4473482523dSSimon 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
4483482523dSSimon Pilgrim; AVX512-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <16 x i16> %sel
4493482523dSSimon Pilgrim;
4505c7b9753SSimon Pilgrim; SLM-LABEL: 'test_16i16'
4515c7b9753SSimon Pilgrim; SLM-NEXT:  Cost Model: Found an estimated cost of 8 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
4525c7b9753SSimon Pilgrim; SLM-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <16 x i16> %sel
4535c7b9753SSimon Pilgrim;
4543482523dSSimon 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
4553482523dSSimon Pilgrim  ret <16 x i16> %sel
4563482523dSSimon Pilgrim}
4573482523dSSimon Pilgrim
4583482523dSSimon Pilgrimdefine <32 x i8> @test_32i8(<32 x i8> %a, <32 x i8> %b) {
4593482523dSSimon Pilgrim; SSE-LABEL: 'test_32i8'
4603482523dSSimon Pilgrim; SSE-NEXT:  Cost Model: Found an estimated cost of 4 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
4613482523dSSimon Pilgrim; SSE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <32 x i8> %sel
4623482523dSSimon Pilgrim;
4633482523dSSimon Pilgrim; AVX1-LABEL: 'test_32i8'
4643482523dSSimon 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
4653482523dSSimon Pilgrim; AVX1-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <32 x i8> %sel
4663482523dSSimon Pilgrim;
4673482523dSSimon Pilgrim; AVX2-LABEL: 'test_32i8'
4683482523dSSimon Pilgrim; AVX2-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
4693482523dSSimon Pilgrim; AVX2-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <32 x i8> %sel
4703482523dSSimon Pilgrim;
4713482523dSSimon Pilgrim; AVX512-LABEL: 'test_32i8'
4723482523dSSimon 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
4733482523dSSimon Pilgrim; AVX512-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <32 x i8> %sel
4743482523dSSimon Pilgrim;
4755c7b9753SSimon Pilgrim; SLM-LABEL: 'test_32i8'
4765c7b9753SSimon Pilgrim; SLM-NEXT:  Cost Model: Found an estimated cost of 8 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
4775c7b9753SSimon Pilgrim; SLM-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <32 x i8> %sel
4785c7b9753SSimon Pilgrim;
4793482523dSSimon 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
4803482523dSSimon Pilgrim  ret <32 x i8> %sel
4813482523dSSimon Pilgrim}
4823482523dSSimon Pilgrim
483