Skip to content

Commit 2866c6c

Browse files
committed
[NFC] [PowerPC] Narrow fast-math flags in tests
A lot of tests under PowerPC are using fast flag, while fast is just alias of 7 fast-math flags. This change makes test points clearer. mc-instrlat.ll and sms-iterator.ll keeps unchanged since they are not testing fast-math behavior. (one for machine combiner crash, one for machine pipeliner bug) Reviewed By: steven.zhang, spatel Differential Revision: https://reviews.llvm.org/D78989
1 parent cac6a26 commit 2866c6c

20 files changed

+207
-207
lines changed

llvm/test/CodeGen/PowerPC/combine-fneg.ll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ define <4 x double> @fneg_fdiv_splat(double %a0, <4 x double> %a1) {
2323
entry:
2424
%splat.splatinsert = insertelement <4 x double> undef, double %a0, i32 0
2525
%splat.splat = shufflevector <4 x double> %splat.splatinsert, <4 x double> undef, <4 x i32> zeroinitializer
26-
%div = fdiv fast <4 x double> %a1, %splat.splat
27-
%sub = fsub fast <4 x double> <double 0.000000e+00, double 0.000000e+00, double 0.000000e+00, double 0.000000e+00>, %div
26+
%div = fdiv reassoc nsz arcp <4 x double> %a1, %splat.splat
27+
%sub = fsub reassoc nsz <4 x double> <double 0.000000e+00, double 0.000000e+00, double 0.000000e+00, double 0.000000e+00>, %div
2828
ret <4 x double> %sub
2929
}

llvm/test/CodeGen/PowerPC/fdiv.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@ define dso_local float @foo(float %0, float %1) local_unnamed_addr {
1010
; CHECK-NEXT: xsmaddasp 0, 3, 1
1111
; CHECK-NEXT: fmr 1, 0
1212
; CHECK-NEXT: blr
13-
%3 = fdiv fast float %0, %1
13+
%3 = fdiv reassoc arcp float %0, %1
1414
ret float %3
1515
}

