From dca2874897ec58ea1c22a9c2161f112fff07cfb2 Mon Sep 17 00:00:00 2001 From: Francois-Xavier Coudert Date: Fri, 2 Sep 2022 13:27:38 +0200 Subject: Fortran: add IEEE_QUIET_* and IEEE_SIGNALING_* comparisons Those operations were added to Fortran 2018, and correspond to well-defined IEEE comparison operations, with defined signaling semantics for NaNs. All are implemented in terms of GCC expressions and built-ins, with no library support needed. gcc/fortran/ * f95-lang.cc (gfc_init_builtin_functions): Add __builtin_iseqsig. * trans-intrinsic.cc (conv_intrinsic_ieee_comparison): New function. (gfc_conv_ieee_arithmetic_function): Handle IEEE comparisons. gcc/testsuite/ * gfortran.dg/ieee/comparisons_1.f90: New test. * gfortran.dg/ieee/comparisons_2.f90: New test. * gfortran.dg/ieee/comparisons_3.F90: New test. libgfortran/ * ieee/ieee_arithmetic.F90: Add IEEE_QUIET_* and IEEE_SIGNALING_* functions. --- gcc/fortran/f95-lang.cc | 2 ++ 1 file changed, 2 insertions(+) (limited to 'gcc/fortran/f95-lang.cc') diff --git a/gcc/fortran/f95-lang.cc b/gcc/fortran/f95-lang.cc index 89944f4..350e6e3 100644 --- a/gcc/fortran/f95-lang.cc +++ b/gcc/fortran/f95-lang.cc @@ -1047,6 +1047,8 @@ gfc_init_builtin_functions (void) ATTR_CONST_NOTHROW_LEAF_LIST); gfc_define_builtin ("__builtin_isunordered", ftype, BUILT_IN_ISUNORDERED, "__builtin_isunordered", ATTR_CONST_NOTHROW_LEAF_LIST); + gfc_define_builtin ("__builtin_iseqsig", ftype, BUILT_IN_ISEQSIG, + "__builtin_iseqsig", ATTR_CONST_NOTHROW_LEAF_LIST); #define DEF_PRIMITIVE_TYPE(ENUM, VALUE) \ -- cgit v1.1