2019-12-20 12:52:07 -08:00
|
|
|
!===-- module/iso_fortran_env.f90 ------------------------------------------===!
|
2019-06-06 13:42:33 -07:00
|
|
|
!
|
2019-12-20 12:52:07 -08:00
|
|
|
! Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
|
|
! See https://llvm.org/LICENSE.txt for license information.
|
|
|
|
! SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
2019-06-06 13:42:33 -07:00
|
|
|
!
|
2020-01-10 12:12:03 -08:00
|
|
|
!===------------------------------------------------------------------------===!
|
2019-06-06 13:42:33 -07:00
|
|
|
|
2024-04-08 11:57:01 -07:00
|
|
|
! See Fortran 2023, subclause 16.10.2
|
2019-06-06 13:42:33 -07:00
|
|
|
|
2024-09-12 09:08:00 -07:00
|
|
|
#include '../include/flang/Runtime/magic-numbers.h'
|
2019-10-11 13:46:58 -07:00
|
|
|
|
2019-06-06 13:42:33 -07:00
|
|
|
module iso_fortran_env
|
|
|
|
|
[flang] IEEE_ARITHMETIC and IEEE_EXCEPTIONS intrinsic module procedures (#74138)
Implement a selection of intrinsic module procedures that involve
exceptions.
- IEEE_GET_FLAG
- IEEE_GET_HALTING_MODE
- IEEE_GET_MODES
- IEEE_GET_STATUS
- IEEE_LOGB
- [f23] IEEE_MAX, IEEE_MAX_MAG, IEEE_MAX_NUM, IEEE_MAX_NUM_MAG
- [f23] IEEE_MIN, IEEE_MIN_MAG, IEEE_MIN_NUM, IEEE_MIN_NUM_MAG
- IEEE_QUIET_EQ, IEEE_QUIET_GE, IEEE_QUIET_GT,
- IEEE_QUIET_LE, IEEE_QUIET_LT, IEEE_QUIET_NE
- IEEE_SET_FLAG
- IEEE_SET_HALTING_MODE
- IEEE_SET_MODES
- IEEE_SET_STATUS
- IEEE_SIGNALING_EQ, IEEE_SIGNALING_GE, IEEE_SIGNALING_GT,
- IEEE_SIGNALING_LE, IEEE_SIGNALING_LT, IEEE_SIGNALING_NE
- IEEE_SUPPORT_FLAG
- IEEE_SUPPORT_HALTING
2023-12-04 09:55:54 -08:00
|
|
|
use __fortran_builtins, only: &
|
2019-12-25 12:29:50 -08:00
|
|
|
event_type => __builtin_event_type, &
|
2024-01-02 10:40:47 -08:00
|
|
|
notify_type => __builtin_notify_type, &
|
2019-12-25 12:29:50 -08:00
|
|
|
lock_type => __builtin_lock_type, &
|
2022-09-01 17:01:52 -07:00
|
|
|
team_type => __builtin_team_type, &
|
|
|
|
atomic_int_kind => __builtin_atomic_int_kind, &
|
2023-06-01 12:31:51 -04:00
|
|
|
atomic_logical_kind => __builtin_atomic_logical_kind, &
|
|
|
|
compiler_options => __builtin_compiler_options, &
|
|
|
|
compiler_version => __builtin_compiler_version
|
2019-12-25 12:29:50 -08:00
|
|
|
|
2024-07-19 19:37:24 +02:00
|
|
|
use iso_fortran_env_impl, only: &
|
|
|
|
selectedInt8, selectedInt16, selectedInt32, selectedInt64, selectedInt128, &
|
|
|
|
safeInt8, safeInt16, safeInt32, safeInt64, safeInt128, &
|
|
|
|
int8, int16, int32, int64, int128, &
|
2024-12-18 07:02:37 -08:00
|
|
|
selectedUInt8, selectedUInt16, selectedUInt32, selectedUInt64, selectedUInt128, &
|
|
|
|
safeUInt8, safeUInt16, safeUInt32, safeUInt64, safeUInt128, &
|
|
|
|
uint8, uint16, uint32, uint64, uint128, &
|
2024-07-19 19:37:24 +02:00
|
|
|
logical8, logical16, logical32, logical64, &
|
|
|
|
selectedReal16, selectedBfloat16, selectedReal32, &
|
|
|
|
selectedReal64, selectedReal80, selectedReal64x2, &
|
|
|
|
selectedReal128, &
|
|
|
|
safeReal16, safeBfloat16, safeReal32, &
|
|
|
|
safeReal64, safeReal80, safeReal64x2, &
|
|
|
|
safeReal128, &
|
|
|
|
real16, bfloat16, real32, real64, &
|
|
|
|
real80, real64x2, real128, &
|
|
|
|
integer_kinds => __builtin_integer_kinds, &
|
|
|
|
real_kinds => __builtin_real_kinds, &
|
|
|
|
logical_kinds => __builtin_logical_kinds
|
|
|
|
|
2019-11-21 13:31:52 -08:00
|
|
|
implicit none
|
2024-01-23 08:43:29 +01:00
|
|
|
private
|
|
|
|
|
|
|
|
public :: event_type, notify_type, lock_type, team_type, &
|
|
|
|
atomic_int_kind, atomic_logical_kind, compiler_options, &
|
|
|
|
compiler_version
|
|
|
|
|
|
|
|
integer, parameter :: &
|
2019-11-21 13:31:52 -08:00
|
|
|
selectedASCII = selected_char_kind('ASCII'), &
|
|
|
|
selectedUCS_2 = selected_char_kind('UCS-2'), &
|
|
|
|
selectedUnicode = selected_char_kind('ISO_10646')
|
2024-01-23 08:43:29 +01:00
|
|
|
integer, parameter, public :: character_kinds(*) = [ &
|
2024-04-08 11:57:01 -07:00
|
|
|
pack([selectedASCII], selectedASCII >= 0), &
|
|
|
|
pack([selectedUCS_2], selectedUCS_2 >= 0), &
|
|
|
|
pack([selectedUnicode], selectedUnicode >= 0)]
|
2019-11-21 13:31:52 -08:00
|
|
|
|
2024-07-19 19:37:24 +02:00
|
|
|
public :: selectedInt8, selectedInt16, selectedInt32, selectedInt64, selectedInt128, &
|
|
|
|
safeInt8, safeInt16, safeInt32, safeInt64, safeInt128, &
|
|
|
|
int8, int16, int32, int64, int128
|
2019-06-06 13:42:33 -07:00
|
|
|
|
2024-12-18 07:02:37 -08:00
|
|
|
public :: selectedUInt8, selectedUInt16, selectedUInt32, selectedUInt64, selectedUInt128, &
|
|
|
|
safeUInt8, safeUInt16, safeUInt32, safeUInt64, safeUInt128, &
|
|
|
|
uint8, uint16, uint32, uint64, uint128
|
|
|
|
|
2024-07-19 19:37:24 +02:00
|
|
|
public :: logical8, logical16, logical32, logical64
|
2019-11-21 13:31:52 -08:00
|
|
|
|
2024-07-19 19:37:24 +02:00
|
|
|
public :: selectedReal16, selectedBfloat16, selectedReal32, &
|
|
|
|
selectedReal64, selectedReal80, selectedReal64x2, &
|
|
|
|
selectedReal128, &
|
|
|
|
safeReal16, safeBfloat16, safeReal32, &
|
|
|
|
safeReal64, safeReal80, safeReal64x2, &
|
|
|
|
safeReal128, &
|
|
|
|
real16, bfloat16, real32, real64, &
|
|
|
|
real80, real64x2, real128
|
2019-11-21 13:31:52 -08:00
|
|
|
|
2024-07-19 19:37:24 +02:00
|
|
|
public :: integer_kinds, real_kinds, logical_kinds
|
2024-04-08 11:57:01 -07:00
|
|
|
|
|
|
|
integer, parameter, public :: current_team = -1, &
|
|
|
|
initial_team = -2, &
|
|
|
|
parent_team = -3
|
2019-06-06 13:42:33 -07:00
|
|
|
|
2024-01-23 08:43:29 +01:00
|
|
|
integer, parameter, public :: character_storage_size = 8
|
|
|
|
integer, parameter, public :: file_storage_size = 8
|
2019-06-06 13:42:33 -07:00
|
|
|
|
2024-04-08 11:57:01 -07:00
|
|
|
intrinsic :: __builtin_numeric_storage_size
|
|
|
|
! This value depends on any -fdefault-integer-N and -fdefault-real-N
|
|
|
|
! compiler options that are active when the module file is read.
|
|
|
|
integer, parameter, public :: numeric_storage_size = &
|
|
|
|
__builtin_numeric_storage_size()
|
|
|
|
|
|
|
|
! From Runtime/magic-numbers.h:
|
2024-01-23 08:43:29 +01:00
|
|
|
integer, parameter, public :: &
|
2024-04-08 11:57:01 -07:00
|
|
|
output_unit = FORTRAN_DEFAULT_OUTPUT_UNIT, &
|
|
|
|
input_unit = FORTRAN_DEFAULT_INPUT_UNIT, &
|
|
|
|
error_unit = FORTRAN_ERROR_UNIT, &
|
|
|
|
iostat_end = FORTRAN_RUNTIME_IOSTAT_END, &
|
|
|
|
iostat_eor = FORTRAN_RUNTIME_IOSTAT_EOR, &
|
|
|
|
iostat_inquire_internal_unit = FORTRAN_RUNTIME_IOSTAT_INQUIRE_INTERNAL_UNIT, &
|
|
|
|
stat_failed_image = FORTRAN_RUNTIME_STAT_FAILED_IMAGE, &
|
|
|
|
stat_locked = FORTRAN_RUNTIME_STAT_LOCKED, &
|
|
|
|
stat_locked_other_image = FORTRAN_RUNTIME_STAT_LOCKED_OTHER_IMAGE, &
|
|
|
|
stat_stopped_image = FORTRAN_RUNTIME_STAT_STOPPED_IMAGE, &
|
|
|
|
stat_unlocked = FORTRAN_RUNTIME_STAT_UNLOCKED, &
|
[flang] IEEE_ARITHMETIC and IEEE_EXCEPTIONS intrinsic module procedures (#74138)
Implement a selection of intrinsic module procedures that involve
exceptions.
- IEEE_GET_FLAG
- IEEE_GET_HALTING_MODE
- IEEE_GET_MODES
- IEEE_GET_STATUS
- IEEE_LOGB
- [f23] IEEE_MAX, IEEE_MAX_MAG, IEEE_MAX_NUM, IEEE_MAX_NUM_MAG
- [f23] IEEE_MIN, IEEE_MIN_MAG, IEEE_MIN_NUM, IEEE_MIN_NUM_MAG
- IEEE_QUIET_EQ, IEEE_QUIET_GE, IEEE_QUIET_GT,
- IEEE_QUIET_LE, IEEE_QUIET_LT, IEEE_QUIET_NE
- IEEE_SET_FLAG
- IEEE_SET_HALTING_MODE
- IEEE_SET_MODES
- IEEE_SET_STATUS
- IEEE_SIGNALING_EQ, IEEE_SIGNALING_GE, IEEE_SIGNALING_GT,
- IEEE_SIGNALING_LE, IEEE_SIGNALING_LT, IEEE_SIGNALING_NE
- IEEE_SUPPORT_FLAG
- IEEE_SUPPORT_HALTING
2023-12-04 09:55:54 -08:00
|
|
|
stat_unlocked_failed_image = FORTRAN_RUNTIME_STAT_UNLOCKED_FAILED_IMAGE
|
2019-06-06 13:42:33 -07:00
|
|
|
|
|
|
|
end module iso_fortran_env
|