[Support] Remove unused includes (NFC) (#116752)
[llvm-project.git] / flang / module / iso_fortran_env_impl.f90
blob4de54dda7bab1c8f73ee0baf34ec3719752ebf3b
1 !===-- module/iso_fortran_env_impl.f90 --=--------------------------------===!
3 ! Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 ! See https://llvm.org/LICENSE.txt for license information.
5 ! SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 !===------------------------------------------------------------------------===!
9 ! This MODULE implements part of the ISO_FORTRAN_ENV module file, which
10 ! partially requires linkable symbols for some entities defined
11 ! (e.g., real_kinds).
13 module iso_fortran_env_impl
14 implicit none
15 private
17 ! INTEGER types
18 integer, parameter, public :: &
19 selectedInt8 = selected_int_kind(2), &
20 selectedInt16 = selected_int_kind(4), &
21 selectedInt32 = selected_int_kind(9), &
22 selectedInt64 = selected_int_kind(18),&
23 selectedInt128 = selected_int_kind(38), &
24 safeInt8 = merge(selectedInt8, selected_int_kind(0), &
25 selectedInt8 >= 0), &
26 safeInt16 = merge(selectedInt16, selected_int_kind(0), &
27 selectedInt16 >= 0), &
28 safeInt32 = merge(selectedInt32, selected_int_kind(0), &
29 selectedInt32 >= 0), &
30 safeInt64 = merge(selectedInt64, selected_int_kind(0), &
31 selectedInt64 >= 0), &
32 safeInt128 = merge(selectedInt128, selected_int_kind(0), &
33 selectedInt128 >= 0)
35 integer, parameter, public :: &
36 int8 = merge(selectedInt8, merge(-2, -1, selectedInt8 >= 0), &
37 digits(int(0,kind=safeInt8)) == 7), &
38 int16 = merge(selectedInt16, merge(-2, -1, selectedInt16 >= 0), &
39 digits(int(0,kind=safeInt16)) == 15), &
40 int32 = merge(selectedInt32, merge(-2, -1, selectedInt32 >= 0), &
41 digits(int(0,kind=safeInt32)) == 31), &
42 int64 = merge(selectedInt64, merge(-2, -1, selectedInt64 >= 0), &
43 digits(int(0,kind=safeInt64)) == 63), &
44 int128 = merge(selectedInt128, merge(-2, -1, selectedInt128 >= 0), &
45 digits(int(0,kind=safeInt128)) == 127)
47 integer, parameter, dimension(*), public :: __builtin_integer_kinds = [ &
48 selected_int_kind(0), &
49 [(pack([selected_int_kind(k)], &
50 selected_int_kind(k) >= 0 .and. &
51 selected_int_kind(k) /= selected_int_kind(k-1)), &
52 integer :: k=1, 39)]]
54 ! LOGICAL TYPES
55 integer, parameter, public :: &
56 logical8 = int8, logical16 = int16, logical32 = int32, logical64 = int64
58 integer, parameter, dimension(*), public :: __builtin_logical_kinds = [ &
59 pack([logical8], logical8 >= 0), &
60 pack([logical16], logical16 >= 0), &
61 pack([logical32], logical32 >= 0), &
62 pack([logical64], logical64 >= 0) &
65 ! REAL types
66 integer, parameter, public :: &
67 selectedReal16 = selected_real_kind(3, 4), & ! IEEE half
68 selectedBfloat16 = selected_real_kind(2, 37), & ! truncated IEEE single
69 selectedReal32 = selected_real_kind(6, 37), & ! IEEE single
70 selectedReal64 = selected_real_kind(15, 307), & ! IEEE double
71 selectedReal80 = selected_real_kind(18, 4931), & ! 80x87 extended
72 selectedReal64x2 = selected_real_kind(31, 307), & ! "double-double"
73 selectedReal128 = selected_real_kind(33, 4931), & ! IEEE quad
74 safeReal16 = merge(selectedReal16, selected_real_kind(0,0), &
75 selectedReal16 >= 0), &
76 safeBfloat16 = merge(selectedBfloat16, selected_real_kind(0,0), &
77 selectedBfloat16 >= 0), &
78 safeReal32 = merge(selectedReal32, selected_real_kind(0,0), &
79 selectedReal32 >= 0), &
80 safeReal64 = merge(selectedReal64, selected_real_kind(0,0), &
81 selectedReal64 >= 0), &
82 safeReal80 = merge(selectedReal80, selected_real_kind(0,0), &
83 selectedReal80 >= 0), &
84 safeReal64x2 = merge(selectedReal64x2, selected_real_kind(0,0), &
85 selectedReal64x2 >= 0), &
86 safeReal128 = merge(selectedReal128, selected_real_kind(0,0), &
87 selectedReal128 >= 0)
89 integer, parameter, public :: &
90 real16 = merge(selectedReal16, merge(-2, -1, selectedReal16 >= 0), &
91 digits(real(0,kind=safeReal16)) == 11), &
92 bfloat16 = merge(selectedBfloat16, merge(-2, -1, selectedBfloat16 >= 0), &
93 digits(real(0,kind=safeBfloat16)) == 8), &
94 real32 = merge(selectedReal32, merge(-2, -1, selectedReal32 >= 0), &
95 digits(real(0,kind=safeReal32)) == 24), &
96 real64 = merge(selectedReal64, merge(-2, -1, selectedReal64 >= 0), &
97 digits(real(0,kind=safeReal64)) == 53), &
98 real80 = merge(selectedReal80, merge(-2, -1, selectedReal80 >= 0), &
99 digits(real(0,kind=safeReal80)) == 64), &
100 real64x2 = merge(selectedReal64x2, merge(-2, -1, selectedReal64x2 >= 0), &
101 digits(real(0,kind=safeReal64x2)) == 106), &
102 real128 = merge(selectedReal128, merge(-2, -1, selectedReal128 >= 0), &
103 digits(real(0,kind=safeReal128)) == 113)
105 integer, parameter, dimension(*), public :: __builtin_real_kinds = [ &
106 pack([real16], real16 >= 0), &
107 pack([bfloat16], bfloat16 >= 0), &
108 pack([real32], real32 >= 0), &
109 pack([real64], real64 >= 0), &
110 pack([real80], real80 >= 0), &
111 pack([real64x2], real64x2 >= 0), &
112 pack([real128], real128 >= 0) &
114 end module iso_fortran_env_impl