fused_costs.ll
7.86 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
; RUN: opt -cost-model -analyze -mtriple=amdgcn-unknown-amdhsa -mcpu=gfx900 -denormal-fp-math-f32=preserve-sign -denormal-fp-math=preserve-sign -fp-contract=on < %s | FileCheck -check-prefixes=FUSED,NOCONTRACT,ALL %s
; RUN: opt -cost-model -analyze -mtriple=amdgcn-unknown-amdhsa -mcpu=gfx900 -denormal-fp-math-f32=ieee -denormal-fp-math=ieee -fp-contract=on < %s | FileCheck -check-prefixes=SLOW,NOCONTRACT,ALL %s
; RUN: opt -cost-model -analyze -mtriple=amdgcn-unknown-amdhsa -mcpu=gfx900 -denormal-fp-math-f32=ieee -denormal-fp-math=ieee -fp-contract=fast < %s | FileCheck -check-prefixes=FUSED,CONTRACT,ALL %s
; RUN: opt -cost-model -analyze -mtriple=amdgcn-unknown-amdhsa -mcpu=gfx1030 -denormal-fp-math-f32=preserve-sign -denormal-fp-math=preserve-sign -fp-contract=on < %s | FileCheck -check-prefixes=GFX1030,NOCONTRACT,ALL %s
; RUN: opt -cost-model -cost-kind=code-size -analyze -mtriple=amdgcn-unknown-amdhsa -mcpu=gfx900 -denormal-fp-math-f32=preserve-sign -denormal-fp-math=preserve-sign -fp-contract=on < %s | FileCheck -check-prefixes=FUSED32,FUSED16,NOCONTRACT,ALL %s
; RUN: opt -cost-model -cost-kind=code-size -analyze -mtriple=amdgcn-unknown-amdhsa -mcpu=gfx900 -denormal-fp-math-f32=ieee -denormal-fp-math=ieee -fp-contract=on < %s | FileCheck -check-prefixes=SLOW,NOCONTRACT,ALL %s
; RUN: opt -cost-model -cost-kind=code-size -analyze -mtriple=amdgcn-unknown-amdhsa -mcpu=gfx900 -denormal-fp-math-f32=ieee -denormal-fp-math=ieee -fp-contract=fast < %s | FileCheck -check-prefixes=FUSED32,FUSED16,CONTRACT,ALL %s
; RUN: opt -cost-model -cost-kind=code-size -analyze -mtriple=amdgcn-unknown-amdhsa -mcpu=gfx1030 -denormal-fp-math-f32=preserve-sign -denormal-fp-math=preserve-sign -fp-contract=on < %s | FileCheck -check-prefixes=GFX1030,NOCONTRACT,ALL %s
target triple = "amdgcn--"
; ALL-LABEL: 'fmul_fadd_f32':
; FUSED: estimated cost of 0 for instruction: %mul = fmul float
; SLOW: estimated cost of 1 for instruction: %mul = fmul float
; GFX1030: estimated cost of 1 for instruction: %mul = fmul float
; ALL: estimated cost of 1 for instruction: %add = fadd float
define float @fmul_fadd_f32(float %r0, float %r1, float %r2) #0 {
%mul = fmul float %r0, %r1
%add = fadd float %mul, %r2
ret float %add
}
; ALL-LABEL: 'fmul_fadd_contract_f32':
; ALL: estimated cost of 0 for instruction: %mul = fmul contract float
; ALL: estimated cost of 1 for instruction: %add = fadd contract float
define float @fmul_fadd_contract_f32(float %r0, float %r1, float %r2) #0 {
%mul = fmul contract float %r0, %r1
%add = fadd contract float %mul, %r2
ret float %add
}
; ALL-LABEL: 'fmul_fadd_v2f32':
; FUSED: estimated cost of 0 for instruction: %mul = fmul <2 x float>
; SLOW: estimated cost of 2 for instruction: %mul = fmul <2 x float>
; GFX1030: estimated cost of 2 for instruction: %mul = fmul <2 x float>
; ALL: estimated cost of 2 for instruction: %add = fadd <2 x float>
define <2 x float> @fmul_fadd_v2f32(<2 x float> %r0, <2 x float> %r1, <2 x float> %r2) #0 {
%mul = fmul <2 x float> %r0, %r1
%add = fadd <2 x float> %mul, %r2
ret <2 x float> %add
}
; ALL-LABEL: 'fmul_fsub_f32':
; FUSED: estimated cost of 0 for instruction: %mul = fmul float
; SLOW: estimated cost of 1 for instruction: %mul = fmul float
; GFX1030: estimated cost of 1 for instruction: %mul = fmul float
; ALL: estimated cost of 1 for instruction: %sub = fsub float
define float @fmul_fsub_f32(float %r0, float %r1, float %r2) #0 {
%mul = fmul float %r0, %r1
%sub = fsub float %mul, %r2
ret float %sub
}
; ALL-LABEL: 'fmul_fsub_v2f32':
; FUSED: estimated cost of 0 for instruction: %mul = fmul <2 x float>
; SLOW: estimated cost of 2 for instruction: %mul = fmul <2 x float>
; GFX1030: estimated cost of 2 for instruction: %mul = fmul <2 x float>
; ALL: estimated cost of 2 for instruction: %sub = fsub <2 x float>
define <2 x float> @fmul_fsub_v2f32(<2 x float> %r0, <2 x float> %r1, <2 x float> %r2) #0 {
%mul = fmul <2 x float> %r0, %r1
%sub = fsub <2 x float> %mul, %r2
ret <2 x float> %sub
}
; ALL-LABEL: 'fmul_fadd_f16':
; FUSED: estimated cost of 0 for instruction: %mul = fmul half
; SLOW: estimated cost of 1 for instruction: %mul = fmul half
; ALL: estimated cost of 1 for instruction: %add = fadd half
define half @fmul_fadd_f16(half %r0, half %r1, half %r2) #0 {
%mul = fmul half %r0, %r1
%add = fadd half %mul, %r2
ret half %add
}
; ALL-LABEL: 'fmul_fadd_contract_f16':
; ALL: estimated cost of 0 for instruction: %mul = fmul contract half
; ALL: estimated cost of 1 for instruction: %add = fadd contract half
define half @fmul_fadd_contract_f16(half %r0, half %r1, half %r2) #0 {
%mul = fmul contract half %r0, %r1
%add = fadd contract half %mul, %r2
ret half %add
}
; ALL-LABEL: 'fmul_fadd_v2f16':
; FUSED: estimated cost of 0 for instruction: %mul = fmul <2 x half>
; SLOW: estimated cost of 1 for instruction: %mul = fmul <2 x half>
; ALL: estimated cost of 1 for instruction: %add = fadd <2 x half>
define <2 x half> @fmul_fadd_v2f16(<2 x half> %r0, <2 x half> %r1, <2 x half> %r2) #0 {
%mul = fmul <2 x half> %r0, %r1
%add = fadd <2 x half> %mul, %r2
ret <2 x half> %add
}
; ALL-LABEL: 'fmul_fsub_f16':
; FUSED: estimated cost of 0 for instruction: %mul = fmul half
; SLOW: estimated cost of 1 for instruction: %mul = fmul half
; ALL: estimated cost of 1 for instruction: %sub = fsub half
define half @fmul_fsub_f16(half %r0, half %r1, half %r2) #0 {
%mul = fmul half %r0, %r1
%sub = fsub half %mul, %r2
ret half %sub
}
; ALL-LABEL: 'fmul_fsub_v2f16':
; FUSED: estimated cost of 0 for instruction: %mul = fmul <2 x half>
; SLOW: estimated cost of 1 for instruction: %mul = fmul <2 x half>
; ALL: estimated cost of 1 for instruction: %sub = fsub <2 x half>
define <2 x half> @fmul_fsub_v2f16(<2 x half> %r0, <2 x half> %r1, <2 x half> %r2) #0 {
%mul = fmul <2 x half> %r0, %r1
%sub = fsub <2 x half> %mul, %r2
ret <2 x half> %sub
}
; ALL-LABEL: 'fmul_fadd_f64':
; CONTRACT: estimated cost of 0 for instruction: %mul = fmul double
; NOCONTRACT: estimated cost of 3 for instruction: %mul = fmul double
; ALL: estimated cost of 3 for instruction: %add = fadd double
define double @fmul_fadd_f64(double %r0, double %r1, double %r2) #0 {
%mul = fmul double %r0, %r1
%add = fadd double %mul, %r2
ret double %add
}
; ALL-LABEL: 'fmul_fadd_contract_f64':
; ALL: estimated cost of 0 for instruction: %mul = fmul contract double
; ALL: estimated cost of 3 for instruction: %add = fadd contract double
define double @fmul_fadd_contract_f64(double %r0, double %r1, double %r2) #0 {
%mul = fmul contract double %r0, %r1
%add = fadd contract double %mul, %r2
ret double %add
}
; ALL-LABEL: 'fmul_fadd_v2f64':
; CONTRACT: estimated cost of 0 for instruction: %mul = fmul <2 x double>
; NOCONTRACT: estimated cost of 6 for instruction: %mul = fmul <2 x double>
; ALL: estimated cost of 6 for instruction: %add = fadd <2 x double>
define <2 x double> @fmul_fadd_v2f64(<2 x double> %r0, <2 x double> %r1, <2 x double> %r2) #0 {
%mul = fmul <2 x double> %r0, %r1
%add = fadd <2 x double> %mul, %r2
ret <2 x double> %add
}
; ALL-LABEL: 'fmul_fsub_f64':
; CONTRACT: estimated cost of 0 for instruction: %mul = fmul double
; NOCONTRACT: estimated cost of 3 for instruction: %mul = fmul double
; ALL: estimated cost of 3 for instruction: %sub = fsub double
define double @fmul_fsub_f64(double %r0, double %r1, double %r2) #0 {
%mul = fmul double %r0, %r1
%sub = fsub double %mul, %r2
ret double %sub
}
; ALL-LABEL: 'fmul_fsub_v2f64':
; CONTRACT: estimated cost of 0 for instruction: %mul = fmul <2 x double>
; NOCONTRACT: estimated cost of 6 for instruction: %mul = fmul <2 x double>
; ALL: estimated cost of 6 for instruction: %sub = fsub <2 x double>
define <2 x double> @fmul_fsub_v2f64(<2 x double> %r0, <2 x double> %r1, <2 x double> %r2) #0 {
%mul = fmul <2 x double> %r0, %r1
%sub = fsub <2 x double> %mul, %r2
ret <2 x double> %sub
}
attributes #0 = { nounwind }