public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Kewen Lin <linkw@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc r11-9384] rs6000: Remove builtin mask check from builtin_decl [PR102347]
Date: Wed, 15 Dec 2021 05:48:16 +0000 (GMT)	[thread overview]
Message-ID: <20211215054816.2C5493858D28@sourceware.org> (raw)

https://gcc.gnu.org/g:4636d61e9ad2a57a9c072e60f9d30429e83c2f4e

commit r11-9384-g4636d61e9ad2a57a9c072e60f9d30429e83c2f4e
Author: Kewen Lin <linkw@linux.ibm.com>
Date:   Mon Nov 29 21:22:32 2021 -0600

    rs6000: Remove builtin mask check from builtin_decl [PR102347]
    
    As the discussion in PR102347, currently builtin_decl is invoked so
    early, it's when making up the function_decl for builtin functions,
    at that time the rs6000_builtin_mask could be wrong for those
    builtins sitting in #pragma/attribute target functions, though it
    will be updated properly later when LTO processes all nodes.
    
    This patch is to align with the practice i386 port adopts, also
    align with r10-7462 by relaxing builtin mask checking in some places.
    
    gcc/ChangeLog:
    
            PR target/102347
            * config/rs6000/rs6000-call.c (rs6000_builtin_decl): Remove builtin mask
            check.
    
    gcc/testsuite/ChangeLog:
    
            PR target/102347
            * gcc.target/powerpc/pr102347.c: New test.
    
    (cherry picked from commit 6c7d489a1e6592bc73db03678c1231748fd7a126)

Diff:
---
 gcc/config/rs6000/rs6000-call.c             | 14 ++++----------
 gcc/testsuite/gcc.target/powerpc/pr102347.c | 15 +++++++++++++++
 2 files changed, 19 insertions(+), 10 deletions(-)

diff --git a/gcc/config/rs6000/rs6000-call.c b/gcc/config/rs6000/rs6000-call.c
index af385072151..84b591512c4 100644
--- a/gcc/config/rs6000/rs6000-call.c
+++ b/gcc/config/rs6000/rs6000-call.c
@@ -13655,23 +13655,17 @@ rs6000_init_builtins (void)
     }
 }
 
-/* Returns the rs6000 builtin decl for CODE.  */
+/* Returns the rs6000 builtin decl for CODE.  Note that we don't check
+   the builtin mask here since there could be some #pragma/attribute
+   target functions and the rs6000_builtin_mask could be wrong when
+   this checking happens, though it will be updated properly later.  */
 
 tree
 rs6000_builtin_decl (unsigned code, bool initialize_p ATTRIBUTE_UNUSED)
 {
-  HOST_WIDE_INT fnmask;
-
   if (code >= RS6000_BUILTIN_COUNT)
     return error_mark_node;
 
-  fnmask = rs6000_builtin_info[code].mask;
-  if ((fnmask & rs6000_builtin_mask) != fnmask)
-    {
-      rs6000_invalid_builtin ((enum rs6000_builtins)code);
-      return error_mark_node;
-    }
-
   return rs6000_builtin_decls[code];
 }
 
diff --git a/gcc/testsuite/gcc.target/powerpc/pr102347.c b/gcc/testsuite/gcc.target/powerpc/pr102347.c
new file mode 100644
index 00000000000..05c439a8dac
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/pr102347.c
@@ -0,0 +1,15 @@
+/* { dg-do link } */
+/* { dg-require-effective-target power10_ok } */
+/* { dg-require-effective-target lto } */
+/* { dg-options "-flto -mdejagnu-cpu=power9" } */
+
+/* Verify there are no error messages in LTO mode.  */
+
+#pragma GCC target "cpu=power10"
+int main ()
+{
+  float *b;
+  __vector_quad c;
+  __builtin_mma_disassemble_acc (b, &c);
+  return 0;
+}


                 reply	other threads:[~2021-12-15  5:48 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20211215054816.2C5493858D28@sourceware.org \
    --to=linkw@gcc.gnu.org \
    --cc=gcc-cvs@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).