cos.ll
12.2 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
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt < %s -instsimplify -S | FileCheck %s
declare half @llvm.amdgcn.cos.f16(half) #0
declare float @llvm.amdgcn.cos.f32(float) #0
declare double @llvm.amdgcn.cos.f64(double) #0
define void @test_f16(half* %p) {
; CHECK-LABEL: @test_f16(
; CHECK-NEXT: store volatile half 0xH3C00, half* [[P:%.*]], align 2
; CHECK-NEXT: store volatile half 0xH3C00, half* [[P]], align 2
; CHECK-NEXT: store volatile half 0xH39A8, half* [[P]], align 2
; CHECK-NEXT: store volatile half 0xH39A8, half* [[P]], align 2
; CHECK-NEXT: store volatile half 0xH0000, half* [[P]], align 2
; CHECK-NEXT: store volatile half 0xH0000, half* [[P]], align 2
; CHECK-NEXT: store volatile half 0xHBC00, half* [[P]], align 2
; CHECK-NEXT: store volatile half 0xHBC00, half* [[P]], align 2
; CHECK-NEXT: store volatile half 0xH3C00, half* [[P]], align 2
; CHECK-NEXT: store volatile half 0xH3C00, half* [[P]], align 2
; CHECK-NEXT: store volatile half 0xH3C00, half* [[P]], align 2
; CHECK-NEXT: store volatile half 0xH3C00, half* [[P]], align 2
; CHECK-NEXT: [[P1000:%.*]] = call half @llvm.amdgcn.cos.f16(half 0xH63D0)
; CHECK-NEXT: store volatile half [[P1000]], half* [[P]], align 2
; CHECK-NEXT: [[N1000:%.*]] = call half @llvm.amdgcn.cos.f16(half 0xHE3D0)
; CHECK-NEXT: store volatile half [[N1000]], half* [[P]], align 2
; CHECK-NEXT: [[PINF:%.*]] = call half @llvm.amdgcn.cos.f16(half 0xH7C00)
; CHECK-NEXT: store volatile half [[PINF]], half* [[P]], align 2
; CHECK-NEXT: [[NINF:%.*]] = call half @llvm.amdgcn.cos.f16(half 0xHFC00)
; CHECK-NEXT: store volatile half [[NINF]], half* [[P]], align 2
; CHECK-NEXT: [[NAN:%.*]] = call half @llvm.amdgcn.cos.f16(half 0xH7E00)
; CHECK-NEXT: store volatile half [[NAN]], half* [[P]], align 2
; CHECK-NEXT: ret void
;
%p0 = call half @llvm.amdgcn.cos.f16(half +0.0)
store volatile half %p0, half* %p
%n0 = call half @llvm.amdgcn.cos.f16(half -0.0)
store volatile half %n0, half* %p
%p0125 = call half @llvm.amdgcn.cos.f16(half +0.125)
store volatile half %p0125, half* %p
%n0125 = call half @llvm.amdgcn.cos.f16(half -0.125)
store volatile half %n0125, half* %p
%p025 = call half @llvm.amdgcn.cos.f16(half +0.25)
store volatile half %p025, half* %p
%n025 = call half @llvm.amdgcn.cos.f16(half -0.25)
store volatile half %n025, half* %p
%p05 = call half @llvm.amdgcn.cos.f16(half +0.5)
store volatile half %p05, half* %p
%n05 = call half @llvm.amdgcn.cos.f16(half -0.5)
store volatile half %n05, half* %p
%p1 = call half @llvm.amdgcn.cos.f16(half +1.0)
store volatile half %p1, half* %p
%n1 = call half @llvm.amdgcn.cos.f16(half -1.0)
store volatile half %n1, half* %p
%p256 = call half @llvm.amdgcn.cos.f16(half +256.0)
store volatile half %p256, half* %p
%n256 = call half @llvm.amdgcn.cos.f16(half -256.0)
store volatile half %n256, half* %p
%p1000 = call half @llvm.amdgcn.cos.f16(half +1000.0)
store volatile half %p1000, half* %p
%n1000 = call half @llvm.amdgcn.cos.f16(half -1000.0)
store volatile half %n1000, half* %p
%pinf = call half @llvm.amdgcn.cos.f16(half 0xH7C00) ; +inf
store volatile half %pinf, half* %p
%ninf = call half @llvm.amdgcn.cos.f16(half 0xHFC00) ; -inf
store volatile half %ninf, half* %p
%nan = call half @llvm.amdgcn.cos.f16(half 0xH7E00) ; nan
store volatile half %nan, half* %p
ret void
}
define void @test_f32(float* %p) {
; CHECK-LABEL: @test_f32(
; CHECK-NEXT: store volatile float 1.000000e+00, float* [[P:%.*]], align 4
; CHECK-NEXT: store volatile float 1.000000e+00, float* [[P]], align 4
; CHECK-NEXT: store volatile float 0x3FE6A09E60000000, float* [[P]], align 4
; CHECK-NEXT: store volatile float 0x3FE6A09E60000000, float* [[P]], align 4
; CHECK-NEXT: store volatile float 0.000000e+00, float* [[P]], align 4
; CHECK-NEXT: store volatile float 0.000000e+00, float* [[P]], align 4
; CHECK-NEXT: store volatile float -1.000000e+00, float* [[P]], align 4
; CHECK-NEXT: store volatile float -1.000000e+00, float* [[P]], align 4
; CHECK-NEXT: store volatile float 1.000000e+00, float* [[P]], align 4
; CHECK-NEXT: store volatile float 1.000000e+00, float* [[P]], align 4
; CHECK-NEXT: store volatile float 1.000000e+00, float* [[P]], align 4
; CHECK-NEXT: store volatile float 1.000000e+00, float* [[P]], align 4
; CHECK-NEXT: [[P1000:%.*]] = call float @llvm.amdgcn.cos.f32(float 1.000000e+03)
; CHECK-NEXT: store volatile float [[P1000]], float* [[P]], align 4
; CHECK-NEXT: [[N1000:%.*]] = call float @llvm.amdgcn.cos.f32(float -1.000000e+03)
; CHECK-NEXT: store volatile float [[N1000]], float* [[P]], align 4
; CHECK-NEXT: [[PINF:%.*]] = call float @llvm.amdgcn.cos.f32(float 0x7FF0000000000000)
; CHECK-NEXT: store volatile float [[PINF]], float* [[P]], align 4
; CHECK-NEXT: [[NINF:%.*]] = call float @llvm.amdgcn.cos.f32(float 0xFFF0000000000000)
; CHECK-NEXT: store volatile float [[NINF]], float* [[P]], align 4
; CHECK-NEXT: [[NAN:%.*]] = call float @llvm.amdgcn.cos.f32(float 0x7FF8000000000000)
; CHECK-NEXT: store volatile float [[NAN]], float* [[P]], align 4
; CHECK-NEXT: ret void
;
%p0 = call float @llvm.amdgcn.cos.f32(float +0.0)
store volatile float %p0, float* %p
%n0 = call float @llvm.amdgcn.cos.f32(float -0.0)
store volatile float %n0, float* %p
%p0125 = call float @llvm.amdgcn.cos.f32(float +0.125)
store volatile float %p0125, float* %p
%n0125 = call float @llvm.amdgcn.cos.f32(float -0.125)
store volatile float %n0125, float* %p
%p025 = call float @llvm.amdgcn.cos.f32(float +0.25)
store volatile float %p025, float* %p
%n025 = call float @llvm.amdgcn.cos.f32(float -0.25)
store volatile float %n025, float* %p
%p05 = call float @llvm.amdgcn.cos.f32(float +0.5)
store volatile float %p05, float* %p
%n05 = call float @llvm.amdgcn.cos.f32(float -0.5)
store volatile float %n05, float* %p
%p1 = call float @llvm.amdgcn.cos.f32(float +1.0)
store volatile float %p1, float* %p
%n1 = call float @llvm.amdgcn.cos.f32(float -1.0)
store volatile float %n1, float* %p
%p256 = call float @llvm.amdgcn.cos.f32(float +256.0)
store volatile float %p256, float* %p
%n256 = call float @llvm.amdgcn.cos.f32(float -256.0)
store volatile float %n256, float* %p
%p1000 = call float @llvm.amdgcn.cos.f32(float +1000.0)
store volatile float %p1000, float* %p
%n1000 = call float @llvm.amdgcn.cos.f32(float -1000.0)
store volatile float %n1000, float* %p
%pinf = call float @llvm.amdgcn.cos.f32(float 0x7FF0000000000000) ; +inf
store volatile float %pinf, float* %p
%ninf = call float @llvm.amdgcn.cos.f32(float 0xFFF0000000000000) ; -inf
store volatile float %ninf, float* %p
%nan = call float @llvm.amdgcn.cos.f32(float 0x7FF8000000000000) ; nan
store volatile float %nan, float* %p
ret void
}
define void @test_f64(double* %p) {
; CHECK-LABEL: @test_f64(
; CHECK-NEXT: store volatile double 1.000000e+00, double* [[P:%.*]], align 8
; CHECK-NEXT: store volatile double 1.000000e+00, double* [[P]], align 8
; CHECK-NEXT: store volatile double 0x3FE6A09E667F3B{{.*}}, double* [[P]], align 8
; CHECK-NEXT: store volatile double 0x3FE6A09E667F3B{{.*}}, double* [[P]], align 8
; CHECK-NEXT: store volatile double 0.000000e+00, double* [[P]], align 8
; CHECK-NEXT: store volatile double 0.000000e+00, double* [[P]], align 8
; CHECK-NEXT: store volatile double -1.000000e+00, double* [[P]], align 8
; CHECK-NEXT: store volatile double -1.000000e+00, double* [[P]], align 8
; CHECK-NEXT: store volatile double 1.000000e+00, double* [[P]], align 8
; CHECK-NEXT: store volatile double 1.000000e+00, double* [[P]], align 8
; CHECK-NEXT: store volatile double 1.000000e+00, double* [[P]], align 8
; CHECK-NEXT: store volatile double 1.000000e+00, double* [[P]], align 8
; CHECK-NEXT: [[P1000:%.*]] = call double @llvm.amdgcn.cos.f64(double 1.000000e+03)
; CHECK-NEXT: store volatile double [[P1000]], double* [[P]], align 8
; CHECK-NEXT: [[N1000:%.*]] = call double @llvm.amdgcn.cos.f64(double -1.000000e+03)
; CHECK-NEXT: store volatile double [[N1000]], double* [[P]], align 8
; CHECK-NEXT: [[PINF:%.*]] = call double @llvm.amdgcn.cos.f64(double 0x7FF0000000000000)
; CHECK-NEXT: store volatile double [[PINF]], double* [[P]], align 8
; CHECK-NEXT: [[NINF:%.*]] = call double @llvm.amdgcn.cos.f64(double 0xFFF0000000000000)
; CHECK-NEXT: store volatile double [[NINF]], double* [[P]], align 8
; CHECK-NEXT: [[NAN:%.*]] = call double @llvm.amdgcn.cos.f64(double 0x7FF8000000000000)
; CHECK-NEXT: store volatile double [[NAN]], double* [[P]], align 8
; CHECK-NEXT: ret void
;
%p0 = call double @llvm.amdgcn.cos.f64(double +0.0)
store volatile double %p0, double* %p
%n0 = call double @llvm.amdgcn.cos.f64(double -0.0)
store volatile double %n0, double* %p
%p0125 = call double @llvm.amdgcn.cos.f64(double +0.125)
store volatile double %p0125, double* %p
%n0125 = call double @llvm.amdgcn.cos.f64(double -0.125)
store volatile double %n0125, double* %p
%p025 = call double @llvm.amdgcn.cos.f64(double +0.25)
store volatile double %p025, double* %p
%n025 = call double @llvm.amdgcn.cos.f64(double -0.25)
store volatile double %n025, double* %p
%p05 = call double @llvm.amdgcn.cos.f64(double +0.5)
store volatile double %p05, double* %p
%n05 = call double @llvm.amdgcn.cos.f64(double -0.5)
store volatile double %n05, double* %p
%p1 = call double @llvm.amdgcn.cos.f64(double +1.0)
store volatile double %p1, double* %p
%n1 = call double @llvm.amdgcn.cos.f64(double -1.0)
store volatile double %n1, double* %p
%p256 = call double @llvm.amdgcn.cos.f64(double +256.0)
store volatile double %p256, double* %p
%n256 = call double @llvm.amdgcn.cos.f64(double -256.0)
store volatile double %n256, double* %p
%p1000 = call double @llvm.amdgcn.cos.f64(double +1000.0)
store volatile double %p1000, double* %p
%n1000 = call double @llvm.amdgcn.cos.f64(double -1000.0)
store volatile double %n1000, double* %p
%pinf = call double @llvm.amdgcn.cos.f64(double 0x7FF0000000000000) ; +inf
store volatile double %pinf, double* %p
%ninf = call double @llvm.amdgcn.cos.f64(double 0xFFF0000000000000) ; -inf
store volatile double %ninf, double* %p
%nan = call double @llvm.amdgcn.cos.f64(double 0x7FF8000000000000) ; nan
store volatile double %nan, double* %p
ret void
}
define void @test_f16_strictfp (half* %p) #1 {
; CHECK-LABEL: @test_f16_strictfp(
; CHECK-NEXT: [[P0:%.*]] = call half @llvm.amdgcn.cos.f16(half 0xH0000) #1
; CHECK-NEXT: store volatile half [[P0]], half* [[P:%.*]], align 2
; CHECK-NEXT: [[P025:%.*]] = call half @llvm.amdgcn.cos.f16(half 0xH3400) #1
; CHECK-NEXT: store volatile half [[P025]], half* [[P]], align 2
; CHECK-NEXT: ret void
;
%p0 = call half @llvm.amdgcn.cos.f16(half +0.0) #1
store volatile half %p0, half* %p
%p025 = call half @llvm.amdgcn.cos.f16(half +0.25) #1
store volatile half %p025, half* %p
ret void
}
define void @test_f32_strictfp(float* %p) #1 {
; CHECK-LABEL: @test_f32_strictfp(
; CHECK-NEXT: [[P0:%.*]] = call float @llvm.amdgcn.cos.f32(float 0.000000e+00) #1
; CHECK-NEXT: store volatile float [[P0]], float* [[P:%.*]], align 4
; CHECK-NEXT: [[P025:%.*]] = call float @llvm.amdgcn.cos.f32(float 2.500000e-01) #1
; CHECK-NEXT: store volatile float [[P025]], float* [[P]], align 4
; CHECK-NEXT: ret void
;
%p0 = call float @llvm.amdgcn.cos.f32(float +0.0) #1
store volatile float %p0, float* %p
%p025 = call float @llvm.amdgcn.cos.f32(float +0.25) #1
store volatile float %p025, float* %p
ret void
}
define void @test_f64_strictfp(double* %p) #1 {
; CHECK-LABEL: @test_f64_strictfp(
; CHECK-NEXT: [[P0:%.*]] = call double @llvm.amdgcn.cos.f64(double 0.000000e+00) #1
; CHECK-NEXT: store volatile double [[P0]], double* [[P:%.*]], align 8
; CHECK-NEXT: [[P025:%.*]] = call double @llvm.amdgcn.cos.f64(double 2.500000e-01) #1
; CHECK-NEXT: store volatile double [[P025]], double* [[P]], align 8
; CHECK-NEXT: ret void
;
%p0 = call double @llvm.amdgcn.cos.f64(double +0.0) #1
store volatile double %p0, double* %p
%p025 = call double @llvm.amdgcn.cos.f64(double +0.25) #1
store volatile double %p025, double* %p
ret void
}
attributes #0 = { nounwind readnone speculatable }
attributes #1 = { strictfp }