From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-qv1-xf33.google.com (mail-qv1-xf33.google.com [IPv6:2607:f8b0:4864:20::f33]) by sourceware.org (Postfix) with ESMTPS id 0430F385842F for ; Fri, 1 Jul 2022 06:42:26 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 0430F385842F Received: by mail-qv1-xf33.google.com with SMTP id u14so3252517qvv.2 for ; Thu, 30 Jun 2022 23:42:26 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=zSpTUCRvqq1G+zKROvrj/tfHcOQd/Ygr5hmh9yCHXDo=; b=n9zTrEybQihuhOnSxOrkhMe5OwoUg+oD52gYA/SBlGThx3ww0KJ/CoEltrK+CRu9+n gmKXBDrFZ6fsR+9IfN2BZ+FtWsFSC18EL/O+MXQtCVVEM4rhwugrLu+c6ZUt3iPOfTQz YPQEo+3OU3yrcIpfJ+HBYicAu/igwsInFuoFyaw+cjFMzdGuKrZIJPwzAeetgq/mhvVt ciJfi61pbQAiPXH/83j7h0RvxX7zyAfjOK2oKt+i9EhGHBU9J2blG5LZc2t6VKiuUSHe +VRtxfDBUzike017R0JAYOMCcLjq13rEPmqHpE3TerVBxE/7BmDKPWHf0R/AGmQLVZh+ 8EUQ== X-Gm-Message-State: AJIora/FYRteKv8Mupt6viYkKWjRwhZcmg3yIHCjxfhzfJgPNg0g2VGi Q06k5KM+FJvfaROEjbz/wjV/PU4jeW2n1Du0GwXg6pljPBo= X-Google-Smtp-Source: AGRyM1sdXCZyM0OEwKkC1y7Gy+wYOCM1tGayPF+6aYH7aYYim+L5ZJPcZwdSnT2XZJLTKIe6qF1izFfKqQBJnNaEvpA= X-Received: by 2002:ac8:57c7:0:b0:31d:395a:4f5f with SMTP id w7-20020ac857c7000000b0031d395a4f5fmr707971qta.224.1656657746363; Thu, 30 Jun 2022 23:42:26 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Richard Biener Date: Fri, 1 Jul 2022 08:42:15 +0200 Message-ID: Subject: Re: [PATCH] aarch64: Fix pure/const function attributes for intrinsics To: Andrew Carlotti Cc: "gcc-patches@gcc.gnu.org" Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-8.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Jul 2022 06:42:28 -0000 On Thu, Jun 30, 2022 at 6:04 PM Andrew Carlotti via Gcc-patches 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))