blob: cb5d0fa7ea03de2b88e5786d1a1887834606da20 [file] [log] [blame]
Simon Pilgrime612ab02018-10-20 14:29:59 +00001; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py
Craig Topper381b4fb2018-12-05 07:56:50 +00002; RUN: opt < %s -cost-model -mtriple=x86_64-apple-darwin -analyze -mattr=+sse2 | FileCheck %s --check-prefixes=CHECK,SSE,SSE2
3; RUN: opt < %s -cost-model -mtriple=x86_64-apple-darwin -analyze -mattr=+ssse3 | FileCheck %s --check-prefixes=CHECK,SSE,SSSE3
4; RUN: opt < %s -cost-model -mtriple=x86_64-apple-darwin -analyze -mattr=+sse4.2 | FileCheck %s --check-prefixes=CHECK,SSE,SSE42
5; RUN: opt < %s -cost-model -mtriple=x86_64-apple-darwin -analyze -mattr=+avx | FileCheck %s --check-prefixes=CHECK,AVX,AVX1
6; RUN: opt < %s -cost-model -mtriple=x86_64-apple-darwin -analyze -mattr=+avx2 | FileCheck %s --check-prefixes=CHECK,AVX,AVX2
7; RUN: opt < %s -cost-model -mtriple=x86_64-apple-darwin -analyze -mattr=+avx512f | FileCheck %s --check-prefixes=CHECK,AVX512,AVX512F
8; RUN: opt < %s -cost-model -mtriple=x86_64-apple-darwin -analyze -mattr=+avx512f,+avx512bw | FileCheck %s --check-prefixes=CHECK,AVX512,AVX512BW
9; RUN: opt < %s -cost-model -mtriple=x86_64-apple-darwin -analyze -mattr=+avx512f,+avx512dq | FileCheck %s --check-prefixes=CHECK,AVX512,AVX512DQ
Simon Pilgrime612ab02018-10-20 14:29:59 +000010
Simon Pilgrim1b986b42019-11-06 17:04:07 +000011; RUN: opt < %s -cost-model -mtriple=x86_64-apple-darwin -analyze -mcpu=slm | FileCheck %s --check-prefixes=SLM
12
Simon Pilgrime612ab02018-10-20 14:29:59 +000013define i32 @reduce_i64(i32 %arg) {
Simon Pilgrim1b59a162019-10-12 13:21:50 +000014; SSE-LABEL: 'reduce_i64'
Amara Emerson322d0af2020-10-02 18:30:53 -070015; SSE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %V1 = call i64 @llvm.vector.reduce.add.v1i64(<1 x i64> undef)
16; SSE-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %V2 = call i64 @llvm.vector.reduce.add.v2i64(<2 x i64> undef)
17; SSE-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %V4 = call i64 @llvm.vector.reduce.add.v4i64(<4 x i64> undef)
18; SSE-NEXT: Cost Model: Found an estimated cost of 5 for instruction: %V8 = call i64 @llvm.vector.reduce.add.v8i64(<8 x i64> undef)
19; SSE-NEXT: Cost Model: Found an estimated cost of 9 for instruction: %V16 = call i64 @llvm.vector.reduce.add.v16i64(<16 x i64> undef)
Simon Pilgrim1b59a162019-10-12 13:21:50 +000020; SSE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i32 undef
Simon Pilgrime612ab02018-10-20 14:29:59 +000021;
Craig Topperf4c67df2020-03-22 11:09:55 -070022; AVX1-LABEL: 'reduce_i64'
Amara Emerson322d0af2020-10-02 18:30:53 -070023; AVX1-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %V1 = call i64 @llvm.vector.reduce.add.v1i64(<1 x i64> undef)
24; AVX1-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %V2 = call i64 @llvm.vector.reduce.add.v2i64(<2 x i64> undef)
25; AVX1-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %V4 = call i64 @llvm.vector.reduce.add.v4i64(<4 x i64> undef)
26; AVX1-NEXT: Cost Model: Found an estimated cost of 7 for instruction: %V8 = call i64 @llvm.vector.reduce.add.v8i64(<8 x i64> undef)
27; AVX1-NEXT: Cost Model: Found an estimated cost of 15 for instruction: %V16 = call i64 @llvm.vector.reduce.add.v16i64(<16 x i64> undef)
Craig Topperf4c67df2020-03-22 11:09:55 -070028; AVX1-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i32 undef
29;
30; AVX2-LABEL: 'reduce_i64'
Amara Emerson322d0af2020-10-02 18:30:53 -070031; AVX2-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %V1 = call i64 @llvm.vector.reduce.add.v1i64(<1 x i64> undef)
32; AVX2-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %V2 = call i64 @llvm.vector.reduce.add.v2i64(<2 x i64> undef)
33; AVX2-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %V4 = call i64 @llvm.vector.reduce.add.v4i64(<4 x i64> undef)
34; AVX2-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %V8 = call i64 @llvm.vector.reduce.add.v8i64(<8 x i64> undef)
35; AVX2-NEXT: Cost Model: Found an estimated cost of 6 for instruction: %V16 = call i64 @llvm.vector.reduce.add.v16i64(<16 x i64> undef)
Craig Topperf4c67df2020-03-22 11:09:55 -070036; AVX2-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i32 undef
Simon Pilgrime612ab02018-10-20 14:29:59 +000037;
38; AVX512-LABEL: 'reduce_i64'
Amara Emerson322d0af2020-10-02 18:30:53 -070039; AVX512-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %V1 = call i64 @llvm.vector.reduce.add.v1i64(<1 x i64> undef)
40; AVX512-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %V2 = call i64 @llvm.vector.reduce.add.v2i64(<2 x i64> undef)
41; AVX512-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %V4 = call i64 @llvm.vector.reduce.add.v4i64(<4 x i64> undef)
42; AVX512-NEXT: Cost Model: Found an estimated cost of 7 for instruction: %V8 = call i64 @llvm.vector.reduce.add.v8i64(<8 x i64> undef)
43; AVX512-NEXT: Cost Model: Found an estimated cost of 8 for instruction: %V16 = call i64 @llvm.vector.reduce.add.v16i64(<16 x i64> undef)
Simon Pilgrime612ab02018-10-20 14:29:59 +000044; AVX512-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i32 undef
45;
Simon Pilgrim1b986b42019-11-06 17:04:07 +000046; SLM-LABEL: 'reduce_i64'
Amara Emerson322d0af2020-10-02 18:30:53 -070047; SLM-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %V1 = call i64 @llvm.vector.reduce.add.v1i64(<1 x i64> undef)
48; SLM-NEXT: Cost Model: Found an estimated cost of 5 for instruction: %V2 = call i64 @llvm.vector.reduce.add.v2i64(<2 x i64> undef)
49; SLM-NEXT: Cost Model: Found an estimated cost of 9 for instruction: %V4 = call i64 @llvm.vector.reduce.add.v4i64(<4 x i64> undef)
50; SLM-NEXT: Cost Model: Found an estimated cost of 17 for instruction: %V8 = call i64 @llvm.vector.reduce.add.v8i64(<8 x i64> undef)
51; SLM-NEXT: Cost Model: Found an estimated cost of 33 for instruction: %V16 = call i64 @llvm.vector.reduce.add.v16i64(<16 x i64> undef)
Simon Pilgrim1b986b42019-11-06 17:04:07 +000052; SLM-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i32 undef
53;
Amara Emerson322d0af2020-10-02 18:30:53 -070054 %V1 = call i64 @llvm.vector.reduce.add.v1i64(<1 x i64> undef)
55 %V2 = call i64 @llvm.vector.reduce.add.v2i64(<2 x i64> undef)
56 %V4 = call i64 @llvm.vector.reduce.add.v4i64(<4 x i64> undef)
57 %V8 = call i64 @llvm.vector.reduce.add.v8i64(<8 x i64> undef)
58 %V16 = call i64 @llvm.vector.reduce.add.v16i64(<16 x i64> undef)
Simon Pilgrime612ab02018-10-20 14:29:59 +000059 ret i32 undef
60}
61
62define i32 @reduce_i32(i32 %arg) {
Simon Pilgrim1b59a162019-10-12 13:21:50 +000063; SSE-LABEL: 'reduce_i32'
Amara Emerson322d0af2020-10-02 18:30:53 -070064; SSE-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %V2 = call i32 @llvm.vector.reduce.add.v2i32(<2 x i32> undef)
65; SSE-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %V4 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> undef)
66; SSE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %V8 = call i32 @llvm.vector.reduce.add.v8i32(<8 x i32> undef)
67; SSE-NEXT: Cost Model: Found an estimated cost of 6 for instruction: %V16 = call i32 @llvm.vector.reduce.add.v16i32(<16 x i32> undef)
68; SSE-NEXT: Cost Model: Found an estimated cost of 10 for instruction: %V32 = call i32 @llvm.vector.reduce.add.v32i32(<32 x i32> undef)
Simon Pilgrim1b59a162019-10-12 13:21:50 +000069; SSE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i32 undef
Simon Pilgrime612ab02018-10-20 14:29:59 +000070;
Craig Topperf4c67df2020-03-22 11:09:55 -070071; AVX1-LABEL: 'reduce_i32'
Amara Emerson322d0af2020-10-02 18:30:53 -070072; AVX1-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %V2 = call i32 @llvm.vector.reduce.add.v2i32(<2 x i32> undef)
73; AVX1-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %V4 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> undef)
74; AVX1-NEXT: Cost Model: Found an estimated cost of 5 for instruction: %V8 = call i32 @llvm.vector.reduce.add.v8i32(<8 x i32> undef)
75; AVX1-NEXT: Cost Model: Found an estimated cost of 9 for instruction: %V16 = call i32 @llvm.vector.reduce.add.v16i32(<16 x i32> undef)
76; AVX1-NEXT: Cost Model: Found an estimated cost of 17 for instruction: %V32 = call i32 @llvm.vector.reduce.add.v32i32(<32 x i32> undef)
Craig Topperf4c67df2020-03-22 11:09:55 -070077; AVX1-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i32 undef
78;
79; AVX2-LABEL: 'reduce_i32'
Amara Emerson322d0af2020-10-02 18:30:53 -070080; AVX2-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %V2 = call i32 @llvm.vector.reduce.add.v2i32(<2 x i32> undef)
81; AVX2-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %V4 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> undef)
82; AVX2-NEXT: Cost Model: Found an estimated cost of 5 for instruction: %V8 = call i32 @llvm.vector.reduce.add.v8i32(<8 x i32> undef)
83; AVX2-NEXT: Cost Model: Found an estimated cost of 6 for instruction: %V16 = call i32 @llvm.vector.reduce.add.v16i32(<16 x i32> undef)
84; AVX2-NEXT: Cost Model: Found an estimated cost of 8 for instruction: %V32 = call i32 @llvm.vector.reduce.add.v32i32(<32 x i32> undef)
Craig Topperf4c67df2020-03-22 11:09:55 -070085; AVX2-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i32 undef
Simon Pilgrime612ab02018-10-20 14:29:59 +000086;
87; AVX512-LABEL: 'reduce_i32'
Amara Emerson322d0af2020-10-02 18:30:53 -070088; AVX512-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %V2 = call i32 @llvm.vector.reduce.add.v2i32(<2 x i32> undef)
89; AVX512-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %V4 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> undef)
90; AVX512-NEXT: Cost Model: Found an estimated cost of 5 for instruction: %V8 = call i32 @llvm.vector.reduce.add.v8i32(<8 x i32> undef)
91; AVX512-NEXT: Cost Model: Found an estimated cost of 9 for instruction: %V16 = call i32 @llvm.vector.reduce.add.v16i32(<16 x i32> undef)
92; AVX512-NEXT: Cost Model: Found an estimated cost of 10 for instruction: %V32 = call i32 @llvm.vector.reduce.add.v32i32(<32 x i32> undef)
Simon Pilgrime612ab02018-10-20 14:29:59 +000093; AVX512-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i32 undef
94;
Simon Pilgrim1b986b42019-11-06 17:04:07 +000095; SLM-LABEL: 'reduce_i32'
Amara Emerson322d0af2020-10-02 18:30:53 -070096; SLM-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %V2 = call i32 @llvm.vector.reduce.add.v2i32(<2 x i32> undef)
97; SLM-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %V4 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> undef)
98; SLM-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %V8 = call i32 @llvm.vector.reduce.add.v8i32(<8 x i32> undef)
99; SLM-NEXT: Cost Model: Found an estimated cost of 6 for instruction: %V16 = call i32 @llvm.vector.reduce.add.v16i32(<16 x i32> undef)
100; SLM-NEXT: Cost Model: Found an estimated cost of 10 for instruction: %V32 = call i32 @llvm.vector.reduce.add.v32i32(<32 x i32> undef)
Simon Pilgrim1b986b42019-11-06 17:04:07 +0000101; SLM-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i32 undef
102;
Amara Emerson322d0af2020-10-02 18:30:53 -0700103 %V2 = call i32 @llvm.vector.reduce.add.v2i32(<2 x i32> undef)
104 %V4 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> undef)
105 %V8 = call i32 @llvm.vector.reduce.add.v8i32(<8 x i32> undef)
106 %V16 = call i32 @llvm.vector.reduce.add.v16i32(<16 x i32> undef)
107 %V32 = call i32 @llvm.vector.reduce.add.v32i32(<32 x i32> undef)
Simon Pilgrime612ab02018-10-20 14:29:59 +0000108 ret i32 undef
109}
110
111define i32 @reduce_i16(i32 %arg) {
Simon Pilgrim1b59a162019-10-12 13:21:50 +0000112; SSE-LABEL: 'reduce_i16'
Amara Emerson322d0af2020-10-02 18:30:53 -0700113; SSE-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %V2 = call i16 @llvm.vector.reduce.add.v2i16(<2 x i16> undef)
114; SSE-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %V4 = call i16 @llvm.vector.reduce.add.v4i16(<4 x i16> undef)
115; SSE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %V8 = call i16 @llvm.vector.reduce.add.v8i16(<8 x i16> undef)
116; SSE-NEXT: Cost Model: Found an estimated cost of 5 for instruction: %V16 = call i16 @llvm.vector.reduce.add.v16i16(<16 x i16> undef)
117; SSE-NEXT: Cost Model: Found an estimated cost of 7 for instruction: %V32 = call i16 @llvm.vector.reduce.add.v32i16(<32 x i16> undef)
118; SSE-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %V64 = call i16 @llvm.vector.reduce.add.v64i16(<64 x i16> undef)
Simon Pilgrim1b59a162019-10-12 13:21:50 +0000119; SSE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i32 undef
Simon Pilgrime612ab02018-10-20 14:29:59 +0000120;
Craig Topperf4c67df2020-03-22 11:09:55 -0700121; AVX1-LABEL: 'reduce_i16'
Amara Emerson322d0af2020-10-02 18:30:53 -0700122; AVX1-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %V2 = call i16 @llvm.vector.reduce.add.v2i16(<2 x i16> undef)
123; AVX1-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %V4 = call i16 @llvm.vector.reduce.add.v4i16(<4 x i16> undef)
124; AVX1-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %V8 = call i16 @llvm.vector.reduce.add.v8i16(<8 x i16> undef)
125; AVX1-NEXT: Cost Model: Found an estimated cost of 5 for instruction: %V16 = call i16 @llvm.vector.reduce.add.v16i16(<16 x i16> undef)
126; AVX1-NEXT: Cost Model: Found an estimated cost of 9 for instruction: %V32 = call i16 @llvm.vector.reduce.add.v32i16(<32 x i16> undef)
127; AVX1-NEXT: Cost Model: Found an estimated cost of 17 for instruction: %V64 = call i16 @llvm.vector.reduce.add.v64i16(<64 x i16> undef)
Craig Topperf4c67df2020-03-22 11:09:55 -0700128; AVX1-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i32 undef
129;
130; AVX2-LABEL: 'reduce_i16'
Amara Emerson322d0af2020-10-02 18:30:53 -0700131; AVX2-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %V2 = call i16 @llvm.vector.reduce.add.v2i16(<2 x i16> undef)
132; AVX2-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %V4 = call i16 @llvm.vector.reduce.add.v4i16(<4 x i16> undef)
133; AVX2-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %V8 = call i16 @llvm.vector.reduce.add.v8i16(<8 x i16> undef)
134; AVX2-NEXT: Cost Model: Found an estimated cost of 5 for instruction: %V16 = call i16 @llvm.vector.reduce.add.v16i16(<16 x i16> undef)
135; AVX2-NEXT: Cost Model: Found an estimated cost of 6 for instruction: %V32 = call i16 @llvm.vector.reduce.add.v32i16(<32 x i16> undef)
136; AVX2-NEXT: Cost Model: Found an estimated cost of 8 for instruction: %V64 = call i16 @llvm.vector.reduce.add.v64i16(<64 x i16> undef)
Craig Topperf4c67df2020-03-22 11:09:55 -0700137; AVX2-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i32 undef
Simon Pilgrime612ab02018-10-20 14:29:59 +0000138;
139; AVX512F-LABEL: 'reduce_i16'
Amara Emerson322d0af2020-10-02 18:30:53 -0700140; AVX512F-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %V2 = call i16 @llvm.vector.reduce.add.v2i16(<2 x i16> undef)
141; AVX512F-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %V4 = call i16 @llvm.vector.reduce.add.v4i16(<4 x i16> undef)
142; AVX512F-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %V8 = call i16 @llvm.vector.reduce.add.v8i16(<8 x i16> undef)
143; AVX512F-NEXT: Cost Model: Found an estimated cost of 5 for instruction: %V16 = call i16 @llvm.vector.reduce.add.v16i16(<16 x i16> undef)
144; AVX512F-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %V32 = call i16 @llvm.vector.reduce.add.v32i16(<32 x i16> undef)
145; AVX512F-NEXT: Cost Model: Found an estimated cost of 13 for instruction: %V64 = call i16 @llvm.vector.reduce.add.v64i16(<64 x i16> undef)
Simon Pilgrime612ab02018-10-20 14:29:59 +0000146; AVX512F-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i32 undef
147;
148; AVX512BW-LABEL: 'reduce_i16'
Amara Emerson322d0af2020-10-02 18:30:53 -0700149; AVX512BW-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %V2 = call i16 @llvm.vector.reduce.add.v2i16(<2 x i16> undef)
150; AVX512BW-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %V4 = call i16 @llvm.vector.reduce.add.v4i16(<4 x i16> undef)
151; AVX512BW-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %V8 = call i16 @llvm.vector.reduce.add.v8i16(<8 x i16> undef)
152; AVX512BW-NEXT: Cost Model: Found an estimated cost of 5 for instruction: %V16 = call i16 @llvm.vector.reduce.add.v16i16(<16 x i16> undef)
153; AVX512BW-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %V32 = call i16 @llvm.vector.reduce.add.v32i16(<32 x i16> undef)
154; AVX512BW-NEXT: Cost Model: Found an estimated cost of 12 for instruction: %V64 = call i16 @llvm.vector.reduce.add.v64i16(<64 x i16> undef)
Simon Pilgrime612ab02018-10-20 14:29:59 +0000155; AVX512BW-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i32 undef
156;
157; AVX512DQ-LABEL: 'reduce_i16'
Amara Emerson322d0af2020-10-02 18:30:53 -0700158; AVX512DQ-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %V2 = call i16 @llvm.vector.reduce.add.v2i16(<2 x i16> undef)
159; AVX512DQ-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %V4 = call i16 @llvm.vector.reduce.add.v4i16(<4 x i16> undef)
160; AVX512DQ-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %V8 = call i16 @llvm.vector.reduce.add.v8i16(<8 x i16> undef)
161; AVX512DQ-NEXT: Cost Model: Found an estimated cost of 5 for instruction: %V16 = call i16 @llvm.vector.reduce.add.v16i16(<16 x i16> undef)
162; AVX512DQ-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %V32 = call i16 @llvm.vector.reduce.add.v32i16(<32 x i16> undef)
163; AVX512DQ-NEXT: Cost Model: Found an estimated cost of 13 for instruction: %V64 = call i16 @llvm.vector.reduce.add.v64i16(<64 x i16> undef)
Simon Pilgrime612ab02018-10-20 14:29:59 +0000164; AVX512DQ-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i32 undef
165;
Simon Pilgrim1b986b42019-11-06 17:04:07 +0000166; SLM-LABEL: 'reduce_i16'
Amara Emerson322d0af2020-10-02 18:30:53 -0700167; SLM-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %V2 = call i16 @llvm.vector.reduce.add.v2i16(<2 x i16> undef)
168; SLM-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %V4 = call i16 @llvm.vector.reduce.add.v4i16(<4 x i16> undef)
169; SLM-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %V8 = call i16 @llvm.vector.reduce.add.v8i16(<8 x i16> undef)
170; SLM-NEXT: Cost Model: Found an estimated cost of 5 for instruction: %V16 = call i16 @llvm.vector.reduce.add.v16i16(<16 x i16> undef)
171; SLM-NEXT: Cost Model: Found an estimated cost of 7 for instruction: %V32 = call i16 @llvm.vector.reduce.add.v32i16(<32 x i16> undef)
172; SLM-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %V64 = call i16 @llvm.vector.reduce.add.v64i16(<64 x i16> undef)
Simon Pilgrim1b986b42019-11-06 17:04:07 +0000173; SLM-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i32 undef
174;
Amara Emerson322d0af2020-10-02 18:30:53 -0700175 %V2 = call i16 @llvm.vector.reduce.add.v2i16(<2 x i16> undef)
176 %V4 = call i16 @llvm.vector.reduce.add.v4i16(<4 x i16> undef)
177 %V8 = call i16 @llvm.vector.reduce.add.v8i16(<8 x i16> undef)
178 %V16 = call i16 @llvm.vector.reduce.add.v16i16(<16 x i16> undef)
179 %V32 = call i16 @llvm.vector.reduce.add.v32i16(<32 x i16> undef)
180 %V64 = call i16 @llvm.vector.reduce.add.v64i16(<64 x i16> undef)
Simon Pilgrime612ab02018-10-20 14:29:59 +0000181 ret i32 undef
182}
183
184define i32 @reduce_i8(i32 %arg) {
Simon Pilgrim1b59a162019-10-12 13:21:50 +0000185; SSE-LABEL: 'reduce_i8'
Amara Emerson322d0af2020-10-02 18:30:53 -0700186; SSE-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %V2 = call i8 @llvm.vector.reduce.add.v2i8(<2 x i8> undef)
187; SSE-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %V4 = call i8 @llvm.vector.reduce.add.v4i8(<4 x i8> undef)
188; SSE-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %V8 = call i8 @llvm.vector.reduce.add.v8i8(<8 x i8> undef)
189; SSE-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %V16 = call i8 @llvm.vector.reduce.add.v16i8(<16 x i8> undef)
190; SSE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %V32 = call i8 @llvm.vector.reduce.add.v32i8(<32 x i8> undef)
191; SSE-NEXT: Cost Model: Found an estimated cost of 6 for instruction: %V64 = call i8 @llvm.vector.reduce.add.v64i8(<64 x i8> undef)
192; SSE-NEXT: Cost Model: Found an estimated cost of 10 for instruction: %V128 = call i8 @llvm.vector.reduce.add.v128i8(<128 x i8> undef)
Simon Pilgrim1b59a162019-10-12 13:21:50 +0000193; SSE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i32 undef
Simon Pilgrime612ab02018-10-20 14:29:59 +0000194;
Craig Topperf4c67df2020-03-22 11:09:55 -0700195; AVX1-LABEL: 'reduce_i8'
Amara Emerson322d0af2020-10-02 18:30:53 -0700196; AVX1-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %V2 = call i8 @llvm.vector.reduce.add.v2i8(<2 x i8> undef)
197; AVX1-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %V4 = call i8 @llvm.vector.reduce.add.v4i8(<4 x i8> undef)
198; AVX1-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %V8 = call i8 @llvm.vector.reduce.add.v8i8(<8 x i8> undef)
199; AVX1-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %V16 = call i8 @llvm.vector.reduce.add.v16i8(<16 x i8> undef)
200; AVX1-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %V32 = call i8 @llvm.vector.reduce.add.v32i8(<32 x i8> undef)
201; AVX1-NEXT: Cost Model: Found an estimated cost of 8 for instruction: %V64 = call i8 @llvm.vector.reduce.add.v64i8(<64 x i8> undef)
202; AVX1-NEXT: Cost Model: Found an estimated cost of 16 for instruction: %V128 = call i8 @llvm.vector.reduce.add.v128i8(<128 x i8> undef)
Craig Topperf4c67df2020-03-22 11:09:55 -0700203; AVX1-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i32 undef
204;
205; AVX2-LABEL: 'reduce_i8'
Amara Emerson322d0af2020-10-02 18:30:53 -0700206; AVX2-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %V2 = call i8 @llvm.vector.reduce.add.v2i8(<2 x i8> undef)
207; AVX2-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %V4 = call i8 @llvm.vector.reduce.add.v4i8(<4 x i8> undef)
208; AVX2-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %V8 = call i8 @llvm.vector.reduce.add.v8i8(<8 x i8> undef)
209; AVX2-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %V16 = call i8 @llvm.vector.reduce.add.v16i8(<16 x i8> undef)
210; AVX2-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %V32 = call i8 @llvm.vector.reduce.add.v32i8(<32 x i8> undef)
211; AVX2-NEXT: Cost Model: Found an estimated cost of 5 for instruction: %V64 = call i8 @llvm.vector.reduce.add.v64i8(<64 x i8> undef)
212; AVX2-NEXT: Cost Model: Found an estimated cost of 7 for instruction: %V128 = call i8 @llvm.vector.reduce.add.v128i8(<128 x i8> undef)
Craig Topperf4c67df2020-03-22 11:09:55 -0700213; AVX2-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i32 undef
Simon Pilgrime612ab02018-10-20 14:29:59 +0000214;
215; AVX512F-LABEL: 'reduce_i8'
Amara Emerson322d0af2020-10-02 18:30:53 -0700216; AVX512F-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %V2 = call i8 @llvm.vector.reduce.add.v2i8(<2 x i8> undef)
217; AVX512F-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %V4 = call i8 @llvm.vector.reduce.add.v4i8(<4 x i8> undef)
218; AVX512F-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %V8 = call i8 @llvm.vector.reduce.add.v8i8(<8 x i8> undef)
219; AVX512F-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %V16 = call i8 @llvm.vector.reduce.add.v16i8(<16 x i8> undef)
220; AVX512F-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %V32 = call i8 @llvm.vector.reduce.add.v32i8(<32 x i8> undef)
221; AVX512F-NEXT: Cost Model: Found an estimated cost of 13 for instruction: %V64 = call i8 @llvm.vector.reduce.add.v64i8(<64 x i8> undef)
222; AVX512F-NEXT: Cost Model: Found an estimated cost of 15 for instruction: %V128 = call i8 @llvm.vector.reduce.add.v128i8(<128 x i8> undef)
Simon Pilgrime612ab02018-10-20 14:29:59 +0000223; AVX512F-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i32 undef
224;
225; AVX512BW-LABEL: 'reduce_i8'
Amara Emerson322d0af2020-10-02 18:30:53 -0700226; AVX512BW-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %V2 = call i8 @llvm.vector.reduce.add.v2i8(<2 x i8> undef)
227; AVX512BW-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %V4 = call i8 @llvm.vector.reduce.add.v4i8(<4 x i8> undef)
228; AVX512BW-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %V8 = call i8 @llvm.vector.reduce.add.v8i8(<8 x i8> undef)
229; AVX512BW-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %V16 = call i8 @llvm.vector.reduce.add.v16i8(<16 x i8> undef)
230; AVX512BW-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %V32 = call i8 @llvm.vector.reduce.add.v32i8(<32 x i8> undef)
231; AVX512BW-NEXT: Cost Model: Found an estimated cost of 13 for instruction: %V64 = call i8 @llvm.vector.reduce.add.v64i8(<64 x i8> undef)
232; AVX512BW-NEXT: Cost Model: Found an estimated cost of 14 for instruction: %V128 = call i8 @llvm.vector.reduce.add.v128i8(<128 x i8> undef)
Simon Pilgrime612ab02018-10-20 14:29:59 +0000233; AVX512BW-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i32 undef
234;
235; AVX512DQ-LABEL: 'reduce_i8'
Amara Emerson322d0af2020-10-02 18:30:53 -0700236; AVX512DQ-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %V2 = call i8 @llvm.vector.reduce.add.v2i8(<2 x i8> undef)
237; AVX512DQ-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %V4 = call i8 @llvm.vector.reduce.add.v4i8(<4 x i8> undef)
238; AVX512DQ-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %V8 = call i8 @llvm.vector.reduce.add.v8i8(<8 x i8> undef)
239; AVX512DQ-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %V16 = call i8 @llvm.vector.reduce.add.v16i8(<16 x i8> undef)
240; AVX512DQ-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %V32 = call i8 @llvm.vector.reduce.add.v32i8(<32 x i8> undef)
241; AVX512DQ-NEXT: Cost Model: Found an estimated cost of 13 for instruction: %V64 = call i8 @llvm.vector.reduce.add.v64i8(<64 x i8> undef)
242; AVX512DQ-NEXT: Cost Model: Found an estimated cost of 15 for instruction: %V128 = call i8 @llvm.vector.reduce.add.v128i8(<128 x i8> undef)
Simon Pilgrime612ab02018-10-20 14:29:59 +0000243; AVX512DQ-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i32 undef
244;
Simon Pilgrim1b986b42019-11-06 17:04:07 +0000245; SLM-LABEL: 'reduce_i8'
Amara Emerson322d0af2020-10-02 18:30:53 -0700246; SLM-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %V2 = call i8 @llvm.vector.reduce.add.v2i8(<2 x i8> undef)
247; SLM-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %V4 = call i8 @llvm.vector.reduce.add.v4i8(<4 x i8> undef)
248; SLM-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %V8 = call i8 @llvm.vector.reduce.add.v8i8(<8 x i8> undef)
249; SLM-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %V16 = call i8 @llvm.vector.reduce.add.v16i8(<16 x i8> undef)
250; SLM-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %V32 = call i8 @llvm.vector.reduce.add.v32i8(<32 x i8> undef)
251; SLM-NEXT: Cost Model: Found an estimated cost of 6 for instruction: %V64 = call i8 @llvm.vector.reduce.add.v64i8(<64 x i8> undef)
252; SLM-NEXT: Cost Model: Found an estimated cost of 10 for instruction: %V128 = call i8 @llvm.vector.reduce.add.v128i8(<128 x i8> undef)
Simon Pilgrim1b986b42019-11-06 17:04:07 +0000253; SLM-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i32 undef
254;
Amara Emerson322d0af2020-10-02 18:30:53 -0700255 %V2 = call i8 @llvm.vector.reduce.add.v2i8(<2 x i8> undef)
256 %V4 = call i8 @llvm.vector.reduce.add.v4i8(<4 x i8> undef)
257 %V8 = call i8 @llvm.vector.reduce.add.v8i8(<8 x i8> undef)
258 %V16 = call i8 @llvm.vector.reduce.add.v16i8(<16 x i8> undef)
259 %V32 = call i8 @llvm.vector.reduce.add.v32i8(<32 x i8> undef)
260 %V64 = call i8 @llvm.vector.reduce.add.v64i8(<64 x i8> undef)
261 %V128 = call i8 @llvm.vector.reduce.add.v128i8(<128 x i8> undef)
Simon Pilgrime612ab02018-10-20 14:29:59 +0000262 ret i32 undef
263}
264
Amara Emerson322d0af2020-10-02 18:30:53 -0700265declare i64 @llvm.vector.reduce.add.v1i64(<1 x i64>)
266declare i64 @llvm.vector.reduce.add.v2i64(<2 x i64>)
267declare i64 @llvm.vector.reduce.add.v4i64(<4 x i64>)
268declare i64 @llvm.vector.reduce.add.v8i64(<8 x i64>)
269declare i64 @llvm.vector.reduce.add.v16i64(<16 x i64>)
Simon Pilgrime612ab02018-10-20 14:29:59 +0000270
Amara Emerson322d0af2020-10-02 18:30:53 -0700271declare i32 @llvm.vector.reduce.add.v2i32(<2 x i32>)
272declare i32 @llvm.vector.reduce.add.v4i32(<4 x i32>)
273declare i32 @llvm.vector.reduce.add.v8i32(<8 x i32>)
274declare i32 @llvm.vector.reduce.add.v16i32(<16 x i32>)
275declare i32 @llvm.vector.reduce.add.v32i32(<32 x i32>)
Simon Pilgrime612ab02018-10-20 14:29:59 +0000276
Amara Emerson322d0af2020-10-02 18:30:53 -0700277declare i16 @llvm.vector.reduce.add.v2i16(<2 x i16>)
278declare i16 @llvm.vector.reduce.add.v4i16(<4 x i16>)
279declare i16 @llvm.vector.reduce.add.v8i16(<8 x i16>)
280declare i16 @llvm.vector.reduce.add.v16i16(<16 x i16>)
281declare i16 @llvm.vector.reduce.add.v32i16(<32 x i16>)
282declare i16 @llvm.vector.reduce.add.v64i16(<64 x i16>)
Simon Pilgrime612ab02018-10-20 14:29:59 +0000283
Amara Emerson322d0af2020-10-02 18:30:53 -0700284declare i8 @llvm.vector.reduce.add.v2i8(<2 x i8>)
285declare i8 @llvm.vector.reduce.add.v4i8(<4 x i8>)
286declare i8 @llvm.vector.reduce.add.v8i8(<8 x i8>)
287declare i8 @llvm.vector.reduce.add.v16i8(<16 x i8>)
288declare i8 @llvm.vector.reduce.add.v32i8(<32 x i8>)
289declare i8 @llvm.vector.reduce.add.v64i8(<64 x i8>)
290declare i8 @llvm.vector.reduce.add.v128i8(<128 x i8>)