1 ! RUN: bbc %s -o - | FileCheck %s
3 ! Test real add on real kinds.
6 REAL(2) FUNCTION real2(x0
, x1
)
9 ! CHECK-DAG: %[[v1:.+]] = fir.load %arg0 : !fir.ref<f16>
10 ! CHECK-DAG: %[[v2:.+]] = fir.load %arg1 : !fir.ref<f16>
11 ! CHECK: %[[v3:.+]] = arith.addf %[[v1]], %[[v2]] {{.*}}: f16
13 ! CHECK: return %{{.*}} : f16
17 REAL(3) FUNCTION real3(x0
, x1
)
20 ! CHECK-DAG: %[[v1:.+]] = fir.load %arg0 : !fir.ref<bf16>
21 ! CHECK-DAG: %[[v2:.+]] = fir.load %arg1 : !fir.ref<bf16>
22 ! CHECK: %[[v3:.+]] = arith.addf %[[v1]], %[[v2]] {{.*}}: bf16
24 ! CHECK: return %{{.*}} : bf16
28 REAL(4) FUNCTION real4(x0
, x1
)
31 ! CHECK-DAG: %[[v1:.+]] = fir.load %arg0 : !fir.ref<f32>
32 ! CHECK-DAG: %[[v2:.+]] = fir.load %arg1 : !fir.ref<f32>
33 ! CHECK: %[[v3:.+]] = arith.addf %[[v1]], %[[v2]] {{.*}}: f32
35 ! CHECK: return %{{.*}} : f32
38 ! CHECK-LABEL: defreal
39 REAL FUNCTION defreal(x0
, x1
)
42 ! CHECK-DAG: %[[v1:.+]] = fir.load %arg0 : !fir.ref<f32>
43 ! CHECK-DAG: %[[v2:.+]] = fir.load %arg1 : !fir.ref<f32>
44 ! CHECK: %[[v3:.+]] = arith.addf %[[v1]], %[[v2]] {{.*}}: f32
46 ! CHECK: return %{{.*}} : f32
50 REAL(8) FUNCTION real8(x0
, x1
)
53 ! CHECK-DAG: %[[v1:.+]] = fir.load %arg0 : !fir.ref<f64>
54 ! CHECK-DAG: %[[v2:.+]] = fir.load %arg1 : !fir.ref<f64>
55 ! CHECK: %[[v3:.+]] = arith.addf %[[v1]], %[[v2]] {{.*}}: f64
57 ! CHECK: return %{{.*}} : f64
60 ! CHECK-LABEL: doubleprec
61 DOUBLE PRECISION FUNCTION doubleprec(x0
, x1
)
62 DOUBLE PRECISION :: x0
63 DOUBLE PRECISION :: x1
64 ! CHECK-DAG: %[[v1:.+]] = fir.load %arg0 : !fir.ref<f64>
65 ! CHECK-DAG: %[[v2:.+]] = fir.load %arg1 : !fir.ref<f64>
66 ! CHECK: %[[v3:.+]] = arith.addf %[[v1]], %[[v2]] {{.*}}: f64
68 ! CHECK: return %{{.*}} : f64
69 END FUNCTION doubleprec
72 REAL(10) FUNCTION real10(x0
, x1
)
75 ! CHECK-DAG: %[[v1:.+]] = fir.load %arg0 : !fir.ref<f80>
76 ! CHECK-DAG: %[[v2:.+]] = fir.load %arg1 : !fir.ref<f80>
77 ! CHECK: %[[v3:.+]] = arith.addf %[[v1]], %[[v2]] {{.*}}: f80
79 ! CHECK: return %{{.*}} : f80
83 REAL(16) FUNCTION real16(x0
, x1
)
86 ! CHECK-DAG: %[[v1:.+]] = fir.load %arg0 : !fir.ref<f128>
87 ! CHECK-DAG: %[[v2:.+]] = fir.load %arg1 : !fir.ref<f128>
88 ! CHECK: %[[v3:.+]] = arith.addf %[[v1]], %[[v2]] {{.*}}: f128
90 ! CHECK: return %{{.*}} : f128
93 ! CHECK-LABEL: real16b
94 REAL(16) FUNCTION real16b(x0
, x1
)
97 ! CHECK-DAG: %[[v0:.+]] = arith.constant 4.0{{.*}} : f128
98 ! CHECK-DAG: %[[v1:.+]] = fir.load %arg0 : !fir.ref<f128>
99 ! CHECK-DAG: %[[v2:.+]] = fir.load %arg1 : !fir.ref<f128>
100 ! CHECK: %[[v3:.+]] = arith.addf %[[v1]], %[[v2]] {{.*}}: f128
101 ! CHECK: %[[v4:.+]] = arith.subf %[[v3]], %[[v0]] {{.*}}: f128
102 real16b
= x0
+ x1
- 4.0_16
103 ! CHECK: return %{{.*}} : f128