From: Richard Biener <richard.guenther@gmail.com>
To: Paul Richard Thomas <paul.richard.thomas@gmail.com>
Cc: Thomas Koenig <tkoenig@netcologne.de>,
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 16:53:56 +0100 [thread overview]
Message-ID: <79BE0629-246D-4EB8-A68F-4D9FEA6B013E@gmail.com> (raw)
In-Reply-To: <CAGkQGiLtEXyH5WLRO21BOzABPcqHJNL1z-e72Lp+yXkgh1Z2=w@mail.gmail.com>
> Am 08.01.2023 um 14:31 schrieb Paul Richard Thomas via Fortran <fortran@gcc.gnu.org>:
>
> Hi Thomas,
>
> Following your off-line explanation that the seemingly empty looking
> assembly line forces an effective reload from memory, all is now clear.
It’s not a full fix (for register vars) and it’s ‚superior‘ to the call itself only because asm handling is implemented in a rather stupid way in the Alias oracle. So I don’t think this is a „fix“ at all.
Richard
> 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
next prev parent reply other threads:[~2023-01-08 15:54 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
2023-01-08 15:53 ` Richard Biener [this message]
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=79BE0629-246D-4EB8-A68F-4D9FEA6B013E@gmail.com \
--to=richard.guenther@gmail.com \
--cc=fortran@gcc.gnu.org \
--cc=gcc-patches@gcc.gnu.org \
--cc=paul.richard.thomas@gmail.com \
--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).