1 ; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py UTC_ARGS: --version 5
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
5 define void @arithmetic_fence_f16() {
6 ; ALL-LABEL: 'arithmetic_fence_f16'
7 ; ALL-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %f16 = call half @llvm.arithmetic.fence.f16(half undef)
8 ; ALL-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %v2f16 = call <2 x half> @llvm.arithmetic.fence.v2f16(<2 x half> undef)
9 ; ALL-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %v3f16 = call <3 x half> @llvm.arithmetic.fence.v3f16(<3 x half> undef)
10 ; ALL-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %v4f16 = call <4 x half> @llvm.arithmetic.fence.v4f16(<4 x half> undef)
11 ; ALL-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %v5f16 = call <5 x half> @llvm.arithmetic.fence.v5f16(<5 x half> undef)
12 ; ALL-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %v8f16 = call <8 x half> @llvm.arithmetic.fence.v8f16(<8 x half> undef)
13 ; ALL-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %v16f16 = call <16 x half> @llvm.arithmetic.fence.v16f16(<16 x half> undef)
14 ; ALL-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %v17f16 = call <17 x half> @llvm.arithmetic.fence.v17f16(<17 x half> undef)
15 ; ALL-NEXT: Cost Model: Found an estimated cost of 10 for instruction: ret void
17 ; ALL-SIZE-LABEL: 'arithmetic_fence_f16'
18 ; ALL-SIZE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %f16 = call half @llvm.arithmetic.fence.f16(half undef)
19 ; ALL-SIZE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %v2f16 = call <2 x half> @llvm.arithmetic.fence.v2f16(<2 x half> undef)
20 ; ALL-SIZE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %v3f16 = call <3 x half> @llvm.arithmetic.fence.v3f16(<3 x half> undef)
21 ; ALL-SIZE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %v4f16 = call <4 x half> @llvm.arithmetic.fence.v4f16(<4 x half> undef)
22 ; ALL-SIZE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %v5f16 = call <5 x half> @llvm.arithmetic.fence.v5f16(<5 x half> undef)
23 ; ALL-SIZE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %v8f16 = call <8 x half> @llvm.arithmetic.fence.v8f16(<8 x half> undef)
24 ; ALL-SIZE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %v16f16 = call <16 x half> @llvm.arithmetic.fence.v16f16(<16 x half> undef)
25 ; ALL-SIZE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %v17f16 = call <17 x half> @llvm.arithmetic.fence.v17f16(<17 x half> undef)
26 ; ALL-SIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void
28 %f16 = call half @llvm.arithmetic.fence.f16(half undef)
29 %v2f16 = call <2 x half> @llvm.arithmetic.fence.v2f16(<2 x half> undef)
30 %v3f16 = call <3 x half> @llvm.arithmetic.fence.v3f16(<3 x half> undef)
31 %v4f16 = call <4 x half> @llvm.arithmetic.fence.v4f16(<4 x half> undef)
32 %v5f16 = call <5 x half> @llvm.arithmetic.fence.v5f16(<5 x half> undef)
33 %v8f16 = call <8 x half> @llvm.arithmetic.fence.v8f16(<8 x half> undef)
34 %v16f16 = call <16 x half> @llvm.arithmetic.fence.v16f16(<16 x half> undef)
35 %v17f16 = call <17 x half> @llvm.arithmetic.fence.v17f16(<17 x half> undef)
39 define void @arithmetic_fence_bf16() {
40 ; ALL-LABEL: 'arithmetic_fence_bf16'
41 ; ALL-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %bf16 = call bfloat @llvm.arithmetic.fence.bf16(bfloat undef)
42 ; ALL-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %v2bf16 = call <2 x bfloat> @llvm.arithmetic.fence.v2bf16(<2 x bfloat> undef)
43 ; ALL-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %v3bf16 = call <3 x bfloat> @llvm.arithmetic.fence.v3bf16(<3 x bfloat> undef)
44 ; ALL-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %v4bf16 = call <4 x bfloat> @llvm.arithmetic.fence.v4bf16(<4 x bfloat> undef)
45 ; ALL-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %v5bf16 = call <5 x bfloat> @llvm.arithmetic.fence.v5bf16(<5 x bfloat> undef)
46 ; ALL-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %v8bf16 = call <8 x bfloat> @llvm.arithmetic.fence.v8bf16(<8 x bfloat> undef)
47 ; ALL-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %v16bf16 = call <16 x bfloat> @llvm.arithmetic.fence.v16bf16(<16 x bfloat> undef)
48 ; ALL-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %v17bf16 = call <17 x bfloat> @llvm.arithmetic.fence.v17bf16(<17 x bfloat> undef)
49 ; ALL-NEXT: Cost Model: Found an estimated cost of 10 for instruction: ret void
51 ; ALL-SIZE-LABEL: 'arithmetic_fence_bf16'
52 ; ALL-SIZE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %bf16 = call bfloat @llvm.arithmetic.fence.bf16(bfloat undef)
53 ; ALL-SIZE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %v2bf16 = call <2 x bfloat> @llvm.arithmetic.fence.v2bf16(<2 x bfloat> undef)
54 ; ALL-SIZE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %v3bf16 = call <3 x bfloat> @llvm.arithmetic.fence.v3bf16(<3 x bfloat> undef)
55 ; ALL-SIZE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %v4bf16 = call <4 x bfloat> @llvm.arithmetic.fence.v4bf16(<4 x bfloat> undef)
56 ; ALL-SIZE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %v5bf16 = call <5 x bfloat> @llvm.arithmetic.fence.v5bf16(<5 x bfloat> undef)
57 ; ALL-SIZE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %v8bf16 = call <8 x bfloat> @llvm.arithmetic.fence.v8bf16(<8 x bfloat> undef)
58 ; ALL-SIZE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %v16bf16 = call <16 x bfloat> @llvm.arithmetic.fence.v16bf16(<16 x bfloat> undef)
59 ; ALL-SIZE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %v17bf16 = call <17 x bfloat> @llvm.arithmetic.fence.v17bf16(<17 x bfloat> undef)
60 ; ALL-SIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void
62 %bf16 = call bfloat @llvm.arithmetic.fence.bf16(bfloat undef)
63 %v2bf16 = call <2 x bfloat> @llvm.arithmetic.fence.v2bf16(<2 x bfloat> undef)
64 %v3bf16 = call <3 x bfloat> @llvm.arithmetic.fence.v3bf16(<3 x bfloat> undef)
65 %v4bf16 = call <4 x bfloat> @llvm.arithmetic.fence.v4bf16(<4 x bfloat> undef)
66 %v5bf16 = call <5 x bfloat> @llvm.arithmetic.fence.v5bf16(<5 x bfloat> undef)
67 %v8bf16 = call <8 x bfloat> @llvm.arithmetic.fence.v8bf16(<8 x bfloat> undef)
68 %v16bf16 = call <16 x bfloat> @llvm.arithmetic.fence.v16bf16(<16 x bfloat> undef)
69 %v17bf16 = call <17 x bfloat> @llvm.arithmetic.fence.v17bf16(<17 x bfloat> undef)
73 define void @arithmetic_fence_f32() {
74 ; ALL-LABEL: 'arithmetic_fence_f32'
75 ; ALL-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %f32 = call float @llvm.arithmetic.fence.f32(float undef)
76 ; ALL-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %v2f32 = call <2 x float> @llvm.arithmetic.fence.v2f32(<2 x float> undef)
77 ; ALL-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %v3f32 = call <3 x float> @llvm.arithmetic.fence.v3f32(<3 x float> undef)
78 ; ALL-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %v4f32 = call <4 x float> @llvm.arithmetic.fence.v4f32(<4 x float> undef)
79 ; ALL-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %v5f32 = call <5 x float> @llvm.arithmetic.fence.v5f32(<5 x float> undef)
80 ; ALL-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %v8f32 = call <8 x float> @llvm.arithmetic.fence.v8f32(<8 x float> undef)
81 ; ALL-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %v16f32 = call <16 x float> @llvm.arithmetic.fence.v16f32(<16 x float> undef)
82 ; ALL-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %v17f32 = call <17 x float> @llvm.arithmetic.fence.v17f32(<17 x float> undef)
83 ; ALL-NEXT: Cost Model: Found an estimated cost of 10 for instruction: ret void
85 ; ALL-SIZE-LABEL: 'arithmetic_fence_f32'
86 ; ALL-SIZE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %f32 = call float @llvm.arithmetic.fence.f32(float undef)
87 ; ALL-SIZE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %v2f32 = call <2 x float> @llvm.arithmetic.fence.v2f32(<2 x float> undef)
88 ; ALL-SIZE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %v3f32 = call <3 x float> @llvm.arithmetic.fence.v3f32(<3 x float> undef)
89 ; ALL-SIZE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %v4f32 = call <4 x float> @llvm.arithmetic.fence.v4f32(<4 x float> undef)
90 ; ALL-SIZE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %v5f32 = call <5 x float> @llvm.arithmetic.fence.v5f32(<5 x float> undef)
91 ; ALL-SIZE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %v8f32 = call <8 x float> @llvm.arithmetic.fence.v8f32(<8 x float> undef)
92 ; ALL-SIZE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %v16f32 = call <16 x float> @llvm.arithmetic.fence.v16f32(<16 x float> undef)
93 ; ALL-SIZE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %v17f32 = call <17 x float> @llvm.arithmetic.fence.v17f32(<17 x float> undef)
94 ; ALL-SIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void
96 %f32 = call float @llvm.arithmetic.fence.f32(float undef)
97 %v2f32 = call <2 x float> @llvm.arithmetic.fence.v2f32(<2 x float> undef)
98 %v3f32 = call <3 x float> @llvm.arithmetic.fence.v3f32(<3 x float> undef)
99 %v4f32 = call <4 x float> @llvm.arithmetic.fence.v4f32(<4 x float> undef)
100 %v5f32 = call <5 x float> @llvm.arithmetic.fence.v5f32(<5 x float> undef)
101 %v8f32 = call <8 x float> @llvm.arithmetic.fence.v8f32(<8 x float> undef)
102 %v16f32 = call <16 x float> @llvm.arithmetic.fence.v16f32(<16 x float> undef)
103 %v17f32 = call <17 x float> @llvm.arithmetic.fence.v17f32(<17 x float> undef)
107 define void @arithmetic_fence_f64() {
108 ; ALL-LABEL: 'arithmetic_fence_f64'
109 ; ALL-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %f64 = call double @llvm.arithmetic.fence.f64(double undef)
110 ; ALL-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %v2f64 = call <2 x double> @llvm.arithmetic.fence.v2f64(<2 x double> undef)
111 ; ALL-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %v3f64 = call <3 x double> @llvm.arithmetic.fence.v3f64(<3 x double> undef)
112 ; ALL-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %v4f64 = call <4 x double> @llvm.arithmetic.fence.v4f64(<4 x double> undef)
113 ; ALL-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %v5f64 = call <5 x double> @llvm.arithmetic.fence.v5f64(<5 x double> undef)
114 ; ALL-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %v8f64 = call <8 x double> @llvm.arithmetic.fence.v8f64(<8 x double> undef)
115 ; ALL-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %v16f64 = call <16 x double> @llvm.arithmetic.fence.v16f64(<16 x double> undef)
116 ; ALL-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %v17f64 = call <17 x double> @llvm.arithmetic.fence.v17f64(<17 x double> undef)
117 ; ALL-NEXT: Cost Model: Found an estimated cost of 10 for instruction: ret void
119 ; ALL-SIZE-LABEL: 'arithmetic_fence_f64'
120 ; ALL-SIZE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %f64 = call double @llvm.arithmetic.fence.f64(double undef)
121 ; ALL-SIZE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %v2f64 = call <2 x double> @llvm.arithmetic.fence.v2f64(<2 x double> undef)
122 ; ALL-SIZE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %v3f64 = call <3 x double> @llvm.arithmetic.fence.v3f64(<3 x double> undef)
123 ; ALL-SIZE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %v4f64 = call <4 x double> @llvm.arithmetic.fence.v4f64(<4 x double> undef)
124 ; ALL-SIZE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %v5f64 = call <5 x double> @llvm.arithmetic.fence.v5f64(<5 x double> undef)
125 ; ALL-SIZE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %v8f64 = call <8 x double> @llvm.arithmetic.fence.v8f64(<8 x double> undef)
126 ; ALL-SIZE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %v16f64 = call <16 x double> @llvm.arithmetic.fence.v16f64(<16 x double> undef)
127 ; ALL-SIZE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %v17f64 = call <17 x double> @llvm.arithmetic.fence.v17f64(<17 x double> undef)
128 ; ALL-SIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void
130 %f64 = call double @llvm.arithmetic.fence.f64(double undef)
131 %v2f64 = call <2 x double> @llvm.arithmetic.fence.v2f64(<2 x double> undef)
132 %v3f64 = call <3 x double> @llvm.arithmetic.fence.v3f64(<3 x double> undef)
133 %v4f64 = call <4 x double> @llvm.arithmetic.fence.v4f64(<4 x double> undef)
134 %v5f64 = call <5 x double> @llvm.arithmetic.fence.v5f64(<5 x double> undef)
135 %v8f64 = call <8 x double> @llvm.arithmetic.fence.v8f64(<8 x double> undef)
136 %v16f64 = call <16 x double> @llvm.arithmetic.fence.v16f64(<16 x double> undef)
137 %v17f64 = call <17 x double> @llvm.arithmetic.fence.v17f64(<17 x double> undef)