[flang] Accept polymorphic component element in storage_size
[llvm-project.git] / flang / test / Lower / Intrinsics / mod.f90
blobb879e7609fe623f2cef7969b1b4aee705e01618e
1 ! RUN: bbc -emit-fir %s -o - | FileCheck %s
2 ! RUN: %flang_fc1 -emit-fir %s -o - | FileCheck %s
4 ! CHECK-LABEL: func @_QPmod_testr4(
5 ! CHECK-SAME: %[[arg0:.*]]: !fir.ref<f32>{{.*}}, %[[arg1:.*]]: !fir.ref<f32>{{.*}}, %[[arg2:.*]]: !fir.ref<f32>{{.*}}) {
6 subroutine mod_testr4(r, a, p)
7 real(4) :: r, a, p
8 ! CHECK: %[[V1:.*]] = fir.load %[[arg1]] : !fir.ref<f32>
9 ! CHECK: %[[V2:.*]] = fir.load %[[arg2]] : !fir.ref<f32>
10 ! CHECK: %[[FILE:.*]] = fir.address_of(@{{.*}}) : !fir.ref<!fir.char<1,{{.*}}>>
11 ! CHECK: %[[LINE:.*]] = arith.constant {{[0-9]*}} : i32
12 ! CHECK: %[[FILEARG:.*]] = fir.convert %[[FILE]] : (!fir.ref<!fir.char<1,{{.*}}>>) -> !fir.ref<i8>
13 ! CHECK: fir.call @_FortranAModReal4(%[[V1]], %[[V2]], %[[FILEARG]], %[[LINE]]) {{.*}}: (f32, f32, !fir.ref<i8>, i32) -> f32
14 r = mod(a, p)
15 end subroutine
17 ! CHECK-LABEL: func @_QPmod_testr8(
18 ! CHECK-SAME: %[[arg0:.*]]: !fir.ref<f64>{{.*}}, %[[arg1:.*]]: !fir.ref<f64>{{.*}}, %[[arg2:.*]]: !fir.ref<f64>{{.*}}) {
19 subroutine mod_testr8(r, a, p)
20 real(8) :: r, a, p
21 ! CHECK: %[[V1:.*]] = fir.load %[[arg1]] : !fir.ref<f64>
22 ! CHECK: %[[V2:.*]] = fir.load %[[arg2]] : !fir.ref<f64>
23 ! CHECK: %[[FILE:.*]] = fir.address_of(@{{.*}}) : !fir.ref<!fir.char<1,{{.*}}>>
24 ! CHECK: %[[LINE:.*]] = arith.constant {{[0-9]*}} : i32
25 ! CHECK: %[[FILEARG:.*]] = fir.convert %[[FILE]] : (!fir.ref<!fir.char<1,{{.*}}>>) -> !fir.ref<i8>
26 ! CHECK: fir.call @_FortranAModReal8(%[[V1]], %[[V2]], %[[FILEARG]], %[[LINE]]) {{.*}}: (f64, f64, !fir.ref<i8>, i32) -> f64
27 r = mod(a, p)
28 end subroutine
30 ! CHECK-LABEL: func @_QPmod_testr10(
31 ! CHECK-SAME: %[[arg0:.*]]: !fir.ref<f80>{{.*}}, %[[arg1:.*]]: !fir.ref<f80>{{.*}}, %[[arg2:.*]]: !fir.ref<f80>{{.*}}) {
32 subroutine mod_testr10(r, a, p)
33 real(10) :: r, a, p
34 ! CHECK: %[[V1:.*]] = fir.load %[[arg1]] : !fir.ref<f80>
35 ! CHECK: %[[V2:.*]] = fir.load %[[arg2]] : !fir.ref<f80>
36 ! CHECK: %[[FILE:.*]] = fir.address_of(@{{.*}}) : !fir.ref<!fir.char<1,{{.*}}>>
37 ! CHECK: %[[LINE:.*]] = arith.constant {{[0-9]*}} : i32
38 ! CHECK: %[[FILEARG:.*]] = fir.convert %[[FILE]] : (!fir.ref<!fir.char<1,{{.*}}>>) -> !fir.ref<i8>
39 ! CHECK: fir.call @_FortranAModReal10(%[[V1]], %[[V2]], %[[FILEARG]], %[[LINE]]) {{.*}}: (f80, f80, !fir.ref<i8>, i32) -> f80
40 r = mod(a, p)
41 end subroutine
43 ! CHECK-LABEL: func @_QPmod_testr16(
44 ! CHECK-SAME: %[[arg0:.*]]: !fir.ref<f128>{{.*}}, %[[arg1:.*]]: !fir.ref<f128>{{.*}}, %[[arg2:.*]]: !fir.ref<f128>{{.*}}) {
45 subroutine mod_testr16(r, a, p)
46 real(16) :: r, a, p
47 ! CHECK: %[[V1:.*]] = fir.load %[[arg1]] : !fir.ref<f128>
48 ! CHECK: %[[V2:.*]] = fir.load %[[arg2]] : !fir.ref<f128>
49 ! CHECK: %[[FILE:.*]] = fir.address_of(@{{.*}}) : !fir.ref<!fir.char<1,{{.*}}>>
50 ! CHECK: %[[LINE:.*]] = arith.constant {{[0-9]*}} : i32
51 ! CHECK: %[[FILEARG:.*]] = fir.convert %[[FILE]] : (!fir.ref<!fir.char<1,{{.*}}>>) -> !fir.ref<i8>
52 ! CHECK: fir.call @_FortranAModReal16(%[[V1]], %[[V2]], %[[FILEARG]], %[[LINE]]) {{.*}}: (f128, f128, !fir.ref<i8>, i32) -> f128
53 r = mod(a, p)
54 end subroutine