1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt < %s -passes=instsimplify -S | FileCheck %s
4 declare double @llvm.log.f64(double)
5 declare double @llvm.exp.f64(double)
6 declare double @llvm.log2.f64(double)
7 declare double @llvm.exp2.f64(double)
8 declare double @llvm.log10.f64(double)
9 declare double @llvm.exp10.f64(double)
11 define double @log_reassoc_exp_strict(double %a) {
12 ; CHECK-LABEL: @log_reassoc_exp_strict(
13 ; CHECK-NEXT: ret double [[A:%.*]]
15 %1 = call double @llvm.exp.f64(double %a)
16 %2 = call reassoc double @llvm.log.f64(double %1)
20 define double @log_strict_exp_reassoc(double %a) {
21 ; CHECK-LABEL: @log_strict_exp_reassoc(
22 ; CHECK-NEXT: [[TMP1:%.*]] = call reassoc double @llvm.exp.f64(double [[A:%.*]])
23 ; CHECK-NEXT: [[TMP2:%.*]] = call double @llvm.log.f64(double [[TMP1]])
24 ; CHECK-NEXT: ret double [[TMP2]]
26 %1 = call reassoc double @llvm.exp.f64(double %a)
27 %2 = call double @llvm.log.f64(double %1)
31 define double @log_exp_log_exp(double %a) {
32 ; CHECK-LABEL: @log_exp_log_exp(
33 ; CHECK-NEXT: [[TMP1:%.*]] = call double @llvm.exp.f64(double [[A:%.*]])
34 ; CHECK-NEXT: [[TMP2:%.*]] = call double @llvm.log.f64(double [[TMP1]])
35 ; CHECK-NEXT: [[TMP3:%.*]] = call double @llvm.exp.f64(double [[TMP2]])
36 ; CHECK-NEXT: [[TMP4:%.*]] = call double @llvm.log.f64(double [[TMP3]])
37 ; CHECK-NEXT: ret double [[TMP4]]
39 %1 = call double @llvm.exp.f64(double %a)
40 %2 = call double @llvm.log.f64(double %1)
41 %3 = call double @llvm.exp.f64(double %2)
42 %4 = call double @llvm.log.f64(double %3)
46 define double @log_exp_log_exp_reassoc(double %a) {
47 ; CHECK-LABEL: @log_exp_log_exp_reassoc(
48 ; CHECK-NEXT: ret double [[A:%.*]]
50 %1 = call double @llvm.exp.f64(double %a)
51 %2 = call reassoc double @llvm.log.f64(double %1)
52 %3 = call double @llvm.exp.f64(double %2)
53 %4 = call reassoc double @llvm.log.f64(double %3)
57 define double @log2_reassoc_exp2_strict(double %a) {
58 ; CHECK-LABEL: @log2_reassoc_exp2_strict(
59 ; CHECK-NEXT: ret double [[A:%.*]]
61 %1 = call double @llvm.exp2.f64(double %a)
62 %2 = call reassoc double @llvm.log2.f64(double %1)
66 define double @log2_strict_exp2_reassoc(double %a) {
67 ; CHECK-LABEL: @log2_strict_exp2_reassoc(
68 ; CHECK-NEXT: [[TMP1:%.*]] = call reassoc double @llvm.exp2.f64(double [[A:%.*]])
69 ; CHECK-NEXT: [[TMP2:%.*]] = call double @llvm.log2.f64(double [[TMP1]])
70 ; CHECK-NEXT: ret double [[TMP2]]
72 %1 = call reassoc double @llvm.exp2.f64(double %a)
73 %2 = call double @llvm.log2.f64(double %1)
77 define double @log2_exp2_log2_exp2(double %a) {
78 ; CHECK-LABEL: @log2_exp2_log2_exp2(
79 ; CHECK-NEXT: [[TMP1:%.*]] = call double @llvm.exp2.f64(double [[A:%.*]])
80 ; CHECK-NEXT: [[TMP2:%.*]] = call double @llvm.log2.f64(double [[TMP1]])
81 ; CHECK-NEXT: [[TMP3:%.*]] = call double @llvm.exp2.f64(double [[TMP2]])
82 ; CHECK-NEXT: [[TMP4:%.*]] = call double @llvm.log2.f64(double [[TMP3]])
83 ; CHECK-NEXT: ret double [[TMP4]]
85 %1 = call double @llvm.exp2.f64(double %a)
86 %2 = call double @llvm.log2.f64(double %1)
87 %3 = call double @llvm.exp2.f64(double %2)
88 %4 = call double @llvm.log2.f64(double %3)
92 define double @log2_exp2_log2_exp2_reassoc(double %a) {
93 ; CHECK-LABEL: @log2_exp2_log2_exp2_reassoc(
94 ; CHECK-NEXT: ret double [[A:%.*]]
96 %1 = call double @llvm.exp2.f64(double %a)
97 %2 = call reassoc double @llvm.log2.f64(double %1)
98 %3 = call double @llvm.exp2.f64(double %2)
99 %4 = call reassoc double @llvm.log2.f64(double %3)
103 define double @exp_reassoc_log_strict(double %a) {
104 ; CHECK-LABEL: @exp_reassoc_log_strict(
105 ; CHECK-NEXT: ret double [[A:%.*]]
107 %1 = call double @llvm.log.f64(double %a)
108 %2 = call reassoc double @llvm.exp.f64(double %1)
112 define double @exp_strict_log_reassoc(double %a) {
113 ; CHECK-LABEL: @exp_strict_log_reassoc(
114 ; CHECK-NEXT: [[TMP1:%.*]] = call reassoc double @llvm.log.f64(double [[A:%.*]])
115 ; CHECK-NEXT: [[TMP2:%.*]] = call double @llvm.exp.f64(double [[TMP1]])
116 ; CHECK-NEXT: ret double [[TMP2]]
118 %1 = call reassoc double @llvm.log.f64(double %a)
119 %2 = call double @llvm.exp.f64(double %1)
123 define double @exp_log_exp_log(double %a) {
124 ; CHECK-LABEL: @exp_log_exp_log(
125 ; CHECK-NEXT: [[TMP1:%.*]] = call double @llvm.log.f64(double [[A:%.*]])
126 ; CHECK-NEXT: [[TMP2:%.*]] = call double @llvm.exp.f64(double [[TMP1]])
127 ; CHECK-NEXT: [[TMP3:%.*]] = call double @llvm.log.f64(double [[TMP2]])
128 ; CHECK-NEXT: [[TMP4:%.*]] = call double @llvm.exp.f64(double [[TMP3]])
129 ; CHECK-NEXT: ret double [[TMP4]]
131 %1 = call double @llvm.log.f64(double %a)
132 %2 = call double @llvm.exp.f64(double %1)
133 %3 = call double @llvm.log.f64(double %2)
134 %4 = call double @llvm.exp.f64(double %3)
138 define double @exp_log_exp_log_reassoc(double %a) {
139 ; CHECK-LABEL: @exp_log_exp_log_reassoc(
140 ; CHECK-NEXT: ret double [[A:%.*]]
142 %1 = call double @llvm.log.f64(double %a)
143 %2 = call reassoc double @llvm.exp.f64(double %1)
144 %3 = call double @llvm.log.f64(double %2)
145 %4 = call reassoc double @llvm.exp.f64(double %3)
149 define double @exp2_reassoc_log2_strict(double %a) {
150 ; CHECK-LABEL: @exp2_reassoc_log2_strict(
151 ; CHECK-NEXT: ret double [[A:%.*]]
153 %1 = call double @llvm.log2.f64(double %a)
154 %2 = call reassoc double @llvm.exp2.f64(double %1)
158 define double @exp2_strict_log2_reassoc(double %a) {
159 ; CHECK-LABEL: @exp2_strict_log2_reassoc(
160 ; CHECK-NEXT: [[TMP1:%.*]] = call reassoc double @llvm.log2.f64(double [[A:%.*]])
161 ; CHECK-NEXT: [[TMP2:%.*]] = call double @llvm.exp2.f64(double [[TMP1]])
162 ; CHECK-NEXT: ret double [[TMP2]]
164 %1 = call reassoc double @llvm.log2.f64(double %a)
165 %2 = call double @llvm.exp2.f64(double %1)
169 define double @exp2_log2_exp2_log2(double %a) {
170 ; CHECK-LABEL: @exp2_log2_exp2_log2(
171 ; CHECK-NEXT: [[TMP1:%.*]] = call double @llvm.log2.f64(double [[A:%.*]])
172 ; CHECK-NEXT: [[TMP2:%.*]] = call double @llvm.exp2.f64(double [[TMP1]])
173 ; CHECK-NEXT: [[TMP3:%.*]] = call double @llvm.log2.f64(double [[TMP2]])
174 ; CHECK-NEXT: [[TMP4:%.*]] = call double @llvm.exp2.f64(double [[TMP3]])
175 ; CHECK-NEXT: ret double [[TMP4]]
177 %1 = call double @llvm.log2.f64(double %a)
178 %2 = call double @llvm.exp2.f64(double %1)
179 %3 = call double @llvm.log2.f64(double %2)
180 %4 = call double @llvm.exp2.f64(double %3)
184 define double @exp2_log2_exp2_log2_reassoc(double %a) {
185 ; CHECK-LABEL: @exp2_log2_exp2_log2_reassoc(
186 ; CHECK-NEXT: ret double [[A:%.*]]
188 %1 = call double @llvm.log2.f64(double %a)
189 %2 = call reassoc double @llvm.exp2.f64(double %1)
190 %3 = call double @llvm.log2.f64(double %2)
191 %4 = call reassoc double @llvm.exp2.f64(double %3)
195 define double @log10_reassoc_exp10_strict(double %a) {
196 ; CHECK-LABEL: @log10_reassoc_exp10_strict(
197 ; CHECK-NEXT: ret double [[A:%.*]]
199 %1 = call double @llvm.exp10.f64(double %a)
200 %2 = call reassoc double @llvm.log10.f64(double %1)
204 define double @log10_strict_exp10_reassoc(double %a) {
205 ; CHECK-LABEL: @log10_strict_exp10_reassoc(
206 ; CHECK-NEXT: [[TMP1:%.*]] = call reassoc double @llvm.exp10.f64(double [[A:%.*]])
207 ; CHECK-NEXT: [[TMP2:%.*]] = call double @llvm.log10.f64(double [[TMP1]])
208 ; CHECK-NEXT: ret double [[TMP2]]
210 %1 = call reassoc double @llvm.exp10.f64(double %a)
211 %2 = call double @llvm.log10.f64(double %1)
215 define double @log10_exp10_log10_exp10(double %a) {
216 ; CHECK-LABEL: @log10_exp10_log10_exp10(
217 ; CHECK-NEXT: [[TMP1:%.*]] = call double @llvm.exp10.f64(double [[A:%.*]])
218 ; CHECK-NEXT: [[TMP2:%.*]] = call double @llvm.log10.f64(double [[TMP1]])
219 ; CHECK-NEXT: [[TMP3:%.*]] = call double @llvm.exp10.f64(double [[TMP2]])
220 ; CHECK-NEXT: [[TMP4:%.*]] = call double @llvm.log10.f64(double [[TMP3]])
221 ; CHECK-NEXT: ret double [[TMP4]]
223 %1 = call double @llvm.exp10.f64(double %a)
224 %2 = call double @llvm.log10.f64(double %1)
225 %3 = call double @llvm.exp10.f64(double %2)
226 %4 = call double @llvm.log10.f64(double %3)
230 define double @log10_exp10_log10_exp10_reassoc(double %a) {
231 ; CHECK-LABEL: @log10_exp10_log10_exp10_reassoc(
232 ; CHECK-NEXT: ret double [[A:%.*]]
234 %1 = call double @llvm.exp10.f64(double %a)
235 %2 = call reassoc double @llvm.log10.f64(double %1)
236 %3 = call double @llvm.exp10.f64(double %2)
237 %4 = call reassoc double @llvm.log10.f64(double %3)
241 define double @exp10_reassoc_log10_strict(double %a) {
242 ; CHECK-LABEL: @exp10_reassoc_log10_strict(
243 ; CHECK-NEXT: ret double [[A:%.*]]
245 %1 = call double @llvm.log10.f64(double %a)
246 %2 = call reassoc double @llvm.exp10.f64(double %1)
250 define double @exp10_strict_log10_reassoc(double %a) {
251 ; CHECK-LABEL: @exp10_strict_log10_reassoc(
252 ; CHECK-NEXT: [[TMP1:%.*]] = call reassoc double @llvm.log10.f64(double [[A:%.*]])
253 ; CHECK-NEXT: [[TMP2:%.*]] = call double @llvm.exp10.f64(double [[TMP1]])
254 ; CHECK-NEXT: ret double [[TMP2]]
256 %1 = call reassoc double @llvm.log10.f64(double %a)
257 %2 = call double @llvm.exp10.f64(double %1)
261 define double @exp10_log10_exp10_log10(double %a) {
262 ; CHECK-LABEL: @exp10_log10_exp10_log10(
263 ; CHECK-NEXT: [[TMP1:%.*]] = call double @llvm.log10.f64(double [[A:%.*]])
264 ; CHECK-NEXT: [[TMP2:%.*]] = call double @llvm.exp10.f64(double [[TMP1]])
265 ; CHECK-NEXT: [[TMP3:%.*]] = call double @llvm.log10.f64(double [[TMP2]])
266 ; CHECK-NEXT: [[TMP4:%.*]] = call double @llvm.exp10.f64(double [[TMP3]])
267 ; CHECK-NEXT: ret double [[TMP4]]
269 %1 = call double @llvm.log10.f64(double %a)
270 %2 = call double @llvm.exp10.f64(double %1)
271 %3 = call double @llvm.log10.f64(double %2)
272 %4 = call double @llvm.exp10.f64(double %3)
276 define double @exp10_log10_exp10_log10_reassoc(double %a) {
277 ; CHECK-LABEL: @exp10_log10_exp10_log10_reassoc(
278 ; CHECK-NEXT: ret double [[A:%.*]]
280 %1 = call double @llvm.log10.f64(double %a)
281 %2 = call reassoc double @llvm.exp10.f64(double %1)
282 %3 = call double @llvm.log10.f64(double %2)
283 %4 = call reassoc double @llvm.exp10.f64(double %3)
287 define double @log2_reassoc_exp10_reassoc(double %a) {
288 ; CHECK-LABEL: @log2_reassoc_exp10_reassoc(
289 ; CHECK-NEXT: [[TMP1:%.*]] = call reassoc double @llvm.exp10.f64(double [[A:%.*]])
290 ; CHECK-NEXT: [[TMP2:%.*]] = call reassoc double @llvm.log2.f64(double [[TMP1]])
291 ; CHECK-NEXT: ret double [[TMP2]]
293 %1 = call reassoc double @llvm.exp10.f64(double %a)
294 %2 = call reassoc double @llvm.log2.f64(double %1)
298 define double @log10_reassoc_exp2_reassoc(double %a) {
299 ; CHECK-LABEL: @log10_reassoc_exp2_reassoc(
300 ; CHECK-NEXT: [[TMP1:%.*]] = call reassoc double @llvm.exp2.f64(double [[A:%.*]])
301 ; CHECK-NEXT: [[TMP2:%.*]] = call reassoc double @llvm.log10.f64(double [[TMP1]])
302 ; CHECK-NEXT: ret double [[TMP2]]
304 %1 = call reassoc double @llvm.exp2.f64(double %a)
305 %2 = call reassoc double @llvm.log10.f64(double %1)
309 define double @log10_reassoc_exp_reassoc(double %a) {
310 ; CHECK-LABEL: @log10_reassoc_exp_reassoc(
311 ; CHECK-NEXT: [[TMP1:%.*]] = call reassoc double @llvm.exp.f64(double [[A:%.*]])
312 ; CHECK-NEXT: [[TMP2:%.*]] = call reassoc double @llvm.log10.f64(double [[TMP1]])
313 ; CHECK-NEXT: ret double [[TMP2]]
315 %1 = call reassoc double @llvm.exp.f64(double %a)
316 %2 = call reassoc double @llvm.log10.f64(double %1)