1; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py
2; RUN: opt -passes='print<cost-model>' 2>&1 -disable-output -mtriple=amdgcn-unknown-amdhsa < %s | FileCheck -check-prefixes=ALL %s
3; RUN: opt -passes='print<cost-model>' -cost-kind=code-size 2>&1 -disable-output -mtriple=amdgcn-unknown-amdhsa < %s | FileCheck -check-prefixes=ALL-SIZE %s
4; END.
5
6define amdgpu_kernel void @fabs_f32() #0 {
7; ALL-LABEL: 'fabs_f32'
8; ALL-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %f32 = call float @llvm.fabs.f32(float undef) #2
9; ALL-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %v2f32 = call <2 x float> @llvm.fabs.v2f32(<2 x float> undef) #2
10; ALL-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %v3f32 = call <3 x float> @llvm.fabs.v3f32(<3 x float> undef) #2
11; ALL-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %v4f32 = call <4 x float> @llvm.fabs.v4f32(<4 x float> undef) #2
12; ALL-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %v5f32 = call <5 x float> @llvm.fabs.v5f32(<5 x float> undef) #2
13; ALL-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %v8f32 = call <8 x float> @llvm.fabs.v8f32(<8 x float> undef) #2
14; ALL-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %v9f32 = call <9 x float> @llvm.fabs.v9f32(<9 x float> undef) #2
15; ALL-NEXT:  Cost Model: Found an estimated cost of 10 for instruction: ret void
16;
17; ALL-SIZE-LABEL: 'fabs_f32'
18; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %f32 = call float @llvm.fabs.f32(float undef) #2
19; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %v2f32 = call <2 x float> @llvm.fabs.v2f32(<2 x float> undef) #2
20; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %v3f32 = call <3 x float> @llvm.fabs.v3f32(<3 x float> undef) #2
21; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %v4f32 = call <4 x float> @llvm.fabs.v4f32(<4 x float> undef) #2
22; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %v5f32 = call <5 x float> @llvm.fabs.v5f32(<5 x float> undef) #2
23; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %v8f32 = call <8 x float> @llvm.fabs.v8f32(<8 x float> undef) #2
24; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %v9f32 = call <9 x float> @llvm.fabs.v9f32(<9 x float> undef) #2
25; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret void
26;
27  %f32 = call float @llvm.fabs.f32(float undef) #1
28  %v2f32 = call <2 x float> @llvm.fabs.v2f32(<2 x float> undef) #1
29  %v3f32 = call <3 x float> @llvm.fabs.v3f32(<3 x float> undef) #1
30  %v4f32 = call <4 x float> @llvm.fabs.v4f32(<4 x float> undef) #1
31  %v5f32 = call <5 x float> @llvm.fabs.v5f32(<5 x float> undef) #1
32  %v8f32 = call <8 x float> @llvm.fabs.v8f32(<8 x float> undef) #1
33  %v9f32 = call <9 x float> @llvm.fabs.v9f32(<9 x float> undef) #1
34  ret void
35}
36
37define amdgpu_kernel void @fabs_f64() #0 {
38; ALL-LABEL: 'fabs_f64'
39; ALL-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %f64 = call double @llvm.fabs.f64(double undef) #2
40; ALL-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %v2f64 = call <2 x double> @llvm.fabs.v2f64(<2 x double> undef) #2
41; ALL-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %v3f64 = call <3 x double> @llvm.fabs.v3f64(<3 x double> undef) #2
42; ALL-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %v4f64 = call <4 x double> @llvm.fabs.v4f64(<4 x double> undef) #2
43; ALL-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %v5f64 = call <5 x double> @llvm.fabs.v5f64(<5 x double> undef) #2
44; ALL-NEXT:  Cost Model: Found an estimated cost of 10 for instruction: ret void
45;
46; ALL-SIZE-LABEL: 'fabs_f64'
47; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %f64 = call double @llvm.fabs.f64(double undef) #2
48; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %v2f64 = call <2 x double> @llvm.fabs.v2f64(<2 x double> undef) #2
49; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %v3f64 = call <3 x double> @llvm.fabs.v3f64(<3 x double> undef) #2
50; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %v4f64 = call <4 x double> @llvm.fabs.v4f64(<4 x double> undef) #2
51; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %v5f64 = call <5 x double> @llvm.fabs.v5f64(<5 x double> undef) #2
52; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret void
53;
54  %f64 = call double @llvm.fabs.f64(double undef) #1
55  %v2f64 = call <2 x double> @llvm.fabs.v2f64(<2 x double> undef) #1
56  %v3f64 = call <3 x double> @llvm.fabs.v3f64(<3 x double> undef) #1
57  %v4f64 = call <4 x double> @llvm.fabs.v4f64(<4 x double> undef) #1
58  %v5f64 = call <5 x double> @llvm.fabs.v5f64(<5 x double> undef) #1
59  ret void
60}
61
62define amdgpu_kernel void @fabs_f16() #0 {
63; ALL-LABEL: 'fabs_f16'
64; ALL-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %f16 = call half @llvm.fabs.f16(half undef) #2
65; ALL-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %v2f16 = call <2 x half> @llvm.fabs.v2f16(<2 x half> undef) #2
66; ALL-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %v3f16 = call <3 x half> @llvm.fabs.v3f16(<3 x half> undef) #2
67; ALL-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %v4f16 = call <4 x half> @llvm.fabs.v4f16(<4 x half> undef) #2
68; ALL-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %v5f16 = call <5 x half> @llvm.fabs.v5f16(<5 x half> undef) #2
69; ALL-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %v16f16 = call <16 x half> @llvm.fabs.v16f16(<16 x half> undef) #2
70; ALL-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %v17f16 = call <17 x half> @llvm.fabs.v17f16(<17 x half> undef) #2
71; ALL-NEXT:  Cost Model: Found an estimated cost of 10 for instruction: ret void
72;
73; ALL-SIZE-LABEL: 'fabs_f16'
74; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %f16 = call half @llvm.fabs.f16(half undef) #2
75; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %v2f16 = call <2 x half> @llvm.fabs.v2f16(<2 x half> undef) #2
76; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %v3f16 = call <3 x half> @llvm.fabs.v3f16(<3 x half> undef) #2
77; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %v4f16 = call <4 x half> @llvm.fabs.v4f16(<4 x half> undef) #2
78; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %v5f16 = call <5 x half> @llvm.fabs.v5f16(<5 x half> undef) #2
79; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %v16f16 = call <16 x half> @llvm.fabs.v16f16(<16 x half> undef) #2
80; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %v17f16 = call <17 x half> @llvm.fabs.v17f16(<17 x half> undef) #2
81; ALL-SIZE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret void
82;
83  %f16 = call half @llvm.fabs.f16(half undef) #1
84  %v2f16 = call <2 x half> @llvm.fabs.v2f16(<2 x half> undef) #1
85  %v3f16 = call <3 x half> @llvm.fabs.v3f16(<3 x half> undef) #1
86  %v4f16 = call <4 x half> @llvm.fabs.v4f16(<4 x half> undef) #1
87  %v5f16 = call <5 x half> @llvm.fabs.v5f16(<5 x half> undef) #1
88  %v16f16 = call <16 x half> @llvm.fabs.v16f16(<16 x half> undef) #1
89  %v17f16 = call <17 x half> @llvm.fabs.v17f16(<17 x half> undef) #1
90  ret void
91}
92
93declare float @llvm.fabs.f32(float) #1
94declare <2 x float> @llvm.fabs.v2f32(<2 x float>) #1
95declare <3 x float> @llvm.fabs.v3f32(<3 x float>) #1
96declare <4 x float> @llvm.fabs.v4f32(<4 x float>) #1
97declare <5 x float> @llvm.fabs.v5f32(<5 x float>) #1
98declare <8 x float> @llvm.fabs.v8f32(<8 x float>) #1
99declare <9 x float> @llvm.fabs.v9f32(<9 x float>) #1
100
101declare double @llvm.fabs.f64(double) #1
102declare <2 x double> @llvm.fabs.v2f64(<2 x double>) #1
103declare <3 x double> @llvm.fabs.v3f64(<3 x double>) #1
104declare <4 x double> @llvm.fabs.v4f64(<4 x double>) #1
105declare <5 x double> @llvm.fabs.v5f64(<5 x double>) #1
106
107declare half @llvm.fabs.f16(half) #1
108declare <2 x half> @llvm.fabs.v2f16(<2 x half>) #1
109declare <3 x half> @llvm.fabs.v3f16(<3 x half>) #1
110declare <4 x half> @llvm.fabs.v4f16(<4 x half>) #1
111declare <5 x half> @llvm.fabs.v5f16(<5 x half>) #1
112declare <16 x half> @llvm.fabs.v16f16(<16 x half>) #1
113declare <17 x half> @llvm.fabs.v17f16(<17 x half>) #1
114
115attributes #0 = { nounwind }
116attributes #1 = { nounwind readnone }
117