1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py 2; RUN: opt < %s -instsimplify -S | FileCheck %s 3 4declare double @llvm.log.f64(double) 5declare double @llvm.exp.f64(double) 6declare double @llvm.log2.f64(double) 7declare double @llvm.exp2.f64(double) 8 9define double @log_reassoc_exp_strict(double %a) { 10; CHECK-LABEL: @log_reassoc_exp_strict( 11; CHECK-NEXT: ret double [[A:%.*]] 12; 13 %1 = call double @llvm.exp.f64(double %a) 14 %2 = call reassoc double @llvm.log.f64(double %1) 15 ret double %2 16} 17 18define 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]] 23; 24 %1 = call reassoc double @llvm.exp.f64(double %a) 25 %2 = call double @llvm.log.f64(double %1) 26 ret double %2 27} 28 29define 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]] 36; 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) 41 ret double %4 42} 43 44define double @log_exp_log_exp_reassoc(double %a) { 45; CHECK-LABEL: @log_exp_log_exp_reassoc( 46; CHECK-NEXT: ret double [[A:%.*]] 47; 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) 52 ret double %4 53} 54 55define double @log2_reassoc_exp2_strict(double %a) { 56; CHECK-LABEL: @log2_reassoc_exp2_strict( 57; CHECK-NEXT: ret double [[A:%.*]] 58; 59 %1 = call double @llvm.exp2.f64(double %a) 60 %2 = call reassoc double @llvm.log2.f64(double %1) 61 ret double %2 62} 63 64define 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]] 69; 70 %1 = call reassoc double @llvm.exp2.f64(double %a) 71 %2 = call double @llvm.log2.f64(double %1) 72 ret double %2 73} 74 75define 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]] 82; 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) 87 ret double %4 88} 89 90define double @log2_exp2_log2_exp2_reassoc(double %a) { 91; CHECK-LABEL: @log2_exp2_log2_exp2_reassoc( 92; CHECK-NEXT: ret double [[A:%.*]] 93; 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) 98 ret double %4 99} 100 101define double @exp_reassoc_log_strict(double %a) { 102; CHECK-LABEL: @exp_reassoc_log_strict( 103; CHECK-NEXT: ret double [[A:%.*]] 104; 105 %1 = call double @llvm.log.f64(double %a) 106 %2 = call reassoc double @llvm.exp.f64(double %1) 107 ret double %2 108} 109 110define 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]] 115; 116 %1 = call reassoc double @llvm.log.f64(double %a) 117 %2 = call double @llvm.exp.f64(double %1) 118 ret double %2 119} 120 121define 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]] 128; 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) 133 ret double %4 134} 135 136define double @exp_log_exp_log_reassoc(double %a) { 137; CHECK-LABEL: @exp_log_exp_log_reassoc( 138; CHECK-NEXT: ret double [[A:%.*]] 139; 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) 144 ret double %4 145} 146 147define double @exp2_reassoc_log2_strict(double %a) { 148; CHECK-LABEL: @exp2_reassoc_log2_strict( 149; CHECK-NEXT: ret double [[A:%.*]] 150; 151 %1 = call double @llvm.log2.f64(double %a) 152 %2 = call reassoc double @llvm.exp2.f64(double %1) 153 ret double %2 154} 155 156define 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]] 161; 162 %1 = call reassoc double @llvm.log2.f64(double %a) 163 %2 = call double @llvm.exp2.f64(double %1) 164 ret double %2 165} 166 167define 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]] 174; 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) 179 ret double %4 180} 181 182define double @exp2_log2_exp2_log2_reassoc(double %a) { 183; CHECK-LABEL: @exp2_log2_exp2_log2_reassoc( 184; CHECK-NEXT: ret double [[A:%.*]] 185; 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) 190 ret double %4 191} 192 193