public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Biener <richard.guenther@gmail.com>
To: Andrew Carlotti <Andrew.Carlotti@arm.com>
Cc: "gcc-patches@gcc.gnu.org" <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH] aarch64: Fix pure/const function attributes for intrinsics
Date: Fri, 1 Jul 2022 08:42:15 +0200	[thread overview]
Message-ID: <CAFiYyc0339Z88_5DZg3owkTo=8k23Mvqc12A=OSO29sN7TOYDg@mail.gmail.com> (raw)
In-Reply-To: <AS8PR08MB66781F579B4CE1794C246CB3F4BA9@AS8PR08MB6678.eurprd08.prod.outlook.com>

On Thu, Jun 30, 2022 at 6:04 PM Andrew Carlotti via Gcc-patches
<gcc-patches@gcc.gnu.org> wrote:
>
> No testcase for this, since I haven't found a way to turn the incorrect
> attribute into incorrect codegen.
>
> Bootstrapped and tested on aarch64-none-linux gnu.
>
> gcc/
>
>         * config/aarch64/aarch64-builtins.c
>         (aarch64_get_attributes): Fix choice of pure/const attributes.
>
> ---
>
> diff --git a/gcc/config/aarch64/aarch64-builtins.cc b/gcc/config/aarch64/aarch64-builtins.cc
> index e0a741ac663188713e21f457affa57217d074783..877f54aab787862794413259cd36ca0fb7bd49c5 100644
> --- a/gcc/config/aarch64/aarch64-builtins.cc
> +++ b/gcc/config/aarch64/aarch64-builtins.cc
> @@ -1085,9 +1085,9 @@ aarch64_get_attributes (unsigned int f, machine_mode mode)
>    if (!aarch64_modifies_global_state_p (f, mode))
>      {
>        if (aarch64_reads_global_state_p (f, mode))
> -       attrs = aarch64_add_attribute ("pure", attrs);
> -      else
>         attrs = aarch64_add_attribute ("const", attrs);
> +      else
> +       attrs = aarch64_add_attribute ("pure", attrs);

that looks backwards.  'pure' allows read of global memory while
'const' does not.  Is
aarch64_reads_global_state_p really backwards?

>      }
>
>    if (!flag_non_call_exceptions || !aarch64_could_trap_p (f, mode))

  reply	other threads:[~2022-07-01  6:42 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-30 16:03 Andrew Carlotti
2022-07-01  6:42 ` Richard Biener [this message]
2022-07-01 15:59   ` Andrew Carlotti
2022-07-04  6:49     ` Richard Biener

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='CAFiYyc0339Z88_5DZg3owkTo=8k23Mvqc12A=OSO29sN7TOYDg@mail.gmail.com' \
    --to=richard.guenther@gmail.com \
    --cc=Andrew.Carlotti@arm.com \
    --cc=gcc-patches@gcc.gnu.org \
    /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).