@@ -21,11 +21,11 @@ define double @exp2_a_exp2_b(double %a, double %b) {
21
21
; exp2(a) * exp2(b) reassoc, multiple uses
22
22
define double @exp2_a_exp2_b_multiple_uses (double %a , double %b ) {
23
23
; CHECK-LABEL: @exp2_a_exp2_b_multiple_uses(
24
- ; CHECK-NEXT: [[TMP:%.*]] = call double @llvm.exp2.f64(double [[A:%.*]])
25
24
; CHECK-NEXT: [[TMP1:%.*]] = call double @llvm.exp2.f64(double [[B:%.*]])
26
- ; CHECK-NEXT: [[MUL:%.*]] = fmul reassoc double [[TMP]], [[TMP1]]
25
+ ; CHECK-NEXT: [[TMP:%.*]] = fadd reassoc double [[A:%.*]], [[B]]
26
+ ; CHECK-NEXT: [[TMP2:%.*]] = call reassoc double @llvm.exp2.f64(double [[TMP]])
27
27
; CHECK-NEXT: call void @use(double [[TMP1]])
28
- ; CHECK-NEXT: ret double [[MUL ]]
28
+ ; CHECK-NEXT: ret double [[TMP2 ]]
29
29
;
30
30
%tmp = call double @llvm.exp2.f64 (double %a )
31
31
%tmp1 = call double @llvm.exp2.f64 (double %b )
@@ -55,10 +55,9 @@ define double @exp2_a_exp2_b_multiple_uses_both(double %a, double %b) {
55
55
; exp2(a) * exp2(b) => exp2(a+b) with reassoc
56
56
define double @exp2_a_exp2_b_reassoc (double %a , double %b ) {
57
57
; CHECK-LABEL: @exp2_a_exp2_b_reassoc(
58
- ; CHECK-NEXT: [[TMP:%.*]] = call double @llvm.exp2.f64(double [[A:%.*]])
59
- ; CHECK-NEXT: [[TMP1:%.*]] = call double @llvm.exp2.f64(double [[B:%.*]])
60
- ; CHECK-NEXT: [[MUL:%.*]] = fmul reassoc double [[TMP]], [[TMP1]]
61
- ; CHECK-NEXT: ret double [[MUL]]
58
+ ; CHECK-NEXT: [[TMP:%.*]] = fadd reassoc double [[A:%.*]], [[B:%.*]]
59
+ ; CHECK-NEXT: [[TMP1:%.*]] = call reassoc double @llvm.exp2.f64(double [[TMP]])
60
+ ; CHECK-NEXT: ret double [[TMP1]]
62
61
;
63
62
%tmp = call double @llvm.exp2.f64 (double %a )
64
63
%tmp1 = call double @llvm.exp2.f64 (double %b )
@@ -69,14 +68,11 @@ define double @exp2_a_exp2_b_reassoc(double %a, double %b) {
69
68
; exp2(a) * exp2(b) * exp2(c) * exp2(d) => exp2(a+b+c+d) with reassoc
70
69
define double @exp2_a_exp2_b_exp2_c_exp2_d (double %a , double %b , double %c , double %d ) {
71
70
; CHECK-LABEL: @exp2_a_exp2_b_exp2_c_exp2_d(
72
- ; CHECK-NEXT: [[TMP:%.*]] = call double @llvm.exp2.f64(double [[A:%.*]])
73
- ; CHECK-NEXT: [[TMP1:%.*]] = call double @llvm.exp2.f64(double [[B:%.*]])
74
- ; CHECK-NEXT: [[MUL:%.*]] = fmul reassoc double [[TMP]], [[TMP1]]
75
- ; CHECK-NEXT: [[TMP2:%.*]] = call double @llvm.exp2.f64(double [[C:%.*]])
76
- ; CHECK-NEXT: [[MUL1:%.*]] = fmul reassoc double [[MUL]], [[TMP2]]
77
- ; CHECK-NEXT: [[TMP3:%.*]] = call double @llvm.exp2.f64(double [[D:%.*]])
78
- ; CHECK-NEXT: [[MUL2:%.*]] = fmul reassoc double [[MUL1]], [[TMP3]]
79
- ; CHECK-NEXT: ret double [[MUL2]]
71
+ ; CHECK-NEXT: [[TMP:%.*]] = fadd reassoc double [[A:%.*]], [[B:%.*]]
72
+ ; CHECK-NEXT: [[TMP1:%.*]] = fadd reassoc double [[TMP]], [[C:%.*]]
73
+ ; CHECK-NEXT: [[TMP2:%.*]] = fadd reassoc double [[TMP1]], [[D:%.*]]
74
+ ; CHECK-NEXT: [[TMP3:%.*]] = call reassoc double @llvm.exp2.f64(double [[TMP2]])
75
+ ; CHECK-NEXT: ret double [[TMP3]]
80
76
;
81
77
%tmp = call double @llvm.exp2.f64 (double %a )
82
78
%tmp1 = call double @llvm.exp2.f64 (double %b )
0 commit comments