1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt < %s -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)
9 define double @log_reassoc_exp_strict(double %a) {
10 ; CHECK-LABEL: @log_reassoc_exp_strict(
11 ; CHECK-NEXT: ret double [[A:%.*]]
13 %1 = call double @llvm.exp.f64(double %a)
14 %2 = call reassoc double @llvm.log.f64(double %1)
18 define double @log_strict_exp_reassoc(double %a) {
19 ; CHECK-LABEL: @log_strict_exp_reassoc(
20 ; CHECK-NEXT: [[TMP1:%.*]] = call reassoc double @llvm.exp.f64(double [[A:%.*]])
21 ; CHECK-NEXT: [[TMP2:%.*]] = call double @llvm.log.f64(double [[TMP1]])
22 ; CHECK-NEXT: ret double [[TMP2]]
24 %1 = call reassoc double @llvm.exp.f64(double %a)
25 %2 = call double @llvm.log.f64(double %1)
29 define double @log_exp_log_exp(double %a) {
30 ; CHECK-LABEL: @log_exp_log_exp(
31 ; CHECK-NEXT: [[TMP1:%.*]] = call double @llvm.exp.f64(double [[A:%.*]])
32 ; CHECK-NEXT: [[TMP2:%.*]] = call double @llvm.log.f64(double [[TMP1]])
33 ; CHECK-NEXT: [[TMP3:%.*]] = call double @llvm.exp.f64(double [[TMP2]])
34 ; CHECK-NEXT: [[TMP4:%.*]] = call double @llvm.log.f64(double [[TMP3]])
35 ; CHECK-NEXT: ret double [[TMP4]]
37 %1 = call double @llvm.exp.f64(double %a)
38 %2 = call double @llvm.log.f64(double %1)
39 %3 = call double @llvm.exp.f64(double %2)
40 %4 = call double @llvm.log.f64(double %3)
44 define double @log_exp_log_exp_reassoc(double %a) {
45 ; CHECK-LABEL: @log_exp_log_exp_reassoc(
46 ; CHECK-NEXT: ret double [[A:%.*]]
48 %1 = call double @llvm.exp.f64(double %a)
49 %2 = call reassoc double @llvm.log.f64(double %1)
50 %3 = call double @llvm.exp.f64(double %2)
51 %4 = call reassoc double @llvm.log.f64(double %3)
55 define double @log2_reassoc_exp2_strict(double %a) {
56 ; CHECK-LABEL: @log2_reassoc_exp2_strict(
57 ; CHECK-NEXT: ret double [[A:%.*]]
59 %1 = call double @llvm.exp2.f64(double %a)
60 %2 = call reassoc double @llvm.log2.f64(double %1)
64 define double @log2_strict_exp2_reassoc(double %a) {
65 ; CHECK-LABEL: @log2_strict_exp2_reassoc(
66 ; CHECK-NEXT: [[TMP1:%.*]] = call reassoc double @llvm.exp2.f64(double [[A:%.*]])
67 ; CHECK-NEXT: [[TMP2:%.*]] = call double @llvm.log2.f64(double [[TMP1]])
68 ; CHECK-NEXT: ret double [[TMP2]]
70 %1 = call reassoc double @llvm.exp2.f64(double %a)
71 %2 = call double @llvm.log2.f64(double %1)
75 define double @log2_exp2_log2_exp2(double %a) {
76 ; CHECK-LABEL: @log2_exp2_log2_exp2(
77 ; CHECK-NEXT: [[TMP1:%.*]] = call double @llvm.exp2.f64(double [[A:%.*]])
78 ; CHECK-NEXT: [[TMP2:%.*]] = call double @llvm.log2.f64(double [[TMP1]])
79 ; CHECK-NEXT: [[TMP3:%.*]] = call double @llvm.exp2.f64(double [[TMP2]])
80 ; CHECK-NEXT: [[TMP4:%.*]] = call double @llvm.log2.f64(double [[TMP3]])
81 ; CHECK-NEXT: ret double [[TMP4]]
83 %1 = call double @llvm.exp2.f64(double %a)
84 %2 = call double @llvm.log2.f64(double %1)
85 %3 = call double @llvm.exp2.f64(double %2)
86 %4 = call double @llvm.log2.f64(double %3)
90 define double @log2_exp2_log2_exp2_reassoc(double %a) {
91 ; CHECK-LABEL: @log2_exp2_log2_exp2_reassoc(
92 ; CHECK-NEXT: ret double [[A:%.*]]
94 %1 = call double @llvm.exp2.f64(double %a)
95 %2 = call reassoc double @llvm.log2.f64(double %1)
96 %3 = call double @llvm.exp2.f64(double %2)
97 %4 = call reassoc double @llvm.log2.f64(double %3)
101 define double @exp_reassoc_log_strict(double %a) {
102 ; CHECK-LABEL: @exp_reassoc_log_strict(
103 ; CHECK-NEXT: ret double [[A:%.*]]
105 %1 = call double @llvm.log.f64(double %a)
106 %2 = call reassoc double @llvm.exp.f64(double %1)
110 define double @exp_strict_log_reassoc(double %a) {
111 ; CHECK-LABEL: @exp_strict_log_reassoc(
112 ; CHECK-NEXT: [[TMP1:%.*]] = call reassoc double @llvm.log.f64(double [[A:%.*]])
113 ; CHECK-NEXT: [[TMP2:%.*]] = call double @llvm.exp.f64(double [[TMP1]])
114 ; CHECK-NEXT: ret double [[TMP2]]
116 %1 = call reassoc double @llvm.log.f64(double %a)
117 %2 = call double @llvm.exp.f64(double %1)
121 define double @exp_log_exp_log(double %a) {
122 ; CHECK-LABEL: @exp_log_exp_log(
123 ; CHECK-NEXT: [[TMP1:%.*]] = call double @llvm.log.f64(double [[A:%.*]])
124 ; CHECK-NEXT: [[TMP2:%.*]] = call double @llvm.exp.f64(double [[TMP1]])
125 ; CHECK-NEXT: [[TMP3:%.*]] = call double @llvm.log.f64(double [[TMP2]])
126 ; CHECK-NEXT: [[TMP4:%.*]] = call double @llvm.exp.f64(double [[TMP3]])
127 ; CHECK-NEXT: ret double [[TMP4]]
129 %1 = call double @llvm.log.f64(double %a)
130 %2 = call double @llvm.exp.f64(double %1)
131 %3 = call double @llvm.log.f64(double %2)
132 %4 = call double @llvm.exp.f64(double %3)
136 define double @exp_log_exp_log_reassoc(double %a) {
137 ; CHECK-LABEL: @exp_log_exp_log_reassoc(
138 ; CHECK-NEXT: ret double [[A:%.*]]
140 %1 = call double @llvm.log.f64(double %a)
141 %2 = call reassoc double @llvm.exp.f64(double %1)
142 %3 = call double @llvm.log.f64(double %2)
143 %4 = call reassoc double @llvm.exp.f64(double %3)
147 define double @exp2_reassoc_log2_strict(double %a) {
148 ; CHECK-LABEL: @exp2_reassoc_log2_strict(
149 ; CHECK-NEXT: ret double [[A:%.*]]
151 %1 = call double @llvm.log2.f64(double %a)
152 %2 = call reassoc double @llvm.exp2.f64(double %1)
156 define double @exp2_strict_log2_reassoc(double %a) {
157 ; CHECK-LABEL: @exp2_strict_log2_reassoc(
158 ; CHECK-NEXT: [[TMP1:%.*]] = call reassoc double @llvm.log2.f64(double [[A:%.*]])
159 ; CHECK-NEXT: [[TMP2:%.*]] = call double @llvm.exp2.f64(double [[TMP1]])
160 ; CHECK-NEXT: ret double [[TMP2]]
162 %1 = call reassoc double @llvm.log2.f64(double %a)
163 %2 = call double @llvm.exp2.f64(double %1)
167 define double @exp2_log2_exp2_log2(double %a) {
168 ; CHECK-LABEL: @exp2_log2_exp2_log2(
169 ; CHECK-NEXT: [[TMP1:%.*]] = call double @llvm.log2.f64(double [[A:%.*]])
170 ; CHECK-NEXT: [[TMP2:%.*]] = call double @llvm.exp2.f64(double [[TMP1]])
171 ; CHECK-NEXT: [[TMP3:%.*]] = call double @llvm.log2.f64(double [[TMP2]])
172 ; CHECK-NEXT: [[TMP4:%.*]] = call double @llvm.exp2.f64(double [[TMP3]])
173 ; CHECK-NEXT: ret double [[TMP4]]
175 %1 = call double @llvm.log2.f64(double %a)
176 %2 = call double @llvm.exp2.f64(double %1)
177 %3 = call double @llvm.log2.f64(double %2)
178 %4 = call double @llvm.exp2.f64(double %3)
182 define double @exp2_log2_exp2_log2_reassoc(double %a) {
183 ; CHECK-LABEL: @exp2_log2_exp2_log2_reassoc(
184 ; CHECK-NEXT: ret double [[A:%.*]]
186 %1 = call double @llvm.log2.f64(double %a)
187 %2 = call reassoc double @llvm.exp2.f64(double %1)
188 %3 = call double @llvm.log2.f64(double %2)
189 %4 = call reassoc double @llvm.exp2.f64(double %3)