From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm1-x332.google.com (mail-wm1-x332.google.com [IPv6:2a00:1450:4864:20::332]) by sourceware.org (Postfix) with ESMTPS id 777073858D3C; Tue, 16 Aug 2022 12:58:22 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 777073858D3C Received: by mail-wm1-x332.google.com with SMTP id s11-20020a1cf20b000000b003a52a0945e8so5334652wmc.1; Tue, 16 Aug 2022 05:58:22 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:x-gm-message-state:from:to:cc; bh=K3YtrPleekyTjlQbRUaKd0xEl1zRvFyR3DR3n1YUeV8=; b=eIzZha6o6YXzH8eCTDsLMYlDkTMkb2EWS6CC5qqNAAGlvsBbtwOkn6/w0gP07paJd0 liJ/U5jSkfDoAeDzKUWXMqrImQtsoatxo8pOHEYmRCfh9U45NtNvPqh42i1mQzQ8ZWGI BY4GhmGkVdvpTeYdMWqncKaWsG76StjbUdTORL6q96IhLYpSZ+gtkTodiX+YyCCViGuV E400rVJ7E9BoX5FV83ncuADFTAEtMnHEzhnnzIoEfjrvtQgMDDngLWNPWJPZhqxXNNpo bXwzpBzfqPaPKmMmAdQ47vxkjqJWKbaBZAsI2XSv8Q+P4YzY6mtB8MmiT1DdbyA/mdAy Ysuw== X-Gm-Message-State: ACgBeo3RM8VfeIiEU2qtdn9FkkiD7dOZNibocISOzI2vMwCZ0SDPWFcq yo0c5DMSm4V8M9tb8znpwj0= X-Google-Smtp-Source: AA6agR5fZ4xIXTqLIzKXVk940m22S+zkbMazPyYvgsA5RLB/U//cFa4aZtwllbnVq3JXVUs5WRA/cw== X-Received: by 2002:a7b:c402:0:b0:3a5:3c7:9741 with SMTP id k2-20020a7bc402000000b003a503c79741mr13344165wmi.72.1660654701109; Tue, 16 Aug 2022 05:58:21 -0700 (PDT) Received: from smtpclient.apple (lfbn-ren-1-637-46.w81-53.abo.wanadoo.fr. [81.53.21.46]) by smtp.gmail.com with ESMTPSA id n15-20020a7bcbcf000000b003a5ce167a68sm12743036wmi.7.2022.08.16.05.58.20 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 16 Aug 2022 05:58:20 -0700 (PDT) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3696.120.41.1.1\)) Subject: Re: [PATCH] fortran: Expand ieee_arithmetic module's ieee_value inline [PR106579] From: FX In-Reply-To: Date: Tue, 16 Aug 2022 14:58:19 +0200 Cc: gcc-patches@gcc.gnu.org, fortran@gcc.gnu.org Content-Transfer-Encoding: quoted-printable Message-Id: References: <4B7DE3A3-8F13-49D1-BCA9-723360EC386A@gmail.com> To: Jakub Jelinek X-Mailer: Apple Mail (2.3696.120.41.1.1) X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: fortran@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Fortran mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Aug 2022 12:58:24 -0000 Hi, >> Why looping over fields? The class type is a simple type with only = one member (and it should be an integer, we can assert that). >=20 > I wanted to make sure it has exactly one field. > The ieee_arithmetic.F90 module in libgfortran surely does that, but = I've > been worrying about some user overriding that module with something > different. In Fortran world it would be a rare and crazy thing to do, but I see. = Could you add a comment (pointing out to the type definition in = libgfortran)? > The libgfortran version had default: label: > switch (type) \ > { \ > case IEEE_SIGNALING_NAN: \ > return __builtin_nans ## SUFFIX (""); \ > case IEEE_QUIET_NAN: \ > return __builtin_nan ## SUFFIX (""); \ > case IEEE_NEGATIVE_INF: \ > return - __builtin_inf ## SUFFIX (); \ > case IEEE_NEGATIVE_NORMAL: \ > return -42; \ > case IEEE_NEGATIVE_DENORMAL: \ > return -(GFC_REAL_ ## TYPE ## _TINY) / 2; \ > case IEEE_NEGATIVE_ZERO: \ > return -(GFC_REAL_ ## TYPE) 0; \ > case IEEE_POSITIVE_ZERO: \ > return 0; \ > case IEEE_POSITIVE_DENORMAL: \ > return (GFC_REAL_ ## TYPE ## _TINY) / 2; \ > case IEEE_POSITIVE_NORMAL: \ > return 42; \ > case IEEE_POSITIVE_INF: \ > return __builtin_inf ## SUFFIX (); \ > default: \ > return 0; \ > } \ > and I've tried to traslate that into what it generates. OK, that makes sense. But: > There is at least the IEEE_OTHER_VALUE (aka 0) value > that isn't covered in the switch, but it is just an integer > under the hood, so it could have any other value. I think I originally included the default for IEEE_OTHER_VALUE, but the = standard says IEEE_OTHER_VALUE as an argument to IEE_VALUE is not = allowed. If removing the default would make the generated code shorter, = I suggest we do it; otherwise let=E2=80=99s keep it. With those two caveats, the patch is OK. We shouldn=E2=80=99t touch the = library code for now, but when the patch is committed we can add the = removal of IEEE_VALUE and IEEE_CLASS from the library to this list: = https://gcc.gnu.org/wiki/LibgfortranAbiCleanup FX=