From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lf1-x12c.google.com (mail-lf1-x12c.google.com [IPv6:2a00:1450:4864:20::12c]) by sourceware.org (Postfix) with ESMTPS id 1FCF53858D37; Mon, 9 Jan 2023 13:00:11 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 1FCF53858D37 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-lf1-x12c.google.com with SMTP id bp15so12789721lfb.13; Mon, 09 Jan 2023 05:00:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=mMITsVB/WY0+YwKLS3Os9fq0bUvkXe3QVse0bCgLLRg=; b=bB3S4uODSXjryj5mT2n2tZ23bnTpQrwrw4QN/JcckAwrIj2IBycMwg35w6RtdyR//t 3FoglbmGtaqSS+cdhGlQOdnxYi10CUroP3pD4YPJnhMCQwzukgFeGKvfjQNlR7jbXYic /ScxLNznUiNcdvgbaaoK0ChDYoOfMyXtK9BemreVcPGsrfxWVXWrQ5fcwjSz9orjKlwO TH2c882yQSlnDJmZTJjtwnazfhJ22DwxN+qHmskqLJYwUlBQDx+T2AXIIaqnfl8LyAci eXlJ7q62EQ7zJxZOAnVz+zYottS4QtB2E2fzyCEkWEA695ekmO7yaHGPge05z+41HVOl 9f9w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=mMITsVB/WY0+YwKLS3Os9fq0bUvkXe3QVse0bCgLLRg=; b=qI2FVJVygjQZqf54iTO62xJF1BYnUJDhSl05sGJ3KUf/d6V6pjOMSDJlL3Ach1xCTk q6634Zk+BQCbfaEOOFvSIzBli9woH9x01N81jaVI6Q3qCoHvaaCQrd8hBOZLo4a8JSpa g1gSWnQx+fPSj7H4QVw+3F5r21Dkj+sdg6hqHlLrDmc9eu7rmrrQ2tca0dOHmNWHjwAs 02/8he8XyjSyFiza6lWeeJPO1IeIdc4Q0rwDactNPw2+5dEes2wGURbWVcjaTDxzEVq6 ZTL5R2tuZTmt3uR9+LbyWuVqbatm8S1klo1nSs6/CBwFn0tlFdNlaLkx3/6M2982es0A 5PqQ== X-Gm-Message-State: AFqh2kovYp8l/UtlC3RH5TVt88xaLhrVn7/O7SwTi1CtCoCNePOEjYxH +lKiLGILXuwdscoc9/xxM1Psar8wBgsFzCLZ2BY= X-Google-Smtp-Source: AMrXdXuI8D2ql7VhJjUEgtsqiUzq2sbfYnGxPfx8MYA0HQV/pj0pvjIx1dofrx4EtIgpYfKtkLzU+WPDpGhNPRS0xEY= X-Received: by 2002:a05:6512:150c:b0:4cb:c3:9366 with SMTP id bq12-20020a056512150c00b004cb00c39366mr2620357lfb.656.1673269209434; Mon, 09 Jan 2023 05:00:09 -0800 (PST) MIME-Version: 1.0 References: <79BE0629-246D-4EB8-A68F-4D9FEA6B013E@gmail.com> In-Reply-To: From: Richard Biener Date: Mon, 9 Jan 2023 13:59:57 +0100 Message-ID: Subject: Re: [patch, fortran] Fix common subexpression elimination with IEEE rounding (PR108329) To: Thomas Koenig Cc: "fortran@gcc.gnu.org" , gcc-patches Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On Sun, Jan 8, 2023 at 5:21 PM Thomas Koenig wrote: > > Hi Richard, > > >> Am 08.01.2023 um 14:31 schrieb Paul Richard Thomas via Fortran : > >> > >> =EF=BB=BFHi Thomas, > >> > >> Following your off-line explanation that the seemingly empty looking > >> assembly line forces an effective reload from memory, all is now clear= . > > > > It=E2=80=99s not a full fix (for register vars) and it=E2=80=99s =E2=80= =9Asuperior=E2=80=98 to the call itself only because asm handling is implem= ented in a rather stupid way in the Alias oracle. So I don=E2=80=99t think= this is a =E2=80=9Efix=E2=80=9C at all. > > There are no register variables in Fortran, this is Fortran FE only, > and it is a fix in the sense that correct code is no longer miscompiled. It's a quite big hammer and the fact that it "works" is just luck and the fact that the memory barrier implied by the ieee_set_rouding_mode does not is because by-reference passed arguments are marked by the frontend so they can be CSEd since memory barriers may not affect them. As said, the fact that this "works" is just because we're lazy on GIMPLE: /* If the statement STMT may clobber the memory reference REF return true, otherwise return false. */ bool stmt_may_clobber_ref_p_1 (gimple *stmt, ao_ref *ref, bool tbaa_p) { ... else if (gimple_code (stmt) =3D=3D GIMPLE_ASM) return true; > There's a FIXME in the code pointing to the relevant PR precisely > because I think that this is less than elegant (as do you, obviously). > Do you have other suggestions how to implement this? If PR 34678 > is solved, this would probably provide a mechanism that we could > simply re-use. There is no reliable way to get this correct at the moment and if there were good and easy ways to get this working they'd be implemented already. Richard. > Best regards > > Thomas