From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ej1-x62b.google.com (mail-ej1-x62b.google.com [IPv6:2a00:1450:4864:20::62b]) by sourceware.org (Postfix) with ESMTPS id D79993858D32; Sun, 8 Jan 2023 15:54:10 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org D79993858D32 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-ej1-x62b.google.com with SMTP id lc27so5150953ejc.1; Sun, 08 Jan 2023 07:54:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=to:in-reply-to:cc:references:message-id:date:subject:mime-version :from:content-transfer-encoding:from:to:cc:subject:date:message-id :reply-to; bh=aJeHZwSH1/9OH5eHeWosvkiYJ/oxTBJ8WWLEfg1JZXE=; b=HI0fBn39ppA2ZIy3LXwgZyis6wesQ7cNUktXTTzFHuiky96nOG5iP9EPoMDV2G53ig lhnL3ngD1zjNT8/qdGhfzdA3PVe3o7GdLzXQNxOxUi78JjFUt/RkI2n4KSk43/zQLeE2 wwRxONoCLNMUWlyY8h9Iwl7zE3D+O6nRJJc78UeXV4siYGZvSVjh6AcwZ7PT/V3FzTve 8XoQimiOy+s9NazXlrVCYiTwFZlhNr8D9nh4AJd0THsNpeN3twgCl/06IQiUaS6GAItE melyTBrWgpsQOcWef+GgOSZSY0DYqeAG404bXD0G0WAEGHTJhqk8Ahk0gWqE2JdIXw3E Z3wg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=to:in-reply-to:cc:references:message-id:date:subject:mime-version :from:content-transfer-encoding:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=aJeHZwSH1/9OH5eHeWosvkiYJ/oxTBJ8WWLEfg1JZXE=; b=8F979V4M/sdNijGn6DMpB6uS/KNlCKPB7XJ0vtEmKjZVnzhA4qT9WOX7uquBlhoC9o +CbpkHJgb5on4cXg+rT8aeAqFcOr7DAmcHoUehdmXaU3pPZJLiSido0a/2zfEfTK9Ojb Ux+9roh0+n/EOcR11arFBxqGEhlbmYTFKGtDcx4eTZE742DEukHfgdHXza3eFAHICsDl w3S98A/jvOEuDNslsCnMeBMQRfB+SxHjhmY1tnKF2C9pBo09qtVh07H2Hore7UpCTOk4 YTlo4IjypBi5dSFlG0ojrfihf3mUwFLz9DXf37ZWJa5zv7igQJYSeyJiVyM/yct7UIKa p1+w== X-Gm-Message-State: AFqh2koVUGUJdO20TtLbH/MZ0BOc49tX2/U7C94w9ne6wKNGzdjSCK06 z8NkPLAISNxRVK6Gu6fWyni6zMQrCzc= X-Google-Smtp-Source: AMrXdXve/7KPKI/kV1P67Dkhg8RnGANU/c1YX4enAxxAwz1+mzLIV2XVE/M0eQGXcFAtiCZFAvfqiA== X-Received: by 2002:a17:906:b041:b0:7c0:c5b3:cb49 with SMTP id bj1-20020a170906b04100b007c0c5b3cb49mr54084186ejb.31.1673193248950; Sun, 08 Jan 2023 07:54:08 -0800 (PST) Received: from smtpclient.apple (dynamic-095-115-021-179.95.115.pool.telefonica.de. [95.115.21.179]) by smtp.gmail.com with ESMTPSA id w13-20020a170906184d00b00838e7e0354asm2582560eje.85.2023.01.08.07.54.07 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 08 Jan 2023 07:54:07 -0800 (PST) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable From: Richard Biener Mime-Version: 1.0 (1.0) Subject: Re: [patch, fortran] Fix common subexpression elimination with IEEE rounding (PR108329) Date: Sun, 8 Jan 2023 16:53:56 +0100 Message-Id: <79BE0629-246D-4EB8-A68F-4D9FEA6B013E@gmail.com> References: Cc: Thomas Koenig , fortran@gcc.gnu.org, gcc-patches In-Reply-To: To: Paul Richard Thomas X-Mailer: iPhone Mail (20C65) X-Spam-Status: No, score=-3.0 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: > Am 08.01.2023 um 14:31 schrieb Paul Richard Thomas via Fortran : >=20 > =EF=BB=BFHi Thomas, >=20 > 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=9Asu= perior=E2=80=98 to the call itself only because asm handling is implemented i= n 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. Richard=20 > OK for mainline and for backporting as you see fit. >=20 > Thanks for the patch. >=20 > Paul >=20 >=20 >> On Sat, 7 Jan 2023 at 15:46, Thomas Koenig via Fortran >> wrote: >>=20 >> Hello world, >>=20 >> this patch fixes Fortran's handling of common subexpression elimination >> across ieee_set_rouding_mode calls. It does so using a rather big >> hammer, by issuing a memory barrier to force reload from memory >> (and thus a recomputation). >>=20 >> This is a rather big hammer, so if there are more elegant ways >> to fix it, I am very much open to suggestions. >>=20 >> If PR 34678 is fixed, then this solution can also be applied here. >>=20 >> OK for trunk? How do you feel about a backport? >>=20 >> Best regards >>=20 >> Thomas >>=20 >> Add memory barrier for calls to ieee_set_rounding_mode. >>=20 >> gcc/fortran/ChangeLog: >>=20 >> PR fortran/108329 >> * trans-expr.cc (trans_memory_barrier): New functions. >> (gfc_conv_procedure_call): Insert memory barrier for >> ieee_set_rounding_mode. >>=20 >> gcc/testsuite/ChangeLog: >>=20 >> PR fortran/108329 >> * gfortran.dg/rounding_4.f90: New test. >=20 >=20 >=20 > --=20 > "If you can't explain it simply, you don't understand it well enough" - > Albert Einstein