llvm/test/CodeGen/PowerPC/fma-assoc.ll

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -364,10 +364,10 @@ define double @test_fast_FMSUB_ASSOC2(double %A, double %B, double %C,
364364
; CHECK-VSX-NEXT: fmr 1, 3
365365
; CHECK-VSX-NEXT: blr
366366
double %D, double %E) {
367-
%F = fmul fast double %A, %B ; <double> [#uses=1]
368-
%G = fmul fast double %C, %D ; <double> [#uses=1]
369-
%H = fadd fast double %F, %G ; <double> [#uses=1]
370-
%I = fsub fast double %E, %H ; <double> [#uses=1]
367+
%F = fmul reassoc double %A, %B ; <double> [#uses=1]
368+
%G = fmul reassoc double %C, %D ; <double> [#uses=1]
369+
%H = fadd reassoc double %F, %G ; <double> [#uses=1]
370+
%I = fsub reassoc nsz double %E, %H ; <double> [#uses=1]
371371
ret double %I
372372
}
373373

llvm/test/CodeGen/PowerPC/fma-combine.ll

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -182,16 +182,16 @@ define float @fma_combine_no_ice() {
182182
; CHECK-NEXT: blr
183183
%tmp = load float, float* undef, align 4
184184
%tmp2 = load float, float* undef, align 4
185-
%tmp3 = fmul fast float %tmp, 0x3FE372D780000000
186-
%tmp4 = fadd fast float %tmp3, 1.000000e+00
187-
%tmp5 = fmul fast float %tmp2, %tmp4
185+
%tmp3 = fmul reassoc float %tmp, 0x3FE372D780000000
186+
%tmp4 = fadd reassoc float %tmp3, 1.000000e+00
187+
%tmp5 = fmul reassoc float %tmp2, %tmp4
188188
%tmp6 = load float, float* undef, align 4
189189
%tmp7 = load float, float* undef, align 4
190-
%tmp8 = fmul fast float %tmp7, 0x3FE372D780000000
191-
%tmp9 = fsub fast float -1.000000e+00, %tmp8
192-
%tmp10 = fmul fast float %tmp9, %tmp6
193-
%tmp11 = fadd fast float %tmp5, 5.000000e-01
194-
%tmp12 = fadd fast float %tmp11, %tmp10
190+
%tmp8 = fmul reassoc float %tmp7, 0x3FE372D780000000
191+
%tmp9 = fsub reassoc nsz float -1.000000e+00, %tmp8
192+
%tmp10 = fmul reassoc float %tmp9, %tmp6
193+
%tmp11 = fadd reassoc float %tmp5, 5.000000e-01
194+
%tmp12 = fadd reassoc float %tmp11, %tmp10
195195
ret float %tmp12
196196
}
197197

@@ -231,10 +231,10 @@ define double @getNegatedExpression_crash(double %x, double %y) {
231231
; CHECK-NEXT: xsmaddadp 0, 3, 2
232232
; CHECK-NEXT: fmr 1, 0
233233
; CHECK-NEXT: blr
234-
%neg = fneg fast double %x
235-
%fma = call fast double @llvm.fma.f64(double %neg, double 42.0, double -1.0)
236-
%add = fadd fast double %x, 1.0
237-
%fma1 = call fast double @llvm.fma.f64(double %fma, double %y, double %add)
234+
%neg = fneg reassoc double %x
235+
%fma = call reassoc nsz double @llvm.fma.f64(double %neg, double 42.0, double -1.0)
236+
%add = fadd reassoc nsz double %x, 1.0
237+
%fma1 = call reassoc nsz double @llvm.fma.f64(double %fma, double %y, double %add)
238238
ret double %fma1
239239
}
240240
declare double @llvm.fma.f64(double, double, double) nounwind readnone

llvm/test/CodeGen/PowerPC/fma-mutate.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ define double @foo3_fmf(double %a) nounwind {
1414
; CHECK-NOT: fmr
1515
; CHECK: xsmaddmdp
1616
; CHECK: xsmaddadp
17-
%r = call fast double @llvm.sqrt.f64(double %a)
17+
%r = call reassoc afn ninf double @llvm.sqrt.f64(double %a)
1818
ret double %r
1919
}
2020

llvm/test/CodeGen/PowerPC/fma-negate.ll

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -167,8 +167,8 @@ define double @test_fast_mul_sub_f64(double %a, double %b, double %c) {
167167
; NO-VSX-NEXT: fnmsub 1, 2, 3, 1
168168
; NO-VSX-NEXT: blr
169169
entry:
170-
%0 = fmul fast double %b, %c
171-
%1 = fsub fast double %a, %0
170+
%0 = fmul reassoc double %b, %c
171+
%1 = fsub reassoc double %a, %0
172172
ret double %1
173173
}
174174

@@ -187,9 +187,9 @@ define double @test_fast_2mul_sub_f64(double %a, double %b, double %c,
187187
; NO-VSX-NEXT: blr
188188
double %d) {
189189
entry:
190-
%0 = fmul fast double %a, %b
191-
%1 = fmul fast double %c, %d
192-
%2 = fsub fast double %0, %1
190+
%0 = fmul reassoc double %a, %b
191+
%1 = fmul reassoc double %c, %d
192+
%2 = fsub reassoc double %0, %1
193193
ret double %2
194194
}
195195

@@ -205,8 +205,8 @@ define double @test_fast_neg_fma_f64(double %a, double %b, double %c) {
205205
; NO-VSX-NEXT: fnmsub 1, 1, 2, 3
206206
; NO-VSX-NEXT: blr
207207
entry:
208-
%0 = fsub fast double -0.0, %a
209-
%1 = call fast double @llvm.fma.f64(double %0, double %b, double %c)
208+
%0 = fsub reassoc double -0.0, %a
209+
%1 = call reassoc double @llvm.fma.f64(double %0, double %b, double %c)
210210
ret double %1
211211
}
212212

@@ -221,8 +221,8 @@ define float @test_fast_mul_sub_f32(float %a, float %b, float %c) {
221221
; NO-VSX-NEXT: fnmsubs 1, 2, 3, 1
222222
; NO-VSX-NEXT: blr
223223
entry:
224-
%0 = fmul fast float %b, %c
225-
%1 = fsub fast float %a, %0
224+
%0 = fmul reassoc float %b, %c
225+
%1 = fsub reassoc float %a, %0
226226
ret float %1
227227
}
228228

@@ -240,9 +240,9 @@ define float @test_fast_2mul_sub_f32(float %a, float %b, float %c, float %d) {
240240
; NO-VSX-NEXT: fmsubs 1, 1, 2, 0
241241
; NO-VSX-NEXT: blr
242242
entry:
243-
%0 = fmul fast float %a, %b
244-
%1 = fmul fast float %c, %d
245-
%2 = fsub fast float %0, %1
243+
%0 = fmul reassoc float %a, %b
244+
%1 = fmul reassoc float %c, %d
245+
%2 = fsub reassoc float %0, %1
246246
ret float %2
247247
}
248248

@@ -258,8 +258,8 @@ define float @test_fast_neg_fma_f32(float %a, float %b, float %c) {
258258
; NO-VSX-NEXT: fnmsubs 1, 1, 2, 3
259259
; NO-VSX-NEXT: blr
260260
entry:
261-
%0 = fsub fast float -0.0, %a
262-
%1 = call fast float @llvm.fma.f32(float %0, float %b, float %c)
261+
%0 = fsub reassoc float -0.0, %a
262+
%1 = call reassoc float @llvm.fma.f32(float %0, float %b, float %c)
263263
ret float %1
264264
}
265265

@@ -277,8 +277,8 @@ define <2 x double> @test_fast_neg_fma_v2f64(<2 x double> %a, <2 x double> %b,
277277
; NO-VSX-NEXT: blr
278278
<2 x double> %c) {
279279
entry:
280-
%0 = fsub fast <2 x double> <double -0.0, double -0.0>, %a
281-
%1 = call fast <2 x double> @llvm.fma.v2f64(<2 x double> %0, <2 x double> %b,
280+
%0 = fsub reassoc <2 x double> <double -0.0, double -0.0>, %a
281+
%1 = call reassoc <2 x double> @llvm.fma.v2f64(<2 x double> %0, <2 x double> %b,
282282
<2 x double> %c)
283283
ret <2 x double> %1
284284
}
@@ -299,10 +299,10 @@ define <4 x float> @test_fast_neg_fma_v4f32(<4 x float> %a, <4 x float> %b,
299299
; NO-VSX-NEXT: blr
300300
<4 x float> %c) {
301301
entry:
302-
%0 = fsub fast <4 x float> <float -0.0, float -0.0, float -0.0,
303-
float -0.0>, %a
304-
%1 = call fast <4 x float> @llvm.fma.v4f32(<4 x float> %0, <4 x float> %b,
305-
<4 x float> %c)
302+
%0 = fsub reassoc <4 x float> <float -0.0, float -0.0, float -0.0,
303+
float -0.0>, %a
304+
%1 = call reassoc <4 x float> @llvm.fma.v4f32(<4 x float> %0, <4 x float> %b,
305+
<4 x float> %c)
306306
ret <4 x float> %1
307307
}
308308

llvm/test/CodeGen/PowerPC/fma-precision.ll

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ define double @fsub1(double %a, double %b, double %c, double %d) {
1111
; CHECK-NEXT: xsmuldp 1, 0, 1
1212
; CHECK-NEXT: blr
1313
entry:
14-
%mul = fmul fast double %b, %a
15-
%mul1 = fmul fast double %d, %c
16-
%sub = fsub fast double %mul, %mul1
17-
%mul3 = fmul fast double %mul, %sub
14+
%mul = fmul reassoc double %b, %a
15+
%mul1 = fmul reassoc double %d, %c
16+
%sub = fsub reassoc double %mul, %mul1
17+
%mul3 = fmul reassoc double %mul, %sub
1818
ret double %mul3
1919
}
2020

@@ -28,10 +28,10 @@ define double @fsub2(double %a, double %b, double %c, double %d) {
2828
; CHECK-NEXT: xsmuldp 1, 0, 3
2929
; CHECK-NEXT: blr
3030
entry:
31-
%mul = fmul fast double %b, %a
32-
%mul1 = fmul fast double %d, %c
33-
%sub = fsub fast double %mul, %mul1
34-
%mul3 = fmul fast double %mul1, %sub
31+
%mul = fmul reassoc double %b, %a
32+
%mul1 = fmul reassoc double %d, %c
33+
%sub = fsub reassoc double %mul, %mul1
34+
%mul3 = fmul reassoc double %mul1, %sub
3535
ret double %mul3
3636
}
3737

@@ -44,9 +44,9 @@ define double @fsub3(double %a, double %b, double %c, double %d) {
4444
; CHECK-NEXT: fmr 1, 0
4545
; CHECK-NEXT: blr
4646
entry:
47-
%mul = fmul fast double %b, %a
48-
%mul1 = fmul fast double %d, %c
49-
%sub = fsub fast double %mul, %mul1
47+
%mul = fmul reassoc double %b, %a
48+
%mul1 = fmul reassoc double %d, %c
49+
%sub = fsub reassoc double %mul, %mul1
5050
ret double %sub
5151
}
5252

@@ -60,10 +60,10 @@ define double @fadd1(double %a, double %b, double %c, double %d) {
6060
; CHECK-NEXT: xsmuldp 1, 0, 1
6161
; CHECK-NEXT: blr
6262
entry:
63-
%mul = fmul fast double %b, %a
64-
%mul1 = fmul fast double %d, %c
65-
%add = fadd fast double %mul1, %mul
66-
%mul3 = fmul fast double %mul, %add
63+
%mul = fmul reassoc double %b, %a
64+
%mul1 = fmul reassoc double %d, %c
65+
%add = fadd reassoc double %mul1, %mul
66+
%mul3 = fmul reassoc double %mul, %add
6767
ret double %mul3
6868
}
6969

@@ -77,10 +77,10 @@ define double @fadd2(double %a, double %b, double %c, double %d) {
7777
; CHECK-NEXT: xsmuldp 1, 0, 3
7878
; CHECK-NEXT: blr
7979
entry:
80-
%mul = fmul fast double %b, %a
81-
%mul1 = fmul fast double %d, %c
82-
%add = fadd fast double %mul1, %mul
83-
%mul3 = fmul fast double %mul1, %add
80+
%mul = fmul reassoc double %b, %a
81+
%mul1 = fmul reassoc double %d, %c
82+
%add = fadd reassoc double %mul1, %mul
83+
%mul3 = fmul reassoc double %mul1, %add
8484
ret double %mul3
8585
}
8686

@@ -92,9 +92,9 @@ define double @fadd3(double %a, double %b, double %c, double %d) {
9292
; CHECK-NEXT: xsmaddadp 1, 4, 3
9393
; CHECK-NEXT: blr
9494
entry:
95-
%mul = fmul fast double %b, %a
96-
%mul1 = fmul fast double %d, %c
97-
%add = fadd fast double %mul1, %mul
95+
%mul = fmul reassoc double %b, %a
96+
%mul1 = fmul reassoc double %d, %c
97+
%add = fadd reassoc double %mul1, %mul
9898
ret double %add
9999
}
100100

@@ -108,12 +108,12 @@ define double @fma_multi_uses1(double %a, double %b, double %c, double %d, doubl
108108
; CHECK-NEXT: xsnmsubadp 1, 3, 4
109109
; CHECK-NEXT: stfd 0, 0(9)
110110
; CHECK-NEXT: blr
111-
%ab = fmul fast double %a, %b
112-
%cd = fmul fast double %c, %d
111+
%ab = fmul reassoc double %a, %b
112+
%cd = fmul reassoc double %c, %d
113113
store double %ab, double* %p1 ; extra use of %ab
114114
store double %ab, double* %p2 ; another extra use of %ab
115115
store double %cd, double* %p3 ; extra use of %cd
116-
%r = fsub fast double %ab, %cd
116+
%r = fsub reassoc double %ab, %cd
117117
ret double %r
118118
}
119119

@@ -128,12 +128,12 @@ define double @fma_multi_uses2(double %a, double %b, double %c, double %d, doubl
128128
; CHECK-NEXT: xsmsubadp 0, 1, 2
129129
; CHECK-NEXT: fmr 1, 0
130130
; CHECK-NEXT: blr
131-
%ab = fmul fast double %a, %b
132-
%cd = fmul fast double %c, %d
131+
%ab = fmul reassoc double %a, %b
132+
%cd = fmul reassoc double %c, %d
133133
store double %ab, double* %p1 ; extra use of %ab
134134
store double %cd, double* %p2 ; extra use of %cd
135135
store double %cd, double* %p3 ; another extra use of %cd
136-
%r = fsub fast double %ab, %cd
136+
%r = fsub reassoc double %ab, %cd
137137
ret double %r
138138
}
139139

@@ -150,14 +150,14 @@ define double @fma_multi_uses3(double %a, double %b, double %c, double %d, doubl
150150
; CHECK-NEXT: xsnmsubadp 0, 3, 4
151151
; CHECK-NEXT: xsadddp 1, 0, 1
152152
; CHECK-NEXT: blr
153-
%ab = fmul fast double %a, %b
154-
%cd = fmul fast double %c, %d
155-
%fg = fmul fast double %f, %g
153+
%ab = fmul reassoc double %a, %b
154+
%cd = fmul reassoc double %c, %d
155+
%fg = fmul reassoc double %f, %g
156156
store double %ab, double* %p1 ; extra use of %ab
157157
store double %ab, double* %p2 ; another extra use of %ab
158158
store double %fg, double* %p3 ; extra use of %fg
159-
%q = fsub fast double %fg, %cd ; The uses of %cd reduce to 1 after %r is folded. 2 uses of %fg, fold %cd, remove def of %cd
160-
%r = fsub fast double %ab, %cd ; Fold %r before %q. 3 uses of %ab, 2 uses of %cd, fold %cd
161-
%add = fadd fast double %r, %q
159+
%q = fsub reassoc double %fg, %cd ; The uses of %cd reduce to 1 after %r is folded. 2 uses of %fg, fold %cd, remove def of %cd
160+
%r = fsub reassoc double %ab, %cd ; Fold %r before %q. 3 uses of %ab, 2 uses of %cd, fold %cd
161+
%add = fadd reassoc double %r, %q
162162
ret double %add
163163
}

0 commit comments

Comments
 (0)