File tree 1 file changed +28
-0
lines changed
llvm/test/Transforms/InstCombine 1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -105,4 +105,32 @@ define fp128 @fmul_tanfp128_cosfp128_reassoc(fp128 %a) {
105
105
ret fp128 %res
106
106
}
107
107
108
+ ; commutativity
109
+ define double @commutativity_cos_tan (double %a ) {
110
+ ; CHECK-LABEL: define double @commutativity_cos_tan(
111
+ ; CHECK-SAME: double [[A:%.*]]) {
112
+ ; CHECK-NEXT: [[RES:%.*]] = call reassoc double @llvm.sin.f64(double [[A]])
113
+ ; CHECK-NEXT: ret double [[RES]]
114
+ ;
115
+ %cos = call reassoc double @llvm.cos.f64 (double %a )
116
+ %tan = call reassoc double @llvm.tan.f64 (double %a )
117
+ %res = fmul reassoc double %cos , %tan
118
+ ret double %res
119
+ }
120
+
121
+ ; negative test with mismatched value
122
+ define double @tan_cos_value_mismatch (double %a , double %b ) {
123
+ ; CHECK-LABEL: define double @tan_cos_value_mismatch(
124
+ ; CHECK-SAME: double [[A:%.*]], double [[B:%.*]]) {
125
+ ; CHECK-NEXT: [[TAN:%.*]] = call reassoc double @llvm.tan.f64(double [[A]])
126
+ ; CHECK-NEXT: [[COS:%.*]] = call reassoc double @llvm.cos.f64(double [[B]])
127
+ ; CHECK-NEXT: [[RES:%.*]] = fmul reassoc double [[TAN]], [[COS]]
128
+ ; CHECK-NEXT: ret double [[RES]]
129
+ ;
130
+ %tan = call reassoc double @llvm.tan.f64 (double %a )
131
+ %cos = call reassoc double @llvm.cos.f64 (double %b )
132
+ %res = fmul reassoc double %tan , %cos
133
+ ret double %res
134
+ }
135
+
108
136
declare void @use (double )
You can’t perform that action at this time.
0 commit comments