Skip to content

Commit e449ea8

Browse files
committed
Update test according to PR reviews
1 parent bb7b9b6 commit e449ea8

File tree

1 file changed

+61
-14
lines changed

1 file changed

+61
-14
lines changed

flang/test/Lower/Intrinsics/fast-real-mod.f90

Lines changed: 61 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
! RUN: %flang_fc1 -ffast-real-mod -emit-mlir -o - %s | FileCheck %s --check-prefixes=CHECK-FRM%if target=x86_64{{.*}} %{,CHECK-FRM-KIND10%}%if flang-supports-f128-math %{,CHECK-FRM-KIND16%}
2-
! RUN: %flang_fc1 -ffast-math -emit-mlir -o - %s | FileCheck %s --check-prefixes=CHECK-FRM%if target=x86_64{{.*}} %{,CHECK-FRM-KIND10%}%if flang-supports-f128-math %{,CHECK-FRM-KIND16%}
2+
! RUN: %flang_fc1 -ffast-real-mod -fno-fast-real-mod -emit-mlir -o - %s | FileCheck %s --check-prefixes=CHECK-NFRM%if target=x86_64{{.*}} %{,CHECK-NFRM-KIND10%}%if flang-supports-f128-math %{,CHECK-NFRM-KIND16%}
3+
! RUN: %flang_fc1 -fno-fast-real-mod -ffast-real-mod -emit-mlir -o - %s | FileCheck %s --check-prefixes=CHECK-FRM%if target=x86_64{{.*}} %{,CHECK-FRM-KIND10%}%if flang-supports-f128-math %{,CHECK-FRM-KIND16%}
4+
! RUN: %flang_fc1 -ffast-math -emit-mlir -o - %s | FileCheck %s --check-prefixes=CHECK-FM%if target=x86_64{{.*}} %{,CHECK-FM-KIND10%}%if flang-supports-f128-math %{,CHECK-FM-KIND16%}
35
! RUN: %flang_fc1 -ffast-math -fno-fast-real-mod -emit-mlir -o - %s | FileCheck %s --check-prefixes=CHECK-NFRM%if target=x86_64{{.*}} %{,CHECK-NFRM-KIND10%}%if flang-supports-f128-math %{,CHECK-NFRM-KIND16%}
46

5-
! CHECK,CHECK-FRM: module attributes {{{.*}}fir.fast_real_mod = true{{.*}}}
7+
! CHECK-FM: module attributes {{{.*}}fir.fast_real_mod = true{{.*}}}
8+
! CHECK-FRM: module attributes {{{.*}}fir.fast_real_mod = true{{.*}}}
69

