xref: /llvm-project/llvm/test/Analysis/CostModel/X86/abs.ll (revision 20ad05f9b462e23502681f4857de0e850f76fb2c)
1c6920081SSimon Pilgrim; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py
2*20ad05f9SSimon Pilgrim; RUN: opt < %s -mtriple=x86_64-unknown-linux-gnu -passes="print<cost-model>" 2>&1 -disable-output -mattr=+sse2 | FileCheck %s -check-prefixes=SSE
3*20ad05f9SSimon Pilgrim; RUN: opt < %s -mtriple=x86_64-unknown-linux-gnu -passes="print<cost-model>" 2>&1 -disable-output -mattr=+ssse3 | FileCheck %s -check-prefixes=SSE
4*20ad05f9SSimon Pilgrim; RUN: opt < %s -mtriple=x86_64-unknown-linux-gnu -passes="print<cost-model>" 2>&1 -disable-output -mattr=+sse4.2 | FileCheck %s -check-prefixes=SSE
54455c5cdSSimon Pilgrim; RUN: opt < %s -mtriple=x86_64-unknown-linux-gnu -passes="print<cost-model>" 2>&1 -disable-output -mattr=+avx | FileCheck %s -check-prefixes=AVX1
64455c5cdSSimon Pilgrim; RUN: opt < %s -mtriple=x86_64-unknown-linux-gnu -passes="print<cost-model>" 2>&1 -disable-output -mattr=+avx2 | FileCheck %s -check-prefixes=AVX2
74455c5cdSSimon Pilgrim; RUN: opt < %s -mtriple=x86_64-unknown-linux-gnu -passes="print<cost-model>" 2>&1 -disable-output -mattr=+avx512f | FileCheck %s -check-prefixes=AVX512,AVX512F
84455c5cdSSimon Pilgrim; RUN: opt < %s -mtriple=x86_64-unknown-linux-gnu -passes="print<cost-model>" 2>&1 -disable-output -mattr=+avx512vl,+avx512dq | FileCheck %s -check-prefixes=AVX512,AVX512DQ
94455c5cdSSimon Pilgrim; RUN: opt < %s -mtriple=x86_64-unknown-linux-gnu -passes="print<cost-model>" 2>&1 -disable-output -mattr=+avx512vl,+avx512bw | FileCheck %s -check-prefixes=AVX512,AVX512BW
10c6920081SSimon Pilgrim
11c6920081SSimon Pilgrim;
12c6920081SSimon Pilgrim; abs(X, not_posion)
13c6920081SSimon Pilgrim;
14c6920081SSimon Pilgrim
15c6920081SSimon Pilgrimdefine void @cost_abs_i64(i64 %a64, <2 x i64> %a128, <4 x i64> %a256, <8 x i64> %a512) {
16*20ad05f9SSimon Pilgrim; SSE-LABEL: 'cost_abs_i64'
17*20ad05f9SSimon Pilgrim; SSE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %I64 = call i64 @llvm.abs.i64(i64 %a64, i1 false)
18*20ad05f9SSimon Pilgrim; SSE-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %V2I64 = call <2 x i64> @llvm.abs.v2i64(<2 x i64> %a128, i1 false)
19*20ad05f9SSimon Pilgrim; SSE-NEXT:  Cost Model: Found an estimated cost of 6 for instruction: %V4I64 = call <4 x i64> @llvm.abs.v4i64(<4 x i64> %a256, i1 false)
20*20ad05f9SSimon Pilgrim; SSE-NEXT:  Cost Model: Found an estimated cost of 12 for instruction: %V8I64 = call <8 x i64> @llvm.abs.v8i64(<8 x i64> %a512, i1 false)
21*20ad05f9SSimon Pilgrim; SSE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret void
22c6920081SSimon Pilgrim;
23c5ef1f1eSSimon Pilgrim; AVX1-LABEL: 'cost_abs_i64'
24*20ad05f9SSimon Pilgrim; AVX1-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %I64 = call i64 @llvm.abs.i64(i64 %a64, i1 false)
25*20ad05f9SSimon Pilgrim; AVX1-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %V2I64 = call <2 x i64> @llvm.abs.v2i64(<2 x i64> %a128, i1 false)
26*20ad05f9SSimon Pilgrim; AVX1-NEXT:  Cost Model: Found an estimated cost of 6 for instruction: %V4I64 = call <4 x i64> @llvm.abs.v4i64(<4 x i64> %a256, i1 false)
27*20ad05f9SSimon Pilgrim; AVX1-NEXT:  Cost Model: Found an estimated cost of 12 for instruction: %V8I64 = call <8 x i64> @llvm.abs.v8i64(<8 x i64> %a512, i1 false)
28c5ef1f1eSSimon Pilgrim; AVX1-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret void
29c5ef1f1eSSimon Pilgrim;
30c5ef1f1eSSimon Pilgrim; AVX2-LABEL: 'cost_abs_i64'
31*20ad05f9SSimon Pilgrim; AVX2-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %I64 = call i64 @llvm.abs.i64(i64 %a64, i1 false)
32385a27d6SSimon Pilgrim; AVX2-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V2I64 = call <2 x i64> @llvm.abs.v2i64(<2 x i64> %a128, i1 false)
330a0f2825SSimon Pilgrim; AVX2-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V4I64 = call <4 x i64> @llvm.abs.v4i64(<4 x i64> %a256, i1 false)
340a0f2825SSimon Pilgrim; AVX2-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %V8I64 = call <8 x i64> @llvm.abs.v8i64(<8 x i64> %a512, i1 false)
35c5ef1f1eSSimon Pilgrim; AVX2-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret void
36c6920081SSimon Pilgrim;
37c6920081SSimon Pilgrim; AVX512-LABEL: 'cost_abs_i64'
38*20ad05f9SSimon Pilgrim; AVX512-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %I64 = call i64 @llvm.abs.i64(i64 %a64, i1 false)
390a0f2825SSimon Pilgrim; AVX512-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V2I64 = call <2 x i64> @llvm.abs.v2i64(<2 x i64> %a128, i1 false)
400a0f2825SSimon Pilgrim; AVX512-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V4I64 = call <4 x i64> @llvm.abs.v4i64(<4 x i64> %a256, i1 false)
410a0f2825SSimon Pilgrim; AVX512-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V8I64 = call <8 x i64> @llvm.abs.v8i64(<8 x i64> %a512, i1 false)
42c6920081SSimon Pilgrim; AVX512-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret void
43c6920081SSimon Pilgrim;
44c6920081SSimon Pilgrim  %I64    = call i64 @llvm.abs.i64(i64 %a64, i1 0)
45c6920081SSimon Pilgrim  %V2I64  = call <2 x i64> @llvm.abs.v2i64(<2 x i64> %a128, i1 0)
46c6920081SSimon Pilgrim  %V4I64  = call <4 x i64> @llvm.abs.v4i64(<4 x i64> %a256, i1 0)
47c6920081SSimon Pilgrim  %V8I64  = call <8 x i64> @llvm.abs.v8i64(<8 x i64> %a512, i1 0)
48c6920081SSimon Pilgrim  ret void
49c6920081SSimon Pilgrim}
50c6920081SSimon Pilgrim
51c6920081SSimon Pilgrimdefine void @cost_abs_i32(i32 %a32, <4 x i32> %a128, <8 x i32> %a256, <16 x i32> %a512) {
52*20ad05f9SSimon Pilgrim; SSE-LABEL: 'cost_abs_i32'
53*20ad05f9SSimon Pilgrim; SSE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %I32 = call i32 @llvm.abs.i32(i32 %a32, i1 false)
54*20ad05f9SSimon Pilgrim; SSE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V2I32 = call <4 x i32> @llvm.abs.v4i32(<4 x i32> %a128, i1 false)
55*20ad05f9SSimon Pilgrim; SSE-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V4I32 = call <8 x i32> @llvm.abs.v8i32(<8 x i32> %a256, i1 false)
56*20ad05f9SSimon Pilgrim; SSE-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %V8I32 = call <16 x i32> @llvm.abs.v16i32(<16 x i32> %a512, i1 false)
57*20ad05f9SSimon Pilgrim; SSE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret void
58c6920081SSimon Pilgrim;
59c5ef1f1eSSimon Pilgrim; AVX1-LABEL: 'cost_abs_i32'
60*20ad05f9SSimon Pilgrim; AVX1-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %I32 = call i32 @llvm.abs.i32(i32 %a32, i1 false)
610a0f2825SSimon Pilgrim; AVX1-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V2I32 = call <4 x i32> @llvm.abs.v4i32(<4 x i32> %a128, i1 false)
620a0f2825SSimon Pilgrim; AVX1-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %V4I32 = call <8 x i32> @llvm.abs.v8i32(<8 x i32> %a256, i1 false)
630a0f2825SSimon Pilgrim; AVX1-NEXT:  Cost Model: Found an estimated cost of 6 for instruction: %V8I32 = call <16 x i32> @llvm.abs.v16i32(<16 x i32> %a512, i1 false)
64c5ef1f1eSSimon Pilgrim; AVX1-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret void
65c5ef1f1eSSimon Pilgrim;
66c5ef1f1eSSimon Pilgrim; AVX2-LABEL: 'cost_abs_i32'
67*20ad05f9SSimon Pilgrim; AVX2-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %I32 = call i32 @llvm.abs.i32(i32 %a32, i1 false)
680a0f2825SSimon Pilgrim; AVX2-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V2I32 = call <4 x i32> @llvm.abs.v4i32(<4 x i32> %a128, i1 false)
690a0f2825SSimon Pilgrim; AVX2-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V4I32 = call <8 x i32> @llvm.abs.v8i32(<8 x i32> %a256, i1 false)
700a0f2825SSimon Pilgrim; AVX2-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V8I32 = call <16 x i32> @llvm.abs.v16i32(<16 x i32> %a512, i1 false)
71c5ef1f1eSSimon Pilgrim; AVX2-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret void
72c6920081SSimon Pilgrim;
73c6920081SSimon Pilgrim; AVX512-LABEL: 'cost_abs_i32'
74*20ad05f9SSimon Pilgrim; AVX512-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %I32 = call i32 @llvm.abs.i32(i32 %a32, i1 false)
750a0f2825SSimon Pilgrim; AVX512-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V2I32 = call <4 x i32> @llvm.abs.v4i32(<4 x i32> %a128, i1 false)
760a0f2825SSimon Pilgrim; AVX512-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V4I32 = call <8 x i32> @llvm.abs.v8i32(<8 x i32> %a256, i1 false)
770a0f2825SSimon Pilgrim; AVX512-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V8I32 = call <16 x i32> @llvm.abs.v16i32(<16 x i32> %a512, i1 false)
78c6920081SSimon Pilgrim; AVX512-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret void
79c6920081SSimon Pilgrim;
80c6920081SSimon Pilgrim  %I32   = call i32 @llvm.abs.i32(i32 %a32, i1 0)
81c6920081SSimon Pilgrim  %V2I32 = call <4 x i32> @llvm.abs.v4i32(<4 x i32> %a128, i1 0)
82c6920081SSimon Pilgrim  %V4I32 = call <8 x i32> @llvm.abs.v8i32(<8 x i32> %a256, i1 0)
83c6920081SSimon Pilgrim  %V8I32 = call <16 x i32> @llvm.abs.v16i32(<16 x i32> %a512, i1 0)
84c6920081SSimon Pilgrim  ret void
85c6920081SSimon Pilgrim}
86c6920081SSimon Pilgrim
87c6920081SSimon Pilgrimdefine void @cost_abs_i16(i16 %a16, <8 x i16> %a128, <16 x i16> %a256, <32 x i16> %a512) {
88*20ad05f9SSimon Pilgrim; SSE-LABEL: 'cost_abs_i16'
89*20ad05f9SSimon Pilgrim; SSE-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %I16 = call i16 @llvm.abs.i16(i16 %a16, i1 false)
90*20ad05f9SSimon Pilgrim; SSE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V8I16 = call <8 x i16> @llvm.abs.v8i16(<8 x i16> %a128, i1 false)
91*20ad05f9SSimon Pilgrim; SSE-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V16I16 = call <16 x i16> @llvm.abs.v16i16(<16 x i16> %a256, i1 false)
92*20ad05f9SSimon Pilgrim; SSE-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %V32I16 = call <32 x i16> @llvm.abs.v32i16(<32 x i16> %a512, i1 false)
93*20ad05f9SSimon Pilgrim; SSE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret void
94c5ef1f1eSSimon Pilgrim;
95c5ef1f1eSSimon Pilgrim; AVX1-LABEL: 'cost_abs_i16'
96385a27d6SSimon Pilgrim; AVX1-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %I16 = call i16 @llvm.abs.i16(i16 %a16, i1 false)
970a0f2825SSimon Pilgrim; AVX1-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V8I16 = call <8 x i16> @llvm.abs.v8i16(<8 x i16> %a128, i1 false)
980a0f2825SSimon Pilgrim; AVX1-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %V16I16 = call <16 x i16> @llvm.abs.v16i16(<16 x i16> %a256, i1 false)
990a0f2825SSimon Pilgrim; AVX1-NEXT:  Cost Model: Found an estimated cost of 6 for instruction: %V32I16 = call <32 x i16> @llvm.abs.v32i16(<32 x i16> %a512, i1 false)
100c5ef1f1eSSimon Pilgrim; AVX1-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret void
101c5ef1f1eSSimon Pilgrim;
102c5ef1f1eSSimon Pilgrim; AVX2-LABEL: 'cost_abs_i16'
103385a27d6SSimon Pilgrim; AVX2-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %I16 = call i16 @llvm.abs.i16(i16 %a16, i1 false)
1040a0f2825SSimon Pilgrim; AVX2-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V8I16 = call <8 x i16> @llvm.abs.v8i16(<8 x i16> %a128, i1 false)
1050a0f2825SSimon Pilgrim; AVX2-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V16I16 = call <16 x i16> @llvm.abs.v16i16(<16 x i16> %a256, i1 false)
1060a0f2825SSimon Pilgrim; AVX2-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V32I16 = call <32 x i16> @llvm.abs.v32i16(<32 x i16> %a512, i1 false)
107c5ef1f1eSSimon Pilgrim; AVX2-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret void
108c5ef1f1eSSimon Pilgrim;
109c5ef1f1eSSimon Pilgrim; AVX512F-LABEL: 'cost_abs_i16'
110385a27d6SSimon Pilgrim; AVX512F-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %I16 = call i16 @llvm.abs.i16(i16 %a16, i1 false)
1110a0f2825SSimon Pilgrim; AVX512F-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V8I16 = call <8 x i16> @llvm.abs.v8i16(<8 x i16> %a128, i1 false)
1120a0f2825SSimon Pilgrim; AVX512F-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V16I16 = call <16 x i16> @llvm.abs.v16i16(<16 x i16> %a256, i1 false)
1130a0f2825SSimon Pilgrim; AVX512F-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V32I16 = call <32 x i16> @llvm.abs.v32i16(<32 x i16> %a512, i1 false)
114c5ef1f1eSSimon Pilgrim; AVX512F-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret void
115c5ef1f1eSSimon Pilgrim;
116c5ef1f1eSSimon Pilgrim; AVX512DQ-LABEL: 'cost_abs_i16'
117385a27d6SSimon Pilgrim; AVX512DQ-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %I16 = call i16 @llvm.abs.i16(i16 %a16, i1 false)
1180a0f2825SSimon Pilgrim; AVX512DQ-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V8I16 = call <8 x i16> @llvm.abs.v8i16(<8 x i16> %a128, i1 false)
1190a0f2825SSimon Pilgrim; AVX512DQ-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V16I16 = call <16 x i16> @llvm.abs.v16i16(<16 x i16> %a256, i1 false)
1200a0f2825SSimon Pilgrim; AVX512DQ-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V32I16 = call <32 x i16> @llvm.abs.v32i16(<32 x i16> %a512, i1 false)
121c5ef1f1eSSimon Pilgrim; AVX512DQ-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret void
122c5ef1f1eSSimon Pilgrim;
123c5ef1f1eSSimon Pilgrim; AVX512BW-LABEL: 'cost_abs_i16'
124385a27d6SSimon Pilgrim; AVX512BW-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %I16 = call i16 @llvm.abs.i16(i16 %a16, i1 false)
1250a0f2825SSimon Pilgrim; AVX512BW-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V8I16 = call <8 x i16> @llvm.abs.v8i16(<8 x i16> %a128, i1 false)
1260a0f2825SSimon Pilgrim; AVX512BW-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V16I16 = call <16 x i16> @llvm.abs.v16i16(<16 x i16> %a256, i1 false)
1270a0f2825SSimon Pilgrim; AVX512BW-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V32I16 = call <32 x i16> @llvm.abs.v32i16(<32 x i16> %a512, i1 false)
128c5ef1f1eSSimon Pilgrim; AVX512BW-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret void
129c6920081SSimon Pilgrim;
130c6920081SSimon Pilgrim  %I16    = call i16 @llvm.abs.i16(i16 %a16, i1 0)
131c6920081SSimon Pilgrim  %V8I16  = call <8 x i16> @llvm.abs.v8i16(<8 x i16> %a128, i1 0)
132c6920081SSimon Pilgrim  %V16I16 = call <16 x i16> @llvm.abs.v16i16(<16 x i16> %a256, i1 0)
133c6920081SSimon Pilgrim  %V32I16 = call <32 x i16> @llvm.abs.v32i16(<32 x i16> %a512, i1 0)
134c6920081SSimon Pilgrim  ret void
135c6920081SSimon Pilgrim}
136c6920081SSimon Pilgrim
137c6920081SSimon Pilgrimdefine void @cost_abs_i8(i8 %a8, <16 x i8> %a128, <32 x i8> %a256, <64 x i8> %a512) {
138*20ad05f9SSimon Pilgrim; SSE-LABEL: 'cost_abs_i8'
139*20ad05f9SSimon Pilgrim; SSE-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %I8 = call i8 @llvm.abs.i8(i8 %a8, i1 false)
140*20ad05f9SSimon Pilgrim; SSE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V16I8 = call <16 x i8> @llvm.abs.v16i8(<16 x i8> %a128, i1 false)
141*20ad05f9SSimon Pilgrim; SSE-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V32I8 = call <32 x i8> @llvm.abs.v32i8(<32 x i8> %a256, i1 false)
142*20ad05f9SSimon Pilgrim; SSE-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %V64I8 = call <64 x i8> @llvm.abs.v64i8(<64 x i8> %a512, i1 false)
143*20ad05f9SSimon Pilgrim; SSE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret void
144c6920081SSimon Pilgrim;
145c5ef1f1eSSimon Pilgrim; AVX1-LABEL: 'cost_abs_i8'
14655b78e28SSimon Pilgrim; AVX1-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %I8 = call i8 @llvm.abs.i8(i8 %a8, i1 false)
1470a0f2825SSimon Pilgrim; AVX1-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V16I8 = call <16 x i8> @llvm.abs.v16i8(<16 x i8> %a128, i1 false)
1480a0f2825SSimon Pilgrim; AVX1-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %V32I8 = call <32 x i8> @llvm.abs.v32i8(<32 x i8> %a256, i1 false)
1490a0f2825SSimon Pilgrim; AVX1-NEXT:  Cost Model: Found an estimated cost of 6 for instruction: %V64I8 = call <64 x i8> @llvm.abs.v64i8(<64 x i8> %a512, i1 false)
150c5ef1f1eSSimon Pilgrim; AVX1-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret void
151c6920081SSimon Pilgrim;
152c5ef1f1eSSimon Pilgrim; AVX2-LABEL: 'cost_abs_i8'
15355b78e28SSimon Pilgrim; AVX2-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %I8 = call i8 @llvm.abs.i8(i8 %a8, i1 false)
1540a0f2825SSimon Pilgrim; AVX2-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V16I8 = call <16 x i8> @llvm.abs.v16i8(<16 x i8> %a128, i1 false)
1550a0f2825SSimon Pilgrim; AVX2-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V32I8 = call <32 x i8> @llvm.abs.v32i8(<32 x i8> %a256, i1 false)
1560a0f2825SSimon Pilgrim; AVX2-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V64I8 = call <64 x i8> @llvm.abs.v64i8(<64 x i8> %a512, i1 false)
157c5ef1f1eSSimon Pilgrim; AVX2-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret void
158c5ef1f1eSSimon Pilgrim;
159c5ef1f1eSSimon Pilgrim; AVX512F-LABEL: 'cost_abs_i8'
16055b78e28SSimon Pilgrim; AVX512F-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %I8 = call i8 @llvm.abs.i8(i8 %a8, i1 false)
1610a0f2825SSimon Pilgrim; AVX512F-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V16I8 = call <16 x i8> @llvm.abs.v16i8(<16 x i8> %a128, i1 false)
1620a0f2825SSimon Pilgrim; AVX512F-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V32I8 = call <32 x i8> @llvm.abs.v32i8(<32 x i8> %a256, i1 false)
1630a0f2825SSimon Pilgrim; AVX512F-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V64I8 = call <64 x i8> @llvm.abs.v64i8(<64 x i8> %a512, i1 false)
164c5ef1f1eSSimon Pilgrim; AVX512F-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret void
165c5ef1f1eSSimon Pilgrim;
166c5ef1f1eSSimon Pilgrim; AVX512DQ-LABEL: 'cost_abs_i8'
16755b78e28SSimon Pilgrim; AVX512DQ-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %I8 = call i8 @llvm.abs.i8(i8 %a8, i1 false)
1680a0f2825SSimon Pilgrim; AVX512DQ-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V16I8 = call <16 x i8> @llvm.abs.v16i8(<16 x i8> %a128, i1 false)
1690a0f2825SSimon Pilgrim; AVX512DQ-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V32I8 = call <32 x i8> @llvm.abs.v32i8(<32 x i8> %a256, i1 false)
1700a0f2825SSimon Pilgrim; AVX512DQ-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V64I8 = call <64 x i8> @llvm.abs.v64i8(<64 x i8> %a512, i1 false)
171c5ef1f1eSSimon Pilgrim; AVX512DQ-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret void
172c5ef1f1eSSimon Pilgrim;
173c5ef1f1eSSimon Pilgrim; AVX512BW-LABEL: 'cost_abs_i8'
17455b78e28SSimon Pilgrim; AVX512BW-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %I8 = call i8 @llvm.abs.i8(i8 %a8, i1 false)
1750a0f2825SSimon Pilgrim; AVX512BW-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V16I8 = call <16 x i8> @llvm.abs.v16i8(<16 x i8> %a128, i1 false)
1760a0f2825SSimon Pilgrim; AVX512BW-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V32I8 = call <32 x i8> @llvm.abs.v32i8(<32 x i8> %a256, i1 false)
1770a0f2825SSimon Pilgrim; AVX512BW-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V64I8 = call <64 x i8> @llvm.abs.v64i8(<64 x i8> %a512, i1 false)
178c5ef1f1eSSimon Pilgrim; AVX512BW-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret void
179c6920081SSimon Pilgrim;
180c6920081SSimon Pilgrim  %I8    = call i8 @llvm.abs.i8(i8 %a8, i1 0)
181c6920081SSimon Pilgrim  %V16I8 = call <16 x i8> @llvm.abs.v16i8(<16 x i8> %a128, i1 0)
182c6920081SSimon Pilgrim  %V32I8 = call <32 x i8> @llvm.abs.v32i8(<32 x i8> %a256, i1 0)
183c6920081SSimon Pilgrim  %V64I8 = call <64 x i8> @llvm.abs.v64i8(<64 x i8> %a512, i1 0)
184c6920081SSimon Pilgrim  ret void
185c6920081SSimon Pilgrim}
186c6920081SSimon Pilgrim
187c6920081SSimon Pilgrim;
188c6920081SSimon Pilgrim; abs(X, posion)
189c6920081SSimon Pilgrim;
190c6920081SSimon Pilgrim
191c6920081SSimon Pilgrimdefine void @cost_abs_i64_poison(i64 %a64, <2 x i64> %a128, <4 x i64> %a256, <8 x i64> %a512) {
192*20ad05f9SSimon Pilgrim; SSE-LABEL: 'cost_abs_i64_poison'
193*20ad05f9SSimon Pilgrim; SSE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %I64 = call i64 @llvm.abs.i64(i64 %a64, i1 true)
194*20ad05f9SSimon Pilgrim; SSE-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %V2I64 = call <2 x i64> @llvm.abs.v2i64(<2 x i64> %a128, i1 true)
195*20ad05f9SSimon Pilgrim; SSE-NEXT:  Cost Model: Found an estimated cost of 6 for instruction: %V4I64 = call <4 x i64> @llvm.abs.v4i64(<4 x i64> %a256, i1 true)
196*20ad05f9SSimon Pilgrim; SSE-NEXT:  Cost Model: Found an estimated cost of 12 for instruction: %V8I64 = call <8 x i64> @llvm.abs.v8i64(<8 x i64> %a512, i1 true)
197*20ad05f9SSimon Pilgrim; SSE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret void
198c6920081SSimon Pilgrim;
199c5ef1f1eSSimon Pilgrim; AVX1-LABEL: 'cost_abs_i64_poison'
200*20ad05f9SSimon Pilgrim; AVX1-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %I64 = call i64 @llvm.abs.i64(i64 %a64, i1 true)
201*20ad05f9SSimon Pilgrim; AVX1-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %V2I64 = call <2 x i64> @llvm.abs.v2i64(<2 x i64> %a128, i1 true)
202*20ad05f9SSimon Pilgrim; AVX1-NEXT:  Cost Model: Found an estimated cost of 6 for instruction: %V4I64 = call <4 x i64> @llvm.abs.v4i64(<4 x i64> %a256, i1 true)
203*20ad05f9SSimon Pilgrim; AVX1-NEXT:  Cost Model: Found an estimated cost of 12 for instruction: %V8I64 = call <8 x i64> @llvm.abs.v8i64(<8 x i64> %a512, i1 true)
204c5ef1f1eSSimon Pilgrim; AVX1-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret void
205c5ef1f1eSSimon Pilgrim;
206c5ef1f1eSSimon Pilgrim; AVX2-LABEL: 'cost_abs_i64_poison'
207*20ad05f9SSimon Pilgrim; AVX2-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %I64 = call i64 @llvm.abs.i64(i64 %a64, i1 true)
208385a27d6SSimon Pilgrim; AVX2-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V2I64 = call <2 x i64> @llvm.abs.v2i64(<2 x i64> %a128, i1 true)
2090a0f2825SSimon Pilgrim; AVX2-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V4I64 = call <4 x i64> @llvm.abs.v4i64(<4 x i64> %a256, i1 true)
2100a0f2825SSimon Pilgrim; AVX2-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %V8I64 = call <8 x i64> @llvm.abs.v8i64(<8 x i64> %a512, i1 true)
211c5ef1f1eSSimon Pilgrim; AVX2-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret void
212c6920081SSimon Pilgrim;
213c6920081SSimon Pilgrim; AVX512-LABEL: 'cost_abs_i64_poison'
214*20ad05f9SSimon Pilgrim; AVX512-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %I64 = call i64 @llvm.abs.i64(i64 %a64, i1 true)
2150a0f2825SSimon Pilgrim; AVX512-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V2I64 = call <2 x i64> @llvm.abs.v2i64(<2 x i64> %a128, i1 true)
2160a0f2825SSimon Pilgrim; AVX512-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V4I64 = call <4 x i64> @llvm.abs.v4i64(<4 x i64> %a256, i1 true)
2170a0f2825SSimon Pilgrim; AVX512-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V8I64 = call <8 x i64> @llvm.abs.v8i64(<8 x i64> %a512, i1 true)
218c6920081SSimon Pilgrim; AVX512-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret void
219c6920081SSimon Pilgrim;
220c6920081SSimon Pilgrim  %I64    = call i64 @llvm.abs.i64(i64 %a64, i1 -1)
221c6920081SSimon Pilgrim  %V2I64  = call <2 x i64> @llvm.abs.v2i64(<2 x i64> %a128, i1 -1)
222c6920081SSimon Pilgrim  %V4I64  = call <4 x i64> @llvm.abs.v4i64(<4 x i64> %a256, i1 -1)
223c6920081SSimon Pilgrim  %V8I64  = call <8 x i64> @llvm.abs.v8i64(<8 x i64> %a512, i1 -1)
224c6920081SSimon Pilgrim  ret void
225c6920081SSimon Pilgrim}
226c6920081SSimon Pilgrim
227c6920081SSimon Pilgrimdefine void @cost_abs_i32_poison(i32 %a32, <4 x i32> %a128, <8 x i32> %a256, <16 x i32> %a512) {
228*20ad05f9SSimon Pilgrim; SSE-LABEL: 'cost_abs_i32_poison'
229*20ad05f9SSimon Pilgrim; SSE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %I32 = call i32 @llvm.abs.i32(i32 %a32, i1 true)
230*20ad05f9SSimon Pilgrim; SSE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V2I32 = call <4 x i32> @llvm.abs.v4i32(<4 x i32> %a128, i1 true)
231*20ad05f9SSimon Pilgrim; SSE-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V4I32 = call <8 x i32> @llvm.abs.v8i32(<8 x i32> %a256, i1 true)
232*20ad05f9SSimon Pilgrim; SSE-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %V8I32 = call <16 x i32> @llvm.abs.v16i32(<16 x i32> %a512, i1 true)
233*20ad05f9SSimon Pilgrim; SSE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret void
234c6920081SSimon Pilgrim;
235c5ef1f1eSSimon Pilgrim; AVX1-LABEL: 'cost_abs_i32_poison'
236*20ad05f9SSimon Pilgrim; AVX1-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %I32 = call i32 @llvm.abs.i32(i32 %a32, i1 true)
2370a0f2825SSimon Pilgrim; AVX1-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V2I32 = call <4 x i32> @llvm.abs.v4i32(<4 x i32> %a128, i1 true)
2380a0f2825SSimon Pilgrim; AVX1-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %V4I32 = call <8 x i32> @llvm.abs.v8i32(<8 x i32> %a256, i1 true)
2390a0f2825SSimon Pilgrim; AVX1-NEXT:  Cost Model: Found an estimated cost of 6 for instruction: %V8I32 = call <16 x i32> @llvm.abs.v16i32(<16 x i32> %a512, i1 true)
240c5ef1f1eSSimon Pilgrim; AVX1-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret void
241c5ef1f1eSSimon Pilgrim;
242c5ef1f1eSSimon Pilgrim; AVX2-LABEL: 'cost_abs_i32_poison'
243*20ad05f9SSimon Pilgrim; AVX2-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %I32 = call i32 @llvm.abs.i32(i32 %a32, i1 true)
2440a0f2825SSimon Pilgrim; AVX2-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V2I32 = call <4 x i32> @llvm.abs.v4i32(<4 x i32> %a128, i1 true)
2450a0f2825SSimon Pilgrim; AVX2-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V4I32 = call <8 x i32> @llvm.abs.v8i32(<8 x i32> %a256, i1 true)
2460a0f2825SSimon Pilgrim; AVX2-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V8I32 = call <16 x i32> @llvm.abs.v16i32(<16 x i32> %a512, i1 true)
247c5ef1f1eSSimon Pilgrim; AVX2-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret void
248c6920081SSimon Pilgrim;
249c6920081SSimon Pilgrim; AVX512-LABEL: 'cost_abs_i32_poison'
250*20ad05f9SSimon Pilgrim; AVX512-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %I32 = call i32 @llvm.abs.i32(i32 %a32, i1 true)
2510a0f2825SSimon Pilgrim; AVX512-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V2I32 = call <4 x i32> @llvm.abs.v4i32(<4 x i32> %a128, i1 true)
2520a0f2825SSimon Pilgrim; AVX512-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V4I32 = call <8 x i32> @llvm.abs.v8i32(<8 x i32> %a256, i1 true)
2530a0f2825SSimon Pilgrim; AVX512-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V8I32 = call <16 x i32> @llvm.abs.v16i32(<16 x i32> %a512, i1 true)
254c6920081SSimon Pilgrim; AVX512-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret void
255c6920081SSimon Pilgrim;
256c6920081SSimon Pilgrim  %I32   = call i32 @llvm.abs.i32(i32 %a32, i1 -1)
257c6920081SSimon Pilgrim  %V2I32 = call <4 x i32> @llvm.abs.v4i32(<4 x i32> %a128, i1 -1)
258c6920081SSimon Pilgrim  %V4I32 = call <8 x i32> @llvm.abs.v8i32(<8 x i32> %a256, i1 -1)
259c6920081SSimon Pilgrim  %V8I32 = call <16 x i32> @llvm.abs.v16i32(<16 x i32> %a512, i1 -1)
260c6920081SSimon Pilgrim  ret void
261c6920081SSimon Pilgrim}
262c6920081SSimon Pilgrim
263c6920081SSimon Pilgrimdefine void @cost_abs_i16_poison(i16 %a16, <8 x i16> %a128, <16 x i16> %a256, <32 x i16> %a512) {
264*20ad05f9SSimon Pilgrim; SSE-LABEL: 'cost_abs_i16_poison'
265*20ad05f9SSimon Pilgrim; SSE-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %I16 = call i16 @llvm.abs.i16(i16 %a16, i1 true)
266*20ad05f9SSimon Pilgrim; SSE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V8I16 = call <8 x i16> @llvm.abs.v8i16(<8 x i16> %a128, i1 true)
267*20ad05f9SSimon Pilgrim; SSE-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V16I16 = call <16 x i16> @llvm.abs.v16i16(<16 x i16> %a256, i1 true)
268*20ad05f9SSimon Pilgrim; SSE-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %V32I16 = call <32 x i16> @llvm.abs.v32i16(<32 x i16> %a512, i1 true)
269*20ad05f9SSimon Pilgrim; SSE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret void
270c5ef1f1eSSimon Pilgrim;
271c5ef1f1eSSimon Pilgrim; AVX1-LABEL: 'cost_abs_i16_poison'
272385a27d6SSimon Pilgrim; AVX1-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %I16 = call i16 @llvm.abs.i16(i16 %a16, i1 true)
2730a0f2825SSimon Pilgrim; AVX1-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V8I16 = call <8 x i16> @llvm.abs.v8i16(<8 x i16> %a128, i1 true)
2740a0f2825SSimon Pilgrim; AVX1-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %V16I16 = call <16 x i16> @llvm.abs.v16i16(<16 x i16> %a256, i1 true)
2750a0f2825SSimon Pilgrim; AVX1-NEXT:  Cost Model: Found an estimated cost of 6 for instruction: %V32I16 = call <32 x i16> @llvm.abs.v32i16(<32 x i16> %a512, i1 true)
276c5ef1f1eSSimon Pilgrim; AVX1-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret void
277c5ef1f1eSSimon Pilgrim;
278c5ef1f1eSSimon Pilgrim; AVX2-LABEL: 'cost_abs_i16_poison'
279385a27d6SSimon Pilgrim; AVX2-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %I16 = call i16 @llvm.abs.i16(i16 %a16, i1 true)
2800a0f2825SSimon Pilgrim; AVX2-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V8I16 = call <8 x i16> @llvm.abs.v8i16(<8 x i16> %a128, i1 true)
2810a0f2825SSimon Pilgrim; AVX2-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V16I16 = call <16 x i16> @llvm.abs.v16i16(<16 x i16> %a256, i1 true)
2820a0f2825SSimon Pilgrim; AVX2-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V32I16 = call <32 x i16> @llvm.abs.v32i16(<32 x i16> %a512, i1 true)
283c5ef1f1eSSimon Pilgrim; AVX2-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret void
284c5ef1f1eSSimon Pilgrim;
285c5ef1f1eSSimon Pilgrim; AVX512F-LABEL: 'cost_abs_i16_poison'
286385a27d6SSimon Pilgrim; AVX512F-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %I16 = call i16 @llvm.abs.i16(i16 %a16, i1 true)
2870a0f2825SSimon Pilgrim; AVX512F-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V8I16 = call <8 x i16> @llvm.abs.v8i16(<8 x i16> %a128, i1 true)
2880a0f2825SSimon Pilgrim; AVX512F-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V16I16 = call <16 x i16> @llvm.abs.v16i16(<16 x i16> %a256, i1 true)
2890a0f2825SSimon Pilgrim; AVX512F-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V32I16 = call <32 x i16> @llvm.abs.v32i16(<32 x i16> %a512, i1 true)
290c5ef1f1eSSimon Pilgrim; AVX512F-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret void
291c5ef1f1eSSimon Pilgrim;
292c5ef1f1eSSimon Pilgrim; AVX512DQ-LABEL: 'cost_abs_i16_poison'
293385a27d6SSimon Pilgrim; AVX512DQ-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %I16 = call i16 @llvm.abs.i16(i16 %a16, i1 true)
2940a0f2825SSimon Pilgrim; AVX512DQ-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V8I16 = call <8 x i16> @llvm.abs.v8i16(<8 x i16> %a128, i1 true)
2950a0f2825SSimon Pilgrim; AVX512DQ-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V16I16 = call <16 x i16> @llvm.abs.v16i16(<16 x i16> %a256, i1 true)
2960a0f2825SSimon Pilgrim; AVX512DQ-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V32I16 = call <32 x i16> @llvm.abs.v32i16(<32 x i16> %a512, i1 true)
297c5ef1f1eSSimon Pilgrim; AVX512DQ-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret void
298c5ef1f1eSSimon Pilgrim;
299c5ef1f1eSSimon Pilgrim; AVX512BW-LABEL: 'cost_abs_i16_poison'
300385a27d6SSimon Pilgrim; AVX512BW-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %I16 = call i16 @llvm.abs.i16(i16 %a16, i1 true)
3010a0f2825SSimon Pilgrim; AVX512BW-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V8I16 = call <8 x i16> @llvm.abs.v8i16(<8 x i16> %a128, i1 true)
3020a0f2825SSimon Pilgrim; AVX512BW-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V16I16 = call <16 x i16> @llvm.abs.v16i16(<16 x i16> %a256, i1 true)
3030a0f2825SSimon Pilgrim; AVX512BW-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V32I16 = call <32 x i16> @llvm.abs.v32i16(<32 x i16> %a512, i1 true)
304c5ef1f1eSSimon Pilgrim; AVX512BW-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret void
305c6920081SSimon Pilgrim;
306c6920081SSimon Pilgrim  %I16    = call i16 @llvm.abs.i16(i16 %a16, i1 -1)
307c6920081SSimon Pilgrim  %V8I16  = call <8 x i16> @llvm.abs.v8i16(<8 x i16> %a128, i1 -1)
308c6920081SSimon Pilgrim  %V16I16 = call <16 x i16> @llvm.abs.v16i16(<16 x i16> %a256, i1 -1)
309c6920081SSimon Pilgrim  %V32I16 = call <32 x i16> @llvm.abs.v32i16(<32 x i16> %a512, i1 -1)
310c6920081SSimon Pilgrim  ret void
311c6920081SSimon Pilgrim}
312c6920081SSimon Pilgrim
313c6920081SSimon Pilgrimdefine void @cost_abs_i8_poison(i8 %a8, <16 x i8> %a128, <32 x i8> %a256, <64 x i8> %a512) {
314*20ad05f9SSimon Pilgrim; SSE-LABEL: 'cost_abs_i8_poison'
315*20ad05f9SSimon Pilgrim; SSE-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %I8 = call i8 @llvm.abs.i8(i8 %a8, i1 true)
316*20ad05f9SSimon Pilgrim; SSE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V16I8 = call <16 x i8> @llvm.abs.v16i8(<16 x i8> %a128, i1 true)
317*20ad05f9SSimon Pilgrim; SSE-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V32I8 = call <32 x i8> @llvm.abs.v32i8(<32 x i8> %a256, i1 true)
318*20ad05f9SSimon Pilgrim; SSE-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %V64I8 = call <64 x i8> @llvm.abs.v64i8(<64 x i8> %a512, i1 true)
319*20ad05f9SSimon Pilgrim; SSE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret void
320c6920081SSimon Pilgrim;
321c5ef1f1eSSimon Pilgrim; AVX1-LABEL: 'cost_abs_i8_poison'
32255b78e28SSimon Pilgrim; AVX1-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %I8 = call i8 @llvm.abs.i8(i8 %a8, i1 true)
3230a0f2825SSimon Pilgrim; AVX1-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V16I8 = call <16 x i8> @llvm.abs.v16i8(<16 x i8> %a128, i1 true)
3240a0f2825SSimon Pilgrim; AVX1-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %V32I8 = call <32 x i8> @llvm.abs.v32i8(<32 x i8> %a256, i1 true)
3250a0f2825SSimon Pilgrim; AVX1-NEXT:  Cost Model: Found an estimated cost of 6 for instruction: %V64I8 = call <64 x i8> @llvm.abs.v64i8(<64 x i8> %a512, i1 true)
326c5ef1f1eSSimon Pilgrim; AVX1-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret void
327c6920081SSimon Pilgrim;
328c5ef1f1eSSimon Pilgrim; AVX2-LABEL: 'cost_abs_i8_poison'
32955b78e28SSimon Pilgrim; AVX2-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %I8 = call i8 @llvm.abs.i8(i8 %a8, i1 true)
3300a0f2825SSimon Pilgrim; AVX2-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V16I8 = call <16 x i8> @llvm.abs.v16i8(<16 x i8> %a128, i1 true)
3310a0f2825SSimon Pilgrim; AVX2-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V32I8 = call <32 x i8> @llvm.abs.v32i8(<32 x i8> %a256, i1 true)
3320a0f2825SSimon Pilgrim; AVX2-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V64I8 = call <64 x i8> @llvm.abs.v64i8(<64 x i8> %a512, i1 true)
333c5ef1f1eSSimon Pilgrim; AVX2-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret void
334c5ef1f1eSSimon Pilgrim;
335c5ef1f1eSSimon Pilgrim; AVX512F-LABEL: 'cost_abs_i8_poison'
33655b78e28SSimon Pilgrim; AVX512F-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %I8 = call i8 @llvm.abs.i8(i8 %a8, i1 true)
3370a0f2825SSimon Pilgrim; AVX512F-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V16I8 = call <16 x i8> @llvm.abs.v16i8(<16 x i8> %a128, i1 true)
3380a0f2825SSimon Pilgrim; AVX512F-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V32I8 = call <32 x i8> @llvm.abs.v32i8(<32 x i8> %a256, i1 true)
3390a0f2825SSimon Pilgrim; AVX512F-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V64I8 = call <64 x i8> @llvm.abs.v64i8(<64 x i8> %a512, i1 true)
340c5ef1f1eSSimon Pilgrim; AVX512F-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret void
341c5ef1f1eSSimon Pilgrim;
342c5ef1f1eSSimon Pilgrim; AVX512DQ-LABEL: 'cost_abs_i8_poison'
34355b78e28SSimon Pilgrim; AVX512DQ-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %I8 = call i8 @llvm.abs.i8(i8 %a8, i1 true)
3440a0f2825SSimon Pilgrim; AVX512DQ-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V16I8 = call <16 x i8> @llvm.abs.v16i8(<16 x i8> %a128, i1 true)
3450a0f2825SSimon Pilgrim; AVX512DQ-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V32I8 = call <32 x i8> @llvm.abs.v32i8(<32 x i8> %a256, i1 true)
3460a0f2825SSimon Pilgrim; AVX512DQ-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V64I8 = call <64 x i8> @llvm.abs.v64i8(<64 x i8> %a512, i1 true)
347c5ef1f1eSSimon Pilgrim; AVX512DQ-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret void
348c5ef1f1eSSimon Pilgrim;
349c5ef1f1eSSimon Pilgrim; AVX512BW-LABEL: 'cost_abs_i8_poison'
35055b78e28SSimon Pilgrim; AVX512BW-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %I8 = call i8 @llvm.abs.i8(i8 %a8, i1 true)
3510a0f2825SSimon Pilgrim; AVX512BW-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V16I8 = call <16 x i8> @llvm.abs.v16i8(<16 x i8> %a128, i1 true)
3520a0f2825SSimon Pilgrim; AVX512BW-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V32I8 = call <32 x i8> @llvm.abs.v32i8(<32 x i8> %a256, i1 true)
3530a0f2825SSimon Pilgrim; AVX512BW-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V64I8 = call <64 x i8> @llvm.abs.v64i8(<64 x i8> %a512, i1 true)
354c5ef1f1eSSimon Pilgrim; AVX512BW-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret void
355c6920081SSimon Pilgrim;
356c6920081SSimon Pilgrim  %I8    = call i8 @llvm.abs.i8(i8 %a8, i1 -1)
357c6920081SSimon Pilgrim  %V16I8 = call <16 x i8> @llvm.abs.v16i8(<16 x i8> %a128, i1 -1)
358c6920081SSimon Pilgrim  %V32I8 = call <32 x i8> @llvm.abs.v32i8(<32 x i8> %a256, i1 -1)
359c6920081SSimon Pilgrim  %V64I8 = call <64 x i8> @llvm.abs.v64i8(<64 x i8> %a512, i1 -1)
360c6920081SSimon Pilgrim  ret void
361c6920081SSimon Pilgrim}
362c6920081SSimon Pilgrim
363c6920081SSimon Pilgrimdeclare i64 @llvm.abs.i64(i64, i1)
364c6920081SSimon Pilgrimdeclare i32 @llvm.abs.i32(i32, i1)
365c6920081SSimon Pilgrimdeclare i16 @llvm.abs.i16(i16, i1)
366c6920081SSimon Pilgrimdeclare  i8 @llvm.abs.i8(i8, i1)
367c6920081SSimon Pilgrim
368c6920081SSimon Pilgrimdeclare <2 x i64>  @llvm.abs.v2i64(<2 x i64>, i1)
369c6920081SSimon Pilgrimdeclare <4 x i32>  @llvm.abs.v4i32(<4 x i32>, i1)
370c6920081SSimon Pilgrimdeclare <8 x i16>  @llvm.abs.v8i16(<8 x i16>, i1)
371c6920081SSimon Pilgrimdeclare <16 x i8>  @llvm.abs.v16i8(<16 x i8>, i1)
372c6920081SSimon Pilgrim
373c6920081SSimon Pilgrimdeclare <4 x i64>  @llvm.abs.v4i64(<4 x i64>, i1)
374c6920081SSimon Pilgrimdeclare <8 x i32>  @llvm.abs.v8i32(<8 x i32>, i1)
375c6920081SSimon Pilgrimdeclare <16 x i16> @llvm.abs.v16i16(<16 x i16>, i1)
376c6920081SSimon Pilgrimdeclare <32 x i8>  @llvm.abs.v32i8(<32 x i8>, i1)
377c6920081SSimon Pilgrim
378c6920081SSimon Pilgrimdeclare <8 x i64>  @llvm.abs.v8i64(<8 x i64>, i1)
379c6920081SSimon Pilgrimdeclare <16 x i32> @llvm.abs.v16i32(<16 x i32>, i1)
380c6920081SSimon Pilgrimdeclare <32 x i16> @llvm.abs.v32i16(<32 x i16>, i1)
381c6920081SSimon Pilgrimdeclare <64 x i8>  @llvm.abs.v64i8(<64 x i8>, i1)
382