@@ -15,160 +15,160 @@ define double @fmul_tan_cos(double %a) {
15
15
ret double %res
16
16
}
17
17
18
- define double @fmul_strict_tan_strict_cos_reassoc (double %a ) {
19
- ; CHECK-LABEL: define double @fmul_strict_tan_strict_cos_reassoc (
18
+ define double @fmul_strict_tan_strict_cos_contract (double %a ) {
19
+ ; CHECK-LABEL: define double @fmul_strict_tan_strict_cos_contract (
20
20
; CHECK-SAME: double [[A:%.*]]) {
21
21
; CHECK-NEXT: [[TAN:%.*]] = call double @llvm.tan.f64(double [[A]])
22
- ; CHECK-NEXT: [[COS:%.*]] = call reassoc double @llvm.cos.f64(double [[A]])
22
+ ; CHECK-NEXT: [[COS:%.*]] = call contract double @llvm.cos.f64(double [[A]])
23
23
; CHECK-NEXT: [[RES:%.*]] = fmul double [[TAN]], [[COS]]
24
24
; CHECK-NEXT: ret double [[RES]]
25
25
;
26
26
%tan = call double @llvm.tan.f64 (double %a )
27
- %cos = call reassoc double @llvm.cos.f64 (double %a )
27
+ %cos = call contract double @llvm.cos.f64 (double %a )
28
28
%res = fmul double %tan , %cos
29
29
ret double %res
30
30
}
31
31
32
- define double @fmul_reassoc_tan_strict_cos_strict (double %a ) {
33
- ; CHECK-LABEL: define double @fmul_reassoc_tan_strict_cos_strict (
32
+ define double @fmul_contract_tan_strict_cos_strict (double %a ) {
33
+ ; CHECK-LABEL: define double @fmul_contract_tan_strict_cos_strict (
34
34
; CHECK-SAME: double [[A:%.*]]) {
35
- ; CHECK-NEXT: [[RES:%.*]] = call reassoc double @llvm.sin.f64(double [[A]])
35
+ ; CHECK-NEXT: [[RES:%.*]] = call contract double @llvm.sin.f64(double [[A]])
36
36
; CHECK-NEXT: ret double [[RES]]
37
37
;
38
38
%tan = call double @llvm.tan.f64 (double %a )
39
39
%cos = call double @llvm.cos.f64 (double %a )
40
- %res = fmul reassoc double %tan , %cos
40
+ %res = fmul contract double %tan , %cos
41
41
ret double %res
42
42
}
43
43
44
- define double @fmul_reassoc_tan_reassoc_cos_strict (double %a ) {
45
- ; CHECK-LABEL: define double @fmul_reassoc_tan_reassoc_cos_strict (
44
+ define double @fmul_contract_tan_contract_cos_strict (double %a ) {
45
+ ; CHECK-LABEL: define double @fmul_contract_tan_contract_cos_strict (
46
46
; CHECK-SAME: double [[A:%.*]]) {
47
- ; CHECK-NEXT: [[RES:%.*]] = call reassoc double @llvm.sin.f64(double [[A]])
47
+ ; CHECK-NEXT: [[RES:%.*]] = call contract double @llvm.sin.f64(double [[A]])
48
48
; CHECK-NEXT: ret double [[RES]]
49
49
;
50
- %tan = call reassoc double @llvm.tan.f64 (double %a )
50
+ %tan = call contract double @llvm.tan.f64 (double %a )
51
51
%cos = call double @llvm.cos.f64 (double %a )
52
- %res = fmul reassoc double %tan , %cos
52
+ %res = fmul contract double %tan , %cos
53
53
ret double %res
54
54
}
55
55
56
- define double @fmul_tan_cos_reassoc_multiple_uses (double %a ) {
57
- ; CHECK-LABEL: define double @fmul_tan_cos_reassoc_multiple_uses (
56
+ define double @fmul_tan_cos_contract_multiple_uses (double %a ) {
57
+ ; CHECK-LABEL: define double @fmul_tan_cos_contract_multiple_uses (
58
58
; CHECK-SAME: double [[A:%.*]]) {
59
- ; CHECK-NEXT: [[TAN:%.*]] = call reassoc double @llvm.tan.f64(double [[A]])
60
- ; CHECK-NEXT: [[COS:%.*]] = call reassoc double @llvm.cos.f64(double [[A]])
61
- ; CHECK-NEXT: [[RES:%.*]] = fmul reassoc double [[TAN]], [[COS]]
59
+ ; CHECK-NEXT: [[TAN:%.*]] = call contract double @llvm.tan.f64(double [[A]])
60
+ ; CHECK-NEXT: [[COS:%.*]] = call contract double @llvm.cos.f64(double [[A]])
61
+ ; CHECK-NEXT: [[RES:%.*]] = fmul contract double [[TAN]], [[COS]]
62
62
; CHECK-NEXT: call void @use(double [[COS]])
63
63
; CHECK-NEXT: ret double [[RES]]
64
64
;
65
- %tan = call reassoc double @llvm.tan.f64 (double %a )
66
- %cos = call reassoc double @llvm.cos.f64 (double %a )
67
- %res = fmul reassoc double %tan , %cos
65
+ %tan = call contract double @llvm.tan.f64 (double %a )
66
+ %cos = call contract double @llvm.cos.f64 (double %a )
67
+ %res = fmul contract double %tan , %cos
68
68
call void @use (double %cos )
69
69
ret double %res
70
70
}
71
71
72
- define double @fmul_tan_cos_reassoc (double %a ) {
73
- ; CHECK-LABEL: define double @fmul_tan_cos_reassoc (
72
+ define double @fmul_tan_cos_contract (double %a ) {
73
+ ; CHECK-LABEL: define double @fmul_tan_cos_contract (
74
74
; CHECK-SAME: double [[A:%.*]]) {
75
- ; CHECK-NEXT: [[RES:%.*]] = call reassoc double @llvm.sin.f64(double [[A]])
75
+ ; CHECK-NEXT: [[RES:%.*]] = call contract double @llvm.sin.f64(double [[A]])
76
76
; CHECK-NEXT: ret double [[RES]]
77
77
;
78
- %tan = call reassoc double @llvm.tan.f64 (double %a )
79
- %cos = call reassoc double @llvm.cos.f64 (double %a )
80
- %res = fmul reassoc double %tan , %cos
78
+ %tan = call contract double @llvm.tan.f64 (double %a )
79
+ %cos = call contract double @llvm.cos.f64 (double %a )
80
+ %res = fmul contract double %tan , %cos
81
81
ret double %res
82
82
}
83
83
84
- define float @fmul_tanf_cosf_reassoc (float %a ) {
85
- ; CHECK-LABEL: define float @fmul_tanf_cosf_reassoc (
84
+ define float @fmul_tanf_cosf_contract (float %a ) {
85
+ ; CHECK-LABEL: define float @fmul_tanf_cosf_contract (
86
86
; CHECK-SAME: float [[A:%.*]]) {
87
- ; CHECK-NEXT: [[RES:%.*]] = call reassoc float @llvm.sin.f32(float [[A]])
87
+ ; CHECK-NEXT: [[RES:%.*]] = call contract float @llvm.sin.f32(float [[A]])
88
88
; CHECK-NEXT: ret float [[RES]]
89
89
;
90
- %tan = call reassoc float @llvm.tan.f32 (float %a )
91
- %cos = call reassoc float @llvm.cos.f32 (float %a )
92
- %res = fmul reassoc float %tan , %cos
90
+ %tan = call contract float @llvm.tan.f32 (float %a )
91
+ %cos = call contract float @llvm.cos.f32 (float %a )
92
+ %res = fmul contract float %tan , %cos
93
93
ret float %res
94
94
}
95
95
96
- define fp128 @fmul_tanfp128_cosfp128_reassoc (fp128 %a ) {
97
- ; CHECK-LABEL: define fp128 @fmul_tanfp128_cosfp128_reassoc (
96
+ define fp128 @fmul_tanfp128_cosfp128_contract (fp128 %a ) {
97
+ ; CHECK-LABEL: define fp128 @fmul_tanfp128_cosfp128_contract (
98
98
; CHECK-SAME: fp128 [[A:%.*]]) {
99
- ; CHECK-NEXT: [[RES:%.*]] = call reassoc fp128 @llvm.sin.f128(fp128 [[A]])
99
+ ; CHECK-NEXT: [[RES:%.*]] = call contract fp128 @llvm.sin.f128(fp128 [[A]])
100
100
; CHECK-NEXT: ret fp128 [[RES]]
101
101
;
102
- %tan = call reassoc fp128 @llvm.tan.fp128 (fp128 %a )
103
- %cos = call reassoc fp128 @llvm.cos.fp128 (fp128 %a )
104
- %res = fmul reassoc fp128 %tan , %cos
102
+ %tan = call contract fp128 @llvm.tan.fp128 (fp128 %a )
103
+ %cos = call contract fp128 @llvm.cos.fp128 (fp128 %a )
104
+ %res = fmul contract fp128 %tan , %cos
105
105
ret fp128 %res
106
106
}
107
107
108
108
; commutativity
109
109
define double @commutativity_cos_tan (double %a ) {
110
110
; CHECK-LABEL: define double @commutativity_cos_tan(
111
111
; CHECK-SAME: double [[A:%.*]]) {
112
- ; CHECK-NEXT: [[RES:%.*]] = call reassoc double @llvm.sin.f64(double [[A]])
112
+ ; CHECK-NEXT: [[RES:%.*]] = call contract double @llvm.sin.f64(double [[A]])
113
113
; CHECK-NEXT: ret double [[RES]]
114
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
115
+ %cos = call contract double @llvm.cos.f64 (double %a )
116
+ %tan = call contract double @llvm.tan.f64 (double %a )
117
+ %res = fmul contract double %cos , %tan
118
118
ret double %res
119
119
}
120
120
121
121
; negative test with mismatched value
122
122
define double @tan_cos_value_mismatch (double %a , double %b ) {
123
123
; CHECK-LABEL: define double @tan_cos_value_mismatch(
124
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]]
125
+ ; CHECK-NEXT: [[TAN:%.*]] = call contract double @llvm.tan.f64(double [[A]])
126
+ ; CHECK-NEXT: [[COS:%.*]] = call contract double @llvm.cos.f64(double [[B]])
127
+ ; CHECK-NEXT: [[RES:%.*]] = fmul contract double [[TAN]], [[COS]]
128
128
; CHECK-NEXT: ret double [[RES]]
129
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
130
+ %tan = call contract double @llvm.tan.f64 (double %a )
131
+ %cos = call contract double @llvm.cos.f64 (double %b )
132
+ %res = fmul contract double %tan , %cos
133
133
ret double %res
134
134
}
135
135
136
136
; Vector
137
137
define <2 x double > @fmul_tan_cos_vector (<2 x double > %a ) {
138
138
; CHECK-LABEL: define <2 x double> @fmul_tan_cos_vector(
139
139
; CHECK-SAME: <2 x double> [[A:%.*]]) {
140
- ; CHECK-NEXT: [[RES:%.*]] = call reassoc <2 x double> @llvm.sin.v2f64(<2 x double> [[A]])
140
+ ; CHECK-NEXT: [[RES:%.*]] = call contract <2 x double> @llvm.sin.v2f64(<2 x double> [[A]])
141
141
; CHECK-NEXT: ret <2 x double> [[RES]]
142
142
;
143
- %tan = call reassoc <2 x double > @llvm.tan.v2f64 (<2 x double > %a )
144
- %cos = call reassoc <2 x double > @llvm.cos.v2f64 (<2 x double > %a )
145
- %res = fmul reassoc <2 x double > %tan , %cos
143
+ %tan = call contract <2 x double > @llvm.tan.v2f64 (<2 x double > %a )
144
+ %cos = call contract <2 x double > @llvm.cos.v2f64 (<2 x double > %a )
145
+ %res = fmul contract <2 x double > %tan , %cos
146
146
ret <2 x double > %res
147
147
}
148
148
149
149
; Flag preservation
150
150
define double @fmul_tan_cos_nnan_preservation (double %a ) {
151
151
; CHECK-LABEL: define double @fmul_tan_cos_nnan_preservation(
152
152
; CHECK-SAME: double [[A:%.*]]) {
153
- ; CHECK-NEXT: [[RES:%.*]] = call reassoc nnan double @llvm.sin.f64(double [[A]])
153
+ ; CHECK-NEXT: [[RES:%.*]] = call nnan contract double @llvm.sin.f64(double [[A]])
154
154
; CHECK-NEXT: ret double [[RES]]
155
155
;
156
- %tan = call reassoc double @llvm.tan.f64 (double %a )
157
- %cos = call reassoc double @llvm.cos.f64 (double %a )
158
- %res = fmul reassoc nnan double %tan , %cos
156
+ %tan = call contract double @llvm.tan.f64 (double %a )
157
+ %cos = call contract double @llvm.cos.f64 (double %a )
158
+ %res = fmul contract nnan double %tan , %cos
159
159
ret double %res
160
160
}
161
161
162
162
; !fpmath metadata preservation
163
163
define double @fmul_tan_cos_fpmath_metadata_preservation (double %a ) {
164
164
; CHECK-LABEL: define double @fmul_tan_cos_fpmath_metadata_preservation(
165
165
; CHECK-SAME: double [[A:%.*]]) {
166
- ; CHECK-NEXT: [[RES:%.*]] = call reassoc double @llvm.sin.f64(double [[A]]), !fpmath [[META0:![0-9]+]]
166
+ ; CHECK-NEXT: [[RES:%.*]] = call contract double @llvm.sin.f64(double [[A]]), !fpmath [[META0:![0-9]+]]
167
167
; CHECK-NEXT: ret double [[RES]]
168
168
;
169
- %tan = call reassoc double @llvm.tan.f64 (double %a )
170
- %cos = call reassoc double @llvm.cos.f64 (double %a )
171
- %res = fmul reassoc double %tan , %cos , !fpmath !0
169
+ %tan = call contract double @llvm.tan.f64 (double %a )
170
+ %cos = call contract double @llvm.cos.f64 (double %a )
171
+ %res = fmul contract double %tan , %cos , !fpmath !0
172
172
ret double %res
173
173
}
174
174
0 commit comments