710
! CHECK-LABEL: @_QPmod_real4
811
subroutine mod_real4(r, a, p)
@@ -13,12 +16,23 @@ subroutine mod_real4(r, a, p)
1316
! CHECK-FRM: %[[R:.*]] = fir.declare{{.*}}r"
1417
! CHECK-FRM: %[[A_LOAD:.*]] = fir.load %[[A]]
1518
! CHECK-FRM: %[[P_LOAD:.*]] = fir.load %[[P]]
16-
! CHECK-FRM: %[[DIV:.*]] = arith.divf %[[A_LOAD]], %[[P_LOAD]] fastmath<{{.*}}> : f32
19+
! CHECK-FRM: %[[DIV:.*]] = arith.divf %[[A_LOAD]], %[[P_LOAD]] fastmath<contract> : f32
1720
! CHECK-FRM: %[[CV1:.*]] = fir.convert %[[DIV]] : (f32) -> si32
1821
! CHECK-FRM: %[[CV2:.*]] = fir.convert %[[CV1]] : (si32) -> f32
19-
! CHECK-FRM: %[[MUL:.*]] = arith.mulf %[[CV2]], %[[P_LOAD]] fastmath<{{.*}}> : f32
20-
! CHECK-FRM: %[[SUB:.*]] = arith.subf %[[A_LOAD]], %[[MUL]] fastmath<{{.*}}> : f32
22+
! CHECK-FRM: %[[MUL:.*]] = arith.mulf %[[CV2]], %[[P_LOAD]] fastmath<contract> : f32
23+
! CHECK-FRM: %[[SUB:.*]] = arith.subf %[[A_LOAD]], %[[MUL]] fastmath<contract> : f32
2124
! CHECK-FRM: fir.store %[[SUB]] to %[[R]] : !fir.ref<f32>
25+
! CHECK-FM: %[[A:.*]] = fir.declare{{.*}}a"
26+
! CHECK-FM: %[[P:.*]] = fir.declare{{.*}}p"
27+
! CHECK-FM: %[[R:.*]] = fir.declare{{.*}}r"
28+
! CHECK-FM: %[[A_LOAD:.*]] = fir.load %[[A]]
29+
! CHECK-FM: %[[P_LOAD:.*]] = fir.load %[[P]]
30+
! CHECK-FM: %[[DIV:.*]] = arith.divf %[[A_LOAD]], %[[P_LOAD]] fastmath<fast> : f32
31+
! CHECK-FM: %[[CV1:.*]] = fir.convert %[[DIV]] : (f32) -> si32
32+
! CHECK-FM: %[[CV2:.*]] = fir.convert %[[CV1]] : (si32) -> f32
33+
! CHECK-FM: %[[MUL:.*]] = arith.mulf %[[CV2]], %[[P_LOAD]] fastmath<fast> : f32
34+
! CHECK-FM: %[[SUB:.*]] = arith.subf %[[A_LOAD]], %[[MUL]] fastmath<fast> : f32
35+
! CHECK-FM: fir.store %[[SUB]] to %[[R]] : !fir.ref<f32>
2236
! CHECK-NFRM: fir.call @_FortranAModReal4(%{{.*}}, %{{.*}}, %{{.*}}, %{{.*}}) {{.*}}: (f32, f32, !fir.ref<i8>, i32) -> f32
2337
r = mod(a, p)
2438
end subroutine mod_real4
@@ -32,12 +46,23 @@ subroutine mod_real8(r, a, p)
3246
! CHECK-FRM: %[[R:.*]] = fir.declare{{.*}}r"
3347
! CHECK-FRM: %[[A_LOAD:.*]] = fir.load %[[A]]
3448
! CHECK-FRM: %[[P_LOAD:.*]] = fir.load %[[P]]
35-
! CHECK-FRM: %[[DIV:.*]] = arith.divf %[[A_LOAD]], %[[P_LOAD]] fastmath<{{.*}}> : f64
49+
! CHECK-FRM: %[[DIV:.*]] = arith.divf %[[A_LOAD]], %[[P_LOAD]] fastmath<contract> : f64
3650
! CHECK-FRM: %[[CV1:.*]] = fir.convert %[[DIV]] : (f64) -> si64
3751
! CHECK-FRM: %[[CV2:.*]] = fir.convert %[[CV1]] : (si64) -> f64
38-
! CHECK-FRM: %[[MUL:.*]] = arith.mulf %[[CV2]], %[[P_LOAD]] fastmath<{{.*}}> : f64
39-
! CHECK-FRM: %[[SUB:.*]] = arith.subf %[[A_LOAD]], %[[MUL]] fastmath<{{.*}}> : f64
52+
! CHECK-FRM: %[[MUL:.*]] = arith.mulf %[[CV2]], %[[P_LOAD]] fastmath<contract> : f64
53+
! CHECK-FRM: %[[SUB:.*]] = arith.subf %[[A_LOAD]], %[[MUL]] fastmath<contract> : f64
4054
! CHECK-FRM: fir.store %[[SUB]] to %[[R]] : !fir.ref<f64>
55+
! CHECK-FM: %[[A:.*]] = fir.declare{{.*}}a"
56+
! CHECK-FM: %[[P:.*]] = fir.declare{{.*}}p"
57+
! CHECK-FM: %[[R:.*]] = fir.declare{{.*}}r"
58+
! CHECK-FM: %[[A_LOAD:.*]] = fir.load %[[A]]
59+
! CHECK-FM: %[[P_LOAD:.*]] = fir.load %[[P]]
60+
! CHECK-FM: %[[DIV:.*]] = arith.divf %[[A_LOAD]], %[[P_LOAD]] fastmath<fast> : f64
61+
! CHECK-FM: %[[CV1:.*]] = fir.convert %[[DIV]] : (f64) -> si64
62+
! CHECK-FM: %[[CV2:.*]] = fir.convert %[[CV1]] : (si64) -> f64
63+
! CHECK-FM: %[[MUL:.*]] = arith.mulf %[[CV2]], %[[P_LOAD]] fastmath<fast> : f64
64+
! CHECK-FM: %[[SUB:.*]] = arith.subf %[[A_LOAD]], %[[MUL]] fastmath<fast> : f64
65+
! CHECK-FM: fir.store %[[SUB]] to %[[R]] : !fir.ref<f64>
4166
! CHECK-NFRM: fir.call @_FortranAModReal8(%{{.*}}, %{{.*}}, %{{.*}}, %{{.*}}) {{.*}}: (f64, f64, !fir.ref<i8>, i32) -> f64
4267
r = mod(a, p)
4368
end subroutine mod_real8
@@ -52,12 +77,23 @@ subroutine mod_real10(r, a, p)
5277
! CHECK-FRM-KIND10: %[[R:.*]] = fir.declare{{.*}}r"
5378
! CHECK-FRM-KIND10: %[[A_LOAD:.*]] = fir.load %[[A]]
5479
! CHECK-FRM-KIND10: %[[P_LOAD:.*]] = fir.load %[[P]]
55-
! CHECK-FRM-KIND10: %[[DIV:.*]] = arith.divf %[[A_LOAD]], %[[P_LOAD]] fastmath<{{.*}}> : f80
80+
! CHECK-FRM-KIND10: %[[DIV:.*]] = arith.divf %[[A_LOAD]], %[[P_LOAD]] fastmath<contract> : f80
5681
! CHECK-FRM-KIND10: %[[CV1:.*]] = fir.convert %[[DIV]] : (f80) -> si80
5782
! CHECK-FRM-KIND10: %[[CV2:.*]] = fir.convert %[[CV1]] : (si80) -> f80
58-
! CHECK-FRM-KIND10: %[[MUL:.*]] = arith.mulf %[[CV2]], %[[P_LOAD]] fastmath<{{.*}}> : f80
59-
! CHECK-FRM-KIND10: %[[SUB:.*]] = arith.subf %[[A_LOAD]], %[[MUL]] fastmath<{{.*}}> : f80
83+
! CHECK-FRM-KIND10: %[[MUL:.*]] = arith.mulf %[[CV2]], %[[P_LOAD]] fastmath<contract> : f80
84+
! CHECK-FRM-KIND10: %[[SUB:.*]] = arith.subf %[[A_LOAD]], %[[MUL]] fastmath<contract> : f80
6085
! CHECK-FRM-KIND10: fir.store %[[SUB]] to %[[R]] : !fir.ref<f80>
86+
! CHECK-FM-KIND10: %[[A:.*]] = fir.declare{{.*}}a"
87+
! CHECK-FM-KIND10: %[[P:.*]] = fir.declare{{.*}}p"
88+
! CHECK-FM-KIND10: %[[R:.*]] = fir.declare{{.*}}r"
89+
! CHECK-FM-KIND10: %[[A_LOAD:.*]] = fir.load %[[A]]
90+
! CHECK-FM-KIND10: %[[P_LOAD:.*]] = fir.load %[[P]]
91+
! CHECK-FM-KIND10: %[[DIV:.*]] = arith.divf %[[A_LOAD]], %[[P_LOAD]] fastmath<fast> : f80
92+
! CHECK-FM-KIND10: %[[CV1:.*]] = fir.convert %[[DIV]] : (f80) -> si80
93+
! CHECK-FM-KIND10: %[[CV2:.*]] = fir.convert %[[CV1]] : (si80) -> f80
94+
! CHECK-FM-KIND10: %[[MUL:.*]] = arith.mulf %[[CV2]], %[[P_LOAD]] fastmath<fast> : f80
95+
! CHECK-FM-KIND10: %[[SUB:.*]] = arith.subf %[[A_LOAD]], %[[MUL]] fastmath<fast> : f80
96+
! CHECK-FM-KIND10: fir.store %[[SUB]] to %[[R]] : !fir.ref<f80>
6197
! CHECK-NFRM-KIND10: fir.call @_FortranAModReal10(%{{.*}}, %{{.*}}, %{{.*}}, %{{.*}}) {{.*}}: (f80, f80, !fir.ref<i8>, i32) -> f80
6298
r = mod(a, p)
6399
end subroutine mod_real10
@@ -72,12 +108,23 @@ subroutine mod_real16(r, a, p)
72108
! CHECK-FRM-KIND16: %[[R:.*]] = fir.declare{{.*}}r"
73109
! CHECK-FRM-KIND16: %[[A_LOAD:.*]] = fir.load %[[A]]
74110
! CHECK-FRM-KIND16: %[[P_LOAD:.*]] = fir.load %[[P]]
75-
! CHECK-FRM-KIND16: %[[DIV:.*]] = arith.divf %[[A_LOAD]], %[[P_LOAD]] fastmath<{{.*}}> : f128
111+
! CHECK-FRM-KIND16: %[[DIV:.*]] = arith.divf %[[A_LOAD]], %[[P_LOAD]] fastmath<contract> : f128
76112
! CHECK-FRM-KIND16: %[[CV1:.*]] = fir.convert %[[DIV]] : (f128) -> si128
77113
! CHECK-FRM-KIND16: %[[CV2:.*]] = fir.convert %[[CV1]] : (si128) -> f128
78-
! CHECK-FRM-KIND16: %[[MUL:.*]] = arith.mulf %[[CV2]], %[[P_LOAD]] fastmath<{{.*}}> : f128
79-
! CHECK-FRM-KIND16: %[[SUB:.*]] = arith.subf %[[A_LOAD]], %[[MUL]] fastmath<{{.*}}> : f128
114+
! CHECK-FRM-KIND16: %[[MUL:.*]] = arith.mulf %[[CV2]], %[[P_LOAD]] fastmath<contract> : f128
115+
! CHECK-FRM-KIND16: %[[SUB:.*]] = arith.subf %[[A_LOAD]], %[[MUL]] fastmath<contract> : f128
80116
! CHECK-FRM-KIND16: fir.store %[[SUB]] to %[[R]] : !fir.ref<f128>
117+
! CHECK-FM-KIND16: %[[A:.*]] = fir.declare{{.*}}a"
118+
! CHECK-FM-KIND16: %[[P:.*]] = fir.declare{{.*}}p"
119+
! CHECK-FM-KIND16: %[[R:.*]] = fir.declare{{.*}}r"
120+
! CHECK-FM-KIND16: %[[A_LOAD:.*]] = fir.load %[[A]]
121+
! CHECK-FM-KIND16: %[[P_LOAD:.*]] = fir.load %[[P]]
122+
! CHECK-FM-KIND16: %[[DIV:.*]] = arith.divf %[[A_LOAD]], %[[P_LOAD]] fastmath<fast> : f128
123+
! CHECK-FM-KIND16: %[[CV1:.*]] = fir.convert %[[DIV]] : (f128) -> si128
124+
! CHECK-FM-KIND16: %[[CV2:.*]] = fir.convert %[[CV1]] : (si128) -> f128
125+
! CHECK-FM-KIND16: %[[MUL:.*]] = arith.mulf %[[CV2]], %[[P_LOAD]] fastmath<fast> : f128
126+
! CHECK-FM-KIND16: %[[SUB:.*]] = arith.subf %[[A_LOAD]], %[[MUL]] fastmath<fast> : f128
127+
! CHECK-FM-KIND16: fir.store %[[SUB]] to %[[R]] : !fir.ref<f128>
81128
! CHECK-NFRM-KIND16: fir.call @_FortranAModReal16(%{{.*}}, %{{.*}}, %{{.*}}, %{{.*}}) {{.*}}: (f128, f128, !fir.ref<i8>, i32) -> f128
82129
r = mod(a, p)
83130
end subroutine mod_real16

0 commit comments

Comments
 (0)