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.log2.f64(double)
5 declare double @llvm.pow.f64(double, double)
7 define double @log2_pow2(double %x) {
8 ; CHECK-LABEL: @log2_pow2(
9 ; CHECK-NEXT: [[TMP:%.*]] = call double @llvm.pow.f64(double 2.000000e+00, double [[X:%.*]])
10 ; CHECK-NEXT: [[TMP1:%.*]] = call double @llvm.log2.f64(double [[TMP]])
11 ; CHECK-NEXT: ret double [[TMP1]]
13 %tmp = call double @llvm.pow.f64(double 2.000000e+00, double %x)
14 %tmp1 = call double @llvm.log2.f64(double %tmp)
18 define double @log2_strict_pow2_reassoc(double %x) {
19 ; CHECK-LABEL: @log2_strict_pow2_reassoc(
20 ; CHECK-NEXT: [[TMP:%.*]] = call reassoc double @llvm.pow.f64(double 2.000000e+00, double [[X:%.*]])
21 ; CHECK-NEXT: [[TMP1:%.*]] = call double @llvm.log2.f64(double [[TMP]])
22 ; CHECK-NEXT: ret double [[TMP1]]
24 %tmp = call reassoc double @llvm.pow.f64(double 2.000000e+00, double %x)
25 %tmp1 = call double @llvm.log2.f64(double %tmp)
29 define double @log2_reassoc_pow2_strict(double %x) {
30 ; CHECK-LABEL: @log2_reassoc_pow2_strict(
31 ; CHECK-NEXT: ret double [[X:%.*]]
33 %tmp = call double @llvm.pow.f64(double 2.000000e+00, double %x)
34 %tmp1 = call reassoc double @llvm.log2.f64(double %tmp)
38 define double @log2_pow2_reassoc(double %x) {
39 ; CHECK-LABEL: @log2_pow2_reassoc(
40 ; CHECK-NEXT: ret double [[X:%.*]]
42 %tmp = call reassoc double @llvm.pow.f64(double 2.000000e+00, double %x)
43 %tmp1 = call reassoc double @llvm.log2.f64(double %tmp)