From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-vk1-xa2c.google.com (mail-vk1-xa2c.google.com [IPv6:2607:f8b0:4864:20::a2c]) by sourceware.org (Postfix) with ESMTPS id 393EA3858D32; Sun, 8 Jan 2023 13:31:28 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 393EA3858D32 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-vk1-xa2c.google.com with SMTP id 6so2753550vkz.0; Sun, 08 Jan 2023 05:31:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=agGhqL9hV06p2nrntnnKgUz5kS7s5S4xvIlTVZum1h8=; b=NlNr4tOI+H9UCTzDL3MyGFeffvnOLzlFxwkR13aL/bD2O+mMVQ1z+ezSNkPUPx9zTu sLIO+0WgaNwvKBugIYX9tgGcOWO3bJq0KlIVkOoZ5DS99DPPoM06Vx2X57bessc3UspJ Y5mFJO+Vo5FBuWgjCboUk7nBFpQrgua5gey6paBg6v4vxN8guV/Wo99hf7c2mmtDbmbN ITxd/iTnmDSfOXtYG8e7V/QQpIH4gcOzT+04LeHoW2FTodPW2e7UWpHN9ASJ7d0sz8pX ar0MUujuhu1M7naIBIZHYzdgwL5eflgLhXdnwNQB8eITknEJ3k/C0XkcjaksolnXKhPd IVHg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=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=agGhqL9hV06p2nrntnnKgUz5kS7s5S4xvIlTVZum1h8=; b=QFyAR7KmQK1KIJ2B305EplCiIb9fvI6tQy70T/eBGzdi3H+lHNoDrmbKi8Baw284mp vudpPYDilOFQTjttwN+EOFFqk3eIEyZr6qFy2y2duiQGI5eKsfwlnQrogEInATDfh1FR BY64upeHK9ptDRpIh0v9c08YPYZzncVax244B3QU5fH7z+Dm9NFEutjoUo5vExB953ab k+/Uj7jyikB0r6Z8sxhHyOYb1sE82zqlfivNPTEfxbUSTGc5qIMO43WnBz+LAW7eGPxH kJqcrwS200byzgQqMPyf42vBJMkeuPBxdIMQAf7NO/Fl4RqpUrmOjM9yBC5SSz16Lows hcvg== X-Gm-Message-State: AFqh2kqK+A6Qk9WXxmMMqIr5qWwgXrOgD4JOpAG+nL3vxsYrmn7qBwe+ wpmkWRtlNFxDP4Ukj3z+pJVRaaBUfoMCU77BoBU= X-Google-Smtp-Source: AMrXdXsw/oKzq9RnQT8jLzeWnJDcskbXE9haWYeO28OM6o/3w9+RlkQsVQFS/rRMK1+Q5JfISCtYLyop6qCrF4cWP6o= X-Received: by 2002:a1f:ac41:0:b0:3d5:63ee:dae1 with SMTP id v62-20020a1fac41000000b003d563eedae1mr5833313vke.9.1673184687561; Sun, 08 Jan 2023 05:31:27 -0800 (PST) MIME-Version: 1.0 References: <7bd3545a-7b9d-a9b2-6923-0d02df809177@netcologne.de> In-Reply-To: <7bd3545a-7b9d-a9b2-6923-0d02df809177@netcologne.de> From: Paul Richard Thomas Date: Sun, 8 Jan 2023 13:31:16 +0000 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: multipart/alternative; boundary="000000000000f21eb005f1c0aa0c" X-Spam-Status: No, score=-1.0 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,HTML_MESSAGE,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: --000000000000f21eb005f1c0aa0c Content-Type: text/plain; charset="UTF-8" Hi Thomas, Following your off-line explanation that the seemingly empty looking assembly line forces an effective reload from memory, all is now clear. OK for mainline and for backporting as you see fit. Thanks for the patch. Paul On Sat, 7 Jan 2023 at 15:46, Thomas Koenig via Fortran wrote: > Hello world, > > 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). > > This is a rather big hammer, so if there are more elegant ways > to fix it, I am very much open to suggestions. > > If PR 34678 is fixed, then this solution can also be applied here. > > OK for trunk? How do you feel about a backport? > > Best regards > > Thomas > > Add memory barrier for calls to ieee_set_rounding_mode. > > gcc/fortran/ChangeLog: > > PR fortran/108329 > * trans-expr.cc (trans_memory_barrier): New functions. > (gfc_conv_procedure_call): Insert memory barrier for > ieee_set_rounding_mode. > > gcc/testsuite/ChangeLog: > > PR fortran/108329 > * gfortran.dg/rounding_4.f90: New test. -- "If you can't explain it simply, you don't understand it well enough" - Albert Einstein --000000000000f21eb005f1c0aa0c--