public inbox for fortran@gcc.gnu.org
 help / color / mirror / Atom feed
From: Paul Richard Thomas <paul.richard.thomas@gmail.com>
To: Thomas Koenig <tkoenig@netcologne.de>
Cc: "fortran@gcc.gnu.org" <fortran@gcc.gnu.org>,
	gcc-patches <gcc-patches@gcc.gnu.org>
Subject: Re: [patch, fortran] Fix common subexpression elimination with IEEE rounding (PR108329)
Date: Sun, 8 Jan 2023 13:31:16 +0000	[thread overview]
Message-ID: <CAGkQGiLtEXyH5WLRO21BOzABPcqHJNL1z-e72Lp+yXkgh1Z2=w@mail.gmail.com> (raw)
In-Reply-To: <7bd3545a-7b9d-a9b2-6923-0d02df809177@netcologne.de>

[-- Attachment #1: Type: text/plain, Size: 1343 bytes --]

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 <fortran@gcc.gnu.org>
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

  reply	other threads:[~2023-01-08 13:31 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-07 15:46 Thomas Koenig
2023-01-08 13:31 ` Paul Richard Thomas [this message]
2023-01-08 15:53   ` Richard Biener
2023-01-08 16:21     ` Thomas Koenig
2023-01-09 12:59       ` Richard Biener
2023-01-09 15:27         ` Thomas Koenig

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAGkQGiLtEXyH5WLRO21BOzABPcqHJNL1z-e72Lp+yXkgh1Z2=w@mail.gmail.com' \
    --to=paul.richard.thomas@gmail.com \
    --cc=fortran@gcc.gnu.org \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=tkoenig@netcologne.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).